From 8586f224d7495ed68bdff2a708ff8cb4e5ff8221 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8D=80=E5=BD=A7?= <荀彧@gentronhealth.com> Date: Thu, 14 May 2026 00:20:09 +0800 Subject: [PATCH] =?UTF-8?q?Fix=20Bug=20#448:=20=E9=97=A8=E8=AF=8A=E5=88=92?= =?UTF-8?q?=E4=BB=B7=E6=A8=A1=E5=9D=97-=E9=A1=B9=E7=9B=AE=E5=88=86?= =?UTF-8?q?=E7=B1=BB=E8=BF=87=E6=BB=A4=E5=A4=B1=E6=95=88=EF=BC=8C=E9=80=89?= =?UTF-8?q?=E6=8B=A9"=E8=80=97=E6=9D=90"=E7=B1=BB=E5=9E=8B=E6=97=B6?= =?UTF-8?q?=E4=BB=8D=E8=83=BD=E6=A3=80=E7=B4=A2=E5=87=BA=E8=8D=AF=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因:getList() 直接发送 queryParams.value 到后端,其中包含 undefined 值的 属性(如 adviceType 未选择时)。后端接收 adviceType=null 后回退到查询所有类型 (List.of(1,2,3)),导致药品出现在耗材的搜索结果中。 修复:显式构建 requestParams 对象,仅包含已定义的过滤参数(adviceType、 categoryCode、searchKey),避免 undefined 值被发送到后端。 Co-Authored-By: Claude Opus 4.7 --- .../bargain/component/adviceBaseList.vue | 36 +++++++++++++++---- 1 file changed, 29 insertions(+), 7 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 ad9802dca..e7194cda5 100755 --- a/openhis-ui-vue3/src/views/clinicmanagement/bargain/component/adviceBaseList.vue +++ b/openhis-ui-vue3/src/views/clinicmanagement/bargain/component/adviceBaseList.vue @@ -115,22 +115,44 @@ function getList() { console.log('[adviceBaseList] getList() 跳过:未选择患者'); return; // 不执行API调用 } - + // 只有在弹窗打开时才执行查询 if (!props.popoverVisible) { console.log('[adviceBaseList] getList() 跳过:弹窗未打开'); return; } - - queryParams.value.organizationId = props.patientInfo.orgId; - console.log('[adviceBaseList] getList() 请求参数:', JSON.stringify(queryParams.value)); - - getAdviceBaseInfo(queryParams.value).then((res) => { + + // 🔧 Bug #448 修复:显式构建请求参数,确保 adviceType 正确传递 + // 不直接使用 queryParams.value,避免 undefined 值被发送到后端导致过滤失效 + const requestParams = { + pageSize: queryParams.value.pageSize, + pageNum: queryParams.value.pageNum, + organizationId: props.patientInfo.orgId, + }; + + // 只在 adviceType 有值时添加(0 是无效值,undefined/null 会导致后端查询所有类型) + if (queryParams.value.adviceType != null && queryParams.value.adviceType !== 0) { + requestParams.adviceType = queryParams.value.adviceType; + } + + // 只在 categoryCode 有值时添加 + if (queryParams.value.categoryCode) { + requestParams.categoryCode = queryParams.value.categoryCode; + } + + // 只在 searchKey 有值时添加 + if (queryParams.value.searchKey) { + requestParams.searchKey = queryParams.value.searchKey; + } + + console.log('[adviceBaseList] getList() 请求参数:', JSON.stringify(requestParams)); + + getAdviceBaseInfo(requestParams).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 + adviceType: requestParams.adviceType }); adviceBaseList.value = res.data.records || []; total.value = res.data.total || 0;