<template>
  <view class="content">
    <view class="search card">
      <u--input
          prefixIcon="search"
          placeholder="请输入关键字"
          border="surround"
          v-model="hiddendescr"
          clearable
          shape="circle"
      ></u--input>
      <view class="bth- ml-10">
        <u-button type="success" text="确定" @click="resetList"></u-button>
      </view>
    </view>
    <u-list @scrolltolower="scrolltolower" v-if="list.length > 0">
      <u-list-item v-for="(item, index) in list" :key="index">
        <view>
          <view class="flex-between main-title">
            <text>{{ item.hiddendescr }}</text>
            <text>发现人：{{ item.discoverPeople }}</text>
          </view>
          <view class="flex-between mt-10 subtitle">
            <text>分公司部门领导小组长：{{ item.confirmUserName }}</text>
          </view>
          <view class="flex-between mt-10 subtitle">
            <text>分公司安委会办公室主任：{{ item.verifyUser }}</text>
          </view>
          <view class="flex-between mt-10 subtitle">
            <text>港股公司安委会办公室副主任：{{ item.verifyUserHK }}</text>
          </view>
          <view class="flex-between mt-10 subtitle">
            <text>隐患级别：{{ item.hiddenlevelName }}</text>

          </view>
          <view class="see_btn">
            <u-button type="primary" text="查看" size="mini"
                      @click="fnNavigatorDetail(item.hiddenId)"></u-button>
          </view>
        </view>
      </u-list-item>
    </u-list>
    <empty v-else></empty>
  </view>
</template>

<script>
import {getMajorHiddenList} from "@/api";
import tkiTree from "@/components/tki-tree/tki-tree.vue"

export default {
  components: {tkiTree},
  data() {
    return {
      hiddendescr: '',
      limit: 10,
      curPage: 1,
      totalPage: 0,
      list: [],
      companyId: '',
    }
  },
  onLoad(event) {
    this.companyId = event.companyId;
    this.resetList()
  },
  methods: {
    async getData() {
      let { page } = await getMajorHiddenList({
        companyId: this.companyId,
        hiddenlevel: 'hiddenLevel2002',
        hiddendescr: this.hiddendescr,
        limit: this.limit,
        curPage: this.curPage,
      });
      this.list = [...this.list, ...page.list];
      this.totalPage = page.totalPage;
    },
    resetList() {
      this.limit = 10
      this.curPage = 1
      this.list = []
      this.getData()
    },
    fnNavigatorDetail(hiddenId) {
      uni.$u.route({
        url: '/pages/larger-major-hidden-management/major-hidden-management/detail',
        params: {
          hiddenId,
        }
      })
    },
    scrolltolower() {
      this.curPage++;
      if (this.totalPage >= this.curPage) this.getData();
    },
  }
}
</script>

<style scoped lang="scss">
.search{
  display: flex;
  .ml-10{
    margin-left: 10rpx;
  }
  .bth-mini{
    width: 100rpx;
  }

}
.see_btn{
  //width: 100rpx;
  float: right;
}

</style>
