Commit 08fb8e0d authored by jingnan's avatar jingnan 👀

合并产品【8067】权限设置,勾选父级自动勾选子级<2>

parent 9105f67b
...@@ -160,13 +160,13 @@ export default { ...@@ -160,13 +160,13 @@ export default {
const items = [node.data] const items = [node.data]
const nodePath = [] const nodePath = []
const dataPath = [] const dataPath = []
if (isChecked) {
// 如果父节点没有勾中,则父节点也要勾中
while (node.level >= 1) { while (node.level >= 1) {
nodePath.push(node) nodePath.push(node)
dataPath.push(node.data) dataPath.push(node.data)
node = node.parent node = node.parent
} }
if (isChecked) {
// 如果父节点没有勾中,则父节点也要勾中
for (let i = 1; i < nodePath.length; i++) { for (let i = 1; i < nodePath.length; i++) {
if (nodePath[i].checked) { if (nodePath[i].checked) {
break break
...@@ -174,10 +174,9 @@ export default { ...@@ -174,10 +174,9 @@ export default {
items.push(dataPath[i]) items.push(dataPath[i])
} }
} }
// 当前节点选中,自动勾选它所有的后代节点 }
const subNodesData = this.getSubNodes(clickNode).map(node => node.data) const subNodesData = this.getSubNodes(clickNode).map(node => node.data)
items.push(...subNodesData) items.push(...subNodesData)
}
this.updatePermState(items, isChecked) this.updatePermState(items, isChecked)
}, },
// 获取指定节点下所有子节点 // 获取指定节点下所有子节点
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment