From 6c4a8e3c14ea0d1a27d817448a556de5558478f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=B3=E7=BE=BD?= <关羽@gentronhealth.com> Date: Wed, 13 May 2026 20:31:18 +0800 Subject: [PATCH] =?UTF-8?q?Fix=20Bug=20#507:=20[=E4=BD=8F=E9=99=A2?= =?UTF-8?q?=E6=8A=A4=E5=A3=AB=E7=AB=99-=E4=BD=8F=E9=99=A2=E8=AE=B0?= =?UTF-8?q?=E8=B4=A6-=E8=A1=A5=E8=B4=B9]=20=E9=A1=B9=E7=9B=AE=E5=8D=95?= =?UTF-8?q?=E4=BD=8D=E6=9C=AA=E8=8E=B7=E5=8F=96=E3=80=81=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=E7=A7=91=E5=AE=A4=E6=98=BE=E7=A4=BA=E5=86=85=E7=A0=81=E4=B8=94?= =?UTF-8?q?=E7=BC=BA=E4=B9=8F=E9=BB=98=E8=AE=A4/=E6=A8=A1=E7=B3=8A?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **后端开发重点**:优先搜索 Java/Spring 后端代码。 关键词:Controller, Service, Mapper, API, 接口, 数据查询 搜索目录:openhis-server-new/src/, his-repo/src/ 修复三个问题: 1. 单位字段显示为空:getUnitCodeOptions 中 unitCode/minUnitCode 未做 String() 转换,与 selectUnitCode(String类型)比较时类型不匹配导致 el-select 无法正确选中;unitCodeChange 中同样存在类型比较问题 2. 执行科室/位置默认值未生效:departmentOptions 在 onMounted 异步加载,用户快速点击项目时数据尚未加载完成导致默认 positionId 为空;增加 watch 监听科室/位置选项加载完成,自动补填默认值;弹窗打开时重新加载确保数据最新 3. 下拉模糊搜索不生效:优化 filterOptions/getFilteredOptions 过滤逻辑,增加拼音首字母(pyStr)搜索支持 --- .../InpatientBilling/components/FeeDialog.vue | 57 +++++++++++++++---- 1 file changed, 46 insertions(+), 11 deletions(-) diff --git a/openhis-ui-vue3/src/views/inpatientNurse/InpatientBilling/components/FeeDialog.vue b/openhis-ui-vue3/src/views/inpatientNurse/InpatientBilling/components/FeeDialog.vue index 8cba9430f..f58c0a90e 100755 --- a/openhis-ui-vue3/src/views/inpatientNurse/InpatientBilling/components/FeeDialog.vue +++ b/openhis-ui-vue3/src/views/inpatientNurse/InpatientBilling/components/FeeDialog.vue @@ -481,12 +481,43 @@ watch( (visible) => { if (visible) { executeTime.value = formatDateStr(new Date(), 'YYYY-MM-DD HH:mm:ss'); + // 弹窗打开时重新加载科室和位置选项,确保数据最新 + loadDepartmentOptions(); + getDiseaseInitLoc(16); } else { resetData(); } } ); +// 监听科室选项加载完成,为已添加的诊疗项目设置默认执行科室 +watch( + () => departmentOptions.value, + (depts) => { + if (!depts || depts.length === 0) return; + feeItemsList.value.forEach(item => { + if (item.adviceType === 3 && !item.positionId) { + const patientOrgId = props.patientInfo.organizationId; + const matched = depts.find(d => String(d.id) === String(patientOrgId)); + item.positionId = matched ? String(matched.id) : String(depts[0].id); + } + }); + } +); + +// 监听位置选项加载完成,为已添加的耗材项目设置默认位置 +watch( + () => locationOptions.value, + (locs) => { + if (!locs || locs.length === 0) return; + feeItemsList.value.forEach(item => { + if (item.adviceType === 2 && !item.positionId) { + item.positionId = String(locs[0].value); + } + }); + } +); + // 加载科室选项 function loadDepartmentOptions() { getOrgList() @@ -527,23 +558,27 @@ function getDiseaseInitLoc() { locationOptions.value = []; }); } -// 下拉框模糊搜索过滤 +// 下拉框模糊搜索过滤(自定义filter-method,配合element-plus filterable使用) function filterOptions(val, row, optionsKey) { const key = row.adviceDefinitionId + '_' + optionsKey; - filterKeywords.value[key] = val; + if (!val || val.trim() === '') { + delete filterKeywords.value[key]; + } else { + filterKeywords.value[key] = val.toLowerCase(); + } } function getFilteredOptions(row, optionsKey) { const key = row.adviceDefinitionId + '_' + optionsKey; const keyword = filterKeywords.value[key]; const options = optionsKey === 'departmentOptions' ? departmentOptions.value : locationOptions.value; - if (!keyword || keyword.trim() === '') { + if (!keyword) { return options; } - const lower = keyword.toLowerCase(); return options.filter(item => { const name = (item.name || item.label || '').toLowerCase(); const id = String(item.id || item.value || '').toLowerCase(); - return name.includes(lower) || id.includes(lower); + const py = (item.pyStr || '').toLowerCase(); + return name.includes(keyword) || id.includes(keyword) || py.includes(keyword); }); } // 获取组套类型文本 @@ -553,9 +588,9 @@ function getItemType_Text(type) { } function getUnitCodeOptions(row) { const unitCodes = [ - { code: row.unitCode, codeText: row.unitCode_dictText }, - { code: row.minUnitCode, codeText: row.minUnitCode_dictText }, - ]; + { code: String(row.unitCode), codeText: row.unitCode_dictText }, + { code: String(row.minUnitCode), codeText: row.minUnitCode_dictText }, + ].filter(item => item.code); // 使用 Set 来跟踪已经存在的 code const seenCodes = new Set(); const uniqueUnitCodes = unitCodes.filter((item) => { @@ -575,11 +610,11 @@ function unitCodeChange(row) { // 获取价格 const price = row.priceList?.[0]?.price || 0; - // 根据选择的单位调整单价 - if (row.selectUnitCode === row.unitCode) { + // 根据选择的单位调整单价(统一用字符串比较) + if (String(row.selectUnitCode) === String(row.unitCode)) { // 如果选择的是大单位 (如 "盒") row.unitPrice = price.toFixed(6); // 单价就是原价 - } else if (row.selectUnitCode === row.minUnitCode) { + } else if (String(row.selectUnitCode) === String(row.minUnitCode)) { // 如果选择的是小单位 (如 "个") row.unitPrice = (price / (row.partPercent || 1)).toFixed(6); // 单价 = 原价 / 拆零比 }