Fix Bug #478: 修复检验申请详情"发往科室"字段回显为"-"的问题

根因:testApplication.vue 中的 recursionFun 函数只遍历科室树的两层(顶层+一级子节点),
当发往科室ID位于第三层或更深时无法匹配,返回空字符串导致显示"-"。
修复:改为递归遍历整棵科室树,确保任意深度的科室节点都能正确解析为名称。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-17 20:08:13 +08:00
parent bbe047e645
commit 3a016100e7

View File

@@ -415,26 +415,16 @@ const getLocationInfo = async () => {
const recursionFun = (targetDepartment) => { const recursionFun = (targetDepartment) => {
if (!targetDepartment) return ''; if (!targetDepartment) return '';
let name = ''; const findNode = (list, id) => {
for (let index = 0; index < orgOptions.value.length; index++) { if (!list || list.length === 0) return '';
const obj = orgOptions.value[index]; for (const item of list) {
if (obj.id == targetDepartment) { if (item.id == id) return item.name;
name = obj.name; const found = findNode(item.children, id);
break; if (found) return found;
} }
const subObjArray = obj['children']; return '';
if (subObjArray && subObjArray.length > 0) { };
for (let i = 0; i < subObjArray.length; i++) { return findNode(orgOptions.value, targetDepartment);
const item = subObjArray[i];
if (item.id == targetDepartment) {
name = item.name;
break;
}
}
}
if (name) break;
}
return name;
}; };
const handleViewDetail = async (row) => { const handleViewDetail = async (row) => {