zj
2024-08-02 815342ea90c689561adeecca3230b5b5f8ddc2b7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<%@ page language="java" pageEncoding="utf-8" isELIgnored="false"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
 
<%@ include file="include/pagetop.jsp"%>
 
<!DOCTYPE html>
<html>
 
<head>
<%@ include file="include/head.jsp"%>
</head>
 
<body>
 
    <%@ include file="include/loading.jsp"%>
<%--     <%@ include file="include/top.jsp"%> --%>
<%--     <%@ include file="include/menu_left.jsp"%> --%>
 
    <!-- //////////////////////////////////////////////////////////////////////////// -->
    <!-- START CONTENT -->
    <div class="ifr-dody">
 
        <form action="<%=basePath%>normal/adminRoleAuthorityAction!list.action"
            method="post" id="queryForm">
            <!-- <s:hidden name="pageNo" id="pageNo"></s:hidden> -->
            <input type="hidden" id="pageNo" name="pageNo" value="${pageNo}"/>
            <!-- <s:hidden name="username_para" id="username_para"></s:hidden> -->
            <input type="hidden" id="username_para" name="username_para" value="${username_para}"/>
        </form>
        
        <!-- //////////////////////////////////////////////////////////////////////////// -->
        <!-- START CONTAINER -->
        <div class="ifr-con">
            <h3>角色权限配置</h3>
            
            <%@ include file="include/alert.jsp"%>
 
            <div class="row">
                <div class="col-md-12">
                    <!-- Start Panel -->
                    <div class="panel panel-default">
                        <div class="panel-title">权限列表</div>
                        <div class="panel-body ">
                        
                            <form class="form-horizontal"
                                action="<%=basePath%>normal/adminRoleAuthorityAction!update.action"
                                method="post" name="mainForm" id="mainForm">
                                
                                <!-- <s:hidden name="username_para" id="username_para"></s:hidden> -->
                                <input type="hidden" id="username_para" name="username_para" value="${username_para}"/>
                                <!-- <s:hidden name="id" id="id"></s:hidden> -->
                                <input type="hidden" id="id" name="id" value="${id}"/>
                                <input type="hidden" id="role_resource_checked" value="${role_resource}" />
                                
                                <div class="form-group">
                                
                                    <table class="table table-bordered table-striped">
                                    
                                        <thead>
                                            <tr>
                                                <td width="200px">模块</td>
                                                <td>权限</td>
                                            </tr>
                                        </thead>
                                        
                                        <tbody>
                                            <!-- <s:iterator value="auth_datas" status="stat"> -->
                                            <c:forEach items="${auth_datas}" var="item" varStatus="stat">
                                                <tr>
                                                    <td>
                                                        <div class="checkbox checkbox-success checkbox-inline">
                                                            <input type="checkbox"
                                                                id="inlineCheckbox12_${item.model}"
                                                                value="${item.model}"
                                                                onClick="modelChecked(this)"> 
                                                                <label for="inlineCheckbox12_${item.model}">
                                                                    ${item.model_name}
                                                                </label>
                                                        </div>
                                                    </td>
                                                    <td data-model="${item.model}" id="model_content_${item.model}">
                                                            <!-- <s:iterator value="contents" status="content_stat" id="content"> -->
                                                            <c:forEach items="${contents}" var="item" varStatus="content_stat">
                                                                <div class="checkbox checkbox-success checkbox-inline">
                                                                    <input type="checkbox"
                                                                        id="inlineCheckbox12_${#item.res_string}"
                                                                        name="role_resource"
                                                                        value="${#item.res_string}"
                                                                        onClick="resourceChecked(this)"> 
                                                                    <label for="inlineCheckbox12_${#item.res_string}">
                                                                        ${#item.res_string}
                                                                    </label>
                                                                </div>
                                                            <!-- </s:iterator> -->
                                                            </c:forEach>
                                                        </td>
                                                </tr>
                                            <!-- </s:iterator> -->
                                            </c:forEach>
                                        </tbody>
                                        
                                    </table>
                                    
                                </div>
                                
                                <div class="form-group">
                                    <div class="col-sm-offset-2 col-sm-10">
                                        <a href="javascript:goUrl(${pageNo})"
                                            class="btn">取消</a> <a href="javascript:submit()"
                                            class="btn btn-default">保存</a>
                                    </div>
                                </div>
                                
                            </form>
                        </div>
 
                    </div>
                    <!-- End Panel -->
 
                </div>
            </div>
 
        </div>
        <!-- END CONTAINER -->
        <!-- //////////////////////////////////////////////////////////////////////////// -->
 
        <%@ include file="include/footer.jsp"%>
 
    </div>
    <!-- End Content -->
    <!-- //////////////////////////////////////////////////////////////////////////// -->
 
    <%@ include file="include/js.jsp"%>
 
    <script type="text/javascript">
        function update_value(code, snotes, svalue) {
            document.getElementById("change_value").value = svalue;
            document.getElementById("titlediv").innerText = snotes;
            $("#code").val(code);
            $('#modal_set').modal("show");
        }
    </script>
 
    <script type="text/javascript">
        function submit() {
            swal({
                title : "是否保存?",
                text : "",
                type : "warning",
                showCancelButton : true,
                confirmButtonColor : "#DD6B55",
                confirmButtonText : "确认",
                closeOnConfirm : false
            }, function() {
                document.getElementById("mainForm").submit();
            });
 
        }
        init();
        function init() {
            var resources = $("#role_resource_checked").val();
            $.each(resources.split(","), function(index, value) {//默认选中
                $("#inlineCheckbox12_" + value).prop("checked", "checked");
            });
            $.each($("td[name='model_content']"), function(index, value) {//默认选中
                modelContentChecked(value);
            });
        }
        function modelContentChecked(value) {
            var input_size = $(value).find("input").size();//未选中长度
            var input_checked_size = $(value).find("input:checked").size();//已选中长度
            var model = $(value).attr("data-model");
            if (input_size == input_checked_size) {
                $("#inlineCheckbox12_" + model).prop("checked", "checked");
            } else {
                $("#inlineCheckbox12_" + model).removeAttr("checked");
            }
        }
        function modelChecked(obj) {
            var model = $(obj).val();
            if ($(obj).is(":checked")) {
                $.each($("#model_content_" + model).find("input"), function(index, value) {
                    $(value).prop("checked", "checked");
                    ;
                });
            } else {
                $.each($("#model_content_" + model).find("input"), function(index, value) {
                    $(value).removeAttr("checked");
                });
            }
        }
        function resourceChecked(obj) {
            modelContentChecked($(obj).parents("td").first());
        }
    </script>
    
</body>
 
</html>