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;