123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
- <html>
- <head>
- <title>我的工作台</title>
- <%@ include file="../common/header.jsp" %>
- <script type="text/javascript">
- $(document).ready(function(){
- //页面加载时候默认选中的节点
- changeRole("${adminRoleId }");
- });
-
- function checkall(){
- var kk=document.getElementsByName("kk");
- for(var i=0;i<kk.length;i++){
- if(kk[i].checked)
- all_Click();
- else
- not_Click();
- }
- }
- //全选
- function all_Click(){
- var chk=document.getElementsByName("chk");
- for(var i=0;i<chk.length;i++){
- chk[i].checked=true;
- }
- }
- //反选
- function not_Click(){
- var chk=document.getElementsByName("chk");
- for(var i=0;i<chk.length;i++){
- if(chk[i].disabled == false){
- if(chk[i].checked)
- chk[i].checked=false;
- else
- chk[i].checked=true;
- }
- }
- }
- function selectuserid(){
- var chk=document.getElementsByName("chk");
- var feedpId = "";
- var falg = false;
- for(var i=0;i<chk.length;i++){
- if(chk[i].checked){
- falg = true;
- if(feedpId=="")
- feedpId = chk[i].value;
- else
- feedpId += "," + chk[i].value;
- }
- }
- return feedpId+"*"+falg;
- }
- function getAllFeedps(){
- var s = selectuserid();
- var newFeedpId = s.substring(0,s.indexOf("*"));
- var falg = s.substring(s.indexOf("*")+1,s.length);
- var adminRoleId = $("#adminRoleId").val();
- if(falg=="true"){
- $.ajax({
- async: false,
- type: "POST",
- dataType: "json",
- data : "newFeedpId="+newFeedpId+"&adminRoleId="+adminRoleId,
- url: "${contextPath }/admin/adminuser/saveRoleFeedp.html",
- error: function(){alert("系统错误");},
- success: function(json){
- if (json.status == "success") {
- //window.location.reload();
- alert(json.msg);
- //保存成功后跳转回权限列表
- document.location.href="${contextPath}/admin/adminuser/role.html";
- }
- }
- });
- }else{
- alert("请给角色分配栏舍");
- }
- }
- //角色改变后选中该角色的权限
- function changeRole(obj){
- //改变角色前先取消所有勾选
- var chk=document.getElementsByName("chk");
- for(var i=0;i<chk.length;i++){
- chk[i].checked=false;
- }
- $.ajax({
- async: false,
- type: "POST",
- dataType: "json",
- data : "adminRoleId="+obj,
- url: "${contextPath }/admin/adminuser/changerole.html?type=ls",
- error: function(){alert("系统错误");},
- success: function(json){
- if (json.status == "success") {
- var pstr = json.value;
- if(pstr != ""){
- //角色有权限勾选所属权限
- var pid = pstr.split(",");
- for(var i = 0; i < pid.length; i++) {
- var chk=document.getElementsByName("chk");
- for(var j=0;j<chk.length;j++){
- if(chk[j].value == pid[i]){
- chk[j].checked=true;
- break;
- }
- }
- }
- }
- }
- }
- });
- }
- </script>
- </head>
- <body>
- <div class="navfrm">
- <span>当前位置:</span>
- <span><a href="${contextPath }/admin/welcome.html">首页</a></span>
- <span> >> </span>
- <span>栏舍权限</span>
- </div>
- <table cellpadding="3" cellspacing="0" width="100%" class="ptabsty">
- <tbody>
- <tr>
- <td width="10%" align="right"><b>角色名称:</b></td>
- <td colspan="3">
- <select id="adminRoleId" name="adminRoleId" style="width:100px;" onchange="changeRole(this.value);">
- <c:forEach items="${rolelists }" var="role">
- <option value="${role.ADMIN_ROLE_ID }" <c:if test="${adminRoleId==role.ADMIN_ROLE_ID}">selected="selected"</c:if>>
- <c:out value="${role.ADMIN_ROLE_NAME }" />
- </option>
- </c:forEach>
- </select>
- <input type="button" class="sysub" value="保存" onclick="getAllFeedps();" />
- </td>
- </tr>
- <tr>
- <c:forEach var="feedp" items="${feedpLists}" varStatus="feedpBL">
- <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>
- <c:if test="${feedpBL.count%4==0 && feedpBL.count<feedpListsSize}"></tr><tr align="left"></c:if>
- </c:forEach>
- <c:set var="feedpsize" value="${feedpListsSize%4}" />
- <c:if test="${feedpsize > 0}">
- <c:forEach begin="1" end="${4-feedpsize}" step="1">
- <td></td>
- </c:forEach>
- </c:if>
- </tr>
- <tr align="center">
- <td colspan="4" height="30px;" style="font-size: 15px;">
- <input type="checkbox" id="kk" name="kk" onclick="checkall();"><label for="kk">全选</label>
- </td>
- </tr>
- </tbody>
- </table>
- </body>
- </html>
|