From 91eff4781fa4142d1f62d30a0fa1de5cae424eaf Mon Sep 17 00:00:00 2001
From: liu <2021943741@qq.com>
Date: 星期三, 16 九月 2026 18:23:12 +0800
Subject: [PATCH] refactor: 单据审核改为审批配置状态机(前端统一审核弹窗)
---
src/views/mes/pd/archive/modules/detail.vue | 63 ++++++++++++++++++++++---------
1 files changed, 44 insertions(+), 19 deletions(-)
diff --git a/src/views/mes/pd/archive/modules/detail.vue b/src/views/mes/pd/archive/modules/detail.vue
index 5646b92..49a4498 100644
--- a/src/views/mes/pd/archive/modules/detail.vue
+++ b/src/views/mes/pd/archive/modules/detail.vue
@@ -9,11 +9,12 @@
import { FilePreviewModal, useFilePreview } from '#/components/file-preview';
interface Props {
- visible: boolean;
+ visible?: boolean;
productCode?: string;
}
const props = withDefaults(defineProps<Props>(), {
+ visible: false,
productCode: '',
});
@@ -27,6 +28,8 @@
const loading = ref(false);
const detailList = ref<MesPdArchiveApi.DetailItem[]>([]);
const activeProject = ref('0');
+/** 褰撳墠鏌ョ湅鐨勪骇鍝佺紪鐮侊紙鍛戒护寮� open(code) 浼犲叆鎴栧彇鑷� prop锛� */
+const currentCode = ref('');
const { openPreview, previewState } = useFilePreview();
@@ -52,28 +55,50 @@
},
];
-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;
- }
- } else if (!newVal) {
- open.value = false;
- detailList.value = [];
+/** 鎵撳紑寮圭獥骞跺姞杞芥寚瀹氫骇鍝佺紪鐮佺殑褰掓。璇︽儏锛涚紪鐮佷负绌烘椂鐩存帴灞曠ず绌烘�� */
+async function showDetail(code: string) {
+ currentCode.value = code || '';
+ open.value = true;
+ detailList.value = [];
+ activeProject.value = '0';
+ if (!currentCode.value) {
+ return;
}
-});
+ loading.value = true;
+ try {
+ detailList.value = await getPdArchiveDetailByProduct(currentCode.value);
+ } catch {
+ message.error('鑾峰彇褰掓。璇︽儏澶辫触');
+ } finally {
+ loading.value = false;
+ }
+}
+
+watch(
+ () => props.visible,
+ (newVal) => {
+ if (newVal) {
+ // 鍗充娇浜у搧缂栫爜涓虹┖涔熸墦寮�寮圭獥锛堝睍绀虹┖鎬侊級锛岄伩鍏嶇埗缁勪欢 visible 鍗″湪 true 鍚庡啀涔熸棤娉曡Е鍙�
+ showDetail(props.productCode || '');
+ } else {
+ open.value = false;
+ detailList.value = [];
+ }
+ },
+);
function handleClose() {
+ open.value = false;
+ detailList.value = [];
emit('update:visible', false);
}
+
+/** 鍏煎鍛戒护寮忚皟鐢細archiveDetailRef.value?.open(productCode) */
+function handleOpen(code?: string) {
+ showDetail(code ?? props.productCode ?? '');
+}
+
+defineExpose({ open: handleOpen });
</script>
<template>
@@ -143,7 +168,7 @@
</Tabs.TabPane>
</Tabs>
<div v-else class="py-8 text-center text-gray-400">
- 鏆傛棤褰掓。璁板綍
+ {{ currentCode ? '鏆傛棤褰掓。璁板綍' : '璇ュ伐鍗曟湭璁剧疆浜у搧缂栫爜锛屾殏鏃犲綊妗h褰�' }}
</div>
</template>
</Modal>
--
Gitblit v1.9.3