From 04ce8a432a7f7a0ddf7851843e75bb8d84807814 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=B3=E7=BE=BD?= <关羽@gentronhealth.com> Date: Thu, 14 May 2026 06:19:28 +0800 Subject: [PATCH] =?UTF-8?q?Fix=20Bug=20#510:=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]=20=E8=BF=9B?= =?UTF-8?q?=E5=85=A5=E9=A1=B5=E9=9D=A2=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因:order/index.vue 中 getList() 在模块顶层执行(非生命周期钩子), 组件导入时立即触发 API 调用,此时患者尚未选择导致 encounterId 为 undefined; 同时 getListInfo() 缺少患者选择守护检查,多处 API 以空参数调用后端引发循环报错。 修复: 1. 将 getList() 从模块顶层移至 onMounted() 生命周期钩子 2. 在 getListInfo() 开头添加 patientInfo.encounterId 守护检查 --- .../views/inpatientDoctor/home/components/order/index.vue | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 dd7fc8794..daae81c6e 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 @@ -533,6 +533,7 @@ const statusOption = [ let loadingInstance = undefined; onMounted(() => { document.addEventListener('keydown', escKeyListener); + getList(); }); onBeforeUnmount(() => { @@ -573,7 +574,6 @@ function handleTotalAmount() { } }, new Decimal(0)); } -getList(); function getList() { getDiagnosisDefinitionList(queryParams.value).then((res) => { // prescriptionList.value = res.data.records; @@ -585,6 +585,11 @@ function refresh() { } // 获取列表信息 function getListInfo(addNewRow) { + // 守护:未选择患者时不发起 API 请求,避免页面加载时循环报错 + if (!patientInfo.value || !patientInfo.value.encounterId) { + console.warn('⚠️ getListInfo 跳过:未选择患者'); + return; + } loadingInstance = ElLoading.service({ fullscreen: true }); setTimeout(() => { loadingInstance.close();