-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjilu.html
410 lines (384 loc) · 21.4 KB
/
jilu.html
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
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>员工工作日历考勤表</title>
<style type="text/css">
body {
margin: 20px;
padding: 20px;
/* background: #ddd; */
background-color:antiquewhite;
text-align:center
}
.everyWeekDay .weekday {
display: -moz-inline-box;
display: inline-block;
text-align: center;
/*height: 50px;*/
line-height: 26px;
width: 13.6%;
border: 1px solid transparent;
cursor: pointer;
box-sizing: border-box;
}
.everyDay .days { /*解决span不支持width属性*/
display: -moz-inline-box;
display: inline-block;
text-align: center;
/*height: 50px;*/
line-height: 50px;
width: 13.6%;
border: 1px solid transparent;
cursor: pointer;
box-sizing: border-box;
}
.col-md-8 {
align-self: center
}
.col-md-81 { align-self: center
}
.col-md-82 { align-self: center
}
.STYLE2 {
align-self: center;
font-family: "Courier New", Courier, monospace;
font-weight: bold;
}
.STYLE3 {
font-family: "Courier New", Courier, monospace;
font-weight: bold;
}
.col-md-83 { align-self: center
}
.col-md-84 { align-self: center
}
.col-md-85 { align-self: center
}
.col-md-86 { align-self: center
}
</style>
</head>
<body onLoad="time()">
<h1>
<script language="JavaScript">
function CurrentTime() {
var now = new Date(); //得到当前时间
var hh = now.getHours(); //取时
var mm = now.getMinutes(); //取分
var ss = now.getTime() % 60000; //取秒
ss = (ss - (ss % 1000)) / 1000; //整数秒
var clock = hh + ':'; //构造时间格式
if (mm < 10) clock += '0';
clock += mm + ':';
if (ss < 10) clock += '0';
clock += ss;
return (clock);
}</script>
</h1>
<div class="text">
<h1 align="justify"><span class="col-md-8">本月考勤记录 </span></h1>
<span class="col-md-8">{% csrf_token %} </span></div>
<form action="/jilu/" method="post">
<div class="STYLE2"> </div>
<div class="text STYLE3">
<div align="justify" class="col-md-8"><span class="col-md-8">本月打卡记录:{ {records}}</span></div>
</div>
<div class="col-md-8 text-left STYLE3"> </div>
<div class="text STYLE3">
<div align="justify" class="col-md-8"><span class="col-md-8">
本月迟到次数:{{late}}
<a href="./child1.html" title="迟到记录" target="_blank"> 迟到记录</a>
</span></div>
</div>
<div class="col-md-8 text-left STYLE3"> </div>
<div class="text STYLE3">
<div align="justify" class="col-md-8"><span class="col-md-8">
本月请假次数: {{leave}}
<a href="./child3.html" title="请假记录" target="_blank"> 请假记录</a>
</span></div>
</div>
<div class="text STYLE3">
<div align="justify" class="col-md-8"><span class="col-md-8">本月加班次数:{{extra}}</span></div>
</div>
<!--<div class="col-md-8 text-left">
<div align="justify" class="col-md-8"><span class="col-md-8"><br />
</span></div>-->
<div class="text STYLE3">
<div align="justify" class="col-md-8"><span class="col-md-8">本月早退次数:{{early}}
<a href="./child2.html" title="早退记录" target="_blank">早退记录</a> </span></div>
</div>
<div class="col-md-8 text-left STYLE3">
<div align="justify" class="col-md-8"></div>
</div>
<div class="text STYLE3">
<div align="justify" class="col-md-8"><span class="col-md-8">本月出差次数:{{business}}
<a href="./child4.html" title="出差记录" target="_blank">出差记录</a></span></div>
</div>
<!--<div class="col-md-8 text-left STYLE3">
<div align="justify" class="col-md-8"><span class="col-md-8"><br />
</span></div>-->
</div>
<div class="text STYLE3">
<div align="justify" class="col-md-8"><span class="col-md-8">本月出差天数:{{businesstime}}</span></div>
</div>
<div class="col-md-8 text-left">
<div align="justify" class="col-md-8"></div>
</div>
</div>
</form>
<form action="/jilu/" method="get">
<div>
<input type="submit" name="Submit" value="返回上页">
</div>
</form>
<div align="center"></div>
<div id="app">
<div style="position: absolute; width: 100%; border-radius: 5px; background-color:rgb(202, 237, 255); left: 21px; top: 417px; visibility: hidden;" id="dateOuter">
<div class="attendtittle" style="height: 51px;line-height: 51px;border-bottom: 1px solid #E6E6EB;">
<span style="margin-left: 16px;font-size: 16px;color: #333;font-weight: bold;">工作日历</span>
<span style="width: 44px;height: 24px;border: 1px solid #E6E6EB;padding:4px 8px;cursor: pointer;border-radius: 4px;font-size: 14px;color: #333;margin-left: 44px;" @click.prevent="getThisDay()">今天</span>
<span style="margin-left: 17px;color: #8E8E93;cursor: pointer;" @click.stop.prevent="lastMonthClick()"><</span>
<span style="margin-left: 18px;color: #8E8E93;cursor: pointer;" @click.stop.prevent="nextMonthClick()">></span>
<span style="font-size: 14px;color: #2D2D2D;margin-left: 17px;">{{checkYear}}年</span>
<span style="font-size: 14px;color: #2D2D2D;">{{checkMonth}}月</span></div>
<!--表体-->
<div id="attendwrap" style="height: 300px;">
<div id="attendwrapleft" style="width: 60%;float: left;">
<div class="everyWeekDay">
<span v-for="(item,index) in weekDays" class="weekday">
<span v-if="item=='日' || item=='六'" class="weekday" style="color:#0089FA;">{{item}}</span>
<span class="weekday" style="color:#888;" v-else>{{item}}</span> </span> </div>
<div class="everyDay">
<!--空白站位-->
<span v-for="item1 in ThisWeekDayCounrt" :key="item1" class="days"></span>
<!--这个月的天数-->
<span @click="getdate(item)" v-for="(item,index) in thisDayCount" class="days">
<span v-if="checkYear == nowYear && checkMonth == nowMonth && index+1 == nowDay" style="position: relative;">
<span v-if="cumWeekDayCounrt(index+1) == 6 || cumWeekDayCounrt(index+1) == 0" class="days" style="width:100%;cursor:pointer;"><span style="background-color:#4eccc4;color:#FFFFFF;padding:4px 10px;border-radius: 100%;">{{index+1}}</span></span>
<span v-else class="days" style="width:100%; cursor:pointer;border-radius: 100%;"><span style="background-color:#4eccc4;color:#FFFFFF;padding: 4px 10px;border-radius: 100%;">{{index+1}}</span></span>
<!--循环日历上面的状态-->
<span v-for="(item,_index) in calData">
<span v-if="item.date==index+1">
<span v-for="(val,_in) in item.type">
<span style="position: absolute;bottom: -12px;right:30px;border-radius: 100%;width: 6px;height: 6px;background: red;" v-if="val==0"></span>
<div v-if="val==1" :style="{position: 'absolute',bottom: '0px',right: 14*(_in+1)+'px',color: '#0089FA',fontSize: '12px'}">加</div>
<div v-if="val==2" :style="{position: 'absolute',bottom: '0px',right: 14*(_in+1)+'px',color: '#5856D6',fontSize: '12px'}">差</div>
<div v-if="val==3" :style="{position: 'absolute',bottom: '0px',right: 14*(_in+1)+'px',color: '#FF9500',fontSize: '12px'}">假</div>
<div v-if="val==4" :style="{position: 'absolute',bottom: '0px',right: 14*(_in+1)+'px',color: '#00A753',fontSize: '12px'}">节</div>
</span> </span> </span>
<!--循环日历上面的状态 over-->
</span>
<span v-else style="position: relative;">
<span v-if="cumWeekDayCounrt(index+1) == 6 || cumWeekDayCounrt(index+1) == 0" class="days" style="color:#0089FA;cursor:pointer;">{{index+1}}</span>
<span v-else style="cursor:pointer;">{{index+1}}</span>
<!--循环日历上面的状态-->
<span v-for="(item,_index) in calData">
<span v-if="item.date==index+1">
<span v-for="(val,_in) in item.type">
<span style="position: absolute;bottom: -10px;right:2px;border-radius: 100%;width: 6px;height: 6px;background: red;" v-if="val==0"></span>
<div v-if="val==1" :style="{position: 'absolute',bottom: '0px',right: -14*(_in+1)+'px',color: '#0089FA',fontSize: '12px'}">加</div>
<div v-if="val==2" :style="{position: 'absolute',bottom: '0px',right: -14*(_in+1)+'px',color: '#5856D6',fontSize: '12px'}">差</div>
<div v-if="val==3" :style="{position: 'absolute',bottom: '0px',right: -14*(_in+1)+'px',color: '#FF9500',fontSize: '12px'}">假</div>
<div v-if="val==4" :style="{position: 'absolute',bottom: '0px',right: -14*(_in+1)+'px',color: '#00A753',fontSize: '12px'}">节</div>
</span> </span> </span>
<!--循环日历上面的状态 over-->
</span> </span> </div>
</div>
<div id="attendwrapright" style="float: right;width: 39%;border-left: 1px solid #E6E6EB;height: 284px;margin-top: 8px;text-align: center;">
<!-- <div>
<div style="color: #5AC8FA;font-size: 54px;">12</div>
<div style="color: #75787B;font-size: 14px;">2017年12月</div>
<div style="color: #FF4C4D;font-size: 12px;margin-top: 6px;">出勤状态:异常</div>
<div style="margin-top: 16px;"><i>图</i><span style="color: #2D2D2D;font-size: 14px;">上班:</span><span style="color: #2D2D2D;font-size: 14px;">08:35:00(正常)</span></div>
<div style="margin-top: 20px;"><i>图</i><span style="color: #2D2D2D;font-size: 14px;">上班:</span><span style="color: #2D2D2D;font-size: 14px;">08:35:00(正常)</span></div>
<div style="margin-top: 20px;"><i>图</i><span style="color: #2D2D2D;font-size: 14px;">上班:</span><span style="color: #2D2D2D;font-size: 14px;">08:35:00(正常)</span></div>
<div style="margin-top: 20px;"><i>图</i><span style="color: #2D2D2D;font-size: 14px;">上班:</span><span style="color: #2D2D2D;font-size: 14px;">08:35:00(正常)</span></div>
</div>-->
<span class="col-md-8 text-left">07/14/2019</span></div>
</div>
<!--footer-->
<div style="height: 47px;border-top: 1px solid #E6E6EB;line-height: 47px;">
<span style="width: 6px;height: 6px;border-radius: 100%;background: red;display: inline-block;margin-left: 16px;"></span>
<span style="color: #666666;font-size: 13px;position: relative;top: 1px;line-height: 13px;">异常</span> </div>
</div>
</div>
<!--<script src="http://cdnjs.cloudflare.com/ajax/libs/vue/1.0.18/vue.min.js" type="text/javascript" charset="utf-8"></script>-->
<script src="{% static 'JS/vue.js' %}" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
new Vue({
el: '#app',
data: function () {
return {
date: new Date(),
nowYear: new Date().getFullYear(),
nowMonth: new Date().getMonth() + 1,
nowDay: new Date().getDate(),
splitString: "-",
weekDays: new Array("日", "一", "二", "三", "四", "五", "六"),
months: new Array("一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"),
lastDays: new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31),
checkYear: '',
checkMonth: '',
thisDayCount: '',//这个月有几天
ThisWeekDayCounrt: "",//这个周有多少天
calData: [],//真数据进行渲染页面
resData: [{//假数据 模拟后台反过来的数据
date: '1',
type: [1, 2],// 0、代表异常 1、代表加班 2、出差 3、假期 4、节日;
num: 4,//2、代表一天打两次卡 4、代表一天打四次卡
value: [
{
isflag: true,//正常
namevalue: "上午上班/08:35:00(正常)"
},
{
isflag: false,//异常
namevalue: "上午下班/08:35:00(早退)"
},
{
isflag: true,
namevalue: "下午上班/---"
},
{
isflag: true,
namevalue: "下午下班/---"
},
]
}, {
date: '2',
type: [0],// 0、代表异常 1、代表加班 2、出差 3、假期 4、节日;
num: 2,//2、代表一天打两次卡 4、代表一天打四次卡
value: [
{
isflag: true,//正常
namevalue: "上班/08:35:00(正常)"
},
{
isflag: false,//异常
namevalue: "下班/08:35:00(早退)"
},
]
}, {
date: '8',
type: [3],// 0、代表异常 1、代表加班 2、出差 3、假期 4、节日;
num: 2,//2、代表一天打两次卡 4、代表一天打四次卡
value: [
{
isflag: true,//正常
namevalue: "上班/08:35:00(正常)"
},
{
isflag: false,//异常
namevalue: "下班/08:35:00(早退)"
},
]
}, {
date: '9',
type: [4],// 0、代表异常 1、代表加班 2、出差 3、假期 4、节日;
num: 2,//2、代表一天打两次卡 4、代表一天打四次卡
value: [
{
isflag: true,//正常
namevalue: "上班/08:35:00(正常)"
},
{
isflag: false,//异常
namevalue: "下班/08:35:00(早退)"
},
]
}, {
date: '7',
type: [1],// 0、代表异常 1、代表加班 2、出差 3、假期 4、节日;
num: 2,//2、代表一天打两次卡 4、代表一天打四次卡
value: [
{
isflag: true,//正常
namevalue: "上班/08:35:00(正常)"
},
{
isflag: false,//异常
namevalue: "下班/08:35:00(早退)"
},
]
}]
}
},
computed: {
},
created: function () {
var _this = this;
_this.checkYear = _this.nowYear;
_this.checkMonth = _this.nowMonth;
setTimeout(function () {
//初始调用服务请求
_this.calData = _this.resData;
_this.getThisMonthDay(_this.checkYear, _this.checkMonth);
_this.getThisWeekDay(_this.checkYear, _this.checkMonth, 1)
}, 1000)
},
methods: {
getdate: function (item) {//点击天根据数据渲染右侧的内容
console.log(item)
},
getThisDay: function () { //返回今天 重新获取今天的数据渲染页面;
this.checkYear = this.nowYear;
this.checkMonth = this.nowMonth;
//请求数据 this.http;
this.requreData();
},
lastMonthClick: function () {//切换上一个月
if (this.checkMonth == 1) {
this.checkYear = this.checkYear - 1;
this.checkMonth = 12;
} else {
this.checkMonth = this.checkMonth - 1;
}
//请求数据 this.http;
this.requreData();
},
nextMonthClick: function () {//切换下一个月
if (this.checkMonth == 12) {
this.checkYear = this.checkYear + 1;
this.checkMonth = 1;
} else {
this.checkMonth = this.checkMonth + 1;
}
//请求数据 this.http;
this.requreData();
},
requreData: function () {
//请求数据 this.http;
this.getThisMonthDay(this.checkYear, this.checkMonth);
this.getThisWeekDay(this.checkYear, this.checkMonth, 1);
},
isLeapYear: function (year) {
var isLeap = false;
if (0 == year % 4 && ((year % 100 != 0) || (year % 400 == 0))) {
isLeap = true;
}
return isLeap;
},
getThisMonthDay: function (year, month) {
var thisDayCount = this.lastDays[month - 1];
if ((month == 2) && this.isLeapYear(year)) {
thisDayCount++;
}
this.thisDayCount = thisDayCount;
},
getThisWeekDay: function (year, month, date) {
var thisDate = new Date(year, month - 1, date);
this.ThisWeekDayCounrt = thisDate.getDay();
},
cumWeekDayCounrt: function (date) {
var thisDate = new Date(this.checkYear, this.checkMonth - 1, date);
return thisDate.getDay();
}
}
});
</script>
<div style="text-align:center;margin:50px 0; font:normal 14px/24px 'MicroSoft YaHei';">
<p>适用浏览器:360、FireFox、Chrome、Opera、傲游、搜狗、世界之窗. 不支持Safari、IE8及以下浏览器。</p>
</div>
</body>
</html>