From 56cd0249499176c64ea806d1b9bd9cb151f87bda Mon Sep 17 00:00:00 2001 From: guanyu Date: Mon, 18 May 2026 11:02:49 +0800 Subject: [PATCH] =?UTF-8?q?Fix=20Bug=20#529:=20[=E4=BD=8F=E9=99=A2?= =?UTF-8?q?=E5=8C=BB=E7=94=9F=E5=B7=A5=E4=BD=9C=E7=AB=99-=E6=A3=80?= =?UTF-8?q?=E9=AA=8C=E7=94=B3=E8=AF=B7]=20=E7=82=B9=E5=87=BB=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=89=93=E5=BC=80=E7=BC=96=E8=BE=91=E5=BC=B9=E7=AA=97?= =?UTF-8?q?=E5=90=8E=E5=8E=9F=E5=B7=B2=E9=80=89=E4=B8=AD=E7=9A=84=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E6=9C=AA=E5=9B=9E=E6=98=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因:时序竞态——editData watch (immediate: true) 在 applicationListAll 加载完成前触发, 匹配不到数据导致 transferValue 被置空。新增 watch 监听 applicationListAll 加载完成后重新回显。 Co-Authored-By: Claude Opus 4.7 --- .../order/applicationForm/laboratoryTests.vue | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/openhis-ui-vue3/src/views/inpatientDoctor/home/components/order/applicationForm/laboratoryTests.vue b/openhis-ui-vue3/src/views/inpatientDoctor/home/components/order/applicationForm/laboratoryTests.vue index e68a5f4c6..b571440e3 100755 --- a/openhis-ui-vue3/src/views/inpatientDoctor/home/components/order/applicationForm/laboratoryTests.vue +++ b/openhis-ui-vue3/src/views/inpatientDoctor/home/components/order/applicationForm/laboratoryTests.vue @@ -380,6 +380,28 @@ watch( }, { immediate: true } ); + +// 编辑模式下,applicationListAll 加载完成后重新回显已选项目 +watch( + () => applicationListAll.value, + () => { + if (!props.editData?.requestFormId) return; + if (!props.editData.requestFormDetailList?.length) return; + if (!applicationListAll.value.length) return; + + const selectedIds = []; + props.editData.requestFormDetailList.forEach((detail) => { + const matched = applicationListAll.value.find( + (item) => item.adviceName === detail.adviceName + ); + if (matched) { + selectedIds.push(matched.adviceDefinitionId); + } + }); + transferValue.value = selectedIds; + } +); + const submit = () => { if (transferValue.value.length == 0) { return proxy.$message.error('请选择申请单');