index.js
3.61 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
var indexJS = {};
var urls = {
"list": "/marketing/hapi/memberlist"
};
indexJS.list = function() {
var keyWord = $("#keyWord").val();
var status = $("input[id='status']:checked").val();
if(!status){
status = -1;
}
$("#page_div").hdpPages({
dataType: "JSON",
url: _REQUESTURL + urls.list,
pageable: { page: 1, size: 15 },
param: { keyWord: keyWord,status:status },
success: function(data, op) {
if (data.success && data.code == 2000) {
var context = "<thead>" +
"<tr>" +
"<th>注册时间</th>" +
"<th>姓名</th>" +
"<th>产品编号</th>" +
"<th>是否领取报告</th>" +
"<th>领取时间</th>" +
"</tr>" +
"</thead>";
op.count = data.content.count;
if (data.content.list) {
$.each(data.content.list, function(k, v) {
var create_atString = "";
if (v.createAt) {
var date = new Date(v.createAt);
create_atString =
date.getFullYear() + "-" +
(date.getMonth() + 1) + "-" +
date.getDate() + " " +
date.getHours() + ":" +
date.getMinutes() + ":" +
date.getSeconds();
}
var genereportAtString = "";
if (v.genereportAt) {
var date = new Date(v.genereportAt);
genereportAtString =
date.getFullYear() + "-" +
(date.getMonth() + 1) + "-" +
date.getDate() + " " +
date.getHours() + ":" +
date.getMinutes() + ":" +
date.getSeconds();
}
var genereport = "";
if(v.isGenereport == 1){
genereport = "已领取";
}
context = context +
"<tr>" +
" <td>" + _nullValue(create_atString) + "</td>" +
" <td>" + _nullValue(v.name) + "</td>" +
" <td>" + _nullValue(v.barcode) + "</td>" +
" <td>" + _nullValue(genereport) + "</td>" +
" <td>" + _nullValue(genereportAtString) + "</td>" +
"</tr>";
});
}
$("#data_table").html(context);
} else {
if (data.code == 503) {
logout();
} else {
alert("系统错误");
}
}
}
});
}
indexJS.list();
indexJS.reflashList = function() {
var keyWord = $("#keyWord").val();
var status = $("input[id='status']:checked").val();
if(!status){
status = -1;
}
$("#page_div").hdpPages("reSetParam", { keyWord: keyWord,status:status });
$("#page_div").hdpPages("reflash");
}
$(function() {
$(document).keypress(function(e) {
// 回车键事件
if (e.which == 13) {
indexJS.reflashList();
return;
}
});
});