| | |
| | | |
| | | import { ref } from 'vue'; |
| | | |
| | | import { useVbenModal } from '#/packages/effects/common-ui/src'; |
| | | import { DICT_TYPE } from '#/packages/constants/src'; |
| | | |
| | | import { Descriptions, Table, Tabs } from 'ant-design-vue'; |
| | | import { Modal, Descriptions, Table, Tabs, message } from 'ant-design-vue'; |
| | | |
| | | import { getPdArchiveDetailByProduct } from '#/api/mes/pd/archive'; |
| | | |
| | | const open = ref(false); |
| | | const loading = ref(false); |
| | | const detailList = ref<MesPdArchiveApi.DetailItem[]>([]); |
| | | const activeProject = ref('0'); |
| | |
| | | }, |
| | | ]; |
| | | |
| | | const [Modal, modalApi] = useVbenModal({ |
| | | async onOpenChange(isOpen: boolean) { |
| | | if (!isOpen) { |
| | | detailList.value = []; |
| | | activeProject.value = '0'; |
| | | return; |
| | | } |
| | | const data = modalApi.getData<{ productCode: number }>(); |
| | | loading.value = true; |
| | | try { |
| | | detailList.value = await getPdArchiveDetailByProduct(data.productCode); |
| | | activeProject.value = '0'; |
| | | } finally { |
| | | loading.value = false; |
| | | } |
| | | }, |
| | | }); |
| | | async function handleOpen(productCode?: string) { |
| | | if (!productCode) { |
| | | message.warning('产品编码为空,无法查看归档'); |
| | | return; |
| | | } |
| | | open.value = true; |
| | | detailList.value = []; |
| | | activeProject.value = '0'; |
| | | loading.value = true; |
| | | try { |
| | | detailList.value = await getPdArchiveDetailByProduct(productCode); |
| | | } catch { |
| | | message.error('获取归档详情失败'); |
| | | } finally { |
| | | loading.value = false; |
| | | } |
| | | } |
| | | |
| | | defineExpose({ |
| | | open: (productCode: number) => modalApi.setData({ productCode }).open(), |
| | | }); |
| | | function handleClose() { |
| | | open.value = false; |
| | | detailList.value = []; |
| | | } |
| | | |
| | | defineExpose({ open: handleOpen }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Modal class="w-4/5" title="归档详情" :loading="loading"> |
| | | <Tabs v-if="detailList.length > 0" v-model:active-key="activeProject" type="card"> |
| | | <Tabs.TabPane |
| | | v-for="(detail, index) in detailList" |
| | | :key="String(index)" |
| | | :tab="detail.project.taskName || '项目'" |
| | | > |
| | | <!-- 项目信息 --> |
| | | <Descriptions :column="3" bordered size="small" class="mb-4"> |
| | | <Descriptions.Item label="任务编码">{{ detail.project.taskCode }}</Descriptions.Item> |
| | | <Descriptions.Item label="任务名称">{{ detail.project.taskName }}</Descriptions.Item> |
| | | <Descriptions.Item label="产品编码">{{ detail.project.productCode }}</Descriptions.Item> |
| | | <Descriptions.Item label="产品名称">{{ detail.project.productName }}</Descriptions.Item> |
| | | <Descriptions.Item label="版本号">{{ detail.project.version }}</Descriptions.Item> |
| | | <Descriptions.Item label="主设计师">{{ detail.project.chiefDesignerNickname }}</Descriptions.Item> |
| | | <Descriptions.Item label="审核人">{{ detail.project.reviewerNickname }}</Descriptions.Item> |
| | | <Descriptions.Item label="计划完成">{{ detail.project.planFinishTime }}</Descriptions.Item> |
| | | </Descriptions> |
| | | |
| | | <!-- 归档记录 --> |
| | | <div class="mb-4"> |
| | | <h4 class="mb-2 text-sm font-medium">归档记录</h4> |
| | | <Table |
| | | :columns="archiveColumns" |
| | | :data-source="detail.archives" |
| | | :pagination="false" |
| | | bordered |
| | | row-key="id" |
| | | size="small" |
| | | /> |
| | | </div> |
| | | |
| | | <!-- 设计资料 --> |
| | | <div> |
| | | <h4 class="mb-2 text-sm font-medium">设计资料</h4> |
| | | <Table |
| | | :columns="documentColumns" |
| | | :data-source="detail.documents" |
| | | :pagination="false" |
| | | bordered |
| | | row-key="id" |
| | | size="small" |
| | | > |
| | | <template #bodyCell="{ column, record }"> |
| | | <template v-if="column.key === 'action'"> |
| | | <a v-if="record.fileUrl" :href="record.fileUrl" target="_blank" class="text-primary">下载</a> |
| | | <span v-else class="text-gray-400">-</span> |
| | | </template> |
| | | </template> |
| | | </Table> |
| | | </div> |
| | | </Tabs.TabPane> |
| | | </Tabs> |
| | | <div v-else class="py-8 text-center text-gray-400"> |
| | | 暂无归档记录 |
| | | <Modal v-model:open="open" title="归档详情" width="80%" :footer="null" @cancel="handleClose"> |
| | | <div v-if="loading" class="flex justify-center py-8"> |
| | | <a-spin /> |
| | | </div> |
| | | <template v-else> |
| | | <Tabs v-if="detailList.length > 0" v-model:active-key="activeProject" type="card"> |
| | | <Tabs.TabPane |
| | | v-for="(detail, index) in detailList" |
| | | :key="String(index)" |
| | | :tab="detail.project.taskName || '项目'" |
| | | > |
| | | <!-- 项目信息 --> |
| | | <Descriptions :column="3" bordered size="small" class="mb-4"> |
| | | <Descriptions.Item label="任务编码">{{ detail.project.taskCode }}</Descriptions.Item> |
| | | <Descriptions.Item label="任务名称">{{ detail.project.taskName }}</Descriptions.Item> |
| | | <Descriptions.Item label="产品编码">{{ detail.project.productCode }}</Descriptions.Item> |
| | | <Descriptions.Item label="产品名称">{{ detail.project.productName }}</Descriptions.Item> |
| | | <Descriptions.Item label="版本号">{{ detail.project.version }}</Descriptions.Item> |
| | | <Descriptions.Item label="主设计师">{{ detail.project.chiefDesignerNickname }}</Descriptions.Item> |
| | | <Descriptions.Item label="审核人">{{ detail.project.reviewerNickname }}</Descriptions.Item> |
| | | <Descriptions.Item label="计划完成">{{ detail.project.planFinishTime }}</Descriptions.Item> |
| | | </Descriptions> |
| | | |
| | | <!-- 归档记录 --> |
| | | <div class="mb-4"> |
| | | <h4 class="mb-2 text-sm font-medium">归档记录</h4> |
| | | <Table |
| | | :columns="archiveColumns" |
| | | :data-source="detail.archives" |
| | | :pagination="false" |
| | | bordered |
| | | row-key="id" |
| | | size="small" |
| | | /> |
| | | </div> |
| | | |
| | | <!-- 设计资料 --> |
| | | <div> |
| | | <h4 class="mb-2 text-sm font-medium">设计资料</h4> |
| | | <Table |
| | | :columns="documentColumns" |
| | | :data-source="detail.documents" |
| | | :pagination="false" |
| | | bordered |
| | | row-key="id" |
| | | size="small" |
| | | > |
| | | <template #bodyCell="{ column, record }"> |
| | | <template v-if="column.key === 'action'"> |
| | | <a v-if="record.fileUrl" :href="record.fileUrl" target="_blank" class="text-primary">下载</a> |
| | | <span v-else class="text-gray-400">-</span> |
| | | </template> |
| | | </template> |
| | | </Table> |
| | | </div> |
| | | </Tabs.TabPane> |
| | | </Tabs> |
| | | <div v-else class="py-8 text-center text-gray-400"> |
| | | 暂无归档记录 |
| | | </div> |
| | | </template> |
| | | </Modal> |
| | | </template> |