list.jsp
6.2 KB
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
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="<%=basePath %>resource/css/base.css" rel="stylesheet">
<link rel="stylesheet" href="<%=basePath %>resource/easyui/uimaker/easyui.css">
<link rel="stylesheet" type="text/css" href="<%=basePath %>resource/easyui/uimaker/icon.css">
<link rel="stylesheet" href="<%=basePath %>resource/css/providers.css">
<link href="<%=basePath %>resource/ztree/css/zTreeStyle/zTreeStyle.css" rel="stylesheet" type='text/css'/>
<!-- validate 验证中英文 -->
<script type="text/javascript" src="<%=basePath %>resource/validate/jquery.validate-${pageContext.response.locale}.js"></script>
</head>
<body>
<div class="container">
<table id="dg" style="width:100%;" title="<spring:message code="role.list"/>" data-options="
rownumbers:true,
singleSelect:false,
autoRowHeight:false,
pagination:true,
fitColumns:true,
striped:true,
collapsible:true,
toolbar:'#tb',
pageSize:10">
<thead>
<tr>
<th field="id" checkbox="true"></th>
<th field="rolename" sortable="true" width="110"><spring:message code="role.name"/></th>
<th field="rolecode" width="112"><spring:message code="role.code"/></th>
<th field="description" width="112" formatter="rowformater"><spring:message code="role.description"/></th>
<th field="editauthority" width="112"><spring:message code="role.editauthority"/></th>
<!-- <th field="." formatter="editFormat" width="25"><spring:message code="role.authority"/></th> -->
</tr>
</thead>
</table>
<div id="restartDialog" class="easyui-dialog" title="<spring:message code="role.authority"/>" style="width: 600px; height: 380px;"
data-options="iconCls:'pag-list',modal:true,collapsible:false,minimizable:false,maximizable:false,resizable:false,closed:true">
<div style="margin-left: 5px;margin-right: 5px;margin-top: 5px;">
<div class="data-tips-info">
<div class="data-tips-tip icon-tip">
<input type="hidden" id="roleId" value="" />
</div>
</div>
<div class="modal-body">
<ul style="height: 250px; overflow-Y: scroll;" id="ztree" class="ztree"></ul>
</div>
<div style="text-align: center">
<button type="submit" class="easyui-linkbutton l-btn l-btn-small l-btn-selected " data-options="selected:true" onclick="postData()">
<span class="l-btn-left"><span class="l-btn-text"><spring:message code="opt.save"/></span></span>
</button>
<button class="easyui-linkbutton l-btn l-btn-small" onclick="cancel()"><span class="l-btn-left">
<span class="l-btn-text"><spring:message code="opt.cancel"/></span></span>
</button>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="<%=basePath %>resource/easyui/jquery.min.js"></script>
<script type="text/javascript" src="<%=basePath %>resource/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="<%=basePath %>resource/easyui/easyui-lang-${pageContext.response.locale}.js"></script>
<script type="text/javascript" src="<%=basePath %>resource/js/tools.js"></script>
<!--弹出层引入的JS-->
<script type="text/javascript" src="<%=basePath %>resource/layer-v3.0.3/layer/layer.js"></script>
<script src="<%=basePath %>resource/ztree/js/jquery.ztree.core.js"></script>
<script src="<%=basePath %>resource/ztree/js/jquery.ztree.excheck.js"></script>
<script type="text/javascript">
$(function(){
$('#dg').datagrid({
url:'<%=basePath %>system/role/grid.json',
queryParams:$("#searchForm").serializeJson(),
onLoadSuccess:function(data){
$("#dg").find("tbody").find("tr").find("td:eq(4)");
}
});
});
function rowformater(value, row, index){
console.log(row);
}
<%-- console.log($("#searchForm").serializeJson());
$.ajax({
url:'<%=basePath %>system/role/grid.json',
data:$("#searchForm").serializeJson(),
success:function(data){
console.log(data);
}
}); --%>
function editFormat(val,row,index){
var html='<a href="javascript:void(0)" style="text-decoration:none;" onclick="editRow('+row.id+')"><i class="iconfont"></i></a>'
return html;
}
function editRow(roleId){
$.get("<%=basePath %>/system/role/qryPermission",{id:roleId,time:new Date().getTime()},function(data){
ztree = $.fn.zTree.init(tree, setting, data.data);
},"json");
$("#roleId").val(roleId);
$("#restartDialog").dialog('open');
}
var setting = {
check: {
enable: true,
chkboxType:{"Y" : "ps", "N" : "ps"}
},
data: {simpleData: {enable: true}}
};
var tree = $("#ztree");
var ztree;
function postData(){
var ids = [];
var checkeds = ztree.getCheckedNodes(true);
if(checkeds) {
for(var i = 0;i<checkeds.length;i++) {
ids.push(checkeds[i].id);
}
}
if(ids.length == 0) {
layer.open({content:"<spring:message code="opt.selectone"/>!"});
return;
}
$.post("<%=basePath %>/system/role/savePermission",{roleId:$("#roleId").val(),permission:ids.join(",")},function(data){
if(data.status == 200) {
layer.open({content:"<spring:message code="opt.savesuccess"/>!"});
$("#restartDialog").dialog('close');
}else{
layer.open({content:"<spring:message code="opt.savefailed"/>!"});
}
},"json");
}
function cancel(){
$("#restartDialog").dialog('close');
}
</script>
</body>
</html>