myapp_evenfuture 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/Dockerfile +7 -0
- package/app.js +58 -0
- package/bin/www +91 -0
- package/package.json +20 -0
- package/public/css/layui.css +1 -0
- package/public/css/lizhi.webp +0 -0
- package/public/css/modules/code.css +1 -0
- package/public/css/modules/laydate/default/laydate.css +1 -0
- package/public/css/modules/layer/default/icon-ext.png +0 -0
- package/public/css/modules/layer/default/icon.png +0 -0
- package/public/css/modules/layer/default/layer.css +1 -0
- package/public/css/modules/layer/default/loading-0.gif +0 -0
- package/public/css/modules/layer/default/loading-1.gif +0 -0
- package/public/css/modules/layer/default/loading-2.gif +0 -0
- package/public/font/iconfont.eot +0 -0
- package/public/font/iconfont.svg +554 -0
- package/public/font/iconfont.ttf +0 -0
- package/public/font/iconfont.woff +0 -0
- package/public/font/iconfont.woff2 +0 -0
- package/public/layui.js +5 -0
- package/public/stylesheets/style.css +8 -0
- package/routes/api.js +505 -0
- package/routes/datatime.js +17 -0
- package/routes/db.js +158 -0
- package/routes/index.js +28 -0
- package/routes/nppBackup/sql.js.2024-07-08_082213.bak +25 -0
- package/routes/nppBackup/sql.js.2024-07-08_082214.bak +25 -0
- package/routes/sql.js +25 -0
- package/routes/switch.js +28 -0
- package/routes/switch1.js +12 -0
- package/views/addstu.ejs +276 -0
- package/views/error.ejs +4 -0
- package/views/hisinfo.ejs +301 -0
- package/views/hisinfo1.ejs +301 -0
- package/views/login.ejs +203 -0
- package/views/modroom.ejs +405 -0
- package/views/modstu.ejs +327 -0
- package/views/rtinfo.ejs +234 -0
- package/views/rtinfo1.ejs +234 -0
@@ -0,0 +1,301 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
|
4
|
+
<head>
|
5
|
+
<meta charset="utf-8">
|
6
|
+
<title>签到管理系统</title>
|
7
|
+
<meta name="renderer" content="webkit">
|
8
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
9
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
10
|
+
<link href="/css/layui.css" rel="stylesheet">
|
11
|
+
</head>
|
12
|
+
|
13
|
+
<body>
|
14
|
+
<div class="layui-layout layui-layout-admin">
|
15
|
+
<div class="layui-header">
|
16
|
+
<div class="layui-logo layui-hide-xs " style="background-color: rgb(146, 151, 209); color: black" ;>签到管理系统
|
17
|
+
</div>
|
18
|
+
|
19
|
+
<ul class="layui-nav layui-layout-right" style="color:black">
|
20
|
+
<li class="layui-nav-item layui-hide layui-show-sm-inline-block">
|
21
|
+
<a href="javascript:;">
|
22
|
+
<img src="/css/lizhi.webp" class="layui-nav-img">
|
23
|
+
<!-- tester -->
|
24
|
+
</a>
|
25
|
+
<dl class="layui-nav-child">
|
26
|
+
<!-- <dd><a href="javascript:;">修改登录密码</a></dd>
|
27
|
+
<dd><a href="javascript:;">修改绑定手机</a></dd> -->
|
28
|
+
<!-- <dd><a href="javascript:;">登出</a></dd> -->
|
29
|
+
<dd><a href="/">退出登录</a></dd>
|
30
|
+
</dl>
|
31
|
+
</li>
|
32
|
+
<li class="layui-nav-item" lay-header-event="menuRight" lay-unselect>
|
33
|
+
<a href="javascript:;">
|
34
|
+
<i class="layui-icon layui-icon-more-vertical"></i>
|
35
|
+
</a>
|
36
|
+
</li>
|
37
|
+
</ul>
|
38
|
+
</div>
|
39
|
+
|
40
|
+
<div class="layui-side " style="background-color: rgb(146, 151, 209)">
|
41
|
+
<div class="layui-side-scroll">
|
42
|
+
<!-- 左侧导航区域(可配合layui已有的垂直导航) -->
|
43
|
+
|
44
|
+
<ul class="layui-nav layui-nav-tree" lay-filter="test" style="background-color:rgb(146, 151, 209) ">
|
45
|
+
<!-- Swipe -->
|
46
|
+
<li class="layui-nav-item"><a href="/switch" style="color:rgb(0, 0, 0)">实时签到信息</a></li>
|
47
|
+
<!-- 实时签到信息只统计当天的 -->
|
48
|
+
<li class="layui-nav-item layui-this "><a href="hisinfo" style="color:rgb(0, 0, 0)">历史签到信息</a></li>
|
49
|
+
|
50
|
+
<li class="layui-nav-item "><a href="modstu" style="color:rgb(0, 0, 0)">用户管理</a></li>
|
51
|
+
<li class="layui-nav-item "><a href="modroom" style="color: black;">房间管理</a></li>
|
52
|
+
</ul>
|
53
|
+
</div>
|
54
|
+
</div>
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
<div class="layui-body" style="height: 100%">
|
59
|
+
<div class="layui-form-item">
|
60
|
+
<div class="layui-inline">
|
61
|
+
<label class="layui-form-label" style="white-space: nowrap; margin-top: 25px;">日期时间范围</label>
|
62
|
+
<div class="layui-input-inline" style="width: 300px; margin-top: 25px;">
|
63
|
+
<input type="text" class="layui-input" id="timerange" placeholder=" - ">
|
64
|
+
</div>
|
65
|
+
|
66
|
+
</div>
|
67
|
+
<div class="layui-inline" style="margin-top: 25px;">
|
68
|
+
<label class="layui-form-label" style="white-space: nowrap;">房间号</label>
|
69
|
+
<div class="layui-input-inline" style="width: 70px;">
|
70
|
+
<input type="text" class="layui-input" id="roomnum">
|
71
|
+
</div>
|
72
|
+
<button id="searchRoom" class="layui-btn" type="button"
|
73
|
+
style="background-color:rgb(100, 109, 214); color:black;">查询</button>
|
74
|
+
</div>
|
75
|
+
<div class="layui-inline" style="margin-top: 25px;">
|
76
|
+
<label class="layui-form-label" style="white-space: nowrap;">学号</label>
|
77
|
+
<div class="layui-input-inline" style="width: 100px;">
|
78
|
+
<input type="text" class="layui-input" id="stuid" >
|
79
|
+
</div>
|
80
|
+
<button id="searchStu" class="layui-btn" type="button"
|
81
|
+
style="background-color:rgb(100, 109, 214); color:black;">查询</button>
|
82
|
+
</div>
|
83
|
+
<div class="layui-inline" style="float: right; margin-top: 25px;">
|
84
|
+
<button id="chartshow" class="layui-btn" type="button"
|
85
|
+
style="background-color:rgb(100, 109, 214); color:black;" lay-filter="chartshow">出勤统计
|
86
|
+
</button>
|
87
|
+
</div>
|
88
|
+
</div>
|
89
|
+
|
90
|
+
<table class="layui-table" id="record" lay-filter="demot1">
|
91
|
+
</table>
|
92
|
+
</div>
|
93
|
+
|
94
|
+
<div class="layui-footer">
|
95
|
+
学习是一种信仰。
|
96
|
+
</div>
|
97
|
+
</div>
|
98
|
+
|
99
|
+
<div class="layui-row layui-col-md4" style="width:400px;height: auto; margin:auto;display:none;" id="chart">
|
100
|
+
<canvas id="myChart"></canvas>
|
101
|
+
<table lay-even lay-skin="nob" style="float: right">
|
102
|
+
<tbody>
|
103
|
+
<tr>
|
104
|
+
<td>正常:</td>
|
105
|
+
<td><label name="normalper" id="normalper" style="float: right"></label></td>
|
106
|
+
</tr>
|
107
|
+
<tr>
|
108
|
+
<td>迟到:</td>
|
109
|
+
<td><label name="lateper" id="lateper" style="float: right"></label></td>
|
110
|
+
</tr>
|
111
|
+
</tbody>
|
112
|
+
</table>
|
113
|
+
</div>
|
114
|
+
|
115
|
+
<script src="/layui.js"></script>
|
116
|
+
<script src="https://cdn.bootcss.com/blueimp-md5/2.10.0/js/md5.js"></script>
|
117
|
+
<script src="https://cdn.bootcss.com/Chart.js/2.7.3/Chart.js"></script>
|
118
|
+
|
119
|
+
<script>
|
120
|
+
//JS
|
121
|
+
layui.use(['element', 'layer', 'util', 'table', 'laydate'], function () {
|
122
|
+
var element = layui.element;
|
123
|
+
var layer = layui.layer;
|
124
|
+
var util = layui.util;
|
125
|
+
var table = layui.table;
|
126
|
+
var laydate = layui.laydate;
|
127
|
+
var $ = layui.$;
|
128
|
+
var returnMessage;
|
129
|
+
// var $ = layui.jquery;
|
130
|
+
var ctx = document.getElementById('myChart').getContext('2d');
|
131
|
+
|
132
|
+
$(function () {
|
133
|
+
$('#timerange').val(sessionStorage.getItem("timerange"));
|
134
|
+
});
|
135
|
+
|
136
|
+
laydate.render({
|
137
|
+
elem: '#timerange'
|
138
|
+
, type: 'datetime'
|
139
|
+
, range: true
|
140
|
+
, done: function (value, date, endDate) {
|
141
|
+
sessionStorage.setItem("timerange", value);
|
142
|
+
value = value.split(" - ");
|
143
|
+
$.ajax({
|
144
|
+
type: 'post',
|
145
|
+
url: '/api/timesearch',
|
146
|
+
data: {
|
147
|
+
bt: value[0],
|
148
|
+
et: value[1],
|
149
|
+
sign: 1
|
150
|
+
},
|
151
|
+
success: function (data) {
|
152
|
+
top.location.href = '';
|
153
|
+
top.location.reload();
|
154
|
+
}
|
155
|
+
});
|
156
|
+
}
|
157
|
+
});
|
158
|
+
|
159
|
+
$(document).on('click', '#searchStu', function () {
|
160
|
+
var stuid = $('#stuid').val();
|
161
|
+
var searchUrl = '/api/recordlist?stuid=' + stuid;
|
162
|
+
|
163
|
+
table.reload('abc', {
|
164
|
+
url: searchUrl
|
165
|
+
});
|
166
|
+
});
|
167
|
+
|
168
|
+
$(document).on('click', '#searchRoom', function () {
|
169
|
+
var roomnum = $('#roomnum').val();
|
170
|
+
var stuid = $('#stuid').val();
|
171
|
+
var searchUrl = '/api/recordlist?room=' + roomnum + '&stuid=' + stuid;
|
172
|
+
|
173
|
+
table.reload('abc', {
|
174
|
+
url: searchUrl
|
175
|
+
});
|
176
|
+
});
|
177
|
+
|
178
|
+
$(document).on('click', '#chartshow', function () {
|
179
|
+
var myChart = new Chart(ctx, {
|
180
|
+
type: 'pie',
|
181
|
+
data: {
|
182
|
+
labels: ['正常', '迟到'],
|
183
|
+
datasets: [{
|
184
|
+
label: '示例',
|
185
|
+
data: [sessionStorage.getItem("normal"), sessionStorage.getItem("late")],
|
186
|
+
backgroundColor: ['#6469D6', '#FA8258'],
|
187
|
+
borderWidth: 1
|
188
|
+
}]
|
189
|
+
}
|
190
|
+
})
|
191
|
+
$('#normalper').html(((parseInt(sessionStorage.getItem("normal")) / (parseInt(sessionStorage.getItem("normal")) + parseInt(sessionStorage.getItem("late")))) * 100).toFixed(2) + '%');
|
192
|
+
$('#lateper').html(((parseInt(sessionStorage.getItem("late")) / (parseInt(sessionStorage.getItem("normal")) + parseInt(sessionStorage.getItem("late")))) * 100).toFixed(2) + '%');
|
193
|
+
layer.open({
|
194
|
+
type: 1,
|
195
|
+
id: 5,
|
196
|
+
title: "出勤统计",
|
197
|
+
area: ['35%', '50%'],
|
198
|
+
content: $("#chart"),
|
199
|
+
});
|
200
|
+
});
|
201
|
+
|
202
|
+
//头部事件
|
203
|
+
util.event('lay-header-event', {
|
204
|
+
menuLeft: function (othis) { // 左侧菜单事件
|
205
|
+
layer.msg('展开左侧菜单的操作', { icon: 0 });
|
206
|
+
},
|
207
|
+
menuRight: function () { // 右侧菜单事件
|
208
|
+
layer.open({
|
209
|
+
type: 1,
|
210
|
+
title: '作者',
|
211
|
+
content: '<div style="padding: 15px;">信息工程学院<br/>祝乙文,姜莱</div>',
|
212
|
+
area: ['150px', '100%'],
|
213
|
+
offset: 'rt', // 右上角
|
214
|
+
anim: 'slideLeft', // 从右侧抽屉滑出
|
215
|
+
shadeClose: true,
|
216
|
+
scrollbar: false
|
217
|
+
});
|
218
|
+
}
|
219
|
+
});
|
220
|
+
|
221
|
+
table.render({
|
222
|
+
elem: '#record',
|
223
|
+
url: '/api/recordlist',
|
224
|
+
toolbar: true,
|
225
|
+
title: '签到记录',
|
226
|
+
totalRow: true,
|
227
|
+
page: true,
|
228
|
+
id: 'abc',
|
229
|
+
limit: 10,
|
230
|
+
limits: [5, 10, 20, 30],
|
231
|
+
initSort: {
|
232
|
+
field: 'time',
|
233
|
+
type: 'desc'
|
234
|
+
},
|
235
|
+
parseData: function (res) { //res 即为原始返回的数据
|
236
|
+
var current_pages;
|
237
|
+
if (this.page === true) current_pages = 1;
|
238
|
+
else current_pages = this.page.curr;
|
239
|
+
var data = res.data.slice(this.limit * (current_pages - 1), this.limit * current_pages);
|
240
|
+
return {
|
241
|
+
"code": res.code,
|
242
|
+
"msg": res.msg,
|
243
|
+
"count": res.data.length,
|
244
|
+
"data": data
|
245
|
+
}
|
246
|
+
},
|
247
|
+
sort: true,
|
248
|
+
cols: [
|
249
|
+
[{
|
250
|
+
field: 'stuid',
|
251
|
+
title: '学号',
|
252
|
+
width: 130,
|
253
|
+
sort: true
|
254
|
+
}, {
|
255
|
+
field: 'name',
|
256
|
+
title: '姓名',
|
257
|
+
width: 130
|
258
|
+
}, {
|
259
|
+
field: 'type',
|
260
|
+
title: '类型',
|
261
|
+
width: 130,
|
262
|
+
sort: true
|
263
|
+
}, {
|
264
|
+
field: 'room',
|
265
|
+
title: '教室',
|
266
|
+
width: 130
|
267
|
+
}, {
|
268
|
+
field: 'time',
|
269
|
+
title: '签到时间',
|
270
|
+
sort: true
|
271
|
+
}, {
|
272
|
+
field: 'qd',
|
273
|
+
title: '签到情况',
|
274
|
+
sort: true
|
275
|
+
}]
|
276
|
+
],
|
277
|
+
done: function (res, curr, count) {
|
278
|
+
$.ajax({
|
279
|
+
type: 'get',
|
280
|
+
url: '/api/chartcheck',
|
281
|
+
success: function (data) {
|
282
|
+
sessionStorage.setItem("late", data.la);
|
283
|
+
sessionStorage.setItem("normal", data.no);
|
284
|
+
}
|
285
|
+
});
|
286
|
+
$.each(res.data, function (index, item) {
|
287
|
+
if (item.qd == '迟到') {
|
288
|
+
$("#record").next().find('tbody tr[data-index="' + index +
|
289
|
+
'"]').css("background-color", "#FFA07A");
|
290
|
+
}
|
291
|
+
});
|
292
|
+
}
|
293
|
+
});
|
294
|
+
|
295
|
+
|
296
|
+
});
|
297
|
+
</script>
|
298
|
+
|
299
|
+
</body>
|
300
|
+
|
301
|
+
</html>
|
@@ -0,0 +1,301 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
|
4
|
+
<head>
|
5
|
+
<meta charset="utf-8">
|
6
|
+
<title>签到管理系统</title>
|
7
|
+
<meta name="renderer" content="webkit">
|
8
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
9
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
10
|
+
<link href="/css/layui.css" rel="stylesheet">
|
11
|
+
</head>
|
12
|
+
|
13
|
+
<body>
|
14
|
+
<div class="layui-layout layui-layout-admin">
|
15
|
+
<div class="layui-header">
|
16
|
+
<div class="layui-logo layui-hide-xs " style="background-color: rgb(146, 151, 209); color: black" ;>签到管理系统
|
17
|
+
</div>
|
18
|
+
|
19
|
+
<ul class="layui-nav layui-layout-right" style="color:black">
|
20
|
+
<li class="layui-nav-item layui-hide layui-show-sm-inline-block">
|
21
|
+
<a href="javascript:;">
|
22
|
+
<img src="/css/lizhi.webp" class="layui-nav-img">
|
23
|
+
<!-- tester -->
|
24
|
+
</a>
|
25
|
+
<dl class="layui-nav-child">
|
26
|
+
<!-- <dd><a href="javascript:;">修改登录密码</a></dd>
|
27
|
+
<dd><a href="javascript:;">修改绑定手机</a></dd> -->
|
28
|
+
<!-- <dd><a href="javascript:;">登出</a></dd> -->
|
29
|
+
<dd><a href="/">退出登录</a></dd>
|
30
|
+
</dl>
|
31
|
+
</li>
|
32
|
+
<li class="layui-nav-item" lay-header-event="menuRight" lay-unselect>
|
33
|
+
<a href="javascript:;">
|
34
|
+
<i class="layui-icon layui-icon-more-vertical"></i>
|
35
|
+
</a>
|
36
|
+
</li>
|
37
|
+
</ul>
|
38
|
+
</div>
|
39
|
+
|
40
|
+
<div class="layui-side " style="background-color: rgb(146, 151, 209)">
|
41
|
+
<div class="layui-side-scroll">
|
42
|
+
<!-- 左侧导航区域(可配合layui已有的垂直导航) -->
|
43
|
+
|
44
|
+
<ul class="layui-nav layui-nav-tree" lay-filter="test" style="background-color:rgb(146, 151, 209) ">
|
45
|
+
<!-- Swipe -->
|
46
|
+
<li class="layui-nav-item"><a href="/switch1" style="color:rgb(0, 0, 0)">实时签到信息</a></li>
|
47
|
+
<!-- 实时签到信息只统计当天的 -->
|
48
|
+
<li class="layui-nav-item layui-this "><a href="hisinfo1" style="color:rgb(0, 0, 0)">历史签到信息</a></li>
|
49
|
+
|
50
|
+
<!-- <li class="layui-nav-item "><a href="modstu" style="color:rgb(0, 0, 0)">用户管理</a></li>
|
51
|
+
<li class="layui-nav-item "><a href="modroom" style="color: black;">房间管理</a></li> -->
|
52
|
+
</ul>
|
53
|
+
</div>
|
54
|
+
</div>
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
<div class="layui-body" style="height: 100%">
|
59
|
+
<div class="layui-form-item">
|
60
|
+
<div class="layui-inline">
|
61
|
+
<label class="layui-form-label" style="white-space: nowrap; margin-top: 25px;">日期时间范围</label>
|
62
|
+
<div class="layui-input-inline" style="width: 300px; margin-top: 25px;">
|
63
|
+
<input type="text" class="layui-input" id="timerange" placeholder=" - ">
|
64
|
+
</div>
|
65
|
+
|
66
|
+
</div>
|
67
|
+
<div class="layui-inline" style="margin-top: 25px;">
|
68
|
+
<label class="layui-form-label" style="white-space: nowrap;">房间号</label>
|
69
|
+
<div class="layui-input-inline" style="width: 70px;">
|
70
|
+
<input type="text" class="layui-input" id="roomnum">
|
71
|
+
</div>
|
72
|
+
<button id="searchRoom" class="layui-btn" type="button"
|
73
|
+
style="background-color:rgb(100, 109, 214); color:black;">查询</button>
|
74
|
+
</div>
|
75
|
+
<div class="layui-inline" style="margin-top: 25px;">
|
76
|
+
<label class="layui-form-label" style="white-space: nowrap;">学号</label>
|
77
|
+
<div class="layui-input-inline" style="width: 100px;">
|
78
|
+
<input type="text" class="layui-input" id="stuid" >
|
79
|
+
</div>
|
80
|
+
<button id="searchStu" class="layui-btn" type="button"
|
81
|
+
style="background-color:rgb(100, 109, 214); color:black;">查询</button>
|
82
|
+
</div>
|
83
|
+
<div class="layui-inline" style="float: right; margin-top: 25px;">
|
84
|
+
<button id="chartshow" class="layui-btn" type="button"
|
85
|
+
style="background-color:rgb(100, 109, 214); color:black;" lay-filter="chartshow">出勤统计
|
86
|
+
</button>
|
87
|
+
</div>
|
88
|
+
</div>
|
89
|
+
|
90
|
+
<table class="layui-table" id="record" lay-filter="demot1">
|
91
|
+
</table>
|
92
|
+
</div>
|
93
|
+
|
94
|
+
<div class="layui-footer">
|
95
|
+
学习是一种信仰。
|
96
|
+
</div>
|
97
|
+
</div>
|
98
|
+
|
99
|
+
<div class="layui-row layui-col-md4" style="width:400px;height: auto; margin:auto;display:none;" id="chart">
|
100
|
+
<canvas id="myChart"></canvas>
|
101
|
+
<table lay-even lay-skin="nob" style="float: right">
|
102
|
+
<tbody>
|
103
|
+
<tr>
|
104
|
+
<td>正常:</td>
|
105
|
+
<td><label name="normalper" id="normalper" style="float: right"></label></td>
|
106
|
+
</tr>
|
107
|
+
<tr>
|
108
|
+
<td>迟到:</td>
|
109
|
+
<td><label name="lateper" id="lateper" style="float: right"></label></td>
|
110
|
+
</tr>
|
111
|
+
</tbody>
|
112
|
+
</table>
|
113
|
+
</div>
|
114
|
+
|
115
|
+
<script src="/layui.js"></script>
|
116
|
+
<script src="https://cdn.bootcss.com/blueimp-md5/2.10.0/js/md5.js"></script>
|
117
|
+
<script src="https://cdn.bootcss.com/Chart.js/2.7.3/Chart.js"></script>
|
118
|
+
|
119
|
+
<script>
|
120
|
+
//JS
|
121
|
+
layui.use(['element', 'layer', 'util', 'table', 'laydate'], function () {
|
122
|
+
var element = layui.element;
|
123
|
+
var layer = layui.layer;
|
124
|
+
var util = layui.util;
|
125
|
+
var table = layui.table;
|
126
|
+
var laydate = layui.laydate;
|
127
|
+
var $ = layui.$;
|
128
|
+
var returnMessage;
|
129
|
+
// var $ = layui.jquery;
|
130
|
+
var ctx = document.getElementById('myChart').getContext('2d');
|
131
|
+
|
132
|
+
$(function () {
|
133
|
+
$('#timerange').val(sessionStorage.getItem("timerange"));
|
134
|
+
});
|
135
|
+
|
136
|
+
laydate.render({
|
137
|
+
elem: '#timerange'
|
138
|
+
, type: 'datetime'
|
139
|
+
, range: true
|
140
|
+
, done: function (value, date, endDate) {
|
141
|
+
sessionStorage.setItem("timerange", value);
|
142
|
+
value = value.split(" - ");
|
143
|
+
$.ajax({
|
144
|
+
type: 'post',
|
145
|
+
url: '/api/timesearch',
|
146
|
+
data: {
|
147
|
+
bt: value[0],
|
148
|
+
et: value[1],
|
149
|
+
sign: 1
|
150
|
+
},
|
151
|
+
success: function (data) {
|
152
|
+
top.location.href = '';
|
153
|
+
top.location.reload();
|
154
|
+
}
|
155
|
+
});
|
156
|
+
}
|
157
|
+
});
|
158
|
+
|
159
|
+
$(document).on('click', '#searchStu', function () {
|
160
|
+
var stuid = $('#stuid').val();
|
161
|
+
var searchUrl = '/api/recordlist?stuid=' + stuid;
|
162
|
+
|
163
|
+
table.reload('abc', {
|
164
|
+
url: searchUrl
|
165
|
+
});
|
166
|
+
});
|
167
|
+
|
168
|
+
$(document).on('click', '#searchRoom', function () {
|
169
|
+
var roomnum = $('#roomnum').val();
|
170
|
+
var stuid = $('#stuid').val();
|
171
|
+
var searchUrl = '/api/recordlist?room=' + roomnum + '&stuid=' + stuid;
|
172
|
+
|
173
|
+
table.reload('abc', {
|
174
|
+
url: searchUrl
|
175
|
+
});
|
176
|
+
});
|
177
|
+
|
178
|
+
$(document).on('click', '#chartshow', function () {
|
179
|
+
var myChart = new Chart(ctx, {
|
180
|
+
type: 'pie',
|
181
|
+
data: {
|
182
|
+
labels: ['正常', '迟到'],
|
183
|
+
datasets: [{
|
184
|
+
label: '示例',
|
185
|
+
data: [sessionStorage.getItem("normal"), sessionStorage.getItem("late")],
|
186
|
+
backgroundColor: ['#6469D6', '#FA8258'],
|
187
|
+
borderWidth: 1
|
188
|
+
}]
|
189
|
+
}
|
190
|
+
})
|
191
|
+
$('#normalper').html(((parseInt(sessionStorage.getItem("normal")) / (parseInt(sessionStorage.getItem("normal")) + parseInt(sessionStorage.getItem("late")))) * 100).toFixed(2) + '%');
|
192
|
+
$('#lateper').html(((parseInt(sessionStorage.getItem("late")) / (parseInt(sessionStorage.getItem("normal")) + parseInt(sessionStorage.getItem("late")))) * 100).toFixed(2) + '%');
|
193
|
+
layer.open({
|
194
|
+
type: 1,
|
195
|
+
id: 5,
|
196
|
+
title: "出勤统计",
|
197
|
+
area: ['35%', '50%'],
|
198
|
+
content: $("#chart"),
|
199
|
+
});
|
200
|
+
});
|
201
|
+
|
202
|
+
//头部事件
|
203
|
+
util.event('lay-header-event', {
|
204
|
+
menuLeft: function (othis) { // 左侧菜单事件
|
205
|
+
layer.msg('展开左侧菜单的操作', { icon: 0 });
|
206
|
+
},
|
207
|
+
menuRight: function () { // 右侧菜单事件
|
208
|
+
layer.open({
|
209
|
+
type: 1,
|
210
|
+
title: '作者',
|
211
|
+
content: '<div style="padding: 15px;">信息工程学院<br/>祝乙文,姜莱</div>',
|
212
|
+
area: ['150px', '100%'],
|
213
|
+
offset: 'rt', // 右上角
|
214
|
+
anim: 'slideLeft', // 从右侧抽屉滑出
|
215
|
+
shadeClose: true,
|
216
|
+
scrollbar: false
|
217
|
+
});
|
218
|
+
}
|
219
|
+
});
|
220
|
+
|
221
|
+
table.render({
|
222
|
+
elem: '#record',
|
223
|
+
url: '/api/recordlist',
|
224
|
+
toolbar: true,
|
225
|
+
title: '签到记录',
|
226
|
+
totalRow: true,
|
227
|
+
page: true,
|
228
|
+
id: 'abc',
|
229
|
+
limit: 10,
|
230
|
+
limits: [5, 10, 20, 30],
|
231
|
+
initSort: {
|
232
|
+
field: 'time',
|
233
|
+
type: 'desc'
|
234
|
+
},
|
235
|
+
parseData: function (res) { //res 即为原始返回的数据
|
236
|
+
var current_pages;
|
237
|
+
if (this.page === true) current_pages = 1;
|
238
|
+
else current_pages = this.page.curr;
|
239
|
+
var data = res.data.slice(this.limit * (current_pages - 1), this.limit * current_pages);
|
240
|
+
return {
|
241
|
+
"code": res.code,
|
242
|
+
"msg": res.msg,
|
243
|
+
"count": res.data.length,
|
244
|
+
"data": data
|
245
|
+
}
|
246
|
+
},
|
247
|
+
sort: true,
|
248
|
+
cols: [
|
249
|
+
[{
|
250
|
+
field: 'stuid',
|
251
|
+
title: '学号',
|
252
|
+
width: 130,
|
253
|
+
sort: true
|
254
|
+
}, {
|
255
|
+
field: 'name',
|
256
|
+
title: '姓名',
|
257
|
+
width: 130
|
258
|
+
}, {
|
259
|
+
field: 'type',
|
260
|
+
title: '类型',
|
261
|
+
width: 130,
|
262
|
+
sort: true
|
263
|
+
}, {
|
264
|
+
field: 'room',
|
265
|
+
title: '教室',
|
266
|
+
width: 130
|
267
|
+
}, {
|
268
|
+
field: 'time',
|
269
|
+
title: '签到时间',
|
270
|
+
sort: true
|
271
|
+
}, {
|
272
|
+
field: 'qd',
|
273
|
+
title: '签到情况',
|
274
|
+
sort: true
|
275
|
+
}]
|
276
|
+
],
|
277
|
+
done: function (res, curr, count) {
|
278
|
+
$.ajax({
|
279
|
+
type: 'get',
|
280
|
+
url: '/api/chartcheck',
|
281
|
+
success: function (data) {
|
282
|
+
sessionStorage.setItem("late", data.la);
|
283
|
+
sessionStorage.setItem("normal", data.no);
|
284
|
+
}
|
285
|
+
});
|
286
|
+
$.each(res.data, function (index, item) {
|
287
|
+
if (item.qd == '迟到') {
|
288
|
+
$("#record").next().find('tbody tr[data-index="' + index +
|
289
|
+
'"]').css("background-color", "#FFA07A");
|
290
|
+
}
|
291
|
+
});
|
292
|
+
}
|
293
|
+
});
|
294
|
+
|
295
|
+
|
296
|
+
});
|
297
|
+
</script>
|
298
|
+
|
299
|
+
</body>
|
300
|
+
|
301
|
+
</html>
|