<template>

  <div>
    <a-page-header
      style="background-color: #FFFFFF;"
      title="稽核历史"
      sub-title=""
      @back="showCheckList"
    >
      <a-descriptions :title="info.customerName" :column="3" :bordered="false">
        <a-descriptions-item label="客户编号">{{info.customerNo}}</a-descriptions-item>
        <a-descriptions-item label="服务号码">{{info.smsNumber}}</a-descriptions-item>
        <a-descriptions-item label="用户编号">{{info.userNo}}</a-descriptions-item>
        <a-descriptions-item label="入网时间">{{info.networkAccessTime}}</a-descriptions-item>
        <a-descriptions-item label="用户状态" :span="2">{{info.userState}}</a-descriptions-item>
        <a-descriptions-item label="员工姓名">{{info.staffName}}</a-descriptions-item>
        <a-descriptions-item label="员工工号">{{info.staffNo}}</a-descriptions-item>
      </a-descriptions>
    </a-page-header>

    <a-card :bordered="false" style="margin-top: 10px;">

      <!-- table区域-begin -->
      <div>

        <a-table
          ref="table"
          size="middle"
          :scroll="{x:true}"
          bordered
          rowKey="id"
          :columns="columns"
          :dataSource="dataSource"
          :pagination="ipagination"
          :loading="loading"
          class="j-table-force-nowrap"
          @change="handleTableChange">

          <p slot="expandedRowRender" slot-scope="record" style="margin: 0">
            基本信息结果：{{ record.basicCheckNote }}<br/>
            规范信息结果：{{ record.standardCheckNote }}<br/>
            附件资料结果：{{ record.dataCheckNote }}<br/>
          </p>

          <template slot="action" slot-scope="text, record">

            <a-dropdown>
              <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
              <a-menu slot="overlay">
                <a-menu-item>
                  <a @click="showCheckCheck(record)">稽核</a>
                </a-menu-item>
                <a-menu-item>
                  <a @click="showCheckLog(record)">历史</a>
                </a-menu-item>
                <a-menu-item>
                  <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                    <a>删除</a>
                  </a-popconfirm>
                </a-menu-item>
              </a-menu>
            </a-dropdown>
          </template>

          <template v-slot:customerName="text, record">
            <a @click="showCheckDetail(record)">{{text}}</a>
          </template>
          <template v-slot:checkState="status">
            <a-badge :status="status | statusTypeFilter" :text="status | statusFilter"/>
          </template>
        </a-table>

      </div>
      <!-- table区域 end -->

    </a-card>

  </div>

</template>

<script>

import { postAction, getAction } from '@api/manage'
import '@/assets/less/TableExpand.less'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'

export default {
  name: 'TaskCheckLog',
  mixins:[JeecgListMixin],
  inject:['closeCurrent'],
  data () {
    return {
      description: '稽核详情页面',
      columns: [
        {
          title: '#',
          dataIndex: '',
          key:'rowIndex',
          width:60,
          align:"center",
          customRender:function (t,r,index) {
            return parseInt(index)+1;
          }
        },
        {
          title:'稽核时间',
          align:"center",
          dataIndex: 'createTime',
        },
        {
          title:'基础信息状态',
          align:"center",
          dataIndex: 'basicCheckState',
          scopedSlots: { customRender: 'checkState' }
        },
        {
          title:'基础信息结果',
          align:"center",
          dataIndex: 'basicCheckNote',
        },
        {
          title:'规范信息状态',
          align:"center",
          dataIndex: 'standardCheckState',
          scopedSlots: { customRender: 'checkState' }
        },
        {
          title:'规范信息结果',
          align:"center",
          dataIndex: 'standardCheckNote',
        },
        {
          title:'附件资料状态',
          align:"center",
          dataIndex: 'dataCheckState',
          scopedSlots: { customRender: 'checkState' }
        },
        {
          title:'附件资料结果',
          align:"center",
          dataIndex: 'dataCheckNote',
        },
      ],
      url: {
        queryInfo: "/smsCheck/customerInfo/queryById",
        list: "/smsCheck/workLog/list",
      },
      info: {},
      autoSearch: false,
    }
  },
  created() {
    this.info.id = this.$route.query.id;
    this.queryInfoById(this.info.id);

    this.queryParam.infoId = this.info.id;
    this.loadData();
  },
  filters: {
    statusTypeFilter(type) {
      const statusTypeMap = {
        '1': 'error',
        '2': 'success'
      }
      return statusTypeMap[type]
    },
    statusFilter(status) {
      const statusMap = {
        '1': '异常',
        '2': '通过'
      }
      return statusMap[status]
    }
  },
  methods: {
    // 显示列表页面
    showCheckList() {
      this.$router.go(-1);
      this.closeCurrent();
    },
    queryInfoById (id) {
      let url = this.url.queryInfo;
      let params = {
        id: id
      }
      let that = this;
      getAction(url, params).then(res => {
        if (res.success) {
          that.info = res.result;
        }
      }).finally(() => {

      })
    },
  }
}
</script>

<style scoped>

</style>