From 3e32458b7fb1212df732ed6f0d1d798b212028bc Mon Sep 17 00:00:00 2001 From: Auora <14587305+auoraasd@user.noreply.gitee.com> Date: Tue, 11 Nov 2025 16:05:18 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=8C=BB=E5=98=B1=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E9=80=89=E4=B8=AD=E5=BC=80=E5=8D=95=E5=90=8E=E5=8F=98?= =?UTF-8?q?=E6=88=90=E6=95=B0=E5=AD=97=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../prescription/prescriptionlist.vue | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/openhis-ui-vue3/src/views/doctorstation/components/prescription/prescriptionlist.vue b/openhis-ui-vue3/src/views/doctorstation/components/prescription/prescriptionlist.vue index 905736f2..95ba773e 100644 --- a/openhis-ui-vue3/src/views/doctorstation/components/prescription/prescriptionlist.vue +++ b/openhis-ui-vue3/src/views/doctorstation/components/prescription/prescriptionlist.vue @@ -523,17 +523,18 @@ + style="width: 100%" + :value-key="'value'"> + {{ getAdviceTypeText(scope.row.adviceType) }} @@ -821,12 +822,14 @@ watch( ); // 获取医嘱类别显示文本 function getAdviceTypeText(adviceType) { + // 转换为字符串进行查找,确保无论输入是数字还是字符串都能正确匹配 const typeMap = { - 1: '西药中成药', - 2: '耗材', - 3: '诊疗' + '1': '西药中成药', + '2': '耗材', + '3': '诊疗' }; - return typeMap[adviceType] || '未知'; + // 先将adviceType转换为字符串,再查找映射 + return typeMap[String(adviceType)] || '未知'; } function handleTotalAmount() { totalAmount.value = prescriptionList.value.reduce((accumulator, currentRow) => { @@ -1012,9 +1015,15 @@ function selectAdviceBase(key, row) { type: 'minUnit', }); } + // 保存当前已选择的医嘱类型 + const currentAdviceType = prescriptionList.value[rowIndex.value].adviceType; + prescriptionList.value[rowIndex.value] = { ...prescriptionList.value[rowIndex.value], ...JSON.parse(JSON.stringify(row)), + // 如果用户已经选择了医嘱类型,则保留用户的选择,否则使用项目默认的类型 + adviceType: currentAdviceType !== undefined && currentAdviceType !== null && currentAdviceType !== '' ? + currentAdviceType : row.adviceType, }; prescriptionList.value[rowIndex.value].orgId = undefined; prescriptionList.value[rowIndex.value].dose = undefined; @@ -1415,6 +1424,8 @@ function setValue(row) { prescriptionList.value[rowIndex.value] = { ...prescriptionList.value[rowIndex.value], ...JSON.parse(JSON.stringify(row)), + // 确保adviceType为数字类型,避免类型不匹配导致的显示问题 + adviceType: Number(row.adviceType), }; prescriptionList.value[rowIndex.value].orgId = undefined; prescriptionList.value[rowIndex.value].dose = undefined;