<template>
  <div class="main-content market">
    <DetailHead result="市场所协同" class="border0" />
    <div class="tips-card">
      <div class="title"><span><i class="el-icon-more" /></span><label>应诉检查</label></div>
      <div class="content">
        <label><router-link :to="{ path: '/market/dailysupervision'}">日常监管 <font style="color: #1989FA;">{{ dailysupervision }}</font> 条</router-link></label>
      </div>
    </div>
    <div class="tips-card">
      <div class="title"><span><i class="el-icon-more" /></span><label>动态监管</label></div>
      <div class="content">
        <label><router-link :to="{ path: '/market/dynamicsupervision'}">动态监管 <font style="color: #1989FA;">{{ dynamicsupervision }}</font> 条</router-link></label>
      </div>
    </div>
    <div class="tips-card">
      <div class="title"><span><i class="el-icon-more" /></span><label>巡查提示</label></div>
      <div class="content">
        <label>地址变更 <font style="color: #1989FA;">0</font> 条</label>
        <label>材料变更 <font style="color: #1989FA;">0</font> 条</label>
      </div>
    </div>
    <div class="tips-card">
      <div class="title"><span><i class="el-icon-more" /></span><label>异常名录</label></div>
      <div class="content">
        <label class="clearfix" style="float:left">待发起审核：</label>
        <div style="display:inline-block;">
          <div style="margin-bottom:10px">未按规定公示或报送年度报告（企业：<el-link type="primary" @click="gotoAbnormal">{{ abnormal.r1.t1 }}</el-link>，个体：<el-link type="primary" @click="gotoAbnormal">{{ abnormal.r1.t2 }}</el-link>，农合：<el-link type="primary" @click="gotoAbnormal">{{ abnormal.r1.t3 }}</el-link>)</div>
          <div style="margin-bottom:10px">通过登记的经营场所无法联系（企业：<el-link type="primary" @click="gotoAbnormal">{{ abnormal.r2.t1 }}</el-link>，个体：<el-link type="primary" @click="gotoAbnormal">{{ abnormal.r2.t2 }}</el-link>，农合：<el-link type="primary" @click="gotoAbnormal">{{ abnormal.r2.t3 }}</el-link>)</div>
          <div style="margin-bottom:10px">公示信息隐瞒情况、弄虚作假（企业：<el-link type="primary" @click="gotoAbnormal">{{ abnormal.r3.t1 }}</el-link>，个体：<el-link type="primary" @click="gotoAbnormal">{{ abnormal.r3.t2 }}</el-link>，农合：<el-link type="primary" @click="gotoAbnormal">{{ abnormal.r3.t3 }}</el-link>)</div>
          <div style="margin-bottom:10px">未按规定公示其他应公示信息（企业：<el-link type="primary" @click="gotoAbnormal">{{ abnormal.r4.t1 }}</el-link>，个体：<el-link type="primary" @click="gotoAbnormal">{{ abnormal.r4.t2 }}</el-link>，农合：<el-link type="primary" @click="gotoAbnormal">{{ abnormal.r4.t3 }}</el-link>)</div>
        </div>
        <br>
        <label>处理中（列入）<el-link type="primary" @click="gotoAbnormal">{{ abnormal.moveIn }}</el-link>条</label>
        <label>处理中（异议）<el-link type="primary" @click="gotoAbnormal">{{ abnormal.dissent }}</el-link>条</label>
        <label>处理中（移出）<el-link type="primary" @click="gotoAbnormal">{{ abnormal.moveOut }}</el-link>条</label>
      </div>
    </div>
    <div class="tips-card">
      <div class="title"><span><i class="el-icon-more" /></span><label>严重违法</label></div>
      <div class="content">
        <label>待办事项<el-link type="primary" @click="$router.push('/market/tips/illegal')">{{ illegalCount }}</el-link>条</label>
      </div>
    </div>
    <div class="tips-card">
      <div class="title"><span><i class="el-icon-more" /></span><label>市场提示</label></div>
      <div class="content">
        <label>地址变更<font>0</font>条</label>
        <label>材料变更<font>0</font>条</label>
      </div>
    </div>
    <div class="tips-card">
      <div class="title"><span><i class="el-icon-more" /></span><label>其他提示</label></div>
      <div class="content">
        <label>待办事项<font>0</font>条</label>
      </div>
    </div>
  </div>
