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 236145846..1bfbc95e0 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 @@ -168,7 +168,7 @@ import {computed, getCurrentInstance, ref, watch} from 'vue'; import {Refresh, Search} from '@element-plus/icons-vue'; import {patientInfo} from '../../store/patient.js'; import {getCheck} from './api'; -import {getOrgList} from '@/views/doctorstation/components/api.js'; +import {getDepartmentList} from '@/api/public.js'; const { proxy } = getCurrentInstance(); @@ -293,8 +293,8 @@ const hasMatchedFields = computed(() => { /** 查询科室 */ const getLocationInfo = () => { - getOrgList().then((res) => { - orgOptions.value = res.data.records; + getDepartmentList().then((res) => { + orgOptions.value = res.data || []; }); }; @@ -306,17 +306,19 @@ const recursionFun = (targetDepartment) => { name = obj.name; } const subObjArray = obj['children']; - for (let index = 0; index < subObjArray.length; index++) { - const item = subObjArray[index]; - if (item.id == targetDepartment) { - name = item.name; + if (subObjArray && subObjArray.length > 0) { + for (let index = 0; index < subObjArray.length; index++) { + const item = subObjArray[index]; + if (item.id == targetDepartment) { + name = item.name; + } } } } return name; }; -const handleViewDetail = (row) => { +const handleViewDetail = async (row) => { console.log('targetDepartment========>', JSON.stringify(row)); currentDetail.value = row; @@ -324,6 +326,15 @@ const handleViewDetail = (row) => { if (row.descJson) { try { const obj = JSON.parse(row.descJson); + // 确保科室数据已加载 + if (!orgOptions.value || orgOptions.value.length === 0) { + await new Promise((resolve) => { + getDepartmentList().then((res) => { + orgOptions.value = res.data || []; + resolve(); + }); + }); + } obj.targetDepartment = recursionFun(obj.targetDepartment); descJsonData.value = obj; } catch (e) {