feedprow.jsp 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
  2. <html>
  3. <head>
  4. <title>我的工作台</title>
  5. <%@ include file="../common/header.jsp" %>
  6. <script type="text/javascript">
  7. $(document).ready(function(){
  8. //页面加载时候默认选中的节点
  9. changeRole("${adminRoleId }");
  10. });
  11. function checkall(){
  12. var kk=document.getElementsByName("kk");
  13. for(var i=0;i<kk.length;i++){
  14. if(kk[i].checked)
  15. all_Click();
  16. else
  17. not_Click();
  18. }
  19. }
  20. //全选
  21. function all_Click(){
  22. var chk=document.getElementsByName("chk");
  23. for(var i=0;i<chk.length;i++){
  24. chk[i].checked=true;
  25. }
  26. }
  27. //反选
  28. function not_Click(){
  29. var chk=document.getElementsByName("chk");
  30. for(var i=0;i<chk.length;i++){
  31. if(chk[i].disabled == false){
  32. if(chk[i].checked)
  33. chk[i].checked=false;
  34. else
  35. chk[i].checked=true;
  36. }
  37. }
  38. }
  39. function selectuserid(){
  40. var chk=document.getElementsByName("chk");
  41. var feedpId = "";
  42. var falg = false;
  43. for(var i=0;i<chk.length;i++){
  44. if(chk[i].checked){
  45. falg = true;
  46. if(feedpId=="")
  47. feedpId = chk[i].value;
  48. else
  49. feedpId += "," + chk[i].value;
  50. }
  51. }
  52. return feedpId+"*"+falg;
  53. }
  54. function getAllFeedps(){
  55. var s = selectuserid();
  56. var newFeedpId = s.substring(0,s.indexOf("*"));
  57. var falg = s.substring(s.indexOf("*")+1,s.length);
  58. var adminRoleId = $("#adminRoleId").val();
  59. if(falg=="true"){
  60. $.ajax({
  61. async: false,
  62. type: "POST",
  63. dataType: "json",
  64. data : "newFeedpId="+newFeedpId+"&adminRoleId="+adminRoleId,
  65. url: "${contextPath }/admin/adminuser/saveRoleFeedp.html",
  66. error: function(){alert("系统错误");},
  67. success: function(json){
  68. if (json.status == "success") {
  69. //window.location.reload();
  70. alert(json.msg);
  71. //保存成功后跳转回权限列表
  72. document.location.href="${contextPath}/admin/adminuser/role.html";
  73. }
  74. }
  75. });
  76. }else{
  77. alert("请给角色分配栏舍");
  78. }
  79. }
  80. //角色改变后选中该角色的权限
  81. function changeRole(obj){
  82. //改变角色前先取消所有勾选
  83. var chk=document.getElementsByName("chk");
  84. for(var i=0;i<chk.length;i++){
  85. chk[i].checked=false;
  86. }
  87. $.ajax({
  88. async: false,
  89. type: "POST",
  90. dataType: "json",
  91. data : "adminRoleId="+obj,
  92. url: "${contextPath }/admin/adminuser/changerole.html?type=ls",
  93. error: function(){alert("系统错误");},
  94. success: function(json){
  95. if (json.status == "success") {
  96. var pstr = json.value;
  97. if(pstr != ""){
  98. //角色有权限勾选所属权限
  99. var pid = pstr.split(",");
  100. for(var i = 0; i < pid.length; i++) {
  101. var chk=document.getElementsByName("chk");
  102. for(var j=0;j<chk.length;j++){
  103. if(chk[j].value == pid[i]){
  104. chk[j].checked=true;
  105. break;
  106. }
  107. }
  108. }
  109. }
  110. }
  111. }
  112. });
  113. }
  114. </script>
  115. </head>
  116. <body>
  117. <div class="navfrm">
  118. <span>当前位置:</span>
  119. <span><a href="${contextPath }/admin/welcome.html">首页</a></span>
  120. <span>&nbsp;>>&nbsp;</span>
  121. <span>栏舍权限</span>
  122. </div>
  123. <table cellpadding="3" cellspacing="0" width="100%" class="ptabsty">
  124. <tbody>
  125. <tr>
  126. <td width="10%" align="right"><b>角色名称:</b></td>
  127. <td colspan="3">
  128. <select id="adminRoleId" name="adminRoleId" style="width:100px;" onchange="changeRole(this.value);">
  129. <c:forEach items="${rolelists }" var="role">
  130. <option value="${role.ADMIN_ROLE_ID }" <c:if test="${adminRoleId==role.ADMIN_ROLE_ID}">selected="selected"</c:if>>
  131. <c:out value="${role.ADMIN_ROLE_NAME }" />
  132. </option>
  133. </c:forEach>
  134. </select>
  135. <input type="button" class="sysub" value="保存" onclick="getAllFeedps();" />
  136. </td>
  137. </tr>
  138. <tr>
  139. <c:forEach var="feedp" items="${feedpLists}" varStatus="feedpBL">
  140. <td width="25%" height="30px;" style="font-size: 15px;"><input id="chk${feedp.ID}" name="chk" type="checkbox" value="${feedp.ID}"><label for="chk${feedp.ID}"><b><c:out value="${feedp.BNAME}" /></b></label></td>
  141. <c:if test="${feedpBL.count%4==0 && feedpBL.count<feedpListsSize}"></tr><tr align="left"></c:if>
  142. </c:forEach>
  143. <c:set var="feedpsize" value="${feedpListsSize%4}" />
  144. <c:if test="${feedpsize > 0}">
  145. <c:forEach begin="1" end="${4-feedpsize}" step="1">
  146. <td></td>
  147. </c:forEach>
  148. </c:if>
  149. </tr>
  150. <tr align="center">
  151. <td colspan="4" height="30px;" style="font-size: 15px;">
  152. <input type="checkbox" id="kk" name="kk" onclick="checkall();"><label for="kk">全选</label>
  153. </td>
  154. </tr>
  155. </tbody>
  156. </table>
  157. </body>
  158. </html>