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 0bfa62f3d..abff1809c 100755 --- a/openhis-ui-vue3/src/views/doctorstation/components/prescription/prescriptionlist.vue +++ b/openhis-ui-vue3/src/views/doctorstation/components/prescription/prescriptionlist.vue @@ -2078,10 +2078,17 @@ function selectAdviceBase(key, row) { } } +// 🔧 Bug #455: 缓存 org 列表加载 Promise,确保 setValue 中可 await 避免竞态条件 +let orgListPromise = null; + function getOrgList() { - getOrgTree().then((res) => { - organization.value = res.data.records; - }); + if (!orgListPromise) { + orgListPromise = getOrgTree().then((res) => { + organization.value = res.data.records; + return organization.value; + }); + } + return orgListPromise; } /** 诊疗医嘱关联检验申请时 contentJson 含 applyNo */ @@ -3453,7 +3460,9 @@ async function setValue(row) { console.log('[BugFix] setValue - prescriptionList[rowIndex].adviceType_dictText:', prescriptionList.value[rowIndex.value].adviceType_dictText); // 🔧 Bug #455: 诊疗医嘱(adviceType=3)的执行科室默认使用患者就诊科室, // 不使用positionId(诊疗目录配置的执行科室),避免配置ID不在机构树中导致显示原始ID + // 关键修复:await organization 加载完成,确保 findOrgNameById 能正确查找到科室名称 if (Number(row.adviceType) == 3) { + await getOrgList(); // 覆盖 catalog 传来的 positionId/orgId,使用患者就诊科室 prescriptionList.value[rowIndex.value].orgId = props.patientInfo?.orgId; prescriptionList.value[rowIndex.value].positionId = props.patientInfo?.orgId;