bug 514 537 538 540 543

This commit is contained in:
Ranyunqiao
2026-05-18 17:44:15 +08:00
parent 4972ca64da
commit 0e974129eb
12 changed files with 512 additions and 396 deletions

View File

@@ -116,7 +116,7 @@ import {computed, getCurrentInstance, ref, watch} from 'vue';
import {Refresh} from '@element-plus/icons-vue';
import {patientInfo} from '../../store/patient.js';
import {getSurgery} from './api';
import {getOrgList} from '@/views/doctorstation/components/api.js';
import {getDepartmentList} from '@/api/public.js';
const { proxy } = getCurrentInstance();
@@ -182,25 +182,32 @@ const hasMatchedFields = computed(() => {
/** 查询科室 */
const getLocationInfo = async () => {
const res = await getOrgList();
orgOptions.value = res.data.records;
const res = await getDepartmentList();
orgOptions.value = res.data || [];
};
const recursionFun = (targetDepartment) => {
if (!targetDepartment || !orgOptions.value || orgOptions.value.length === 0) {
return '';
}
let name = '';
for (let index = 0; index < orgOptions.value.length; index++) {
const obj = orgOptions.value[index];
if (obj.id == 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;
// 统一处理:扁平列表和树形结构都适用
const findInList = (list) => {
for (const node of list) {
if (String(node.id) === String(targetDepartment)) {
name = node.name;
return true;
}
// 树形结构:递归查找 children
if (node.children && node.children.length > 0) {
if (findInList(node.children)) {
return true;
}
}
}
}
return false;
};
findInList(orgOptions.value);
return name;
};