Merge branch 'master' of http://47.115.223.229:8888/yangjun/nursing_unit_vue
This commit is contained in:
commit
80d706dc05
|
|
@ -34,19 +34,22 @@
|
||||||
</a-radio-group>
|
</a-radio-group>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="treeLoading"
|
<!-- <div v-if="treeLoading"
|
||||||
style="width: 350px; height: 20vh; display: flex; justify-content: center; align-items: center;">
|
style="width: 350px; height: 20vh; display: flex; justify-content: center; align-items: center;">
|
||||||
<a-spin tip="加载中..."></a-spin>
|
<a-spin tip="加载中..."></a-spin>
|
||||||
</div>
|
</div> -->
|
||||||
|
|
||||||
<a-empty v-if="!treeLoading && treeLoading" />
|
<a-empty v-if="!treeLoading && treeLoading" />
|
||||||
<a-button v-if="!treeLoading && treeData.length < 1" type="link" class="btnPrivate" @click="addInstruction"
|
<a-button v-if="!treeLoading && treeData.length < 1" type="link" class="btnPrivate" @click="addInstruction"
|
||||||
v-show="mainOrgCode == ownOrgCode" preIcon="ant-design:plus-outlined">新增分类标签</a-button>
|
v-show="mainOrgCode == ownOrgCode" preIcon="ant-design:plus-outlined">新增分类标签</a-button>
|
||||||
<a-menu v-model:selectedKeys="selectedKeys" style="width: 100%;margin-top: 50px;" mode="inline"
|
<a-menu
|
||||||
:open-keys="openKeys" @openChange="onOpenChange">
|
v-model:openKeys="openKeys"
|
||||||
|
v-model:selectedKeys="selectedKeys"
|
||||||
|
style="width: 100%;margin-top: 50px;" mode="inline"
|
||||||
|
@openChange="onOpenChange">
|
||||||
<template v-for="item in treeData">
|
<template v-for="item in treeData">
|
||||||
<!-- 第一层判断是否有下级 -->
|
<!-- 第一层判断是否有下级 -->
|
||||||
<a-sub-menu v-if="item.children && item.children.length > 0" :key="item.id">
|
<a-sub-menu v-if="item.children && item.children.length > 0" :key="item.key">
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<Icon :icon="item.icon" :size="20" v-if="item.icon" />
|
<Icon :icon="item.icon" :size="20" v-if="item.icon" />
|
||||||
<Icon icon="ant-design:appstore-add-outlined" :size="20" v-else />
|
<Icon icon="ant-design:appstore-add-outlined" :size="20" v-else />
|
||||||
|
|
@ -716,34 +719,39 @@ function getDropDownAction(record) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function expandTreeNodeToLevel4(directiveData: any) {
|
function expandTreeNodeToLevel4(directiveData: any) {
|
||||||
// 清空之前展开的节点
|
console.log("🚀 ~ expandTreeNodeToLevel4 ~ directiveData:", directiveData)
|
||||||
expandedKeys.value = [];
|
|
||||||
// 递归查找并展开相应的节点
|
|
||||||
const findAndExpandNode = (nodes: any[], level: number, directiveData: any) => {
|
selectedKeys.value = [ directiveData.instructionTagId, directiveData.categoryId, directiveData.typeId, directiveData.id ]
|
||||||
for (const node of nodes) {
|
openKeys.value = [ directiveData.instructionTagId, directiveData.categoryId, directiveData.typeId, directiveData.id ]
|
||||||
// 判断当前节点的 level 是否与 directiveData 的级别匹配
|
// // 清空之前展开的节点
|
||||||
if (level === 1 && node.instructionId === directiveData.instructionTagId) {
|
// expandedKeys.value = [];
|
||||||
expandedKeys.value.push(node.key);
|
// // 递归查找并展开相应的节点
|
||||||
if (node.children && node.children.length > 0) {
|
// const findAndExpandNode = (nodes: any[], level: number, directiveData: any) => {
|
||||||
findAndExpandNode(node.children, 2, directiveData);
|
// for (const node of nodes) {
|
||||||
}
|
// // 判断当前节点的 level 是否与 directiveData 的级别匹配
|
||||||
} else if (level === 2 && node.categoryId === directiveData.categoryId) {
|
// if (level === 1 && node.instructionId === directiveData.instructionTagId) {
|
||||||
expandedKeys.value.push(node.key);
|
// expandedKeys.value.push(node.key);
|
||||||
if (node.children && node.children.length > 0) {
|
// if (node.children && node.children.length > 0) {
|
||||||
findAndExpandNode(node.children, 3, directiveData);
|
// findAndExpandNode(node.children, 2, directiveData);
|
||||||
}
|
// }
|
||||||
} else if (level === 3 && node.typeId === directiveData.typeId) {
|
// } else if (level === 2 && node.categoryId === directiveData.categoryId) {
|
||||||
expandedKeys.value.push(node.key);
|
// expandedKeys.value.push(node.key);
|
||||||
if (node.children && node.children.length > 0) {
|
// if (node.children && node.children.length > 0) {
|
||||||
findAndExpandNode(node.children, 4, directiveData);
|
// findAndExpandNode(node.children, 3, directiveData);
|
||||||
}
|
// }
|
||||||
} else if (level === 4 && node.key === directiveData.id) {
|
// } else if (level === 3 && node.typeId === directiveData.typeId) {
|
||||||
expandedKeys.value.push(node.key);
|
// expandedKeys.value.push(node.key);
|
||||||
}
|
// if (node.children && node.children.length > 0) {
|
||||||
}
|
// findAndExpandNode(node.children, 4, directiveData);
|
||||||
};
|
// }
|
||||||
// 调用递归方法,从树的根节点开始查找
|
// } else if (level === 4 && node.key === directiveData.id) {
|
||||||
findAndExpandNode(treeData.value, 1, directiveData);
|
// expandedKeys.value.push(node.key);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
// // 调用递归方法,从树的根节点开始查找
|
||||||
|
// findAndExpandNode(treeData.value, 1, directiveData);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue