<template>
  <PageWrapper dense contentFullHeight fixedHeight contentClass="flex">
    <BasicTable class="w-4/4 xl:w-5/5" @register="registerTable">
      <template #bodyCell="{ column, record }">
        <template v-if="column.key === 'action'">
          <TableAction
            :actions="[
              {
                label: '详情',
                onClick: () => {
                  handleAudit(record);
                },
              }
            ]"
          />
        </template>
      </template>
    </BasicTable>
    <a-modal width="75%" style="top: 8px;" v-model:open="openModal" title="线索审核" :destroyOnClose="true" :footer="null">
      <InfoModal :infoData="infoData.info" @handleOk="handleOk" @closeModal="closeModal" :control="false"/>
    </a-modal>
  </PageWrapper>
</template>
<script lang="ts" setup>
import { nextTick, onMounted, ref } from 'vue';
import { BasicTable, useTable, TableAction } from '@/components/Table';
import { PageWrapper } from '@/components/Page';
import InfoModal from '../mainaudit/InfoModal/index.vue'
import { columns, searchFormSchema } from './util';
import { MainLoadCaseInfoLists, MainGetCaseInfo } from '@/api/illegalmining/index';

const infoData = ref({})
const openModal = ref(false)

const [registerTable, { reload, expandAll}] = useTable({
  title: '已关闭',
  api: MainLoadCaseInfoLists,
  columns,
  rowKey: 'id',
  formConfig: {
    labelWidth: 120,
    schemas: searchFormSchema,
  },
  striped: false,
  // 序号列
  showIndexColumn: false,
  // 使用搜索表单
  useSearchForm: true,
  // 显示表格设置工具
  showTableSetting: true,
  bordered: true,
  beforeFetch(data) {
    let params = {...data,nowStatus: '已关闭'}
    return params
  },
  afterFetch(data) {
    console.log('afterFetch', data);
  },
  actionColumn: {
    width: 100,
    title: '操作',
    dataIndex: 'action',
  },
  handleSearchInfoFn(info) {
    return info;
  },
});
function handleAudit(record) {
  MainGetCaseInfo({id: record.Id}).then(res => {
    console.log(res)
    infoData.value = res
    openModal.value = true
  })
}
const handleOk = () => {
  console.log('infoData',infoData.value)
}
const closeModal = () => {
  openModal.value = false
}
</script>
