<template>
  <BasicModal v-bind="$attrs" @register="registerModal" :title="title" width="70%">
    <BasicTable @register="registerTable"></BasicTable>
    <template #footer></template>
  </BasicModal>
</template>

<script lang="ts" setup>
  import { ref } from 'vue';
  import { BasicColumn } from '/@/components/Table';
  import { BasicModal, useModalInner } from '/@/components/Modal';
  import { BasicTable } from '@/components/Table';
  import { useListPage } from '/@/hooks/system/useListPage';
  import { dkjlxq } from '../api';

  const dwtjColumns: BasicColumn[] = [
    {
      title: '地块名称',
      dataIndex: 'wrdkmc',
      resizable: true,
    },
    {
      title: '地块编码',
      dataIndex: 'wrdkbm',
      resizable: true,
    },

    {
      title: '阶段类型',
      dataIndex: 'szjd',
      resizable: true,
    },

    {
      title: '第几次评审',
      dataIndex: 'pscs',
      resizable: true,
    },
    {
      title: '评审会时间',
      dataIndex: 'hysj',
      resizable: true,
    },
    {
      title: '会议信息上传系统时间',
      dataIndex: 'tsamp',
      resizable: true,
    },
    {
      title: '是否通过评审',
      dataIndex: 'pssftg',
      resizable: true,
    },
    {
      title: '评审结论',
      dataIndex: 'psjl',
      resizable: true,
    },
    {
      title: '专家组人员',
      dataIndex: 'zjs',
      resizable: true,
    },
    {
      title: '参会人员',
      dataIndex: 'cys',
      resizable: true,
    },
    {
      title: '复核信息上传系统时间',
      dataIndex: 'fhsj',
      resizable: true,
    },
  ];
  // Emits声明
  const emit = defineEmits(['register', 'success']);

  const { tableContext } = useListPage({
    tableProps: {
      title: '',
      api: dkjlxq,
      columns: dwtjColumns,
      canResize: false,
      rowSelection: { type: 'radio' },
      rowKey: 'wrdkid',
      clickToRowSelect: true,
      showActionColumn: false,
      useSearchForm: false,
      beforeFetch(params) {
        params.wrdkid = wrdkid.value;
      },
      immediate: false,
      actionColumn: {
        width: 120,
        fixed: 'right',
      },
    },
  });
  const wrdkid = ref('');
  const [registerModal, { setModalProps }] = useModalInner(async (data) => {
    wrdkid.value = data.record.wrdkid;
    reload();
    setModalProps({ confirmLoading: false, showCancelBtn: data?.showFooter, showOkBtn: false });
  });
  const [registerTable, { reload }, {}] = tableContext;
  //设置标题
  const title = ref('记录');
</script>

<style lang="less" scoped></style>
