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,15 +470,26 @@ 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])
})
/*
点击复选框对外抛出 `data, node, vm`<br>
`data:` 当前点击的节点数据<br>
`node:` 当前点击的node<br>
`vm:` 当前组件的vm
*/
点击复选框对外抛出 `data, node, vm`<br>
`data:` 当前点击的节点数据<br>
`node:` 当前点击的node<br>
`vm:` 当前组件的vm
*/
node.checkedKeys = checkedNodes.map(node => node.id)
this.$emit('check', data, node, vm)
this._emitFun()
},