From 861129c9d4b1017b853bf8231332d42abd740ffc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=BA=91?= <赵云@gentronhealth.com> Date: Mon, 11 May 2026 12:04:20 +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. 修复单位字段默认为空:selectChange中增加defaultUnitCode逻辑,优先取minUnitCode,回退到unitCode 2. 修复执行科室显示内码:统一positionId和el-option value为字符串类型,避免类型不匹配导致el-select无法匹配选项 3. 科室匹配增加String类型转换:find时用String(d.id)===String(patientOrgId)避免因类型不同找不到匹配科室 4. loadDepartmentOptions和getDiseaseInitLoc增加.catch优雅降级,避免API失败时页面阻断 Co-Authored-By: Claude Opus 4.7 --- .../InpatientBilling/components/FeeDialog.vue | 52 +++++++++++++------ 1 file changed, 35 insertions(+), 17 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 40484fdf..5a9e6687 100755 --- a/openhis-ui-vue3/src/views/inpatientNurse/InpatientBilling/components/FeeDialog.vue +++ b/openhis-ui-vue3/src/views/inpatientNurse/InpatientBilling/components/FeeDialog.vue @@ -181,7 +181,7 @@ v-for="dept in getFilteredOptions(scope.row, 'departmentOptions')" :key="dept.id" :label="dept.name" - :value="dept.id" + :value="String(dept.id)" /> @@ -481,11 +481,16 @@ watch( // 加载科室选项 function loadDepartmentOptions() { - getOrgList().then((res) => { - if (res.data && res.data.records && res.data.records.length > 0) { - departmentOptions.value = res.data.records[0].children || []; - } - }); + getOrgList() + .then((res) => { + if (res.data && res.data.records && res.data.records.length > 0) { + departmentOptions.value = res.data.records[0].children || []; + } + }) + .catch(() => { + console.warn('科室列表加载失败(可能无权限)'); + departmentOptions.value = []; + }); } // 加载收费组套数据 @@ -504,10 +509,15 @@ function getAdviceBaseInfos() { }); } function getDiseaseInitLoc() { - getDiseaseTreatmentInitLoc(16).then((response) => { - console.log('Disease Treatment Init Loc:', response); - locationOptions.value = response.data.locationOptions; - }); + getDiseaseTreatmentInitLoc(16) + .then((response) => { + console.log('Disease Treatment Init Loc:', response); + locationOptions.value = response.data.locationOptions; + }) + .catch(() => { + console.warn('位置列表加载失败(可能无权限)'); + locationOptions.value = []; + }); } // 下拉框模糊搜索过滤 function filterOptions(val, row, optionsKey) { @@ -603,15 +613,23 @@ function selectChange(row) { const price = row.priceList?.[0]?.price || 0; //获取大小单位 const uniqueUnitCodes = getUnitCodeOptions(row); - // 设置默认执行科室/位置 + // 设置默认单位:优先使用 minUnitCode(小单位),回退到 unitCode(大单位) + let defaultUnitCode = ''; + if (row.minUnitCode) { + defaultUnitCode = String(row.minUnitCode); + } else if (row.unitCode) { + defaultUnitCode = String(row.unitCode); + } + // 设置默认执行科室/位置(统一转为字符串,避免 el-select 类型不匹配) let defaultPositionId = undefined; if (row.adviceType === 3 && departmentOptions.value.length > 0) { // 诊疗:优先使用患者所在科室,否则取第一个科室 - defaultPositionId = departmentOptions.value.find(d => d.id === props.patientInfo.organizationId)?.id - || departmentOptions.value[0]?.id; + const patientOrgId = props.patientInfo.organizationId; + const matched = departmentOptions.value.find(d => String(d.id) === String(patientOrgId)); + defaultPositionId = matched ? String(matched.id) : String(departmentOptions.value[0].id); } else if (row.adviceType === 2 && locationOptions.value.length > 0) { // 耗材:默认取第一个药房/耗材房 - defaultPositionId = locationOptions.value[0]?.value; + defaultPositionId = String(locationOptions.value[0].value); } //插入费用列表 feeItemsList.value.push({ @@ -619,8 +637,8 @@ function selectChange(row) { uniqueUnitCodes: uniqueUnitCodes, unitPrice: (price / (row.partPercent || 1)).toFixed(6), // 根据拆零比计算单价 quantity: 1, - positionId: defaultPositionId, // 默认执行科室/位置 - selectUnitCode: String(row.minUnitCode || ''), // 默认选择小单位,确保字符串类型 + positionId: defaultPositionId, // 默认执行科室/位置(字符串类型) + selectUnitCode: defaultUnitCode, // 默认选择小单位 }); }