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, // 默认选择小单位 }); }