| | |
| | | |
| | | 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'; |
| | | async function handleOpen(productCode?: string) { |
| | | if (!productCode) { |
| | | message.warning('产品编码为空,无法查看归档'); |
| | | return; |
| | | } |
| | | const data = modalApi.getData<{ productCode: number }>(); |
| | | open.value = true; |
| | | detailList.value = []; |
| | | activeProject.value = '0'; |
| | | loading.value = true; |
| | | try { |
| | | detailList.value = await getPdArchiveDetailByProduct(data.productCode); |
| | | activeProject.value = '0'; |
| | | 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"> |
| | | <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" |
| | |
| | | <div v-else class="py-8 text-center text-gray-400"> |
| | | 暂无归档记录 |
| | | </div> |
| | | </template> |
| | | </Modal> |
| | | </template> |