</template>

<script>
import DetailHead from '@/components/DetailHead'
import { getIllegalTaskListCount } from '@/api/illegal'
import { statisticMyTaskGroupBySpeCause, statisticAbnormalTaskCount } from '@/api/abnormal'
import { sueInspectList, tSUsualInspectList } from '@/api/market'
export default {
  components: {
    DetailHead
  },
  data() {
    return {
      illegalCount: 0,
      abnormal: { // 异常名录待办统计结果
        r1: { t1: 0, t2: 0, t3: 0 }, // 原因1
        r2: { t1: 0, t2: 0, t3: 0 }, // 原因2
        r3: { t1: 0, t2: 0, t3: 0 }, // 原因3
        r4: { t1: 0, t2: 0, t3: 0 }, // 原因4
        moveIn: 0,
        dissent: 0,
        moveOut: 0
      },
      dailysupervision: '0', // 应诉检查
      dynamicsupervision: '0'// 动态监管
    }
  },
  created() {
    sueInspectList({
      customParamMap: {
        type: '0'
      },
      pageSize: 10,
      curPage: 1
    }).then((res) => {
      if (res.code === 0) {
        this.dailysupervision = res.data.total
      }
    })
    tSUsualInspectList({
      customParamMap: {
        type: '0'
      },
      pageSize: 10,
      curPage: 1
    }).then((res) => {
      if (res.code === 0) {
        this.dynamicsupervision = res.data.total
      }
    })
  },
  mounted() {
    getIllegalTaskListCount().then(res => {
      if (res.code === 0) {
        this.illegalCount = res.data || 0
      }
    })
    statisticMyTaskGroupBySpeCause().then(res => {
      if (res.code === 0) {
        const data = res.data
        data.forEach(each => {
          switch (each.reason) {
            case '1':this.swType(this.abnormal.r1, each); break
            case '2':this.swType(this.abnormal.r4, each); break
            case '3':this.swType(this.abnormal.r3, each); break
            case '4':this.swType(this.abnormal.r2, each); break
          }
        })
      }
    })
    statisticAbnormalTaskCount().then(res => {
      if (res.code === 0) {
        const data = res.data
        data.forEach(each => {
          switch (each.bustype) {
            case '列入': this.abnormal.moveIn = each.amount; break
            case '异议': this.abnormal.dissent = each.amount; break
            case '移出': this.abnormal.moveOut = each.amount; break
          }
        })
      }
    })
  },
  methods: {
    gotoAbnormal() {
      this.$router.push('/market/tips/abnormal')
    },
    swType(r, each) {
      switch (each.entType) {
        case '企业': this.$set(r, 't1', each.amount); break
        case '个体户': this.$set(r, 't2', each.amount); break
        case '农合': this.$set(r, 't3', each.amount); break
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.main-content{
  font-size:$table-content-font-size!important;
    .tips-card{
        padding:16px;
        border:1px solid #D1E5FF;
        margin-top:24px;
        border-radius: 5px;
        .title{
            >span{
                display:inline-block;
                position: relative;
                bottom:5px;
                width:25px;
                height:25px;
                background:#1F65FF;
                border-radius: 50%;
                color:#FEFEFE;
                margin-right:20px;
                margin-bottom:25px;
                i{
                    transform: rotate(90deg);
                    position: relative;
                    left:5px;
                    top:3.5px;
                }
            }
            >label{
                font-family: PingFang SC, PingFang SC-Semibold Microsoft YaHei;
                font-weight: bold;
                font-size:18PX;
            }
        }
        .content{
            color:#5E5E7A;
            >label{
                margin-left:45px;
            }
            .el-link{
              margin:0 10px;
              color:#1989FA;
              font-size:16PX;
            }
        }
    }

}
</style>
