From ad05215260dd2216401ab43ce1240ada06d7b8ae Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Mon, 9 Mar 2020 12:19:03 +0800 Subject: [PATCH] =?UTF-8?q?fix(#I1B42I):=20=E5=AD=90=E8=8F=9C=E5=8D=95?= =?UTF-8?q?=E4=B8=8E=E7=88=B6=E7=BA=A7=E8=8F=9C=E5=8D=95=E8=81=94=E5=8A=A8?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #Issue close #I1B42I --- src/admin/Bootstrap.Admin/wwwroot/js/roles.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/admin/Bootstrap.Admin/wwwroot/js/roles.js b/src/admin/Bootstrap.Admin/wwwroot/js/roles.js index 2117f9fd..6fd0efe9 100644 --- a/src/admin/Bootstrap.Admin/wwwroot/js/roles.js +++ b/src/admin/Bootstrap.Admin/wwwroot/js/roles.js @@ -142,18 +142,22 @@ $(function () { $nestMenu.nestMenu(function () { $nestMenuInput = $nestMenu.find('div.dd3-content'); $nestMenuInput.on('click', ':checkbox', function () { - var val = $(this).prop('checked'); - var child = $(this).parents('.dd3-content').next(); + var $this = $(this); + var val = $this.prop('checked'); + var child = $this.parents('.dd3-content').next(); if (child.hasClass('dd-list')) { child.find(':checkbox').prop('checked', val); } // 子节点全部取消时父级菜单也取消 - $(this).parents('ol.dd-list').each(function (index, p) { - if (val === false) { - val = $(p).prev().next().find(':checked').length > 0; + $this.parents('ol.dd-list').each(function (index, p) { + var $menuType = $this.parents('.dd3-item').attr('data-resource'); + if ($menuType === "0") { + if (val === false) { + val = $(p).find(':checked').length > 0; + } + $(p).prev().find(':checkbox').prop('checked', val); } - $(p).prev().find(':checkbox').prop('checked', val); }); }).children('.radio').hide(); });