修改查询定位功能

This commit is contained in:
yangjun 2025-08-26 13:46:04 +08:00
parent f43c01795f
commit 041f90c71c
1 changed files with 41 additions and 33 deletions

View File

@ -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);
}
/**