From f041f972012ff8a2e517e42941ef50456716e65e Mon Sep 17 00:00:00 2001 From: zhaoyun Date: Sun, 17 May 2026 17:15:55 +0800 Subject: [PATCH] =?UTF-8?q?Fix=20Bug=20#426:=20handleMethodSelect/onDetail?= =?UTF-8?q?MethodChange=20=E8=A1=A5=E5=85=85=20packageName=20=E5=A5=97?= =?UTF-8?q?=E9=A4=90=E8=A7=A3=E6=9E=90=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因:check_method 表只有 package_name 字段无 package_id,handleMethodSelect 等路径只检查 packageId 导致套餐的 hasChildren、右侧卡片展开、套餐明细加载 全部不生效。补充 6 处 packageId→packageName 兜底检查,使所有选择路径 一致支持 packageName→packageId 解析。 Co-Authored-By: Claude Opus 4.7 --- .../examination/examinationApplication.vue | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 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 bea406574..475e14d0c 100755 --- a/openhis-ui-vue3/src/views/doctorstation/components/examination/examinationApplication.vue +++ b/openhis-ui-vue3/src/views/doctorstation/components/examination/examinationApplication.vue @@ -639,9 +639,9 @@ function getPackageDetailsList(item) { return Array.isArray(carrier?.packageDetails) ? carrier.packageDetails : []; } -/** 有套餐 ID 的已选行才展示右侧套餐区(加载中 / 空 / 明细列表) */ +/** 有套餐 ID 或 packageName 的已选行才展示右侧套餐区(加载中 / 空 / 明细列表) */ function shouldShowPackageBody(item) { - return !!getPackageCarrier(item)?.packageId; + return !!(getPackageCarrier(item)?.packageId || item.packageName || item.packageId); } /** 金额展示:统一两位小数 */ @@ -1381,10 +1381,10 @@ async function handleMethodSelect(checked, method, cat) { const existingItem = selectedItems.value.find(s => s.id === targetItem.id); if (existingItem) { existingItem.selectedMethod = method; - // 从方法中获取套餐信息 - if (method.packageId) { + // 从方法中获取套餐信息(支持 packageId 或 packageName 解析) + if (method.packageId || method.packageName) { existingItem.isPackage = true; - existingItem.packageId = method.packageId; + existingItem.packageId = method.packageId || existingItem.packageId; existingItem.hasChildren = true; // #426修复 existingItem.packageName = method.packageName || existingItem.packageName; // #428修复: 确保 packageName 同步 // 预加载套餐明细 @@ -1421,12 +1421,12 @@ async function handleMethodSelect(checked, method, cat) { isPackage: !!method.packageId || !!targetItem.packageName, packageId: method.packageId || targetItem.packageId || null, packageName: method.packageName || targetItem.packageName || null, // #428修复: 复制 packageName,确保套餐明细可加载 - hasChildren: !!(method.packageId || targetItem.packageId) // #426修复: 树形表格懒加载展开标记 + hasChildren: !!(method.packageId || method.packageName || targetItem.packageId || targetItem.packageName) // #426修复: 树形表格懒加载展开标记,支持 packageName 解析 }; selectedItems.value.push(newItem); // 如果是套餐,预加载套餐明细 - if (newItem.isPackage && newItem.packageId) { + if (newItem.isPackage && (newItem.packageId || newItem.packageName)) { loadPackageDetailsForItem(newItem); } @@ -1564,7 +1564,7 @@ async function toggleItemExpand(item) { async function selectMethodCheckbox(checked, item, method) { if (checked) { item.selectedMethod = method; - if (item.expanded && method.packageId) { + if (item.expanded && (method.packageId || method.packageName)) { loadPackageDetailsForItem(item); } // 动态加载该方法对应的套餐明细 @@ -1629,8 +1629,9 @@ async function loadMethodPackageDetails(item, method) { /** 检查明细表格中切换检查方法 */ async function onDetailMethodChange(row, val) { row.selectedMethod = val || null; - if (val?.packageId) { - row.packageId = val.packageId; + if (val?.packageId || val?.packageName) { + row.packageId = val.packageId || row.packageId; + row.packageName = val.packageName || row.packageName; row.isPackage = true; row.hasChildren = true; // #426修复 }