You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jeecg/WebRoot/webpage/system/role/roleSet.jsp

100 lines
3.2 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<script type="text/javascript">
$(function() {
$('#functionid').tree({
checkbox : true,
url : 'roleController.do?setAuthority&roleId=${roleId}',
onLoadSuccess : function(node) {
expandAll();
},
onClick: function(node){
var isRoot = $('#functionid').tree('getChildren', node.target);
if(isRoot==''){
var roleId = $("#rid").val();
$('#operationListpanel').panel("refresh", "roleController.do?operationListForFunction&functionId="+node.id+"&roleId="+roleId);
}else {
}
}
});
$("#functionListPanel").panel(
{
title :"菜单列表",
tools:[{iconCls:'icon-save',handler:function(){mysubmit();}}]
}
);
$("#operationListpanel").panel(
{
title :"操作按钮列表",
tools:[{iconCls:'icon-save',handler:function(){submitOperation();}}]
}
);
});
function mysubmit() {
var roleId = $("#rid").val();
var s = GetNode();
doSubmit("roleController.do?updateAuthority&rolefunctions=" + s + "&roleId=" + roleId);
}
function GetNode() {
var node = $('#functionid').tree('getChecked');
var cnodes = '';
var pnodes = '';
var pnode = null; //保存上一步所选父节点
for ( var i = 0; i < node.length; i++) {
if ($('#functionid').tree('isLeaf', node[i].target)) {
cnodes += node[i].id + ',';
pnode = $('#functionid').tree('getParent', node[i].target); //获取当前节点的父节点
while (pnode!=null) {//添加全部父节点
pnodes += pnode.id + ',';
pnode = $('#functionid').tree('getParent', pnode.target);
}
}
}
cnodes = cnodes.substring(0, cnodes.length - 1);
pnodes = pnodes.substring(0, pnodes.length - 1);
return cnodes + "," + pnodes;
};
function expandAll() {
var node = $('#functionid').tree('getSelected');
if (node) {
$('#functionid').tree('expandAll', node.target);
} else {
$('#functionid').tree('expandAll');
}
}
function selecrAll() {
var node = $('#functionid').tree('getRoots');
for ( var i = 0; i < node.length; i++) {
var childrenNode = $('#functionid').tree('getChildren',node[i].target);
for ( var j = 0; j < childrenNode.length; j++) {
$('#functionid').tree("check",childrenNode[j].target);
}
}
}
function reset() {
$('#functionid').tree('reload');
}
$('#selecrAllBtn').linkbutton({
});
$('#resetBtn').linkbutton({
});
</script>
<div class="easyui-layout" fit="true">
<div region="center" style="padding:1px;">
<div class="easyui-panel" style="padding:1px;" fit="true" border="false" id="functionListPanel">
<input type="hidden" name="roleId" value="${roleId}" id="rid">
<!-- update-begin--Author:anchao Date:20130324 for角色编辑全选、取消菜单 -->
<a id = "selecrAllBtn" onclick="selecrAll();">全选</a>
<a id = "resetBtn" onclick="reset();">重置</a>
<!-- update-end--Author:zhangdaihao Date:20130205 for角色编辑全选、取消菜单 -->
<ul id="functionid"></ul>
</div>
</div>
<div region="east" style="width:150px; overflow: hidden;" split="true" >
<div class="easyui-panel" style="padding:1px;" fit="true" border="false" id="operationListpanel">
</div>
</div>
</div>