roleAuthor.jsp 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <%@ page contentType="text/html;charset=GBK"%>
  2. <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4. <HEAD>
  5. <TITLE>角色授权</TITLE>
  6. <script type=text/javascript src="/shares/js/jquery-1.6.4.min.js"></script>
  7. <link href="main.css" rel="stylesheet" type="text/css"></link>
  8. <script type="text/javascript" src="js/lr-page.js"></script>
  9. <script type="text/javascript" src="/shares/js/constant.js"></script>
  10. <script type="text/javascript" src="/shares/js/common.js"></script>
  11. <script type="text/javascript" src="/shares/js/yw/eu/roleAuthor.js"></script>
  12. <link href="./liger/lib/ligerUI/skins/${sessionScope.css}/css/ligerui-all.css" rel="stylesheet" type="text/css"></link>
  13. <script src="./liger/lib/ligerUI/js/core/base.js" type="text/javascript"></script>
  14. <script src="./liger/lib/ligerUI/js/plugins/ligerTab.js" type="text/javascript"></script>
  15. <script src="./liger/lib/ligerUI/js/plugins/ligerLayout.js" type="text/javascript"></script>
  16. <script src="./liger/lib/ligerUI/js/plugins/ligerDialog.js" type="text/javascript"></script>
  17. <script src="./liger/lib/ligerUI/js/plugins/ligerTree.js" type="text/javascript"></script>
  18. <script type="text/javascript">
  19. var dialog;
  20. $(function (){
  21. $("#layout1").ligerLayout({ leftWidth: 250,height:'99%'});
  22. var height = $(".l-layout-center").height();
  23. $("#navtab1").ligerTab({height:height-25});
  24. tabitem = $("#navtab1").ligerGetTabManager();
  25. replaceItem();
  26. checkAll();
  27. $("#leftTree").height(height-50);
  28. managerTree = roleAutorTree("loadUnitRole.do","unitTree",clickRoleEvent,onSuccess);
  29. });
  30. function replaceItem(){
  31. tabitem.addTabItem({tabid:'temp_1',text: "",content:"",isMove:false});
  32. tabitem.selectTabItem("tabitem1");
  33. tabitem.removeTabItem('temp_1');
  34. }
  35. function loadTree(){
  36. $("#unitTree").empty();
  37. if($(".l-dialog-close").length>0)$(".l-dialog-close").click();
  38. managerTree = roleAutorTree("loadUnitRole.do","unitTree",clickRoleEvent,onSuccess);
  39. }
  40. function onSuccess(){
  41. managerTree.expandAll();
  42. var roleId = $("input[name='role']").val();
  43. if(roleId!=''&&roleId!=undefined){
  44. $("input[name='author']").each(function(){
  45. $(this).attr("checked",false);
  46. });
  47. var param = {'id':roleId};
  48. managerTree.selectNode(roleId);
  49. sendAsyncAjax(param,'findRoleAuthor.do','json',process);
  50. }
  51. }
  52. function checkAll(){
  53. var checkIds = $("[name='checkedIds']").val();
  54. var checkIdCol = checkIds.split(",");
  55. $("[name='role']").each(function(){
  56. var roleId = $(this).val();
  57. if(isExist(roleId,checkIdCol)){
  58. $(this).parent().click();
  59. }
  60. });
  61. }
  62. function addRole(){
  63. var selectUnit = $("input[name='unit']").val();
  64. if(selectUnit==undefined||selectUnit=="")addError("请选择角色所属单位!");
  65. else dialog = $.ligerDialog.open({ height: 350,width:480,url: 'BuildRole.do?unit='+selectUnit});
  66. }
  67. function editRole(){
  68. var selectRole = $("input[name='role']").val();
  69. if(selectRole==undefined||selectRole=="")addError("请选择需要修改的角色!");
  70. else dialog = $.ligerDialog.open({ height: 350,width:480,url: 'EditRole.do?id='+selectRole});
  71. }
  72. function delRole(){
  73. var selectRole = $("input[name='role']").val();
  74. if(selectRole==undefined||selectRole==""){
  75. addError("请选择需要删除的角色!");
  76. return;
  77. }
  78. selectRole = -parseInt(selectRole,10);
  79. if (window.confirm("确定删除当前选中的角色?")){
  80. var url = "delRole.do?id="+selectRole;
  81. $("form[name='roleAuthorForm']").attr("action", url);
  82. $("form[name='roleAuthorForm']").submit();
  83. }
  84. }
  85. </script>
  86. <style type="text/css">
  87. body{ padding:5px; margin:0;}
  88. #layout1{width:100%;margin:0; padding:0; }
  89. .author-list{
  90. width:100px;
  91. float:left;
  92. height:25px;
  93. padding-top:3px;
  94. overflow-x:hidden;
  95. white-space:nowrap;text-overflow:ellipsis;
  96. }
  97. .roleTree{
  98. height:20px;
  99. padding-top:3px;
  100. }
  101. .l-button{margin-left:1px;}
  102. #deptBtn{
  103. width: 100%;
  104. background: #e5ecf9;
  105. text-align:center;
  106. height:25px;
  107. padding-top:3px
  108. }
  109. </style>
  110. </HEAD>
  111. <BODY>
  112. <%@ include file="/include/button.jsp"%>
  113. <%@ include file="/include/message.jsp"%>
  114. <form name="roleAuthorForm" action="addRoleAuthor.do" method="post">
  115. <div id="layout1">
  116. <div position="left" title="角色列表" id="accordion1">
  117. <div id="deptBtn">
  118. <input type="button" value="新增" class="l-button" onclick="addRole()">
  119. <input type="button" value="修改" class="l-button" onclick="editRole()">
  120. <input type="button" value="删除" id="delRoleEvent" class="l-button" onclick="delRole()" />
  121. </div>
  122. <input type="hidden" name="checkedIds" value="${checkedIds}" />
  123. <input type="hidden" name="role" value="${role}"/>
  124. <input type="hidden" name="unit" value=""/>
  125. <%-- <c:forEach items="${roleList}" var="role">
  126. <DIV class="dTreeNode roleTree">
  127. &nbsp;&nbsp;
  128. <input type="radio" value="${role.roleId}" name="role"/>
  129. <span title="${role.roleName}">${role.roleName}</span>
  130. </DIV>
  131. </c:forEach> --%>
  132. <div id="leftTree" style="overflow:auto;position:relative;">
  133. <ul id="unitTree" class="tree" style="margin-top: 3px;">
  134. </div>
  135. </div>
  136. <div position="center" title="权限">
  137. <div id="navtab1" style="width: 99%;margin:0 auto;overflow:hidden;height:99%; border:1px solid #A3C0E8; ">
  138. <c:forEach items="${authorMap}" var="system" varStatus="i">
  139. <div title="${system.key}" ${i.index==0?"lselected='true'":""}>
  140. <div id="maingrid2" style="margin:5px;overflow:hidden">
  141. <c:forEach items="${system.value}" var="author">
  142. <div style="margin-top:3px">
  143. <div class="me">
  144. <span style="font-weight:bold"><input type="checkbox" name="checkAll" value=""/>&nbsp;${author.text}</span>
  145. </div>
  146. <div class="node" style="padding-left:3px;float:left;text-align:left;border:1px solid #eee;width:98%">
  147. <c:forEach items="${author.children}" var="action">
  148. <div class="author-list">
  149. <input type="checkbox" value="${action.url} ${action.text}" name="author" id="${action.url}"/>
  150. <span title="${action.text}">${action.text}</span>
  151. </div>
  152. </c:forEach>
  153. </div>
  154. </div>
  155. </c:forEach>
  156. </div>
  157. </div>
  158. </c:forEach>
  159. </div>
  160. </div>
  161. </div>
  162. </form>
  163. </div>
  164. </BODY>
  165. </HTML>