From 1e4fa2d22a3f9f36df616053550144f3f40885a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=B3=E7=BE=BD?= <关羽@gentronhealth.com> Date: Sat, 16 May 2026 18:16:19 +0800 Subject: [PATCH] =?UTF-8?q?Fix=20Bug=20#455:=20=E9=97=A8=E8=AF=8A=E5=8C=BB?= =?UTF-8?q?=E7=94=9F=E7=AB=99-=E5=8C=BB=E5=98=B1=EF=BC=9A=E5=BC=80?= =?UTF-8?q?=E7=AB=8B=E8=AF=8A=E7=96=97=E5=8C=BB=E5=98=B1=E6=97=B6=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E7=A7=91=E5=AE=A4=E9=BB=98=E8=AE=A4=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E6=9C=89=E8=AF=AF=E4=B8=94=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E4=B8=BA=E5=8E=9F=E5=A7=8BID?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因:setValue 中调用 findOrgNameById 时 organization 树数据尚未加载完成(异步竞态), 导致 findOrgNameById 返回空字符串,el-tree-select 无法解析 orgId 对应的名称,显示原始ID。 修复:1. 将 getOrgList 改为返回缓存的 Promise,可被 await 2. 在 setValue 的诊疗医嘱分支中 await getOrgList(),确保 org 树加载完成后再查找科室名称 Co-Authored-By: Claude Opus 4.7 --- .../components/prescription/prescriptionlist.vue | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 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 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;