diff --git a/openhis-ui-vue3/src/views/inpatientDoctor/home/components/applicationShow/examineApplication.vue b/openhis-ui-vue3/src/views/inpatientDoctor/home/components/applicationShow/examineApplication.vue index 4b3786e8e..63da4662e 100755 --- a/openhis-ui-vue3/src/views/inpatientDoctor/home/components/applicationShow/examineApplication.vue +++ b/openhis-ui-vue3/src/views/inpatientDoctor/home/components/applicationShow/examineApplication.vue @@ -513,6 +513,30 @@ const findTreeItem = (list, id) => { return null; }; +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 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; +}; + const handleViewDetail = async (row) => { // 确保科室数据已加载,以便将 ID 解析为名称 if (!orgOptions.value || orgOptions.value.length === 0) { @@ -526,8 +550,7 @@ const handleViewDetail = async (row) => { const obj = JSON.parse(row.descJson); // 将发往科室 ID 转换为名称 if (obj.targetDepartment) { - const deptItem = findTreeItem(orgOptions.value, obj.targetDepartment); - obj.targetDepartment = deptItem ? deptItem.name : obj.targetDepartment; + obj.targetDepartment = recursionFun(obj.targetDepartment); } descJsonData.value = obj; } catch (e) {