From 5a637e40fe1e9979497a40507cd64f3ec737d5c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E7=90=B3?= <陈琳@gentronhealth.com> Date: Tue, 12 May 2026 23:01:48 +0800 Subject: [PATCH] =?UTF-8?q?Fix=20Bug=20#428:=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=E7=94=B3=E8=AF=B7?= =?UTF-8?q?=EF=BC=9A=E6=9C=AA=E5=AE=9E=E7=8E=B0=E5=88=86=E7=B1=BB=E8=81=94?= =?UTF-8?q?=E5=8A=A8=E6=A3=80=E6=9F=A5=E6=96=B9=E6=B3=95=E5=8F=8A=E5=A5=97?= =?UTF-8?q?=E9=A4=90=E6=98=8E=E7=BB=86=E5=B1=95=E7=A4=BA=E4=B8=8E=E5=8B=BE?= =?UTF-8?q?=E9=80=89=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因分析: 1. handleCategoryExpand 加载了 cat.methods 但模板从未渲染,用户展开分类后看不到检查方法 2. 缺少 isMethodSelected/handleMethodSelect 函数,无法通过勾选检查方法来联动添加到已选择列表 3. 套餐明细展示缺少 CSS 样式(package-details-list/detail-row/detail-name/detail-info) 修复内容: - 模板: 在分类折叠区域添加 cat.methods 的渲染(检查方法列表 + 勾选框 + 价格) - 逻辑: 新增 isMethodSelected 和 handleMethodSelect 函数,支持直接勾选检查方法添加到已选择列表 - 样式: 添加套餐明细列表样式 + 检查方法区域样式 Co-Authored-By: Claude Opus 4.7 --- .../examination/examinationApplication.vue | 176 ++++++++++++++++++ 1 file changed, 176 insertions(+) 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 a73bff99..f01a3f64 100755 --- a/openhis-ui-vue3/src/views/doctorstation/components/examination/examinationApplication.vue +++ b/openhis-ui-vue3/src/views/doctorstation/components/examination/examinationApplication.vue @@ -316,6 +316,7 @@ {{ cat.categoryName }} +
加载中...
+ +
+
检查方法
+
+ + {{ method.name }} + + ¥{{ method.packagePrice || method.price || 0 }} +
+
@@ -1047,6 +1069,78 @@ function handleDelete(row) { }); } +// Bug #428修复: 判断某个检查方法是否已被选中(任意项目关联了该方法) +function isMethodSelected(method, cat) { + return selectedItems.value.some(item => + item.selectedMethod?.id === method.id && item.checkType === cat.typeName + ); +} + +// Bug #428修复: 勾选检查方法 +async function handleMethodSelect(checked, method, cat) { + if (checked) { + // 找到该方法所属的第一个检查项目 + const targetItem = cat.items[0]; + if (!targetItem) { + // 如果分类下没有项目,尝试从其他分类找同名项目或创建 + console.warn('分类下没有检查项目,无法关联方法'); + return; + } + + // 如果该项目已存在,只更新 selectedMethod + const existingItem = selectedItems.value.find(s => s.id === targetItem.id); + if (existingItem) { + existingItem.selectedMethod = method; + updateMethodDisplay(); + return; + } + + // 如果该项目不存在,创建一个并关联方法 + if (selectedItems.value.length > 0) { + const currentCategory = selectedItems.value[0].checkType; + const newCategory = cat.typeCode || ''; + if (currentCategory !== newCategory) { + ElMessage.warning('一个检查单不能同时选择多个项目类型的检查项目'); + return; + } + } + + selectedItems.value.push({ + id: targetItem.id, name: targetItem.name, + price: targetItem.price, quantity: 1, + serviceFee: targetItem.serviceFee || 0, + unit: targetItem.unit || '次', + applyPart: targetItem.name, + checkType: cat.typeName, + nationalCode: targetItem.nationalCode || '', + checked: true, + methods: [method], + selectedMethod: method, + expanded: false, + isPackage: !!targetItem.packageName, + packageId: targetItem.packageId || null + }); + + // 自动回填执行科室 + if (selectedItems.value.length === 1 && cat?.performDeptName) { + form.performDeptCode = cat.performDeptName; + } + + // 同时勾选左侧项目的 checkbox + targetItem.checked = true; + + } else { + // 取消选择方法:将 selectedItems 中关联该方法的项的 selectedMethod 清空 + const itemsWithMethod = selectedItems.value.filter( + item => item.selectedMethod?.id === method.id + ); + for (const item of itemsWithMethod) { + item.selectedMethod = null; + } + } + updateMethodDisplay(); +} + // ====== 勾选逻辑 ====== async function handleItemSelect(checked, item, cat) { if (checked) { @@ -1367,6 +1461,53 @@ defineExpose({ getList }); margin-left: 6px; } +/* Bug #428修复: 分类下检查方法区域样式 */ +.method-section { + padding: 6px 8px; + background: #f0f7ff; + border-radius: 4px; + margin-top: 6px; +} + +.method-section-title { + font-size: 12px; + font-weight: 600; + color: #409eff; + margin-bottom: 4px; + padding-bottom: 3px; + border-bottom: 1px dashed #d9ecff; +} + +.method-row { + display: flex; + align-items: center; + justify-content: space-between; + padding: 3px 4px; + border-radius: 3px; +} + +.method-row:hover { + background: #e8f4ff; +} + +.method-checkbox { + flex: 1; + overflow: hidden; +} + +.method-checkbox :deep(.el-checkbox__label) { + font-size: 12px; + color: #303133; +} + +.method-price-tag { + font-size: 11px; + color: #e6a23c; + font-weight: 500; + flex-shrink: 0; + margin-left: 6px; +} + /* 已选择 tags */ .selected-panel { width: 140px; /* Bug #384修复: 加宽以适应展开内容 */ @@ -1438,6 +1579,41 @@ defineExpose({ getList }); transform: rotate(180deg); } +/* Bug #428修复: 套餐明细列表样式 */ +.package-details-list { + padding: 6px 10px; + background: #fffbe6; + border-top: 1px solid #ffe58f; + display: flex; + flex-direction: column; + gap: 4px; +} + +.detail-row { + display: flex; + align-items: center; + justify-content: space-between; + padding: 2px 6px; + border-radius: 3px; + font-size: 11px; + background: #fff; +} + +.detail-row:hover { + background: #fff9e6; +} + +.detail-name { + color: #303133; + font-weight: 500; +} + +.detail-info { + color: #909399; + font-size: 10px; + white-space: nowrap; +} + /* Bug #384修复: 检查方法勾选框列表 */ .method-list { padding: 6px 10px;