Fix Bug #478: 修复检验申请详情"发往科室"字段回显为"-"的问题
根因:testApplication.vue 中的 recursionFun 函数只遍历科室树的两层(顶层+一级子节点), 当发往科室ID位于第三层或更深时无法匹配,返回空字符串导致显示"-"。 修复:改为递归遍历整棵科室树,确保任意深度的科室节点都能正确解析为名称。 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -415,26 +415,16 @@ const getLocationInfo = async () => {
|
||||
|
||||
const recursionFun = (targetDepartment) => {
|
||||
if (!targetDepartment) return '';
|
||||
let name = '';
|
||||
for (let index = 0; index < orgOptions.value.length; index++) {
|
||||
const obj = orgOptions.value[index];
|
||||
if (obj.id == targetDepartment) {
|
||||
name = obj.name;
|
||||
break;
|
||||
const findNode = (list, id) => {
|
||||
if (!list || list.length === 0) return '';
|
||||
for (const item of list) {
|
||||
if (item.id == id) return item.name;
|
||||
const found = findNode(item.children, id);
|
||||
if (found) return found;
|
||||
}
|
||||
const subObjArray = obj['children'];
|
||||
if (subObjArray && subObjArray.length > 0) {
|
||||
for (let i = 0; i < subObjArray.length; i++) {
|
||||
const item = subObjArray[i];
|
||||
if (item.id == targetDepartment) {
|
||||
name = item.name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (name) break;
|
||||
}
|
||||
return name;
|
||||
return '';
|
||||
};
|
||||
return findNode(orgOptions.value, targetDepartment);
|
||||
};
|
||||
|
||||
const handleViewDetail = async (row) => {
|
||||
|
||||
Reference in New Issue
Block a user