gaoluyang
2026-08-03 75242bbba28ae8902ddf86d33febb497d79e5fc3
src/views/mes/pd/archive/modules/detail.vue
@@ -3,13 +3,11 @@
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');
@@ -36,31 +34,38 @@
  },
];
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"
@@ -116,5 +121,6 @@
    <div v-else class="py-8 text-center text-gray-400">
      暂无归档记录
    </div>
    </template>
  </Modal>
</template>