From 96a57f1b7ee01e07b7c0b88c9edcf00013526d8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=BA=91?= <赵云@gentronhealth.com> Date: Sat, 16 May 2026 18:24:26 +0800 Subject: [PATCH] =?UTF-8?q?Fix=20Bug=20#463:=20[=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E7=AE=A1=E7=90=86-=E8=AF=8A=E7=96=97=E7=9B=AE=E5=BD=95]=20?= =?UTF-8?q?=E6=96=B0=E5=A2=9E/=E7=BC=96=E8=BE=91=E5=BC=B9=E7=AA=97?= =?UTF-8?q?=E4=B8=AD"=E8=AF=8A=E7=96=97=E5=AD=90=E9=A1=B9"=E6=A3=80?= =?UTF-8?q?=E7=B4=A2=E5=8A=9F=E8=83=BD=E5=A4=B1=E6=95=88=EF=BC=8C=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E6=90=9C=E5=88=B0=E5=B7=B2=E7=BB=B4=E6=8A=A4=E7=9A=84?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因:medicineList.vue 中 preloadedData 的 watch(immediate: true)在父组件异步加载数据完成时触发, 会覆盖 searchList() 的搜索结果,导致搜索显示"暂无数据"。 修复:新增 isSearching 标记,在 searchList() 执行期间跳过 preloadedData watch 处理,防止搜索结果被覆盖。 Co-Authored-By: Claude Opus 4.7 --- .../catalog/diagnosistreatment/components/medicineList.vue | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/openhis-ui-vue3/src/views/catalog/diagnosistreatment/components/medicineList.vue b/openhis-ui-vue3/src/views/catalog/diagnosistreatment/components/medicineList.vue index 9e79c4bcf..26367a32c 100755 --- a/openhis-ui-vue3/src/views/catalog/diagnosistreatment/components/medicineList.vue +++ b/openhis-ui-vue3/src/views/catalog/diagnosistreatment/components/medicineList.vue @@ -38,6 +38,9 @@ const filteredList = ref([]); // 过滤后的数据列表 const hasLoaded = ref(false); // 标记是否已加载数据 const isLoading = ref(false); // 标记是否正在加载 +// 标记是否正在执行搜索(用于防止 preloadedData 覆盖搜索结果) +const isSearching = ref(false); + // 获取诊疗项目列表 function getList() { if (hasLoaded.value) return; // 如果已经加载过数据,则不再重复请求 @@ -66,6 +69,7 @@ function getList() { // 服务端搜索(当用户输入搜索关键词时) function searchList(searchKey) { if (!searchKey || searchKey.trim() === '') return; + isSearching.value = true; isLoading.value = true; // 使用较大的pageSize确保搜索结果尽可能多 getDiagnosisTreatmentList({ statusEnum: 2, searchKey: searchKey.trim(), pageSize: 5000, pageNo: 1 }) @@ -79,6 +83,7 @@ function searchList(searchKey) { }) .finally(() => { isLoading.value = false; + isSearching.value = false; }); } @@ -119,6 +124,8 @@ watch( watch( () => props.preloadedData, (newData) => { + // 正在搜索时跳过,避免覆盖searchList的搜索结果 + if (isSearching.value) return; if (newData && newData.length > 0) { diagnosisTreatmentList.value = newData; filterList(); // 更新过滤