list.vm
10.8 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
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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
<link rel="stylesheet" href="/assets/css/auth.css" />
<script type="text/javascript" src="/assets/js/jquery.js"></script>
<script type="text/javascript" src="/assets/js/jQuery-Form.js"></script>
<DIV id="navBar" title="auth">
<li><a href="$!{contextPath}/">首页</a><span class="divider">></span>
<a href="$!{contextPath}/titan/auth">认证管理</a></li>
</DIV>
<div class="btn-group pull-right" style="margin-bottom:6px">
<a class="btn btn-sm btn-primary" href="javascript:void(0)" id="addData"><i class="icon-pencil"></i>新增</a>
</div>
<!-- 表格数据 -->
<table class="table table-striped table-bordered table-condensed grid" style="text-align: center">
<thead>
<tr>
<th #sorting($!{auth} "name")>认证名称</th>
<th #sorting($!{auth} "authIcon")>认证图标</th>
<th #sorting($!{auth} "status")>状态</th>
<th>操作</th>
</tr>
</thead>
<tbody>
#foreach(${item} in ${page.result})
<tr>
<td>$!{item.name}</td>
<td><img src="$!{item.authIcon}" width="30px" height="30px"/></td>
<td>
#if($!{item.status} == 2)
已停用
#else
已启用
#end
</td>
<td class="textC">
<div class="btn-group">
#set($scopeIdstr="")
#set($i=1)
#foreach($scope in $!{item.scopeSet})
#set($scopeIdstr = $scopeIdstr + ${scope.getScopeId()})
#if($i < $!{item.scopeSet.size()})
#set($scopeIdstr = $scopeIdstr + ",")
#end
#set($i = $i + 1)
#end
<a href="javascript:void(0)" onClick="editData($!{item.id},'$!{item.name}','$!{scopeIdstr}','$!{item.authIcon}')"><i class="icon-pencil"></i>修改</a>
<a onClick="changeStates($!{item.id},$!{item.status})" href="javascript:void(0)"><i class="icon-pencil"></i>
#if($!{item.status} == 2)
启用
#else
停用
#end
</a>
</div>
</td>
</tr>
#end
</tbody>
</table>
<!-- 分页栏 -->
<script>
$(function(){
$('#uploadImg').live('change', function(){
//请求地址
jQuery("#imageForm").ajaxSubmit(function(result){
if(!result.succ){
XUI.window.alert(result.messg);
jQuery("#uploadImg").resetForm();
return false;
}
$("#authIcon_id").val(result.messg);
$("#icon_id").attr("src",result.messg);
});
});
//添加数据
$("#addData").click(function(){
$("#pop_title").html("新增");
$("#u54").show();
var winHeight = document.body.scrollHeight;
$("#mc_id").show();
$("#mc_id").height(winHeight);
});
$("#u71_input").click(function(){
if(document.getElementById("u71_input").checked){
$("#u72_input").attr("checked","checked");
}else{
$("#u72_input").removeAttr("checked");
}
});
$("#u72_input").click(function(){
if(document.getElementById("u72_input").checked){
$("#u71_input").attr("checked","checked");
}else{
$("#u71_input").removeAttr("checked");
}
});
//提交添加或修改的数据
$("#u68_input").click(function(){
var v = $("#addAuthForm");
var authName = $("#u65_input").val();
if(authName == ""){
XUI.window.alert("认证名称不能为空!");
return;
}
if(authName.length > 10){
XUI.window.alert("认证名称长度不能超过10个字符!");
return;
}
var message="请输入合法的认证名称(中文汉字、英文字母(含大小写)、数字、“/,(),&,《》,【】,[],=,+”)";
var regex=/^[0-9a-zA-Z\u4e00-\u9fa5/()()&《》【】\+=\]\[,]+$/g;
if (authName=="" || !regex.test(authName)) {
XUI.window.alert(message);
return false;
}
var authId = $("#authId").val();
if($("#authIcon_id").val() == ""){
XUI.window.alert("请选择认证图片!");
return false;
}
$.ajax({
type : 'post',
url : '$!{contextPath}/titan/auth/checkAuthName?name='+authName+'&authId='+authId,
async : false,
success : function(msg){
if(msg == "1"){
XUI.window.alert("该认证名称已经存在了!");
return;
}else if(msg == "2"){
XUI.window.alert("参数错误!");
return;
}else{
$("#name_id").val(authName);
var auth_scope="";
if(document.getElementById("u71_input").checked){
var dilizy = $("#u71_input").val();
auth_scope = dilizy;
}
if(document.getElementById("u72_input").checked){
var dilidx = $("#u72_input").val();
auth_scope = auth_scope + ','+dilidx;
}
if(document.getElementById("u73_input").checked){
var mmdj = $("#u73_input").val();
auth_scope = auth_scope + ','+mmdj;
}
if(auth_scope !=""){
$("#authScopeId").val(auth_scope);
}else{
XUI.window.alert("请选择经营范围!");
return;
}
if($("#authScopeId").val() == ""){
return;
}
v.submit();
}
}
});
});
$("#u60").click(function(){
$("#u65_input").val("");
$("#authId").val("");
$("#authIcon_id").val("");
$("#u71_input").removeAttr("checked");
$("#u73_input").removeAttr("checked");
$("#u72_input").removeAttr("checked");
$("#icon_id").attr("src","/img/auth/u45.png");
$("#u54").hide();
$("#mc_id").hide();
});
});
//修改数据
function editData( id, name, scopeIdStr, icon){
var winHeight = document.body.scrollHeight;
$("#mc_id").show();
$("#mc_id").height(winHeight);
$("#u54").show();
$("#pop_title").html("修改");
$("#u65_input").val(name);
$("#authId").val(id);
var scope = scopeIdStr.split(",");
for(var i=0;i<scope.length;++i){
if(scope[i] == 1){
$("#u71_input").prop("checked","checked");
}else if(scope[i] == 2){
$("#u72_input").prop("checked","checked");
}else if(scope[i] == 4){
$("#u73_input").prop("checked","checked");
}
}
$("#icon_id").attr("src",icon);
$("#authIcon_id").val(icon);
$("#authId").val(id);
}
function changeStates(id,states){
var content = "";
if(states == 1){
content = "确定要停用该认证吗?";
}else if(states == 2){
content = "确定要启用该认证吗?";
}
XUI.window.confirm(content, "认证确认窗口", function(){
$.ajax({
type : "post",
url : "/titan/auth/"+id+"?status="+states,
success : function(data){
if(data){
if(data == "success"){
window.location.href = "/titan/auth";
}else{
XUI.window.alert("操作失败,请刷新页面重试!");
}
}
},
error : function(){
XUI.window.alert("网络错误,请稍后重试");
}
});
});
}
</script>
<div style="width:100%; height:100%; opacity:0.5; background:#000; z-index:99; position: absolute; top: 0; display:none" id="mc_id"></div>
<div id="u54" style="display:none; z-index:999">
<div class="panel_state" id="u54_state0">
<div class="panel_state_content" id="u54_state0_content">
<div id="u55">
<img src="/img/auth/u55.png" class="img " id="u55_img">
<div class="text" id="u56">
<p><span> </span></p>
</div>
</div>
<div id="u57">
<img src="/img/auth/u57.png" class="img " id="u57_img">
<div class="text" id="u58">
<p><span style="font-family:'Arial Normal', 'Arial';font-weight:400;"> </span><span id="pop_title" style="font-family:'Arial Negreta', 'Arial';font-weight:700;">新增</span></p>
</div>
</div>
<div id="u59" style="cursor: pointer;">
<div class="text" id="u60">
<p><span>×</span></p>
</div>
</div>
<div id="u61">
<div class="text" id="u62">
<p><span>认证名称:</span></p>
</div>
</div>
<div id="u63">
<div class="text" id="u64">
<p><span>认证</span><span>图片</span><span>:</span></p>
</div>
</div>
<div id="u65">
<input type="text" name="name" id="u65_input">
</div>
<div class="ax_html__" id="u67">
<!-- <input type="file" value="上传" name="authIconFile" id="u67_input"> -->
<form id="imageForm" action="/titan/auth/uploadAuthIcon" enctype="multipart/form-data" method="POST">
<input name="image" type="file" id="uploadImg" value="上传图片" accept="image/gif,image/jpeg,image/png,image/jpg,image/bmp" style="line-height: normal;width:200px;"/>
</form>
</div>
<div id="u681">
<img src="/img/auth/u45.png" width="70px" height="60px" id="icon_id"></img>
</div>
<div class="ax_html__" id="u68" style="cursor: pointer;">
<input type="button" value="提交" id="u68_input" tabindex="0">
</div>
<div class="ax_文本" id="u69">
<div class="text" id="u70">
<p><span>运营范围</span><span></span><span>:</span></p>
</div>
</div>
<div class="ax_复选框" id="u71">
<label for="u71_input">
<div class="text" id="u72">
<p><span>自营</span></p>
</div>
</label>
<input type="checkbox" value="1" id="u71_input">
</div>
<div class="ax_复选框" id="u75">
<label for="u72_input">
<div class="text" id="u76">
<p><span>代销</span></p>
</div>
</label>
<input type="checkbox" value="2" id="u72_input">
</div>
<div class="ax_复选框" id="u73">
<label for="u73_input">
<div class="text" id="u74">
<p><span>买卖对接</span></p>
</div>
</label>
<input type="checkbox" value="4" id="u73_input">
<form id="addAuthForm" action="/titan/auth/save" method="post">
<input name="authScope" id="authScopeId" type="hidden">
<input name="id" id="authId" type="hidden">
<input type="hidden" name="name" id="name_id">
<input type="hidden" name="authIcon" id="authIcon_id">
</form>
</div>
</div>
</div>