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();