<template>
  <view class="content">
    <u-cell-group>
      <u-cell v-for="(item,index) in baseList" :key="index" isLink :url="item.url">
        <view slot="title">{{ item.title }}</view>
        <view slot="value">
          <u-badge :value="item.NUM"></u-badge></view>
      </u-cell>
    </u-cell-group>
  </view>
</template>

<script>
  import {
    getkeyprojectcount,
  } from "../../../api";

export default {
  data() {
    return {
      count : {},
      baseList: []
    }
  },
  onShow(event) {
    this.baseList = [
      {
        title: '安全环保检查管理',
        url: '/pages/key-project-management/safety-environmental-inspection/list',
      },
      {
        title: '隐患管理',
        url: '/pages/key-project-management/hidden-management/list',
      },
      {
        title: '处罚管理',
        url: '/pages/key-project-management/penalty-management/list',
      },
      // {
      //   title: 'AI报警处置',
      //   url: '/pages/key-project-management/AI-warning/list',
      // },
    ]
    this.getData();
  },
  computed: {
    userInfo() {
      return this.$store.getters.getUserInfo
    }
  },
  methods: {
    fnNavigator(e) {
      uni.$u.route({
        url: this.baseList[e].url
      })
    },
    async getData() {
      let resData = await getkeyprojectcount({
        loginUserId: this.userInfo.USER_ID,
      })
      this.$set(this.baseList[1], 'NUM', resData.pd.HIDDEN_COUNT)
      this.$set(this.baseList[2], 'NUM', resData.pd.CF_COUNT)
    }
  },
}
</script>

<style scoped>

</style>
