菜单&数据权限新增(展开/折叠 全选/全不选 父子联动)

This commit is contained in:
RuoYi
2020-09-16 11:47:22 +08:00
parent b7e20b48cb
commit acfb6a56bb
7 changed files with 113 additions and 18 deletions

View File

@@ -42,9 +42,15 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">菜单权限</label>
<label class="col-sm-3 control-label">菜单权限</label>
<div class="col-sm-8">
<div id="menuTrees" class="ztree"></div>
<label class="check-box">
<input type="checkbox" value="1">展开/折叠</label>
<label class="check-box">
<input type="checkbox" value="2">全选/全不选</label>
<label class="check-box">
<input type="checkbox" value="3" checked>父子联动</label>
<div id="menuTrees" class="ztree ztree-border"></div>
</div>
</div>
</form>
@@ -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();