Fix Bug #999: 修复手术申请详情弹窗中 recursionFun 函数 children 为空时 TypeError

手术申请详情查看时,若科室组织数据中某节点无 children 字段(为 null/undefined),
遍历访问 subObjArray.length 会抛出 TypeError 导致详情弹窗崩溃。
添加 null 守卫 `if (!subObjArray) continue;` 优雅跳过无子节点的项。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-10 10:53:31 +08:00
parent 2b64719d46
commit 07c92e63a2

View File

@@ -195,8 +195,9 @@ const recursionFun = (targetDepartment) => {
name = obj.name; name = obj.name;
} }
const subObjArray = obj['children']; const subObjArray = obj['children'];
for (let index = 0; index < subObjArray.length; index++) { if (!subObjArray) continue;
const item = subObjArray[index]; for (let i = 0; i < subObjArray.length; i++) {
const item = subObjArray[i];
if (item.id == targetDepartment) { if (item.id == targetDepartment) {
name = item.name; name = item.name;
} }