<template>
  <div id="examine-data">
    <el-row>
      <el-col :span="24" class="main">
        <el-col :span="24" class="one">
          <el-col :span="24" class="one_1">
            有
            <span @click="toPath('security/zwzpcj')">{{ num1 }}</span>
            个保安员需要进行
            <span>指纹与照片采集</span>
          </el-col>
          <el-col :span="24" class="one_1">
            有<span @click="toPath('security/bmzgsh')">{{ num2 }}</span
            >个保安员需要进行<span>报名资格审核</span></el-col
          >
          <el-col :span="24" class="one_1">
            有<span @click="toPath('security/zgsh')">{{ num3 }}</span
            >个保安员需要进行<span>资格审核</span></el-col
          >
          <el-col :span="24" class="one_1">
            有<span @click="toPath('permit/slsqsl')">{{ num4 }}</span
            >家保安服务公司需要进行<span>设立申请受理</span></el-col
          >
          <el-col :span="24" class="one_1">
            有<span @click="toPath('permit/sjsh')">{{ num5 }}</span
            >家保安服务公司需要进行<span>备案</span></el-col
          >
          <el-col :span="24" class="one_1">
            有<span @click="toPath('permit/frbgsjsh')">{{ num6 }}</span
            >家保安服务公司需要进行<span>法人变更备案</span></el-col
          >
          <el-col :span="24" class="one_1">
            有<span @click="toPath('administration/pxsjsh')">{{ num7 }}</span
            >家保安培训机构需要进行<span>备案</span></el-col
          >
          <el-col :span="24" class="one_1">
            有<span @click="toPath('administration/zxsjsh')">{{ num8 }}</span
            >家自行招用保安员单位需要进行<span>备案</span></el-col
          >
        </el-col>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import { mapState, createNamespacedHelpers } from 'vuex';
const { mapActions: security_guard_base } = createNamespacedHelpers('security_guard_base');
const { mapActions: company_base } = createNamespacedHelpers('company_base');
const { mapActions: company_legal_change } = createNamespacedHelpers('company_legal_change');

export default {
  name: 'examine-data',
  props: {},
  components: {},
  data: function () {
    return {
      num1: 0,
      num2: 0,
      num3: 0,
      num4: 0,
      num5: 0,
      num6: 0,
      num7: 0,
      num8: 0,
    };
  },
  created() {
    this.search();
  },
  methods: {
    ...security_guard_base(['query']),
    ...company_base({ combaseQuery: 'query' }),
    ...company_legal_change({ comlegalQuery: 'query' }),
    async search() {
      // 照片/指纹采集
      let res = await this.query({ status: '1' });
      console.log(res);
      if (this.$checkRes(res)) this.$set(this, `num1`, res.total || 0);
      // 报名资格审核
      res = await this.query({ status: '2' });
      if (this.$checkRes(res)) this.$set(this, `num2`, res.total || 0);
      // 资格审核
      res = await this.query({ status: '3' });
      if (this.$checkRes(res)) this.$set(this, `num3`, res.total || 0);
      // 设立申请
      res = await this.combaseQuery({ status: '1', purpose: '保安服务公司申请设立' });
      if (this.$checkRes(res)) this.$set(this, `num4`, res.total || 0);
      // 市级审核
      res = await this.combaseQuery({ status: '2', purpose: '保安服务公司申请设立' });
      if (this.$checkRes(res)) this.$set(this, `num5`, res.total || 0);
      // 法人变更
      res = await this.comlegalQuery();
      if (this.$checkRes(res)) this.$set(this, `num6`, res.total || 0);
      // 培训机构市级审核
      res = await this.combaseQuery({ status: '2', purpose: '保安培训单位设立审批' });
      if (this.$checkRes(res)) this.$set(this, `num7`, res.total || 0);
      // 自行招用市级审核
      res = await this.combaseQuery({ status: '2', purpose: '自行招用保安员单位申请备案' });
      if (this.$checkRes(res)) this.$set(this, `num8`, res.total || 0);
    },
    toPath(path) {
      this.$router.push({ path: `/adminPolice/${path}` });
    },
  },
  computed: {
    ...mapState(['user']),
  },
  metaInfo() {
    return { title: this.$route.meta.title };
  },
  watch: {
    test: {
      deep: true,
      immediate: true,
      handler(val) {},
    },
  },
};
</script>

<style lang="less" scoped>
.main {
  .one {
    .one_1 {
      height: 40px;
      line-height: 40px;
      border-bottom: 1px solid #ccc;
      font-size: 18px;
      span:first-child {
        color: #ff0000;
        font-weight: bold;
        padding: 0 5px;
        text-decoration: underline;
      }
      span:first-child:hover {
        cursor: pointer;
      }
      span:last-child {
        font-weight: bold;
      }
    }
  }
}
</style>
