[update] 授权部门先勾选复选框再切换树操作,显示子节点选中实际没选中的问题
This commit is contained in:
@@ -304,42 +304,20 @@ export default {
|
||||
}
|
||||
return rows
|
||||
},
|
||||
// 获取currKeys及其子节点
|
||||
getChildrenTreeData (currKeys, treeData) {
|
||||
const childrenKeys = []
|
||||
for (let i = 0; i < treeData.length; i++) {
|
||||
if (currKeys.includes(treeData[i].key)) {
|
||||
childrenKeys.push(treeData[i].key)
|
||||
if (treeData[i].children) {
|
||||
const childrenKeysArr = this.getChildrenKeys(treeData[i].children)
|
||||
childrenKeys.push(...childrenKeysArr)
|
||||
}
|
||||
}
|
||||
if (treeData[i].children) {
|
||||
childrenKeys.push(...this.getChildrenTreeData(currKeys, treeData[i].children))
|
||||
}
|
||||
}
|
||||
return childrenKeys
|
||||
},
|
||||
// 把传入的树结构key值全部存成一个数组
|
||||
getChildrenKeys (treeData) {
|
||||
const arr = []
|
||||
for (const item of treeData) {
|
||||
arr.push(item.key)
|
||||
if (item.children) {
|
||||
arr.push(...this.getChildrenKeys(item.children))
|
||||
}
|
||||
}
|
||||
return arr
|
||||
},
|
||||
switchCheckStrictly (v) {
|
||||
if (v === 1) {
|
||||
this.checkStrictly = false
|
||||
this.checkedKeys = this.getChildrenTreeData(this.checkedKeys, this.treeData)
|
||||
this.checkedRows = this.getCheckedRows(this.checkedKeys)
|
||||
} else if (v === 2) {
|
||||
this.checkStrictly = true
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
const dom = document.getElementsByClassName('ant-tree-checkbox')
|
||||
console.log(dom)
|
||||
dom[0].click()
|
||||
setTimeout(() => {
|
||||
dom[0].click()
|
||||
}, 0)
|
||||
})
|
||||
},
|
||||
isFullscreen (val) {
|
||||
this.fullscreen = val
|
||||
|
||||
Reference in New Issue
Block a user