From 27d1afaa8699c05500b72fccbcc2559bce9c8a51 Mon Sep 17 00:00:00 2001 From: hwj Date: Tue, 26 May 2026 11:33:11 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E8=AE=BE=E5=A4=87=E5=8F=B0?= =?UTF-8?q?=E8=B4=A6-=E8=AF=A6=E6=83=85=E4=BA=8C=E7=BB=B4=E7=A0=81?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0json=E5=9B=9E=E6=98=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/mes/deviceledger/detail/index.vue | 29 +++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/views/mes/deviceledger/detail/index.vue b/src/views/mes/deviceledger/detail/index.vue index 360de443..29228ea1 100644 --- a/src/views/mes/deviceledger/detail/index.vue +++ b/src/views/mes/deviceledger/detail/index.vue @@ -56,6 +56,8 @@ :print-max-width="220" :empty-text="t('EquipmentManagement.EquipmentLedger.qrcodeLoadError')" :error-text="t('EquipmentManagement.EquipmentLedger.qrcodeLoadError')" + :template-json="detailTemplateJson" + :print-data="buildDetailPrintData()" :show-refresh="false" /> @@ -430,6 +432,33 @@ const getDeviceTypeName = (value: any) => { return value ?? '' } +const detailTemplateJson = computed(() => { + const templateJson = detailData.value?.templateJson + if (!templateJson) return undefined + if (typeof templateJson === 'string') { + try { + return JSON.parse(templateJson) + } catch { + return undefined + } + } + return templateJson +}) + +const buildDetailPrintData = () => { + return { + id: detailData.value?.id, + deviceCode: detailData.value?.deviceCode, + deviceName: detailData.value?.deviceName, + deviceSpec: detailData.value?.deviceSpec, + deviceBrand: detailData.value?.deviceBrand, + deviceModel: detailData.value?.deviceModel, + deviceLocation: detailData.value?.deviceLocation, + remark: detailData.value?.remark ?? detailData.value?.deviceRemark, + qrcodeUrl: detailData.value?.qrcodeUrl + } +} + const formatDetailDate = (value: any) => { if (!value) return '' return formatDate(new Date(value), 'YYYY-MM-DD')