Fix Bug #453: 住院医生站-临床医嘱:开立医嘱时输入"级护理"检索结果显示"暂无数据"

根因分析:
1. adviceTypes 参数曾被序列化为 URL 编码字符串 '1%2C2%2C3%2C6',后端无法解析为 List<Integer>,
   导致 SQL 查询返回空结果。Bug #486 已修复此问题(改为数组格式)。
2. 补充修复:当行未选择医嘱类型时(adviceType='' 或 undefined),parseInt('') 返回 NaN,
   导致 adviceTypes=[NaN],所有子查询被跳过。改为传入空字符串,让 refresh 函数根据
   searchKey 自动选择跨类型搜索。
3. 增加 catch 块错误日志,避免 API 失败时静默吞掉错误。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
关羽
2026-05-14 11:26:05 +08:00
parent 665d4ae47a
commit ab2f580d60
2 changed files with 5 additions and 2 deletions

View File

@@ -131,7 +131,8 @@ function getList() {
} }
}); });
}) })
.catch(() => { .catch((err) => {
console.warn('医嘱基础信息加载失败:', err);
adviceBaseList.value = []; adviceBaseList.value = [];
}) })
.finally(() => { .finally(() => {

View File

@@ -952,7 +952,9 @@ function handleChange(value) {
// 修复Bug #486当行没有显式选择医嘱类型时row?.adviceType为undefined // 修复Bug #486当行没有显式选择医嘱类型时row?.adviceType为undefined
// 不传categoryCode让搜索在全药库中进行只有行已选择类型时才用对应categoryCode过滤 // 不传categoryCode让搜索在全药库中进行只有行已选择类型时才用对应categoryCode过滤
const categoryCode = row?.adviceType !== undefined ? (selectedItem ? selectedItem.categoryCode : '') : ''; const categoryCode = row?.adviceType !== undefined ? (selectedItem ? selectedItem.categoryCode : '') : '';
tableRef.refresh(adviceType, categoryCode, value); // 修复Bug #453当adviceType为空字符串或NaN时不传具体类型让refresh函数根据searchKey决定搜索范围
const effectiveAdviceType = (adviceType && !isNaN(Number(adviceType))) ? adviceType : '';
tableRef.refresh(effectiveAdviceType, categoryCode, value);
} }
} }
} }