修改查询定位功能
This commit is contained in:
parent
f43c01795f
commit
041f90c71c
|
|
@ -34,19 +34,22 @@
|
|||
</a-radio-group>
|
||||
</div>
|
||||
|
||||
<div v-if="treeLoading"
|
||||
<!-- <div v-if="treeLoading"
|
||||
style="width: 350px; height: 20vh; display: flex; justify-content: center; align-items: center;">
|
||||
<a-spin tip="加载中..."></a-spin>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<a-empty v-if="!treeLoading && treeLoading" />
|
||||
<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>
|
||||
<a-menu v-model:selectedKeys="selectedKeys" style="width: 100%;margin-top: 50px;" mode="inline"
|
||||
:open-keys="openKeys" @openChange="onOpenChange">
|
||||
<a-menu
|
||||
v-model:openKeys="openKeys"
|
||||
v-model:selectedKeys="selectedKeys"
|
||||
style="width: 100%;margin-top: 50px;" mode="inline"
|
||||
@openChange="onOpenChange">
|
||||
<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>
|
||||
<Icon :icon="item.icon" :size="20" v-if="item.icon" />
|
||||
<Icon icon="ant-design:appstore-add-outlined" :size="20" v-else />
|
||||
|
|
@ -716,34 +719,39 @@ function getDropDownAction(record) {
|
|||
}
|
||||
|
||||
function expandTreeNodeToLevel4(directiveData: any) {
|
||||
// 清空之前展开的节点
|
||||
expandedKeys.value = [];
|
||||
// 递归查找并展开相应的节点
|
||||
const findAndExpandNode = (nodes: any[], level: number, directiveData: any) => {
|
||||
for (const node of nodes) {
|
||||
// 判断当前节点的 level 是否与 directiveData 的级别匹配
|
||||
if (level === 1 && node.instructionId === directiveData.instructionTagId) {
|
||||
expandedKeys.value.push(node.key);
|
||||
if (node.children && node.children.length > 0) {
|
||||
findAndExpandNode(node.children, 2, directiveData);
|
||||
}
|
||||
} else if (level === 2 && node.categoryId === directiveData.categoryId) {
|
||||
expandedKeys.value.push(node.key);
|
||||
if (node.children && node.children.length > 0) {
|
||||
findAndExpandNode(node.children, 3, directiveData);
|
||||
}
|
||||
} else if (level === 3 && node.typeId === directiveData.typeId) {
|
||||
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) {
|
||||
expandedKeys.value.push(node.key);
|
||||
}
|
||||
}
|
||||
};
|
||||
// 调用递归方法,从树的根节点开始查找
|
||||
findAndExpandNode(treeData.value, 1, directiveData);
|
||||
console.log("🚀 ~ expandTreeNodeToLevel4 ~ directiveData:", directiveData)
|
||||
|
||||
|
||||
selectedKeys.value = [ directiveData.instructionTagId, directiveData.categoryId, directiveData.typeId, directiveData.id ]
|
||||
openKeys.value = [ directiveData.instructionTagId, directiveData.categoryId, directiveData.typeId, directiveData.id ]
|
||||
// // 清空之前展开的节点
|
||||
// expandedKeys.value = [];
|
||||
// // 递归查找并展开相应的节点
|
||||
// const findAndExpandNode = (nodes: any[], level: number, directiveData: any) => {
|
||||
// for (const node of nodes) {
|
||||
// // 判断当前节点的 level 是否与 directiveData 的级别匹配
|
||||
// if (level === 1 && node.instructionId === directiveData.instructionTagId) {
|
||||
// expandedKeys.value.push(node.key);
|
||||
// if (node.children && node.children.length > 0) {
|
||||
// findAndExpandNode(node.children, 2, directiveData);
|
||||
// }
|
||||
// } else if (level === 2 && node.categoryId === directiveData.categoryId) {
|
||||
// expandedKeys.value.push(node.key);
|
||||
// if (node.children && node.children.length > 0) {
|
||||
// findAndExpandNode(node.children, 3, directiveData);
|
||||
// }
|
||||
// } else if (level === 3 && node.typeId === directiveData.typeId) {
|
||||
// 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) {
|
||||
// expandedKeys.value.push(node.key);
|
||||
// }
|
||||
// }
|
||||
// };
|
||||
// // 调用递归方法,从树的根节点开始查找
|
||||
// findAndExpandNode(treeData.value, 1, directiveData);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue