From ceeeb4f3315fbd4e4ca3e91efffcee0a54bc22ee Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期三, 23 九月 2026 17:42:19 +0800
Subject: [PATCH] 资料类型字段显示问题
---
src/views/mes/pd/archive/modules/detail.vue | 69 ++++++++++++++++++++++++++++------
1 files changed, 56 insertions(+), 13 deletions(-)
diff --git a/src/views/mes/pd/archive/modules/detail.vue b/src/views/mes/pd/archive/modules/detail.vue
index e13a306..f767001 100644
--- a/src/views/mes/pd/archive/modules/detail.vue
+++ b/src/views/mes/pd/archive/modules/detail.vue
@@ -7,6 +7,10 @@
import { getPdArchiveDetailByProduct } from '#/api/mes/pd/archive';
import { FilePreviewModal, useFilePreview } from '#/components/file-preview';
+import { DICT_TYPE } from '#/packages/constants/src';
+import { getDictOptions } from '#/packages/effects/hooks/src';
+
+import { getPdDocumentTypeOptions } from '../../project/data';
interface Props {
visible: boolean;
@@ -30,17 +34,46 @@
const { openPreview, previewState } = useFilePreview();
+/** 璧勬枡绫诲瀷涓枃鍚嶏細澶嶇敤椤圭洰璧勬枡鍒楄〃鐨勫悓涓�浠芥槧灏勶紙getPdDocumentTypeOptions锛夛紝閬垮厤涓ゅ缁存姢 */
+function documentTypeText(value?: string) {
+ if (!value) return '-';
+ return (
+ getPdDocumentTypeOptions().find((item) => item.value === value)?.label ??
+ String(value)
+ );
+}
+
+/** 褰掓。鐘舵�佷腑鏂囧悕锛氬瓧鍏� mes_pd_archive_status */
+function archiveStatusText(value?: number) {
+ if (value === undefined || value === null || value === '') return '-';
+ return (
+ getDictOptions(DICT_TYPE.MES_PD_ARCHIVE_STATUS, 'number').find(
+ (item) => Number(item.value) === Number(value),
+ )?.label ?? String(value)
+ );
+}
+
const archiveColumns = [
{ title: '褰掓。缂栧彿', dataIndex: 'archiveCode', key: 'archiveCode' },
{ title: '褰掓。浜�', dataIndex: 'archiverNickname', key: 'archiverNickname' },
- { title: '褰掓。鐘舵��', dataIndex: 'archiveStatus', key: 'archiveStatus' },
+ {
+ title: '褰掓。鐘舵��',
+ dataIndex: 'archiveStatus',
+ key: 'archiveStatus',
+ customRender: ({ text }: { text: number }) => archiveStatusText(text),
+ },
{ title: '褰掓。鏃堕棿', dataIndex: 'archiveTime', key: 'archiveTime' },
{ title: '澶囨敞', dataIndex: 'remark', key: 'remark', ellipsis: true },
];
const documentColumns = [
{ title: '璧勬枡鍚嶇О', dataIndex: 'documentName', key: 'documentName' },
- { title: '璧勬枡绫诲瀷', dataIndex: 'documentType', key: 'documentType' },
+ {
+ title: '璧勬枡绫诲瀷',
+ dataIndex: 'documentType',
+ key: 'documentType',
+ customRender: ({ text }: { text: string }) => documentTypeText(text),
+ },
{ title: '鐗堟湰', dataIndex: 'documentVersion', key: 'documentVersion', width: 80 },
{ title: '鏂囦欢鍚�', dataIndex: 'fileName', key: 'fileName' },
{ title: '涓婁紶浜�', dataIndex: 'uploadUserNickname', key: 'uploadUserNickname' },
@@ -54,23 +87,33 @@
watch(() => props.visible, async (newVal) => {
if (newVal && props.productCode) {
- open.value = true;
- loading.value = true;
- detailList.value = [];
- activeProject.value = '0';
- try {
- detailList.value = await getPdArchiveDetailByProduct(props.productCode);
- } catch {
- message.error('鑾峰彇褰掓。璇︽儏澶辫触');
- } finally {
- loading.value = false;
- }
+ loadData(props.productCode);
} else if (!newVal) {
open.value = false;
detailList.value = [];
}
});
+async function loadData(code: string) {
+ open.value = true;
+ loading.value = true;
+ detailList.value = [];
+ activeProject.value = '0';
+ try {
+ detailList.value = await getPdArchiveDetailByProduct(code);
+ } catch {
+ message.error('鑾峰彇褰掓。璇︽儏澶辫触');
+ } finally {
+ loading.value = false;
+ }
+}
+
+function openModal(code: string) {
+ loadData(code);
+}
+
+defineExpose({ open: openModal });
+
function handleClose() {
emit('update:visible', false);
}
--
Gitblit v1.9.3