index.vue
23 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
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
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
<template>
<div class="app-container">
<!-- 可视化大屏 -->
<div class="box-view" v-loading="loading" element-loading-text="Loading..."
element-loading-svg-view-box="-10, -10, 50, 50" element-loading-background="#081138">
<!-- 标题 -->
<div class="big-view-container-title">
<div class="big-view-container-time">
<text>
{{ timeTaskObject.titleNowDateObject }}
</text>
</div>
</div>
<!-- 签到信息 -->
<div class="big-view-container-global-info common-style">
<div v-for=" (item, index) in globalInfoBoxList" :key="index" class="global-info-box">
<div class="global-info-box-container">
<div class="global-info-box-container-left">
<img :src="item.icon" />
</div>
<div class="global-info-box-container-right">
<div class="global-info-box-container-right-title">
{{ item.title }}
</div>
<div class="global-info-box-container-right-number">
<count-to ref="scrollNumber" :start-val="item.startNumber" :end-val="item.endNumber" :duration="8000"
:decimals="0" />
</div>
</div>
</div>
</div>
</div>
<!-- 信息提示 -->
<div class="big-view-container-prompt-info common-style">
<div class="prompt-info-left-box">
<div v-for="(item, index) in signStyleColor" :key="index" class="zone-left-prompt-info small-box">
<div class="label-box" :style="item">
</div>
<div class="label-txt">{{ item.label }}</div>
</div>
</div>
<div class="prompt-info-right-box">
<div class="first-right-prompt-info">
数据更新时间:{{ timeTaskObject.updateDateObject }}
</div>
<div class="second-right-prompt-info">
更新倒计时:{{ timeTaskObject.updateDateSchedulerObject }}
</div>
</div>
</div>
<!-- 主要内容 -->
<div class="big-view-container-main-content common-style">
<!-- 车队信息 -->
<div v-for="(item, index) in fleetInfoList" :key="item.title" class="fleet-common-style">
<!-- 车队title -->
<div class="fleet-top-container">
<div class="fleet-top-box"></div>
<div class="fleet-top-title">{{ item.title }}</div>
</div>
<!-- 内容盒子 -->
<div class="fleet-content-box">
<!-- 线路信息 -->
<div v-for="(childItem, childIndex) in item.fleetInfos" :key="childItem.lineName"
class="fleet-line-info-container">
<div class="fleet-line-title">
{{ childItem.lineName }}
</div>
<div ref="fleetNbbmInfoContainer" class="fleet-nbbm-info-container">
<div v-for="(sunItem, sunIndex) in childItem.lineInfos" :key="sunItem.nbbm" class="fleet-nbbm-info-item">
<div v-if="sunItem.saleInfoVo != null" class="fleet-nbbm-info-have-sale">
<el-popover popper-class="fleet-popover-style" placement="top" :title="childItem.lineName"
:width="300" :show-after="300" @after-enter="alterEnterHandler(sunItem.driverInfoVo.jobCode)">
<ConstForm :showFlag="personSignInfo.jobCode == sunItem.driverInfoVo.jobCode"
:jobCode="sunItem.driverInfoVo.jobCode" />
<template #reference>
<div class="fleet-nbbm-have-sale-driver" :style="signStyleColor[sunItem.driverInfoVo.signStatus]">
</div>
</template>
</el-popover>
<div class="fleet-nbbm-have-sale-txt-box">
<span class="fleet-nbbm-have-sale-txt">{{ sunItem.nbbm }}</span>
</div>
<el-popover popper-class="fleet-popover-style" placement="top" :title="childItem.lineName"
:width="300" :show-after="300" @after-enter="alterEnterHandler(sunItem.saleInfoVo.jobCode)">
<ConstForm :showFlag="personSignInfo.jobCode == sunItem.saleInfoVo.jobCode"
:jobCode="sunItem.saleInfoVo.jobCode" />
<template #reference>
<div class="fleet-nbbm-have-sale-sale" :style="signStyleColor[sunItem.saleInfoVo.signStatus]">
</div>
</template>
</el-popover>
</div>
<el-popover v-else :show-after="300" @after-enter="alterEnterHandler(sunItem.driverInfoVo.jobCode)"
placement="top" :title="childItem.lineName" popper-class="fleet-popover-style" :width="300">
<ConstForm :showFlag="personSignInfo.jobCode == sunItem.driverInfoVo.jobCode"
:jobCode="sunItem.driverInfoVo.jobCode" />
<template #reference>
<div class="fleet-nbbm-info-no-sale" :style="signStyleColor[sunItem.driverInfoVo.signStatus]">
<span class="fleet-nbbm-info-no-sale-text">
{{ sunItem.nbbm }}
</span>
</div>
</template>
</el-popover>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script setup name="Index">
import { queryLineInfo, querySignInfoByType } from '@/api/big_view/big_view.js';
import ConstForm from '@/components/ConstForm/index.vue';
import getWeek from "@/utils/dateUtils.js";
import moment from 'moment';
import { nextTick, onMounted, reactive, watch } from 'vue';
import { CountTo } from 'vue3-count-to';
// 图片信息 直接写路径会有问题 打包的时候vite构建会导出路径找不到
import icon2 from "../../assets/bigview/image-icon-1.png";
import icon3 from "../../assets/bigview/image-icon-2.png";
import icon4 from "../../assets/bigview/image-icon-3.png";
import icon5 from "../../assets/bigview/image-icon-4.png";
import icon6 from "../../assets/bigview/image-icon-5.png";
import icon1 from "../../assets/bigview/image-icon-6.png";
const loading = ref(true);
/** 签到信息 */
const personSignInfo = reactive(
{
jobCode: null,
date: null
}
);
/** 定时更新对象 */
const timeTaskObject = reactive(
{
/** 当前日期 */
titleNowDateObject: "0000-00-00 星期日 00:00:00",
/** 数据更新日期 */
updateDateObject: "0000-00-00 00:00:00",
/** 数据更新计时 5分钟 */
updateDateSchedulerObject: "0:00"
}
);
/** 定时任务 */
const timeTask = reactive(
{ /** 当前日期 */
titleNowDateTimer: null,
/** 数据更新计时 5分钟 */
updateDateSchedulerTimer: null
}
)
// 全局信息List
const globalInfoBoxList = reactive(
[
{
title: "设备数",
icon: icon1,
startNumber: 0,
endNumber: 0
},
{
title: "线路数",
icon: icon2,
startNumber: 0,
endNumber: 0
},
{
title: "车辆数",
icon: icon3,
startNumber: 0,
endNumber: 0
},
{
title: "售票员签到",
icon: icon4,
startNumber: 0,
endNumber: 0
},
{
title: "驾驶员签到",
icon: icon5,
startNumber: 0,
endNumber: 0
},
{
title: "辅助人员签到",
icon: icon6,
startNumber: 0,
endNumber: 0
},
]
)
// 提示信息样式对照表
const signStyleColor = ref(
[
{
backgroundColor: "#10A0DD",
label: "今日签到正常"
},
{
border: "2px solid #0761ba",
label: "今日打卡未签"
},
{
backgroundColor: "#ffa500",
label: "今日打卡迟到"
},
{
backgroundColor: "#ff0000",
label: "今日酒测异常"
}
]
)
// 车队信息List
const fleetInfoList = ref(
[
{
title: "一车队",
fleetInfos: []
},
{
title: "二车队",
fleetInfos: []
},
{
title: "三车队",
fleetInfos: []
}
]
)
// 元素信息
const fleetNbbmInfoContainer = ref(null);
const scrollNumber = ref(null);
// 计算宽度初始化数据
onMounted(() => {
handleUpdateDataRequest();
timeTask.titleNowDateTimer = startUpdateNowDateTimerTaskScheduler();
timeTask.updateDateSchedulerTimer = startUpdateDataTaskScheduler();
})
/** 销毁之前触发 */
onDeactivated(() => {
clearInterval(timeTask.titleNowDateTimer)
clearInterval(timeTask.updateDateSchedulerTimer)
})
/** 组件不挂载之前触发 */
onBeforeUnmount(() => {
clearInterval(timeTask.titleNowDateTimer)
clearInterval(timeTask.updateDateSchedulerTimer)
})
/**
* 开启当前日期更新
* @param {*} val
*/
const startUpdateNowDateTimerTaskScheduler = () => {
return setInterval(() => {
const currentDay = moment(new Date());
timeTaskObject.titleNowDateObject = currentDay.format("yyyy-MM-DD ") + getWeek(currentDay) + currentDay.format(" HH:mm:ss");
}, 1000);
}
/**
* 数据更新日期
* @param {*} val
*/
const startUpdateDataTaskScheduler = () => {
let duration;
// 目标日期时间
let targetDate;
// 当前日期时间
let currentDate;
return setInterval(() => {
currentDate = moment();
if (timeTaskObject.updateDateSchedulerObject <= "0:00") {
const updateMinutes = 5
timeTaskObject.updateDateSchedulerObject = `${updateMinutes}:00`;
targetDate = moment().add(updateMinutes, 'minutes');
timeTaskObject.updateDateObject = currentDate.format("yyyy-MM-DD HH:mm:ss");
}
// 计算剩余时间
duration = moment.duration(targetDate.diff(currentDate));
// 获取剩余的分钟数和秒数
const minutes = Math.floor(duration.asMinutes()) % 60;
let seconds = Math.floor(duration.asSeconds()) % 60;
seconds = seconds < 10 ? "0" + seconds : seconds;
// 格式化倒计时字符串
timeTaskObject.updateDateSchedulerObject = `${minutes}:${seconds}`;
}, 1000);
}
/**
* 显示弹窗
* @param {*} val 工号
*/
const alterEnterHandler = (val, el) => {
personSignInfo.jobCode = val;
}
/** 监听数据更新日期 */
watch(timeTaskObject.updateDateObject, (val1, val2) => {
// TODO 发送请求更新数据
handleUpdateDataRequest();
console.log("时间到了,需要更新数据---");
})
/**
* 类型 device 设备数量 line 线路数 car 车辆数
* sale 售票员签到数量 driver 驾驶员签到 auxiliary 辅助人员签到数量
*/
const handleUpdateDataRequest = () => {
// 获取设备数量
querySignInfoByType("device").then(res => {
handleGlobalInfo(res.data, 0)
})
// 获取线路数
querySignInfoByType("line").then(res => {
handleGlobalInfo(res.data, 1)
})
// 获取车辆数
querySignInfoByType("car").then(res => {
handleGlobalInfo(res.data, 2)
})
// 售票员签到
querySignInfoByType("sale").then(res => {
handleGlobalInfo(res.data, 3)
})
// 驾驶员签到
querySignInfoByType("driver").then(res => {
handleGlobalInfo(res.data, 4)
})
// 辅助人员签到
querySignInfoByType("auxiliary").then(res => {
handleGlobalInfo(res.data, 5)
})
//获取车队
queryLineInfo().then(res => {
fleetInfoList.value = res.data
nextTick(() => {
const containerElement = fleetNbbmInfoContainer.value;
if (containerElement != null) {
containerElement.forEach((el) => {
const nbbmHaveSaleInfo = el.firstElementChild.firstElementChild;
if ("fleet-nbbm-info-have-sale" == nbbmHaveSaleInfo.className) {
const textWidth = nbbmHaveSaleInfo.children[1].firstElementChild.offsetWidth;
// 有售票员
for (let index = 0; index < el.children.length; index++) {
const element = el.children[index];
element.style.width = `${textWidth}px`;
}
// 无售票员
} else {
const textWidth = nbbmHaveSaleInfo.firstElementChild.offsetWidth;
for (let index = 0; index < el.children.length; index++) {
const element = el.children[index];
element.style.width = `${textWidth}px`;
}
}
})
loading.value = false;
} else {
loading.value = false;
}
})
})
}
const handleGlobalInfo = (data, num) => {
globalInfoBoxList[num].startNumber = globalInfoBoxList[num].endNumber;
globalInfoBoxList[num].endNumber = data;
}
</script>
<style scoped lang="scss">
// 可视化大屏
.app-container {
width: 100%;
height: 100%;
background-color: #081138;
padding: 0 !important;
box-sizing: border-box;
// min-height: 900px;
// min-width: 1600px;
.box-view {
width: 100%;
height: 100%;
// 整体蓝色背景
background-image: url("@/assets/bigview/back.png");
background-size: cover;
background-repeat: no-repeat;
background-position: cover;
color: whitesmoke;
box-sizing: border-box;
padding: 0 1.5vw 1.5vw 1.5vw;
background-size: 100% 100%;
// min-height: 900px;
// min-width: 1600px;
.common-style {
padding-top: clamp(1rem, -1.5rem + 2.5vh, 2rem);
box-sizing: border-box;
}
// 标题
.big-view-container-title {
height: 7%;
width: 100%;
font-size: clamp(0.7rem, 0.489rem + 1.05vw, 1.2rem);
display: flex;
justify-content: flex-end;
align-items: center;
box-sizing: border-box;
.big-view-container-time {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: flex-end;
margin-top: 3%;
box-sizing: border-box;
}
}
// 全局信息
.big-view-container-global-info {
height: 11%;
width: 100%;
font-size: clamp(0.3rem, -2.531rem + 19.69vw, 1.1rem);
display: flex;
justify-content: center;
align-items: center;
.global-info-box {
flex-grow: 1;
width: 100%;
height: 100%;
display: flex;
margin-right: clamp(0.7rem, 0.489rem + 1.05vw, 1.2rem);
background-image: url('@/assets/bigview/bottom-box-small.png');
background-repeat: no-repeat;
background-size: 100% 100%;
justify-content: center;
align-items: center;
.global-info-box-container {
width: 100%;
height: 100%;
padding: clamp(0.3rem, 0.2rem + 0.5vw, 0.6rem);
display: flex;
justify-content: center;
align-items: center;
.global-info-box-container-left {
// icon
flex-grow: 1;
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: flex-end;
box-sizing: border-box;
margin-right: clamp(0.3rem, 0.2rem + 0.5vw, 0.6rem);
}
.global-info-box-container-left img {
height: clamp(4rem, 3.713rem + 2vw, 4.1rem);
width: clamp(4rem, 3.713rem + 2vw, 4.1rem);
}
.global-info-box-container-right {
// icon
flex-grow: 1;
width: 100%;
height: clamp(4rem, 3.713rem + 2vw, 4.1rem);
display: flex;
flex-direction: column;
justify-content: space-between;
overflow-x: visible;
.global-info-box-container-right-title {
white-space: nowrap;
}
.global-info-box-container-right-number {
font-weight: bold;
color: aqua;
}
}
}
}
/* 取消最后一个盒子的右侧间距 */
.global-info-box:last-child {
margin-right: 0;
}
}
// 提示信息
.big-view-container-prompt-info {
font-size: 1vw;
box-sizing: border-box;
width: 100%;
height: 4.5%;
display: flex;
align-items: center;
.prompt-info-left-box {
display: flex;
height: 100%;
width: 100%;
justify-content: flex-start;
align-items: center;
.zone-left-prompt-info {
.label-box {
height: 100%;
width: 3vw;
margin-right: clamp(0.5rem, -2.5rem + 30vw, 1.1rem);
}
}
.small-box {
margin-right: 3vw;
width: 10vw;
height: 2vh;
box-sizing: border-box;
display: flex;
justify-content: flex-start;
align-items: center;
.label-txt {
white-space: nowrap;
}
}
}
.prompt-info-right-box {
height: 100%;
width: 100%;
display: flex;
align-items: center;
justify-content: flex-end;
.first-right-prompt-info {
white-space: nowrap;
}
.second-right-prompt-info {
white-space: nowrap;
}
}
}
// 主要内容
.big-view-container-main-content {
width: 100%;
height: calc(85% - clamp(0.7rem, 0.489rem + 1.05vw, 1.2rem) * 3);
display: flex;
font-size: clamp(0.6rem, -0.907rem + 5.71vw, 1.2rem);
// 通用样式
.fleet-common-style {
flex-grow: 1;
width: 33.3%;
height: 100%;
background-image: url("@/assets/bigview/bottom-box.png");
margin-right: clamp(0.7rem, 0.489rem + 1.05vw, 1.2rem);
background-size: 100% 100%;
box-sizing: border-box;
padding: clamp(0.6rem, 0.489rem + 1.05vw, 1rem);
.fleet-top-container {
display: flex;
box-sizing: border-box;
align-items: center;
.fleet-top-box {
height: clamp(0.5rem, -0.907rem + 5.71vw, 0.8rem);
width: clamp(0.5rem, -0.907rem + 5.71vw, 0.8rem);
display: flex;
justify-content: center;
align-items: center;
background-color: aqua;
margin-right: clamp(0.4rem, 0.489rem + 1.05vw, 0.7rem);
}
.fleet-top-title {
display: flex;
justify-content: center;
align-items: center;
}
}
.fleet-content-box {
height: calc(100% - clamp(0.6rem, -0.907rem + 5.71vw, 1.2rem));
width: 100%;
overflow-y: scroll;
overflow-x: hidden;
// 线路信息
.fleet-line-info-container {
width: 100%;
height: auto;
.fleet-line-title {
margin: clamp(0.8rem, -0.549rem + 4.09vw, 1.2rem) 0 clamp(0.8rem, -0.549rem + 4.09vw, 1.2rem) 0;
box-sizing: border-box;
font-weight: bold;
}
.fleet-nbbm-info-container {
width: 100%;
height: auto;
box-sizing: border-box;
display: flex;
flex-wrap: wrap;
font-size: 0.8vw;
.fleet-nbbm-info-item {
// width: 6vw;
height: 2.4vh;
margin-right: 0.4vw;
box-sizing: border-box;
margin-top: 0.4vw;
color: white;
.fleet-nbbm-info-have-sale {
width: 100%;
height: 100%;
display: flex;
.fleet-nbbm-have-sale-driver {
border-radius: 1 solid #0761ba;
height: 100%;
width: 100%;
margin-right: 0.2vw;
position: relative;
display: flex;
align-items: center;
}
.fleet-nbbm-have-sale-sale {
border-radius: 1 solid #0761ba;
width: 100%;
height: 100%;
}
.fleet-nbbm-have-sale-txt-box {
position: relative;
display: flex;
justify-content: center;
align-items: center;
.fleet-nbbm-have-sale-txt {
position: absolute;
width: auto;
/* 防止文字换行 */
white-space: nowrap;
padding-left: 0.5vw;
padding-right: 0.5vw;
/** 防止元素遮挡 */
pointer-events: none;
}
}
}
.fleet-nbbm-info-no-sale {
width: 100%;
height: 100%;
border-radius: 1 solid #0761ba;
position: relative;
display: flex;
justify-content: center;
align-items: center;
box-sizing: border-box;
/* 防止文字换行 */
.fleet-nbbm-info-no-sale-text {
position: absolute;
width: auto;
white-space: nowrap;
padding-left: 0.5vw;
padding-right: 0.5vw;
/* 防止文字换行 */
}
}
}
.fleet-nbbm-info-item:last-child {
margin-right: 0;
}
}
}
}
/* 定义滚动条样式 */
.fleet-content-box::-webkit-scrollbar {
width: 6px;
height: 6px;
}
/*定义滑块 内阴影+圆角*/
.fleet-content-box::-webkit-scrollbar-thumb {
border-radius: 6px;
// box-shadow: inset 0 0 0px rgba(237, 44, 37, .5);
background-color: #01366c;
background-image: url('../assets/bigview/scroll-box.png');
}
/* 设置滚动条拖拽按钮的样式 */
.fleet-content-box::-webkit-scrollbar-thumb:vertical {
background-image: url('../assets/bigview/scroll-box.png');
background-color: #0761ba;
/* 背景图片的尺寸适应滑块 */
background-size: cover;
}
.fleet-content-box::-webkit-scrollbar-button {
display: none;
}
/*定义滚动条轨道 内阴影+圆角*/
.fleet-content-box::-webkit-scrollbar-track {
box-shadow: inset 0 0 0px #01DEDD;
border-radius: 6px;
background-color: #121622;
}
}
.fleet-common-style:last-child {
margin-right: 0;
}
}
}
}
</style>
<style>
.fleet-popover-style {
color: white !important;
margin: 10px 0 10px 0;
min-width: 100px;
}
.el-popover.fleet-popover-style {
border-color: #146EBD;
background-color: #062a5ac5;
/* background:
-webkit-linear-gradient(top, transparent 14px, blue 15px),
-webkit-linear-gradient(left, transparent 14px, blue 15px);
background-size: 15px 15px; */
}
.fleet-popover-style .el-popover__title {
color: #FFFFF0;
font-weight: bold;
}
.el-popper[data-popper-placement^=top]>.el-popper__arrow::before {
border-top-color: #062B5A !important;
background-color: #062B5A !important;
}
</style>