From 46affb424e908c2fed03fe7c67c176034ea3292d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=B3=E7=BE=BD?= <关羽@gentronhealth.com> Date: Thu, 14 May 2026 15:11:22 +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 1. FeeDialog.vue - getUnitCodeOptions 修复:当 unitCode/minUnitCode 为 null 但对应字典文本存在时,使用文本作为选项值兜底,确保单位下拉框不显示为空 2. newfeeDetailQuery.vue - getLocationInfo 修复:从单一 records[0].children 解析改为支持树形/扁平/数组多种响应结构,并添加 catch 兜底置空数组 3. newfeeDetailQuery.vue - selectOrg 修复:查找失败时返回 '-' 而非显示原始 orgId 内码,空值同样返回 '-' **后端开发重点**:优先搜索 Java/Spring 后端代码。 关键词:Controller, Service, Mapper, API, 接口, 数据查询 搜索目录:openhis-server-new/src/, his-repo/src/ --- .../InpatientBilling/components/FeeDialog.vue | 25 ++++++++------ .../components/newfeeDetailQuery.vue | 33 ++++++++++++++++--- 2 files changed, 44 insertions(+), 14 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 b193876a2..85fc2d7e1 100755 --- a/openhis-ui-vue3/src/views/inpatientNurse/InpatientBilling/components/FeeDialog.vue +++ b/openhis-ui-vue3/src/views/inpatientNurse/InpatientBilling/components/FeeDialog.vue @@ -606,21 +606,26 @@ function getItemType_Text(type) { return map[type] || '其他'; } function getUnitCodeOptions(row) { - const unitCodes = [ - { code: row.unitCode != null ? String(row.unitCode) : null, codeText: row.unitCode_dictText }, - { code: row.minUnitCode != null ? String(row.minUnitCode) : null, codeText: row.minUnitCode_dictText }, - ]; - // 过滤掉 code 为空的单位选项 - const validUnitCodes = unitCodes.filter(item => item.code != null && item.code !== ''); - // 使用 Set 来跟踪已经存在的 code + const unitCodes = []; + // 大单位:优先用 code,code 缺失时用字典文本兜底 + if (row.unitCode != null && String(row.unitCode) !== '') { + unitCodes.push({ code: String(row.unitCode), codeText: row.unitCode_dictText }); + } else if (row.unitCode_dictText) { + unitCodes.push({ code: row.unitCode_dictText, codeText: row.unitCode_dictText }); + } + // 小单位:同上 + if (row.minUnitCode != null && String(row.minUnitCode) !== '') { + unitCodes.push({ code: String(row.minUnitCode), codeText: row.minUnitCode_dictText }); + } else if (row.minUnitCode_dictText) { + unitCodes.push({ code: row.minUnitCode_dictText, codeText: row.minUnitCode_dictText }); + } + // 去重 const seenCodes = new Set(); - const uniqueUnitCodes = validUnitCodes.filter((item) => { - // 如果 Set 中没有这个 code,就保留它,并把它加入 Set + const uniqueUnitCodes = unitCodes.filter((item) => { if (!seenCodes.has(item.code)) { seenCodes.add(item.code); return true; } - // 如果已经存在,就过滤掉 return false; }); return uniqueUnitCodes; diff --git a/openhis-ui-vue3/src/views/inpatientNurse/InpatientBilling/components/newfeeDetailQuery.vue b/openhis-ui-vue3/src/views/inpatientNurse/InpatientBilling/components/newfeeDetailQuery.vue index b3a73f25a..626919646 100755 --- a/openhis-ui-vue3/src/views/inpatientNurse/InpatientBilling/components/newfeeDetailQuery.vue +++ b/openhis-ui-vue3/src/views/inpatientNurse/InpatientBilling/components/newfeeDetailQuery.vue @@ -463,20 +463,45 @@ function watchPatientSelection() { }, 300); } -/** 查询科室 */ +/** 查询科室(支持树形/扁平多种响应结构) */ const getLocationInfo = () => { getOrgList().then((res) => { - orgOptions.value = res.data?.records[0]?.children; + if (!res.data) { + orgOptions.value = []; + return; + } + // 尝试从树形结构取:records[0].children + if (res.data.records && res.data.records.length > 0) { + if (res.data.records[0].children && res.data.records[0].children.length > 0) { + orgOptions.value = res.data.records[0].children; + return; + } + // 如果 records[0] 有 id 和 name(非树根节点),直接用所有 records + if (res.data.records[0].id) { + orgOptions.value = res.data.records; + return; + } + } + // 兜底:如果 data 本身是数组 + if (Array.isArray(res.data)) { + orgOptions.value = res.data; + return; + } + orgOptions.value = []; + }).catch(() => { + console.warn('科室列表加载失败(可能无权限)'); + orgOptions.value = []; }); }; getLocationInfo(); -// 映射 +// 映射(查找失败时返回 '-' 而非显示内码) const selectOrg = (itemid) => { + if (!itemid) return '-'; const item = orgOptions.value.find((item) => { return item.id == itemid; }); - return item?.name; + return item?.name || '-'; }; // 重置 const onReset = () => {