diff --git a/openhis-ui-vue3/src/views/inpatientDoctor/home/components/order/index.vue b/openhis-ui-vue3/src/views/inpatientDoctor/home/components/order/index.vue index b16de7c0d..d3d4016db 100755 --- a/openhis-ui-vue3/src/views/inpatientDoctor/home/components/order/index.vue +++ b/openhis-ui-vue3/src/views/inpatientDoctor/home/components/order/index.vue @@ -863,13 +863,22 @@ function clickRowDb(row, column, event) { } row.showPopover = false; // 仅”待签发(statusEnum==1)”允许编辑;”已签发(statusEnum==2)”及之后状态不允许编辑 - if (row.statusEnum == 1) { + // 使用 Number() 做类型转换,确保后端返回的数值能正确比较 + if (Number(row.statusEnum) === 1) { // 确保治疗类型为字符串,方便与单选框 label 对齐,默认为长期医嘱('1') row.therapyEnum = String(row.therapyEnum ?? '1'); row.isEdit = true; const index = prescriptionList.value.findIndex((item) => item.uniqueKey === row.uniqueKey); - prescriptionList.value[index] = row; - expandOrder.value = [row.uniqueKey]; + if (index !== -1) { + prescriptionList.value.splice(index, 1, row); + // 使用 nextTick 确保数据更新后再设置展开状态,保证 el-table 能正确识别 row-key + nextTick(() => { + expandOrder.value = [row.uniqueKey]; + }); + } else { + console.warn('⚠️ clickRowDb 未找到匹配行: uniqueKey=', row.uniqueKey, ', row=', row); + proxy.$modal.msgWarning('无法进入编辑模式,请刷新列表后重试'); + } } }