Merge pull request #2455 from dataease/pr@dev@perf_filter_tree

perf: 树过滤组件模糊搜索后全选只选中展示的节点
This commit is contained in:
fit2cloud-chenyw 2022-06-20 17:10:17 +08:00 committed by GitHub
commit d29eaac857
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -470,7 +470,17 @@ export default {
_treeCheckFun(data, node, vm) {
this.ids = []
const { propsValue } = this
node.checkedNodes.forEach(item => {
const checkKeys = this.$refs.tree.getCheckedKeys()
checkKeys.forEach((i, n) => {
const node = this.$refs.tree.getNode(i)
if (!node.visible && node.checked) {
this.$refs.tree.setChecked(i, false)
}
})
const checkedNodes = this.$refs.tree.getCheckedNodes()
checkedNodes.forEach(item => {
this.ids.push(item[propsValue])
})
/*
@ -479,6 +489,7 @@ export default {
`node:` 当前点击的node<br>
`vm:` 当前组件的vm
*/
node.checkedKeys = checkedNodes.map(node => node.id)
this.$emit('check', data, node, vm)
this._emitFun()
},