From 4f6ee867984a57815942679161e183109d44f9ad Mon Sep 17 00:00:00 2001 From: hwj Date: Wed, 13 May 2026 15:23:16 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E8=AE=BE=E5=A4=87=E5=85=B3?= =?UTF-8?q?=E9=94=AE=E4=BB=B6-=E4=BA=8C=E7=BB=B4=E7=A0=81=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E5=9B=9E=E6=98=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/mes/criticalComponent/index.ts | 1 + .../CriticalComponentForm.vue | 24 ++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/api/mes/criticalComponent/index.ts b/src/api/mes/criticalComponent/index.ts index e249417e..38255d36 100644 --- a/src/api/mes/criticalComponent/index.ts +++ b/src/api/mes/criticalComponent/index.ts @@ -9,6 +9,7 @@ export interface CriticalComponentVO { count?: number remark?: string qrcodeUrl?: string + templateJson?: string | any createTime?: string images?: string } diff --git a/src/views/mes/criticalComponent/CriticalComponentForm.vue b/src/views/mes/criticalComponent/CriticalComponentForm.vue index 5b1dc87c..6bf29149 100644 --- a/src/views/mes/criticalComponent/CriticalComponentForm.vue +++ b/src/views/mes/criticalComponent/CriticalComponentForm.vue @@ -72,6 +72,8 @@ :refresh-url="getQrcodeRefreshUrl()" :refresh-disabled="!formData.id || !formData.code" refresh-confirm-text="确认刷新该关键件二维码吗?" + :template-json="formData.templateJson" + :print-data="buildPrintData()" @refresh-success="handleQrcodeRefreshSuccess" /> @@ -123,6 +125,7 @@ const formData = ref>({ count: undefined, remark: undefined, qrcodeUrl: undefined, + templateJson: undefined, images: undefined }) @@ -152,7 +155,9 @@ const resetForm = () => { description: undefined, count: undefined, remark: undefined, - qrcodeUrl: undefined + qrcodeUrl: undefined, + templateJson: undefined, + images: undefined } formRef.value?.resetFields?.() } @@ -169,6 +174,18 @@ const getQrcodeRefreshUrl = () => { return `/mes/critical-component/regenerate-code?id=${formData.value.id}&code=${encodeURIComponent(String(formData.value.code))}` } +const buildPrintData = () => { + return { + id: formData.value.id, + code: formData.value.code, + name: formData.value.name, + description: formData.value.description, + count: formData.value.count, + remark: formData.value.remark, + qrcodeUrl: formData.value.qrcodeUrl + } +} + const handleQrcodeRefreshSuccess = async (data: any) => { if (!formData.value.id) return if (data?.qrcodeUrl) { @@ -189,6 +206,10 @@ const open = async (type: 'create' | 'update', id?: number) => { formLoading.value = true try { const detail = await CriticalComponentApi.getCriticalComponent(id) + const templateJson = detail?.templateJson + const parsedTemplateJson = typeof templateJson === 'string' + ? JSON.parse(templateJson) + : templateJson formData.value = { id: detail?.id, code: detail?.code, @@ -199,6 +220,7 @@ const open = async (type: 'create' | 'update', id?: number) => { count: detail?.count, remark: detail?.remark, qrcodeUrl: detail?.qrcodeUrl, + templateJson: parsedTemplateJson, images: detail?.images } } finally {