role_list.jsp 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  1. <%@ page language="java" contentType="text/html; charset=UTF-8"
  2. pageEncoding="UTF-8"%>
  3. <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
  4. <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
  5. <%
  6. String path = request.getContextPath();
  7. String basePath = request.getScheme() + "://"
  8. + request.getServerName() + ":" + request.getServerPort()
  9. + path + "/";
  10. %>
  11. <!DOCTYPE html>
  12. <html lang="en">
  13. <head>
  14. <base href="<%=basePath%>">
  15. <!-- jsp文件头和头部 -->
  16. <%@ include file="../index/top.jsp"%>
  17. </head>
  18. <body class="no-skin">
  19. <!-- /section:basics/navbar.layout -->
  20. <div class="main-container" id="main-container">
  21. <!-- /section:basics/sidebar -->
  22. <div class="main-content">
  23. <div class="main-content-inner">
  24. <div class="page-content">
  25. <div class="row">
  26. <div class="col-xs-12">
  27. <table style="margin-top: 8px;">
  28. <tr height="35">
  29. <c:if test="${QX.add == 1 }">
  30. <td style="width:69px;"><a href="javascript:addRole(0);" class="btn btn-sm btn-success">新增组</a></td>
  31. </c:if>
  32. <c:choose>
  33. <c:when test="${not empty roleList}">
  34. <c:forEach items="${roleList}" var="role" varStatus="vs">
  35. <td style="width:100px;" class="center" <c:choose><c:when test="${pd.ROLE_ID == role.ROLE_ID}">bgcolor="#FFC926" onMouseOut="javascript:this.bgColor='#FFC926';"</c:when><c:otherwise>bgcolor="#E5E5E5" onMouseOut="javascript:this.bgColor='#E5E5E5';"</c:otherwise></c:choose> onMouseMove="javascript:this.bgColor='#FFC926';" >
  36. <a href="role.do?ROLE_ID=${role.ROLE_ID }" style="text-decoration:none; display:block;"><i class="menu-icon fa fa-users"></i><font color="#666666">${role.ROLE_NAME }</font></a>
  37. </td>
  38. <td style="width:5px;"></td>
  39. </c:forEach>
  40. </c:when>
  41. <c:otherwise>
  42. <tr>
  43. <td colspan="100">没有相关数据</td>
  44. </tr>
  45. </c:otherwise>
  46. </c:choose>
  47. <td></td>
  48. </tr>
  49. </table>
  50. <table>
  51. <tr height="7px;"><td colspan="100"></td></tr>
  52. <tr>
  53. <td><font color="#808080">本组:</font></td>
  54. <td>
  55. <c:if test="${QX.edit == 1 }">
  56. <a class="btn btn-mini btn-info" onclick="editRole('${pd.ROLE_ID }');">修改组名称<i class="icon-arrow-right icon-on-right"></i></a>
  57. </c:if>
  58. <c:choose>
  59. <c:when test="${pd.ROLE_ID == '99'}">
  60. </c:when>
  61. <c:otherwise>
  62. <c:if test="${QX.edit == 1 }">
  63. <a class="btn btn-mini btn-purple" onclick="editRights('${pd.ROLE_ID }');">
  64. <i class="icon-pencil"></i>
  65. <c:if test="${pd.ROLE_ID == '1'}">Admin 菜单权限</c:if>
  66. <c:if test="${pd.ROLE_ID != '1'}">组菜单权限</c:if>
  67. </a>
  68. </c:if>
  69. </c:otherwise>
  70. </c:choose>
  71. <c:choose>
  72. <c:when test="${pd.ROLE_ID == '1' or pd.ROLE_ID == '2'}">
  73. </c:when>
  74. <c:otherwise>
  75. <c:if test="${QX.del == 1 }">
  76. <a class='btn btn-mini btn-danger' title="删除" onclick="delRole('${pd.ROLE_ID }','z','${pd.ROLE_NAME }');"><i class='ace-icon fa fa-trash-o bigger-130'></i></a>
  77. </c:if>
  78. </c:otherwise>
  79. </c:choose>
  80. </td>
  81. </tr>
  82. </table>
  83. <table id="dynamic-table" class="table table-striped table-bordered table-hover" style="margin-top:7px;">
  84. <thead>
  85. <tr>
  86. <th class="center" style="width: 50px;">序号</th>
  87. <th>角色</th>
  88. <th>编码</th>
  89. <%-- <c:if test="${QX.edit == 1 }">
  90. <th class="center">增</th>
  91. <th class="center">删</th>
  92. <th class="center">改</th>
  93. <th class="center">查</th>
  94. </c:if> --%>
  95. <th style="width:155px;" class="center">操作</th>
  96. </tr>
  97. </thead>
  98. <c:choose>
  99. <c:when test="${not empty roleList_z}">
  100. <c:if test="${QX.cha == 1 }">
  101. <c:forEach items="${roleList_z}" var="var" varStatus="vs">
  102. <tr>
  103. <td class='center' style="width:30px;">${vs.index+1}</td>
  104. <td id="ROLE_NAMETd${var.ROLE_ID }">${var.ROLE_NAME }</td>
  105. <td>${var.RNUMBER }</td>
  106. <%-- <c:if test="${QX.edit == 1 }">
  107. <td style="width:30px;"><a onclick="roleButton('${var.ROLE_ID }','add_qx');" class="btn btn-warning btn-mini" title="分配新增权限"><i class="ace-icon fa fa-wrench bigger-110 icon-only"></i></a></td>
  108. <td style="width:30px;"><a onclick="roleButton('${var.ROLE_ID }','del_qx');" class="btn btn-warning btn-mini" title="分配删除权限"><i class="ace-icon fa fa-wrench bigger-110 icon-only"></i></a></td>
  109. <td style="width:30px;"><a onclick="roleButton('${var.ROLE_ID }','edit_qx');" class="btn btn-warning btn-mini" title="分配修改权限"><i class="ace-icon fa fa-wrench bigger-110 icon-only"></i></a></td>
  110. <td style="width:30px;"><a onclick="roleButton('${var.ROLE_ID }','cha_qx');" class="btn btn-warning btn-mini" title="分配查看权限"><i class="ace-icon fa fa-wrench bigger-110 icon-only"></i></a></td>
  111. </c:if> --%>
  112. <td style="width:155px;">
  113. <c:if test="${QX.edit != 1 && QX.del != 1 }">
  114. <div style="width:100%;" class="center">
  115. <span class="label label-large label-grey arrowed-in-right arrowed-in"><i class="ace-icon fa fa-lock" title="无权限"></i></span>
  116. </div>
  117. </c:if>
  118. <c:if test="${QX.edit == 1 }">
  119. <a class="btn btn-mini btn-purple" onclick="editRights('${var.ROLE_ID }');"><i class="icon-pencil"></i>菜单权限</a>
  120. <c:if test="${var.ROLE_ID != 'fhadminzhuche' }"><!-- 注册用户角色不能修改 -->
  121. <a class='btn btn-mini btn-info' title="编辑" onclick="editRole('${var.ROLE_ID }');"><i class='ace-icon fa fa-pencil-square-o bigger-130'></i></a>
  122. </c:if>
  123. </c:if>
  124. <c:choose>
  125. <c:when test="${var.ROLE_ID == '2' or var.ROLE_ID == '1'}">
  126. </c:when>
  127. <c:otherwise>
  128. <c:if test="${QX.del == 1 }">
  129. <c:if test="${var.ROLE_ID != 'fhadminzhuche' }"><!-- 注册用户角色不能删除 -->
  130. <a class='btn btn-mini btn-danger' title="删除" onclick="delRole('${var.ROLE_ID }','c','${var.ROLE_NAME }');"><i class='ace-icon fa fa-trash-o bigger-130'></i></a>
  131. </c:if>
  132. </c:if>
  133. </c:otherwise>
  134. </c:choose>
  135. </td>
  136. </tr>
  137. </c:forEach>
  138. </c:if>
  139. <c:if test="${QX.cha == 0 }">
  140. <tr>
  141. <td colspan="100" class="center">您无权查看</td>
  142. </tr>
  143. </c:if>
  144. </c:when>
  145. <c:otherwise>
  146. <tr>
  147. <td colspan="100" class="center" >没有相关数据</td>
  148. </tr>
  149. </c:otherwise>
  150. </c:choose>
  151. </table>
  152. <div>
  153. <c:if test="${QX.add == 1 }">
  154. &nbsp;&nbsp;<a class="btn btn-sm btn-success" onclick="addRole('${pd.ROLE_ID }');">新增角色</a>
  155. </c:if>
  156. </div>
  157. </div>
  158. <!-- /.col -->
  159. </div>
  160. <!-- /.row -->
  161. </div>
  162. <!-- /.page-content -->
  163. </div>
  164. </div>
  165. <!-- /.main-content -->
  166. <!-- 返回顶部 -->
  167. <a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
  168. <i class="ace-icon fa fa-angle-double-up icon-only bigger-110"></i>
  169. </a>
  170. </div>
  171. <!-- /.main-container -->
  172. <!-- basic scripts -->
  173. <!-- 页面底部js¨ -->
  174. <%@ include file="../index/foot.jsp"%>
  175. <!-- 删除时确认窗口 -->
  176. <script src="static/ace/js/bootbox.js"></script>
  177. <!-- ace scripts -->
  178. <script src="static/ace/js/ace/ace.js"></script>
  179. <!-- inline scripts related to this page -->
  180. <script type="text/javascript">
  181. $(top.hangge());
  182. //新增组
  183. function addRole(pid){
  184. top.jzts();
  185. var diag = new top.Dialog();
  186. diag.Drag=true;
  187. diag.Title ="新增";
  188. diag.URL = '<%=basePath%>role/toAdd.do?parent_id='+pid;
  189. diag.Width = 222;
  190. diag.Height = 100;
  191. diag.CancelEvent = function(){ //关闭事件
  192. if(diag.innerFrame.contentWindow.document.getElementById('zhongxin').style.display == 'none'){
  193. top.jzts();
  194. setTimeout("self.location.reload()",100);
  195. }
  196. diag.close();
  197. };
  198. diag.show();
  199. }
  200. //修改
  201. function editRole(ROLE_ID){
  202. top.jzts();
  203. var diag = new top.Dialog();
  204. diag.Drag=true;
  205. diag.Title ="编辑";
  206. diag.URL = '<%=basePath%>role/toEdit.do?ROLE_ID='+ROLE_ID;
  207. diag.Width = 222;
  208. diag.Height = 100;
  209. diag.CancelEvent = function(){ //关闭事件
  210. if(diag.innerFrame.contentWindow.document.getElementById('zhongxin').style.display == 'none'){
  211. top.jzts();
  212. setTimeout("self.location.reload()",100);
  213. }
  214. diag.close();
  215. };
  216. diag.show();
  217. }
  218. //删除
  219. function delRole(ROLE_ID,msg,ROLE_NAME){
  220. bootbox.confirm("确定要删除["+ROLE_NAME+"]吗?", function(result) {
  221. if(result) {
  222. var url = "<%=basePath%>role/delete.do?ROLE_ID="+ROLE_ID+"&guid="+new Date().getTime();
  223. top.jzts();
  224. $.get(url,function(data){
  225. if("success" == data.result){
  226. if(msg == 'c'){
  227. top.jzts();
  228. document.location.reload();
  229. }else{
  230. top.jzts();
  231. window.location.href="role.do";
  232. }
  233. }else if("false" == data.result){
  234. top.hangge();
  235. bootbox.dialog({
  236. message: "<span class='bigger-110'>删除失败,请先删除下级角色!</span>",
  237. buttons:
  238. {
  239. "button" :
  240. {
  241. "label" : "确定",
  242. "className" : "btn-sm btn-success"
  243. }
  244. }
  245. });
  246. }else if("false2" == data.result){
  247. top.hangge();
  248. bootbox.dialog({
  249. message: "<span class='bigger-110'>删除失败,此角色已被使用!</span>",
  250. buttons:
  251. {
  252. "button" :
  253. {
  254. "label" : "确定",
  255. "className" : "btn-sm btn-success"
  256. }
  257. }
  258. });
  259. }
  260. });
  261. }
  262. });
  263. }
  264. //菜单权限
  265. function editRights(ROLE_ID){
  266. top.jzts();
  267. var diag = new top.Dialog();
  268. diag.Drag = true;
  269. diag.Title = "菜单权限";
  270. diag.URL = '<%=basePath%>role/menuqx.do?ROLE_ID='+ROLE_ID;
  271. diag.Width = 320;
  272. diag.Height = 450;
  273. diag.CancelEvent = function(){ //关闭事件
  274. diag.close();
  275. };
  276. diag.show();
  277. }
  278. //按钮权限(增删改查)
  279. function roleButton(ROLE_ID,msg){
  280. top.jzts();
  281. if(msg == 'add_qx'){
  282. var Title = "授权新增权限(此角色下打勾的菜单拥有新增权限)";
  283. }else if(msg == 'del_qx'){
  284. Title = "授权删除权限(此角色下打勾的菜单拥有删除权限)";
  285. }else if(msg == 'edit_qx'){
  286. Title = "授权修改权限(此角色下打勾的菜单拥有修改权限)";
  287. }else if(msg == 'cha_qx'){
  288. Title = "授权查看权限(此角色下打勾的菜单拥有查看权限)";
  289. }
  290. var diag = new top.Dialog();
  291. diag.Drag = true;
  292. diag.Title = Title;
  293. diag.URL = '<%=basePath%>role/b4Button.do?ROLE_ID='+ROLE_ID+'&msg='+msg;
  294. diag.Width = 330;
  295. diag.Height = 450;
  296. diag.CancelEvent = function(){ //关闭事件
  297. diag.close();
  298. };
  299. diag.show();
  300. }
  301. </script>
  302. </body>
  303. </html>