Fix Bug #448: 门诊划价模块-项目分类过滤失效,选择"耗材"类型时仍能检索出药品
根因:getList() 直接发送 queryParams.value 到后端,其中包含 undefined 值的 属性(如 adviceType 未选择时)。后端接收 adviceType=null 后回退到查询所有类型 (List.of(1,2,3)),导致药品出现在耗材的搜索结果中。 修复:显式构建 requestParams 对象,仅包含已定义的过滤参数(adviceType、 categoryCode、searchKey),避免 undefined 值被发送到后端。 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -115,22 +115,44 @@ function getList() {
|
|||||||
console.log('[adviceBaseList] getList() 跳过:未选择患者');
|
console.log('[adviceBaseList] getList() 跳过:未选择患者');
|
||||||
return; // 不执行API调用
|
return; // 不执行API调用
|
||||||
}
|
}
|
||||||
|
|
||||||
// 只有在弹窗打开时才执行查询
|
// 只有在弹窗打开时才执行查询
|
||||||
if (!props.popoverVisible) {
|
if (!props.popoverVisible) {
|
||||||
console.log('[adviceBaseList] getList() 跳过:弹窗未打开');
|
console.log('[adviceBaseList] getList() 跳过:弹窗未打开');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
queryParams.value.organizationId = props.patientInfo.orgId;
|
// 🔧 Bug #448 修复:显式构建请求参数,确保 adviceType 正确传递
|
||||||
console.log('[adviceBaseList] getList() 请求参数:', JSON.stringify(queryParams.value));
|
// 不直接使用 queryParams.value,避免 undefined 值被发送到后端导致过滤失效
|
||||||
|
const requestParams = {
|
||||||
getAdviceBaseInfo(queryParams.value).then((res) => {
|
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() 响应数据:', {
|
console.log('[adviceBaseList] getList() 响应数据:', {
|
||||||
total: res.data?.total,
|
total: res.data?.total,
|
||||||
recordsCount: res.data?.records?.length || 0,
|
recordsCount: res.data?.records?.length || 0,
|
||||||
firstRecord: res.data?.records?.[0]?.adviceName || '无数据',
|
firstRecord: res.data?.records?.[0]?.adviceName || '无数据',
|
||||||
adviceType: queryParams.value.adviceType
|
adviceType: requestParams.adviceType
|
||||||
});
|
});
|
||||||
adviceBaseList.value = res.data.records || [];
|
adviceBaseList.value = res.data.records || [];
|
||||||
total.value = res.data.total || 0;
|
total.value = res.data.total || 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user