<template>
  <!-- 自定义表单 -->
  <BasicModal
    v-bind="$attrs"
    @register="registerModal"
    title="入库项目汇总详情"
    width="1700px"
    :showOkBtn="false"
    :showCancelBtn="false"
  >
    <BasicTable @register="registerTable">
      <template #action="{ record }">
        <TableAction :actions="getTableAction(record)" />
      </template>
      <template #toolbar>
        <div class="text-base font-bold">单位：（万元）</div>
      </template>
    </BasicTable>
  </BasicModal>
  <BasicModal
    @register="registeruploadFile"
    title="查看进度"
    width="1200px"
    :showOkBtn="false"
    :showCancelBtn="false"
  >
    <settu :res="showtuList" />
  </BasicModal>
</template>
<script lang="ts" name="addAndModify" setup>
  import { ref, onMounted } from 'vue';
  import { ActionItem, BasicTable, TableAction, useTable } from '@/components/Table';
  import { useModalInner, BasicModal } from '@/components/Modal';
  import {
    detailColumn,
    searchFormSchema,
  } from '@/views/projectSummary/planSummary/planSummary.data';
  import {
    getProjectDetailPage,
  } from '@/views/projectSummary/planSummary/planSummary.api';
  import settu from './settu.vue';
  import { useModal } from '@/components/Modal';
  import { queryPlanInfoMainTimelineOffline } from '@/views/projectLib/projectPlan/projectPlan.api';

  const [registeruploadFile, { openModal: openPlanFile, closeModal: closePlanFile }] = useModal(); //文件上传和查看

  let showtuList = ref<Array<Object>>();

  const emit = defineEmits(['close']);
  let pageType = ref<string>('renwu');

  const [registerModal, { closeModal }] = useModalInner();
  const [registerTable, { getForm, setProps }] = useTable({
    api: getProjectDetailPage,
    columns: detailColumn,
    showIndexColumn: false,
    useSearchForm: true,
    actionColumn: {
      width: 140,
      title: '操作',
      dataIndex: 'action',
      slots: { customRender: 'action' },
    },
    //表单查询项设置
    formConfig: {
      schemas: searchFormSchema,
    },
  });
  function getTableAction(record): ActionItem[] {
    return [
      {
        label: '填写',
        onClick: handleset.bind(null, record),
        ifShow: () => {
          if (record.projectStage == '项目申报阶段') {
            return false;
          } else {
            return true;
          }
        },
      },
    ];
  }
 async function handleset(record) {
  showtuList.value = await queryPlanInfoMainTimelineOffline({ projectid: record.id });
  openPlanFile(true);
}


  function dialogVisible() {
    closeModal();
    emit('close');
  }
</script>
<style></style>
