From 53a491ed48c92772a0930bd591b759db259a0451 Mon Sep 17 00:00:00 2001 From: WangXu10 Date: Wed, 16 Aug 2023 16:46:57 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=AB=98=E7=BA=A7=E6=90=9C=E7=B4=A2=E6=89=80?= =?UTF-8?q?=E5=B1=9E=E6=A8=A1=E5=9D=97=E5=8F=96=E6=B6=88=E6=9F=90=E4=B8=AA?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E4=BC=9A=E6=8A=8A=E7=88=B6=E7=BA=A7=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E4=B8=80=E8=B5=B7=E5=8F=96=E6=B6=88=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1028035 --user=王旭 高级搜索所属模块取消某个模块会把父级模块一起取消 https://www.tapd.cn/55049933/s/1404684 --- .../search/MsTableSearchNodeTree.vue | 32 +++++++++++++++++-- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/framework/sdk-parent/frontend/src/components/search/MsTableSearchNodeTree.vue b/framework/sdk-parent/frontend/src/components/search/MsTableSearchNodeTree.vue index 0224f3364f..9cde94aaf6 100644 --- a/framework/sdk-parent/frontend/src/components/search/MsTableSearchNodeTree.vue +++ b/framework/sdk-parent/frontend/src/components/search/MsTableSearchNodeTree.vue @@ -36,6 +36,7 @@ @check="handleCheckChange" default-expand-all show-checkbox + :check-strictly="true" node-key="id" class="search-tree" ref="tree"> @@ -154,9 +155,34 @@ export default { } } }, - handleCheckChange(data, curData) { - const {checkedKeys} = curData; - this.component.value = checkedKeys; + handleCheckChange(data) { + const node = this.$refs.tree.getNode(data.id); + 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() { if (this.component.value) {