From 3a016100e7ce7448d6a3c341debdfbb38fdc5582 Mon Sep 17 00:00:00 2001 From: zhaoyun Date: Sun, 17 May 2026 20:08:13 +0800 Subject: [PATCH] =?UTF-8?q?Fix=20Bug=20#478:=20=E4=BF=AE=E5=A4=8D=E6=A3=80?= =?UTF-8?q?=E9=AA=8C=E7=94=B3=E8=AF=B7=E8=AF=A6=E6=83=85"=E5=8F=91?= =?UTF-8?q?=E5=BE=80=E7=A7=91=E5=AE=A4"=E5=AD=97=E6=AE=B5=E5=9B=9E?= =?UTF-8?q?=E6=98=BE=E4=B8=BA"-"=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因:testApplication.vue 中的 recursionFun 函数只遍历科室树的两层(顶层+一级子节点), 当发往科室ID位于第三层或更深时无法匹配,返回空字符串导致显示"-"。 修复:改为递归遍历整棵科室树,确保任意深度的科室节点都能正确解析为名称。 Co-Authored-By: Claude Opus 4.7 --- .../applicationShow/testApplication.vue | 28 ++++++------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/openhis-ui-vue3/src/views/inpatientDoctor/home/components/applicationShow/testApplication.vue b/openhis-ui-vue3/src/views/inpatientDoctor/home/components/applicationShow/testApplication.vue index b5f294642..c6e36d3bd 100755 --- a/openhis-ui-vue3/src/views/inpatientDoctor/home/components/applicationShow/testApplication.vue +++ b/openhis-ui-vue3/src/views/inpatientDoctor/home/components/applicationShow/testApplication.vue @@ -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) => {