gaoluyang
2026-08-04 29ef7c017c0dbbae7c62933d0fa3220f04cd8f56
银川
1.归档bug
已修改3个文件
68 ■■■■ 文件已修改
src/api/mes/pro/workorder/index.ts 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mes/pd/archive/modules/detail.vue 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mes/pro/task/index.vue 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/mes/pro/workorder/index.ts
@@ -14,6 +14,7 @@
    productId?: number; // 产品编号
    productName?: string; // 产品名称
    productCode?: string; // 产品编码
    itemCode?: string; // 产品编码(物料编码)
    productSpecification?: string; // 规格型号
    unitMeasureName?: string; // 单位名称
    quantity?: number; // 生产数量
src/views/mes/pd/archive/modules/detail.vue
@@ -1,16 +1,34 @@
<script lang="ts" setup>
import type { MesPdArchiveApi } from '#/api/mes/pd/archive';
import { ref } from 'vue';
import { ref, watch } from 'vue';
import { Modal, Descriptions, Table, Tabs, message } from 'ant-design-vue';
import { Modal, Descriptions, Table, Tabs, Spin, message } from 'ant-design-vue';
import { getPdArchiveDetailByProduct } from '#/api/mes/pd/archive';
import { FilePreviewModal, useFilePreview } from '#/components/file-preview';
interface Props {
  visible: boolean;
  productCode?: string;
}
const props = withDefaults(defineProps<Props>(), {
  productCode: '',
});
interface Emits {
  (e: 'update:visible', value: boolean): void;
}
const emit = defineEmits<Emits>();
const open = ref(false);
const loading = ref(false);
const detailList = ref<MesPdArchiveApi.DetailItem[]>([]);
const activeProject = ref('0');
const { openPreview, previewState } = useFilePreview();
const archiveColumns = [
  { title: '归档编号', dataIndex: 'archiveCode', key: 'archiveCode' },
@@ -30,40 +48,39 @@
  {
    title: '操作',
    key: 'action',
    width: 80,
    width: 120,
  },
];
async function handleOpen(productCode?: string) {
  if (!productCode) {
    message.warning('产品编码为空,无法查看归档');
    return;
  }
watch(() => props.visible, async (newVal) => {
  if (newVal && props.productCode) {
  open.value = true;
    loading.value = true;
  detailList.value = [];
  activeProject.value = '0';
  loading.value = true;
  try {
    detailList.value = await getPdArchiveDetailByProduct(productCode);
      detailList.value = await getPdArchiveDetailByProduct(props.productCode);
  } catch {
    message.error('获取归档详情失败');
  } finally {
    loading.value = false;
  }
}
function handleClose() {
  } else if (!newVal) {
  open.value = false;
  detailList.value = [];
}
});
defineExpose({ open: handleOpen });
function handleClose() {
  emit('update:visible', false);
}
</script>
<template>
  <FilePreviewModal v-bind="previewState" />
  <Modal v-model:open="open" title="归档详情" width="80%" :footer="null" @cancel="handleClose">
    <div v-if="loading" class="flex justify-center py-8">
      <a-spin />
      <Spin />
    </div>
    <template v-else>
      <Tabs v-if="detailList.length > 0" v-model:active-key="activeProject" type="card">
@@ -110,7 +127,10 @@
            >
              <template #bodyCell="{ column, record }">
                <template v-if="column.key === 'action'">
                  <a v-if="record.fileUrl" :href="record.fileUrl" target="_blank" class="text-primary">下载</a>
                  <template v-if="record.fileUrl">
                    <a class="mr-2" @click="openPreview(record.fileUrl, record.fileName)">预览</a>
                    <a :href="record.fileUrl" target="_blank">下载</a>
                  </template>
                  <span v-else class="text-gray-400">-</span>
                </template>
              </template>
src/views/mes/pro/task/index.vue
@@ -25,7 +25,8 @@
const router = useRouter();
const ganttTasks = ref<any[]>([]); // 甘特图预览数据
const archiveDetailRef = ref<InstanceType<typeof ArchiveDetail>>();
const archiveVisible = ref(false);
const archiveProductCode = ref('');
const [ScheduleModal, scheduleModalApi] = useVbenModal({
  connectedComponent: ScheduleForm,
@@ -82,6 +83,12 @@
  } catch {
    message.error('排产失败');
  }
}
/** 打开归档详情 */
function handleArchive(row: MesProWorkOrderApi.WorkOrder) {
  archiveProductCode.value = row.productCode || '';
  archiveVisible.value = true;
}
/** 打开甘特图编辑页面 */
@@ -169,14 +176,14 @@
              onClick: handleSchedule.bind(null, row),
            },
            {
              label: '归档',
              label: '归档详情',
              type: 'link',
              onClick: () => archiveDetailRef.value?.open(row.productCode),
              onClick: handleArchive.bind(null, row),
            },
          ]"
        />
      </template>
    </Grid>
    <ArchiveDetail ref="archiveDetailRef" />
    <ArchiveDetail :visible="archiveVisible" :product-code="archiveProductCode" @update:visible="archiveVisible = $event" />
  </Page>
</template>