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;