unionShareUserApplys.html
12.9 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
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Yoho!Buy运营平台</title>
<script src="/union/js/include.js"></script>
<script src="/union/js/ajaxfileupload.js"></script>
</head>
<body class="easyui-layout" fit="true">
<div region="north" style="padding-bottom: 35px; height: auto;">
<script>
document.write(addHead('CPS联盟管理', 'CPS联盟用户申请管理'));
</script>
<form id="searchForm" method="post" accept-charset="utf-8">
<div style="margin-left: 10px;margin-top: 10px">
<label>用户ID:</label>
<input class="easyui-textbox" id="uid" name="uid"/>
<label>姓名:</label>
<input class="easyui-textbox" id="name" name="name"/>
<label>手机:</label>
<input class="easyui-textbox" id="mobile" name="mobile"/>
<label>社交媒体:</label>
<input class="easyui-combobox" id="socialMediaType" name="socialMediaType">
</input>
<label>社交媒体账号:</label>
<input class="easyui-textbox" id="socialMediaAccount" name="socialMediaAccount">
</input>
<label>状态:</label>
<input class="easyui-combobox" id="status" name="status"
data-options="valueField: 'value',
textField: 'label',
data: [{
label: '申请中',
value: '1'
},{
label: '通过',
value: '2'
},{
label: '拒绝',
value: '3'
}]">
</input>
</div>
<div style="margin-left: 10px;margin-top: 10px">
<label>开始时间:</label>
<input class="easyui-datetimebox" id="beginTime" name="beginTime">
</input>
<label>结束时间:</label>
<input class="easyui-datetimebox" id="endTime" name="endTime">
</input>
<a id="searchBtn" style="margin-left: 20px" class="easyui-linkbutton btn-primary" data-options="iconCls:'icon-more'">查询</a>
<a id="passButton" style="margin-left: 20px" class="easyui-linkbutton btn-primary" data-options="iconCls:'icon-more'">批量通过</a>
<a id="exportButton" style="margin-left: 20px" class="easyui-linkbutton btn-primary" data-options="iconCls:'icon-more'">导出</a>
</div>
</form>
</div>
<div region="center">
<div style="margin-left: 30px;margin-top: 20px; height: 500px;">
<table id="userApplyTable"></table>
</div>
</div>
<script type="text/javascript">
var checkedItems = [];
$(function () {
var _socialMediaTypeSelector = $("#socialMediaType");
$.ajax({
type: 'POST',
url: contextPath + "/UnionShareRest/getSocialMediaBasicParams",
//data: JSON.stringify(formData),
async: true,
dataType: 'json',
contentType: "application/json; charset=utf-8",
success: function(res) {
//$.messager.progress("close");
if (res.code == 200) {
if(res.data){
_socialMediaTypeSelector.combobox({valueField: 'type',
textField: 'name',
data:res.data.mediaType});
}
} else {
$.messager.alert("失败", res.message, "error");
}
},
error:function(res){
$.messager.alert("失败", "加载所属业务,请刷新页面重试", "error");
return false;
}
});
$("#userApplyTable").myDatagrid({
fit: true,
fitColumns: true,
<!-- idField: "id",-->
view: fileview,
nowrap: false,
onCheckAll: addcheckItem,
onCheck: addcheckItem,
onUncheckAll: removeAllItem,
onUncheck: removeSingleItem,
url: contextPath + "/UnionShareRest/queryUnionShareUserApplys",
method: 'POST',
loadFilter: function (data) {
var temp = defaultLoadFilter(data);
temp=null==temp?[]:temp;
temp.rows = temp.list;
return temp;
},
columns: [[{
title: "ID",
field: "id",
idField:"id",
width: 200,
align: "center",
checkbox: true
}, {
title: "用户ID",
field: "uid",
width: 200,
align: "center"
}, {
title: "姓名",
field: "name",
width: 200,
align: "center"
}, {
title: "手机号",
field: "mobile",
width: 200,
align: "center"
}, {
title: "社交媒体",
field: "socialMediaType",
width: 200,
align: "center"
}, {
title: "社交媒体账号",
field: "socialMediaAccount",
width: 200,
align: "center"
}, {
title: "社交媒体粉丝数",
field: "socialMediaFans",
width: 200,
align: "center"
}, {
title: "状态",
field: "statusStr",
width: 200,
align: "center"
}, {
title: "申请时间",
field: "createTime",
width: 200,
align: "center"
}, {
title: "审核时间",
field: "checkTime",
width: 200,
align: "center"
}, {
title: "操作",
field: "asdf",
width: 200,
align: "center",
formatter: function (value, rowData, rowIndex) {
//状态:1-申请中,2-通过,3-拒绝
if(rowData.status == 1) {
var str = "<a role='pass' dataId='" + rowData.id + "' style='margin-left:10px'>通过</a>";
str += "<a role='refuse' dataId='" + rowData.id + "' style='margin-left:10px'>拒绝</a>";
return str;
}
}
}
]],
cache: false,
pagination: true,
pageSize: 10,
pageList: [10],
idField: "id",
singleSelect: false,
checkOnSelect: false,
onLoadSuccess: function (data) {
resetSelectedCheckBox(data);
$(this).myDatagrid("getPanel").find("a[role='pass']").linkbutton({
iconCls: "icon-more",
onClick: function () {
var cancleId=$(this).attr("dataId");
pass(cancleId);
}
});
$(this).myDatagrid("getPanel").find("a[role='refuse']").linkbutton({
iconCls: "icon-more",
onClick: function () {
var cancleId=$(this).attr("dataId");
refuse(cancleId);
}
});
}
});
function pass(id) {
var paramObj={};
if(id==null) {
paramObj.ids = checkedItems.toString();
}else {
paramObj.id = id;
}
$.post(contextPath + "/UnionShareRest/agreeApply", paramObj, function (res) {
$.messager.progress("close");
if (res.code == 200) {
if(res.data > 0) {
$.messager.show({
title: "提示",
msg: "通过成功!",
height: 120
});
}else {
$.messager.alert("失败", "操作失败,请重新操作", "error");
}
$("#searchBtn").click();
} else {
$.messager.alert("失败", res.message, "error");
}
}, "json");
}
function refuse(id) {
var paramObj={};
if(id==null) {
paramObj.idArray = checkedItems;
}else {
paramObj.id = id;
}
$.post(contextPath + "/UnionShareRest/refuseApply", paramObj, function (res) {
$.messager.progress("close");
if (res.code == 200) {
if(res.data > 0) {
$.messager.show({
title: "提示",
msg: "拒绝成功!",
height: 120
});
}else {
$.messager.alert("失败", "操作失败,请重新操作", "error");
}
$("#searchBtn").click();
} else {
$.messager.alert("失败", res.message, "error");
}
}, "json");
}
function resetSelectedCheckBox(data){
$("input[type='checkbox'][name='id']").each(function () {
var cb=$(this);
$.each(checkedItems,function(index,value){
if(value==cb.val()){
cb.attr("checked",true);
return false;
}
});
});
}
$("#searchBtn").linkbutton({
iconCls : "icon-search",
onClick : function() {
checkedItems=[];
var param = getParams();
$("#userApplyTable").myDatagrid("load", param);
}
});
function addcheckItem() {
$("input[type='checkbox'][name='id']:checked").each(function () {
var k = findCheckedItem($(this).val());
if (k == -1) {
checkedItems.push($(this).val());
}
});
}
$("#passButton").linkbutton({
onClick : function() {
if (checkedItems.length == 0) {
$.messager.alert('提示','请选择要审核通过的数据');
return;
}
pass(null);
}
});
$("#exportButton").linkbutton({
onClick : function() {
window.open(contextPath + "/batch/export.do?type=unionShareApplyExportImpl&queryConf=" + escape(JSON.stringify(getParams())));
// window.open(contextPath + "/batch/export.do?type=unionShareApplyExportImpl&queryConf=" + getParams());
}
});
var fileview = $.extend({}, $.fn.datagrid.defaults.view, { onAfterRender: function (target) { isCheckItem(); } });
function getParams() {
var param = {
uid:$("#uid").val(),
name:$("#name").val(),
socialMediaType:$("#socialMediaType").combobox('getValue'),
socialMediaAccount:$("#socialMediaAccount").val(),
status:$("#status").combobox('getValue'),
mobile:$("#mobile").val()
};
if ($("#beginTime").datetimebox('getValue')!='')
{
param.beginTime = parseInt(new Date($("#beginTime").datetimebox('getValue')).getTime() / 1000)
}
if ($("#endTime").datetimebox('getValue') != ''){
param.endTime = parseInt(new Date($("#endTime").datetimebox('getValue')).getTime() / 1000)
}
return param;
}
function isCheckItem() {
for (var i = 0; i < checkedItems.length; i++) {
$("input[type='checkbox'][name='id'][value='"+checkedItems[i]+"']").attr("checked", "checked");
}
}
function findCheckedItem(ID) {
for (var i = 0; i < checkedItems.length; i++) {
if (checkedItems[i] == ID) return i;
}
return -1;
}
function removeAllItem(rows) {
$("input[type='checkbox'][name='id']").each(function () {
if (!this.checked) {
var k = findCheckedItem($(this).val());
if (k != -1) {
checkedItems.splice(k, 1);
}
}
});
}
function removeSingleItem(rowIndex, rowData) {
var k = findCheckedItem(rowData.id);
if (k != -1) {
checkedItems.splice(k, 1);
}
}
});
</script>
</body>
</html>