<!--紧急案卷-->
<template>
  <app-container>
    <search-div @searchForm="searchForm"/>
    <case-list
      v-loading="listLoading"
      :case-list="caseList"
      :total="total"
      :list-query="listQuery"
      :table-columns="tableColumns"
      @changeQuery="changeQuery"
      @addDetail="showDetail"/>
  </app-container>
</template>

<script>
import CaseList from '@/components/CaseCommon/caseList'
import CaseDetailSupervise from './components/caseDetailSupervise'
import { getCriticalList } from '@/api/supervise/supervise'
import SearchDiv from './components/searchDiv'

export default {
  name: 'OvertimeCase',
  components: { SearchDiv, CaseList, CaseDetailSupervise },
  data() {
    return {
      props: [], // 存储列表页传递的row
      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: 'onedeptName'
        }],
      listQuery: {
        offset: 1,
        limit: 10,
        sort: '',
        order: ''
      }, // 筛选条件
      total: 0,
      listLoading: true // 加载动画
    }
  },
  mounted() {
    this.fetchData()
  },
  methods: {
    fetchData() {
      console.log(this.listQuery)
      this.listLoading = true
      getCriticalList(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()
    },
    // 来自业务查询条件更改后的查询
    searchForm(listQuery) {
      this.listQuery = listQuery
      this.fetchData()
    },
    // 查看详情
    showDetail(tabPane, row) {
      // this.$router.push({ path: '/caseDetailSupervise/' + row.id })
      this.$router.push({
        name: 'CaseDetailSupervise',
        params: {
          id: row.id
        }
      })
    },
    // 业务提交后的刷新
    submitProcess(caseid) {
      this.fetchData()
    }
  }
}
</script>

<style>

</style>
