From 52fc64c71ddad01e2d63cd33fee0cfef41edc3b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8D=80=E5=BD=A7?= <荀彧@gentronhealth.com> Date: Thu, 14 May 2026 14:20:50 +0800 Subject: [PATCH] =?UTF-8?q?Fix=20Bug=20#477:=20=E4=BD=8F=E9=99=A2=E5=8C=BB?= =?UTF-8?q?=E7=94=9F=E5=B7=A5=E4=BD=9C=E7=AB=99-=E6=A3=80=E6=9F=A5?= =?UTF-8?q?=E7=94=B3=E8=AF=B7=E8=AF=A6=E6=83=85=E5=BC=B9=E7=AA=97=E4=B8=AD?= =?UTF-8?q?"=E5=8F=91=E5=BE=80=E7=A7=91=E5=AE=A4"=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E4=B8=BA=E7=9F=AD=E6=A8=AA=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因: examineApplication.vue 的 handlePrint 函数调用了未定义的 recursionFun 方法 (ReferenceError),handleViewDetail 使用 findTreeItem 但该方法对后端返回的扁平 科室列表解析不够健壮。与 testApplication.vue 对比后,发现缺少 recursionFun 函数定义。 修复策略: 新增 recursionFun 函数(与 testApplication.vue 一致实现),并在 handleViewDetail 和 handlePrint 中统一使用该方法将 targetDepartment ID 转换为科室名称。 Co-Authored-By: Claude Opus 4.7 --- .../applicationShow/examineApplication.vue | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) 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) {