fix(测试跟踪): 修复高级搜索所属模块取消某个模块会把父级模块一起取消缺陷
--bug=1028035 --user=王旭 高级搜索所属模块取消某个模块会把父级模块一起取消 https://www.tapd.cn/55049933/s/1404684
This commit is contained in:
parent
557b98e8f8
commit
53a491ed48
|
@ -36,6 +36,7 @@
|
||||||
@check="handleCheckChange"
|
@check="handleCheckChange"
|
||||||
default-expand-all
|
default-expand-all
|
||||||
show-checkbox
|
show-checkbox
|
||||||
|
:check-strictly="true"
|
||||||
node-key="id"
|
node-key="id"
|
||||||
class="search-tree"
|
class="search-tree"
|
||||||
ref="tree">
|
ref="tree">
|
||||||
|
@ -154,9 +155,34 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleCheckChange(data, curData) {
|
handleCheckChange(data) {
|
||||||
const {checkedKeys} = curData;
|
const node = this.$refs.tree.getNode(data.id);
|
||||||
this.component.value = checkedKeys;
|
this.setNode(node);
|
||||||
|
},
|
||||||
|
setNode(node) {
|
||||||
|
if (node.checked) {
|
||||||
|
//选中,递归设置所有父节点选中
|
||||||
|
this.setParentNode(node);
|
||||||
|
} else {
|
||||||
|
//取消选中,所有子节点取消选中
|
||||||
|
this.setChildenNode(node);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
setParentNode(node) {
|
||||||
|
if (node.parent) {
|
||||||
|
for (const key in node) {
|
||||||
|
if (key === "parent") {
|
||||||
|
node[key].checked = true;
|
||||||
|
this.setParentNode(node[key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
setChildenNode(node) {
|
||||||
|
for (let i = 0; i < node.childNodes.length; i++) {
|
||||||
|
node.childNodes[i].checked = false;
|
||||||
|
this.setChildenNode(node.childNodes[i]);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
changeTreeTag() {
|
changeTreeTag() {
|
||||||
if (this.component.value) {
|
if (this.component.value) {
|
||||||
|
|
Loading…
Reference in New Issue