diff --git a/ruoyi-admin/src/main/resources/static/ruoyi/css/ry-ui.css b/ruoyi-admin/src/main/resources/static/ruoyi/css/ry-ui.css index 25f0d9adc..98765f7d3 100644 --- a/ruoyi-admin/src/main/resources/static/ruoyi/css/ry-ui.css +++ b/ruoyi-admin/src/main/resources/static/ruoyi/css/ry-ui.css @@ -443,6 +443,14 @@ label.error { background-position: -180px 0 } +/* ztree */ +div.ztree-border { + margin-top: 10px; + border: 1px solid #e5e6e7; + background: #FFFFFF none; + border-radius:4px; +} + /* 切换开关 */ .toggle-switch { display: -webkit-inline-box; diff --git a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js index f858ab4a6..8450dc9d6 100644 --- a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js +++ b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js @@ -1261,6 +1261,7 @@ var table = { check: { enable: false, // 置 zTree 的节点上是否显示 checkbox / radio nocheckInherit: true, // 设置子节点是否自动继承 + chkboxType: { "Y": "ps", "N": "ps" } // 父子节点的关联关系 }, data: { key: { diff --git a/ruoyi-admin/src/main/resources/templates/system/role/add.html b/ruoyi-admin/src/main/resources/templates/system/role/add.html index 2675d093c..82d3f439b 100644 --- a/ruoyi-admin/src/main/resources/templates/system/role/add.html +++ b/ruoyi-admin/src/main/resources/templates/system/role/add.html @@ -42,9 +42,15 @@
- +
- + + + +
@@ -111,6 +117,30 @@ focusCleanup: true }); + $('input').on('ifChanged', function(obj){ + var type = $(this).val(); + var checked = obj.currentTarget.checked; + if (type == 1) { + if (checked) { + $._tree.expandAll(true); + } else { + $._tree.expandAll(false); + } + } else if (type == "2") { + if (checked) { + $._tree.checkAllNodes(true); + } else { + $._tree.checkAllNodes(false); + } + } else if (type == "3") { + if (checked) { + $._tree.setting.check.chkboxType = { "Y": "ps", "N": "ps" }; + } else { + $._tree.setting.check.chkboxType = { "Y": "", "N": "" }; + } + } + }) + function submitHandler() { if ($.validate.form()) { add(); diff --git a/ruoyi-admin/src/main/resources/templates/system/role/dataScope.html b/ruoyi-admin/src/main/resources/templates/system/role/dataScope.html index d23fe5887..d3b5513a9 100644 --- a/ruoyi-admin/src/main/resources/templates/system/role/dataScope.html +++ b/ruoyi-admin/src/main/resources/templates/system/role/dataScope.html @@ -34,9 +34,15 @@
- +
-
+ + + +
@@ -55,6 +61,30 @@ }; $.tree.init(options); }); + + $('input').on('ifChanged', function(obj){ + var type = $(this).val(); + var checked = obj.currentTarget.checked; + if (type == 1) { + if (checked) { + $._tree.expandAll(true); + } else { + $._tree.expandAll(false); + } + } else if (type == "2") { + if (checked) { + $._tree.checkAllNodes(true); + } else { + $._tree.checkAllNodes(false); + } + } else if (type == "3") { + if (checked) { + $._tree.setting.check.chkboxType = { "Y": "ps", "N": "ps" }; + } else { + $._tree.setting.check.chkboxType = { "Y": "", "N": "" }; + } + } + }) function submitHandler() { if ($.validate.form()) { diff --git a/ruoyi-admin/src/main/resources/templates/system/role/edit.html b/ruoyi-admin/src/main/resources/templates/system/role/edit.html index 8d510da8c..354380d16 100644 --- a/ruoyi-admin/src/main/resources/templates/system/role/edit.html +++ b/ruoyi-admin/src/main/resources/templates/system/role/edit.html @@ -43,9 +43,15 @@
- +
- + + + +
@@ -117,6 +123,30 @@ }, focusCleanup: true }); + + $('input').on('ifChanged', function(obj){ + var type = $(this).val(); + var checked = obj.currentTarget.checked; + if (type == 1) { + if (checked) { + $._tree.expandAll(true); + } else { + $._tree.expandAll(false); + } + } else if (type == "2") { + if (checked) { + $._tree.checkAllNodes(true); + } else { + $._tree.checkAllNodes(false); + } + } else if (type == "3") { + if (checked) { + $._tree.setting.check.chkboxType = { "Y": "ps", "N": "ps" }; + } else { + $._tree.setting.check.chkboxType = { "Y": "", "N": "" }; + } + } + }) function edit() { var roleId = $("input[name='roleId']").val(); diff --git a/ruoyi-admin/src/main/resources/templates/system/user/add.html b/ruoyi-admin/src/main/resources/templates/system/user/add.html index 6e3ac0c47..1d6c93a35 100644 --- a/ruoyi-admin/src/main/resources/templates/system/user/add.html +++ b/ruoyi-admin/src/main/resources/templates/system/user/add.html @@ -251,12 +251,10 @@ function doSubmit(index, layero){ var tree = layero.find("iframe")[0].contentWindow.$._tree; - if ($.tree.notAllowParents(tree)) { - var body = layer.getChildFrame('body', index); - $("#treeId").val(body.find('#treeId').val()); - $("#treeName").val(body.find('#treeName').val()); - layer.close(index); - } + var body = layer.getChildFrame('body', index); + $("#treeId").val(body.find('#treeId').val()); + $("#treeName").val(body.find('#treeName').val()); + layer.close(index); } $(function() { diff --git a/ruoyi-admin/src/main/resources/templates/system/user/edit.html b/ruoyi-admin/src/main/resources/templates/system/user/edit.html index d01144db0..8e2464e40 100644 --- a/ruoyi-admin/src/main/resources/templates/system/user/edit.html +++ b/ruoyi-admin/src/main/resources/templates/system/user/edit.html @@ -215,12 +215,10 @@ function doSubmit(index, layero){ var tree = layero.find("iframe")[0].contentWindow.$._tree; - if ($.tree.notAllowParents(tree)) { - var body = layer.getChildFrame('body', index); - $("#treeId").val(body.find('#treeId').val()); - $("#treeName").val(body.find('#treeName').val()); - layer.close(index); - } + var body = layer.getChildFrame('body', index); + $("#treeId").val(body.find('#treeId').val()); + $("#treeName").val(body.find('#treeName').val()); + layer.close(index); } $(function() {