<!--综合评价-钻取案卷列表查询-->
<template>
  <div>
    <case-list
      v-loading="listLoading"
      :case-list="caseList"
      :total="total"
      :list-query="listQuery"
      :table-columns="tableColumns"
      @changeQuery="changeQuery"
      @addDetail="showDetail"/>
  </div>
</template>

<script>
import CaseList from '@/components/CaseCommon/caseList'
import CaseDetailRead from '@/components/CaseCommon/caseDetailRead'
import { assessCaseList } from '@/api/assess/caseList'
// import { assessSupervisorShouldverify, assessSupervisorVerify, assessSupervisorVerifyOntime } from '@/api/assess/caseList'
// import { assessSupervisorShouldcheck, assessSupervisorCheck, assessSupervisorCheckOntime } from '@/api/assess/caseList'

export default {
  name: 'AssessCaseList',
  components: { CaseList, CaseDetailRead },
  data() {
    return {
      props: [], // 存储列表页传递的row
      type: '', // 查询类型
      editableTabsValue: 'listTab',
      editableTabs: [], // tab
      caseList: [], // 案卷列表// ，传递给子组件
      tableColumns: [
        {
          text: '案卷编号',
          value: 'caseid'
        },
        {
          text: '案卷类别',
          value: 'eorcName'
        },
        {
          text: '节点名称',
          value: 'caseStateName'
        },
        {
          text: '案卷描述',
          value: 'description'
        },
        {
          text: '大类',
          value: 'casetypeName'
        },
        {
          text: '小类',
          value: 'casetypeDetailName'
        },
        {
          text: '发生地点',
          value: 'fieldintro'
        },
        {
          text: '限制完成时间',
          value: 'nodeLimittime',
          width: 160
        }],
      listQuery: {
        personId: '',
        beginDate: '',
        endDate: '',
        offset: 1,
        limit: 20,
        sort: '',
        order: ''
      }, // 筛选条件
      total: 0,
      listLoading: true // 加载动画
    }
  },
  mounted() {
    this.listQuery.personId = this.$route.query.personId
    this.listQuery.beginDate = this.$route.query.beginDate
    this.listQuery.endDate = this.$route.query.endDate
    this.type = this.$route.query.type
    this.fetchData()
  },
  activated() {
    this.listQuery.personId = this.$route.query.personId
    this.listQuery.beginDate = this.$route.query.beginDate
    this.listQuery.endDate = this.$route.query.endDate
    this.type = this.$route.query.type
    this.fetchData()
  },
  methods: {
    // 获取数据
    fetchData() {
      this.listLoading = true
      // 根据不同类型，调用不同的接口
      assessCaseList(this.type, this.listQuery).then(res => {
        this.caseList = res.data.rows
        this.total = parseInt(res.data.total)
        this.listLoading = false
      })
    },
    // 来自caselist组件的查询条件(分页)更改后的查询
    changeQuery(listQuery) {
      this.listQuery = listQuery
      this.fetchData()
    },
    // 查看详情
    showDetail(tabPane, row) {
      // this.$router.push({ path: '/caseDetailRead/' + row.id })
      this.$router.push({
        name: 'CaseDetailRead',
        params: {
          id: row.id
        }
      })
    }
  }
}
</script>

<style>

</style>
