Fix Bug #523: [住院医生站-临床医嘱] 待保存医嘱总金额显示缺失且编辑态单位选择框变为数字控件

- 总金额列显示横杠: 在 setValue 中为药品类医嘱初始化 totalPrice(有 quantity 时按单价计算,否则为 '0'),确保待保存医嘱的总金额列能正常回显
- 单位选择框变数字控件: setValue 中将 unitCode/doseUnitCode/minUnitCode 统一转为 String 类型,避免 el-select 因值类型不匹配而渲染异常

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
关羽
2026-05-14 16:30:03 +08:00
parent 9a665b7caf
commit 9e0acde6d7

View File

@@ -1503,16 +1503,16 @@ function handleSaveBatch() {
}
function setValue(row) {
// 构造单位列表
// 构造单位列表,确保 value 始终为 String 类型,避免 el-select 值类型不匹配
unitCodeList.value = [
{ value: row.unitCode, label: row.unitCode_dictText, type: 'unit' },
{ value: String(row.unitCode ?? ''), label: row.unitCode_dictText, type: 'unit' },
{
value: row.doseUnitCode,
value: String(row.doseUnitCode ?? ''),
label: row.doseUnitCode_dictText,
type: 'dose',
},
{
value: row.minUnitCode,
value: String(row.minUnitCode ?? ''),
label: row.minUnitCode_dictText,
type: 'minUnit',
},
@@ -1577,9 +1577,9 @@ function setValue(row) {
orgName: row.adviceType != 3 ? undefined : (findOrgName(row.orgId || row.positionId || patientInfo.value?.inHospitalOrgId) || row.orgName || patientInfo.value?.inHospitalOrgName || ''),
// dose: undefined, Removed to preserve dose value from group package
unitCodeList: unitCodeList.value,
doseUnitCode: row.doseUnitCode,
minUnitCode: row.minUnitCode,
unitCode: row.partAttributeEnum == 1 ? row.minUnitCode : row.unitCode,
doseUnitCode: String(row.doseUnitCode ?? ''),
minUnitCode: String(row.minUnitCode ?? ''),
unitCode: row.partAttributeEnum == 1 ? String(row.minUnitCode ?? '') : String(row.unitCode ?? ''),
categoryEnum: row.categoryCode,
definitionId: row.chargeItemDefinitionId,
executeNum: 1,
@@ -1595,6 +1595,10 @@ function setValue(row) {
? new Decimal(selectedStock.price).div(row.partPercent).toFixed(6)
: prevRow.minUnitPrice,
positionName: selectedStock?.locationName,
// 🔧 Bug #523 修复:初始化 totalPrice 为 0避免总金额列显示为横杠
totalPrice: row.quantity
? new Decimal(row.quantity).mul(selectedStock?.price ?? 0).toFixed(6)
: '0',
}
: {
quantity: 1,