|
@@ -144,17 +144,26 @@ const ElTreeClick = async (data,node) => {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+//处理自动展开的节点KEY
|
|
|
|
+// const getNodeExpandKeys = async (node, newKeys) => {
|
|
|
|
+// const parent = getArrValue(node?.parent)
|
|
|
|
+// const nodeData = getObjValue(node?.data);
|
|
|
|
+// console.log(nodeData,'nodeData');
|
|
|
|
+// const primaryKeyId = nodeData?.primaryKeyId ?? ''
|
|
|
|
+// if (primaryKeyId) {
|
|
|
|
+// newKeys.push(primaryKeyId)
|
|
|
|
+// await getNodeExpandKeys(parent, newKeys)
|
|
|
|
+// }
|
|
|
|
+// }
|
|
//处理自动展开的节点KEY
|
|
//处理自动展开的节点KEY
|
|
const getNodeExpandKeys = async (node, newKeys) => {
|
|
const getNodeExpandKeys = async (node, newKeys) => {
|
|
- const parent = getArrValue(node?.parent)
|
|
|
|
- const nodeData = getObjValue(node?.data);
|
|
|
|
- const primaryKeyId = nodeData?.primaryKeyId ?? ''
|
|
|
|
|
|
+ const parent = node?.parent ?? []
|
|
|
|
+ const primaryKeyId = node?.data?.primaryKeyId ?? ''
|
|
if (primaryKeyId) {
|
|
if (primaryKeyId) {
|
|
newKeys.push(primaryKeyId)
|
|
newKeys.push(primaryKeyId)
|
|
await getNodeExpandKeys(parent, newKeys)
|
|
await getNodeExpandKeys(parent, newKeys)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
//鼠标右键事件
|
|
//鼠标右键事件
|
|
const contextMenuRef = ref(null)
|
|
const contextMenuRef = ref(null)
|
|
const ElTreeLabelContextMenu = (e,data,node) => {
|
|
const ElTreeLabelContextMenu = (e,data,node) => {
|
|
@@ -169,7 +178,7 @@ const ElTreeLabelContextMenu = (e,data,node) => {
|
|
}
|
|
}
|
|
|
|
|
|
//鼠标右键菜单被点击
|
|
//鼠标右键菜单被点击
|
|
-const handleMenuSelect = ({key}) => {
|
|
|
|
|
|
+const handleMenuSelect = async({key}) => {
|
|
const node = treeRefNode.value;
|
|
const node = treeRefNode.value;
|
|
const data = treeRefData.value;
|
|
const data = treeRefData.value;
|
|
//如果为标记菜单
|
|
//如果为标记菜单
|
|
@@ -180,7 +189,13 @@ const handleMenuSelect = ({key}) => {
|
|
emit('menuTap', {key: 'mark', node, data})
|
|
emit('menuTap', {key: 'mark', node, data})
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- emit('menuTap', {key, node, data})
|
|
|
|
|
|
+ // emit('menuTap', {key, node, data})
|
|
|
|
+ if (isAutoKeys.value) {
|
|
|
|
+ let autoKeysArr = []
|
|
|
|
+ await getNodeExpandKeys(node, autoKeysArr)
|
|
|
|
+ const autoKeys = autoKeysArr.reverse()
|
|
|
|
+ emit('menuTap', {key, node, data,keys:autoKeys})
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//设置树菜单的标记数据
|
|
//设置树菜单的标记数据
|