From b3d4bbd44000ed4a608ab112d265899d5ee21e58 Mon Sep 17 00:00:00 2001 From: hyx Date: Mon, 20 Nov 2023 15:27:14 +0800 Subject: [PATCH] =?UTF-8?q?fix:CN-1470=20=20=E8=B0=83=E6=95=B4=E6=96=B0?= =?UTF-8?q?=E5=A2=9E/=E4=BF=AE=E6=94=B9role=E9=A1=B5=E9=9D=A2=E6=9D=83?= =?UTF-8?q?=E9=99=90=E6=A0=91=E7=9A=84=E9=80=BB=E8=BE=91=EF=BC=9A1.?= =?UTF-8?q?=E9=80=89=E4=B8=AD=E8=8A=82=E7=82=B9=E6=97=B6=EF=BC=8C=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E9=80=89=E4=B8=AD=E6=89=80=E6=9C=89=E7=9A=84=E7=88=B6?= =?UTF-8?q?=E8=BE=88=E8=8A=82=E7=82=B9=EF=BC=8C=E5=AD=90=E8=8A=82=E7=82=B9?= =?UTF-8?q?=E4=B8=8D=E8=BF=9B=E8=A1=8C=E5=90=8C=E6=AD=A5=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=EF=BC=9B2.=E5=8F=96=E6=B6=88=E9=80=89=E4=B8=AD=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E6=97=B6=EF=BC=8C=E5=90=8C=E6=AD=A5=E5=8F=96=E6=B6=88?= =?UTF-8?q?=E9=80=89=E4=B8=AD=E6=89=80=E6=9C=89=E5=AD=90=E8=8A=82=E7=82=B9?= =?UTF-8?q?=EF=BC=8C=E5=AF=B9=E7=88=B6=E8=8A=82=E7=82=B9=E4=B8=8D=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E5=90=8C=E6=AD=A5=E6=93=8D=E4=BD=9C=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/rightBox/settings/RoleBox.vue | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/components/rightBox/settings/RoleBox.vue b/src/components/rightBox/settings/RoleBox.vue index 1279cc0e..8502abd8 100644 --- a/src/components/rightBox/settings/RoleBox.vue +++ b/src/components/rightBox/settings/RoleBox.vue @@ -183,7 +183,26 @@ export default { } } }, + checkParentNode(node) { + if(node && this.$refs.menuTree.getNode(node)){ + let parent = this.$refs.menuTree.getNode(node).parent + let parentNode = parent.data + if(parentNode && parentNode.id && parentNode.id !== 0 ){ + this.$refs.menuTree.setChecked(parentNode,true,false) + this.checkParentNode(parentNode) + } + } + }, selectChange: function (data, isCheck, childIsCheck) { + if(isCheck) {//如果是选中节点,则同步选中所有的父辈节点(有全选和半选两种状态) + this.checkParentNode(data) + } else {//如果是取消节点,则同步取消选中所有子节点 + if(data.children && data.children.length > 0) { + data.children.forEach(node => { + this.$refs.menuTree.setChecked(node, false, true) + }) + } + } if (this.$refs.menuTree) { this.editRole.menuIds = this.$refs.menuTree.getCheckedKeys(false) }