From 41494ebf7c68dd5f857f20750414c717bf144e94 Mon Sep 17 00:00:00 2001 From: nanyangbreeze <1955231298@qq.com> Date: Tue, 27 Jan 2026 11:05:43 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=8A=E7=96=97=E4=B8=8B=E9=9D=A2=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E9=A1=B9=E7=9B=AE=E7=9A=84=E4=BB=A3=E7=A0=81=E5=86=B2?= =?UTF-8?q?=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bargain/component/adviceBaseList.vue | 51 +++++++++++++++---- 1 file changed, 41 insertions(+), 10 deletions(-) diff --git a/openhis-ui-vue3/src/views/clinicmanagement/bargain/component/adviceBaseList.vue b/openhis-ui-vue3/src/views/clinicmanagement/bargain/component/adviceBaseList.vue index ab598f16..fe8a9b48 100644 --- a/openhis-ui-vue3/src/views/clinicmanagement/bargain/component/adviceBaseList.vue +++ b/openhis-ui-vue3/src/views/clinicmanagement/bargain/component/adviceBaseList.vue @@ -99,17 +99,48 @@ watch( // 移除组件初始化时的 getList() 调用,避免在没有 adviceType 时查询所有类型的数据 // getList(); -async function getList() { - loading.value = true; - try { - // 统一调用 getAdviceBaseInfo,因为后端在这个接口里实现了库存和价格查询 - const res = await getAdviceBaseInfo(props.adviceQueryParams); - adviceBaseList.value = res.data?.records || []; - } catch (error) { - console.error('获取医嘱列表失败:', error); - } finally { - loading.value = false; +function getList() { + // 验证是否已选择患者 + if (!props.patientInfo || Object.keys(props.patientInfo).length === 0) { + console.log('[adviceBaseList] getList() 跳过:未选择患者'); + return; // 不执行API调用 } + + // 只有在弹窗打开时才执行查询 + if (!props.popoverVisible) { + console.log('[adviceBaseList] getList() 跳过:弹窗未打开'); + return; + } + + // 必须有 adviceType 才查询,避免查询所有类型的数据 + if (!queryParams.value.adviceType) { + console.log('[adviceBaseList] getList() 跳过:adviceType 未设置,当前值:', queryParams.value.adviceType); + return; + } + + queryParams.value.organizationId = props.patientInfo.orgId; + console.log('[adviceBaseList] getList() 请求参数:', JSON.stringify(queryParams.value)); + + getAdviceBaseInfo(queryParams.value).then((res) => { + console.log('[adviceBaseList] getList() 响应数据:', { + total: res.data?.total, + recordsCount: res.data?.records?.length || 0, + firstRecord: res.data?.records?.[0]?.adviceName || '无数据', + adviceType: queryParams.value.adviceType + }); + adviceBaseList.value = res.data.records || []; + total.value = res.data.total || 0; + nextTick(() => { + currentIndex.value = 0; + if (adviceBaseList.value.length > 0) { + adviceBaseRef.value?.setCurrentRow(adviceBaseList.value[0]); + } + }); + }).catch((err) => { + console.error('[adviceBaseList] getList() 请求失败:', err); + adviceBaseList.value = []; + total.value = 0; + }); } // 处理键盘事件