From c082a272c1745de3d2dbcd8f02a6c80e594e8a0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=B3=E7=BE=BD?= <关羽@gentronhealth.com> Date: Wed, 13 May 2026 15:05:37 +0800 Subject: [PATCH] =?UTF-8?q?Fix=20Bug=20#426:=20=E9=97=A8=E8=AF=8A=E5=8C=BB?= =?UTF-8?q?=E7=94=9F=E7=AB=99-=E6=A3=80=E6=9F=A5=E5=BC=80=E7=AB=8B?= =?UTF-8?q?=EF=BC=9A=E5=B7=B2=E9=80=89=E6=8B=A9=E5=88=97=E8=A1=A8=E5=BA=94?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E6=A0=91=E5=BD=A2=E5=B1=95=E5=BC=80=EF=BC=8C?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=A5=97=E9=A4=90=E6=98=8E=E7=BB=86=EF=BC=88?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE/=E6=95=B0=E9=87=8F/=E5=8D=95=E4=BB=B7?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因:CheckPart 实体只有 packageName 字段,没有 packageId 字段。 前端 loadCategoryList 中 packageId 永远为 null,导致 loadPackageDetailsForItem 的 guard 条件 (!item.packageId) 永远提前返回,套餐明细无法加载。 修复策略: 1. handleItemSelect 中添加 packageName 到 selectedItems 数据对象 2. loadPackageDetailsForItem 改为优先使用 packageId,若无则通过 packageName 调用 listCheckPackage API 查找 packageId(复用 loadMethodPackageDetails 已有的模式) --- .../examination/examinationApplication.vue | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/openhis-ui-vue3/src/views/doctorstation/components/examination/examinationApplication.vue b/openhis-ui-vue3/src/views/doctorstation/components/examination/examinationApplication.vue index 788d56066..ea7dfba0b 100755 --- a/openhis-ui-vue3/src/views/doctorstation/components/examination/examinationApplication.vue +++ b/openhis-ui-vue3/src/views/doctorstation/components/examination/examinationApplication.vue @@ -482,14 +482,28 @@ async function loadPackageDetails(row, treeNode, resolve) { } } -// #428: 为已选择项目加载套餐明细 +// #428修复: 为已选择项目加载套餐明细(通过packageId或packageName查询) async function loadPackageDetailsForItem(item) { - if (!item.isPackage || !item.packageId) { + if (!item.isPackage || (!item.packageId && !item.packageName)) { return; } try { + let packageId = item.packageId; + if (!packageId && item.packageName) { + // CheckPart 没有 packageId 字段,需要通过 packageName 查询获取 + const pkgRes = await listCheckPackage({ packageName: item.packageName }); + let packages = pkgRes?.data || []; + if (!Array.isArray(packages)) { + packages = packages.records || packages.data || []; + } + if (packages.length === 0) { + item.packageDetails = []; + return; + } + packageId = packages[0].id; + } const res = await request({ - url: `/system/package/${item.packageId}/details`, + url: `/system/package/${packageId}/details`, method: 'get' }); if (res.code === 200 && res.data) { @@ -497,7 +511,7 @@ async function loadPackageDetailsForItem(item) { ...detail, name: detail.name || detail.itemName, unit: detail.unit || '次', - price: detail.price || detail.itemPrice || 0, + price: detail.price || detail.unitPrice || 0, quantity: detail.quantity || 1 })); } else { @@ -1241,6 +1255,7 @@ async function handleItemSelect(checked, item, cat) { selectedMethod: null, expanded: false, // Bug #384修复: 新增展开状态,默认不展开 isPackage: !!item.packageName, // Bug #428修复: 标记是否为套餐 + packageName: item.packageName || null, // Bug #426修复: 套餐名称,用于查找packageId packageId: item.packageId || null // Bug #428修复: 套餐ID });