alarmDetail.vue
20 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
<template>
<v-layout>
<template slot="breadcrumb">
<el-breadcrumb-item>统计报表</el-breadcrumb-item>
<el-breadcrumb-item>警情中心</el-breadcrumb-item>
<el-breadcrumb-item class="last">详情</el-breadcrumb-item>
<p style="font-weight:bold; padding-top: 10px;font-size:20px;">详情 <i v-if="detail.isAttention===1" class="fa fa-star focused"></i></p>
</template>
<template slot="main">
<div class="ibox">
<div class="ibox-title">
<h3>基本信息 </h3>
</div>
<div class="ibox-content">
<el-row class="base-info">
<el-col :span="12">
<label>姓名:</label>
<span>{{detail.name}}</span>
</el-col>
<el-col :span="12">
<label>申请编号:</label>
<span>{{detail.sqbh}}</span>
</el-col>
<el-col :span="12">
<label>门店名称:</label>
<span>{{detail.shopName}}</span>
</el-col>
<el-col :span="12">
<label>激活时间:</label>
<span>{{detail.activeTime}}</span>
</el-col>
<el-col :span="12">
<label>门店地址:</label>
<span>{{detail.address}}</span>
</el-col>
<el-col :span="12">
<label>设备号(有线):</label>
<span>{{detail.wiredSn}}</span>
</el-col>
<el-col :span="12">
<label>车架号:</label>
<span>{{detail.standno}}</span>
</el-col>
<el-col :span="12">
<label>设备号(无线){{detail.wirelessSn2?'1':''}}:</label>
<span>{{detail.wirelessSn1?detail.wirelessSn1:'无'}}</span>
</el-col>
<el-col :span="12">
<label>门店联系方式:</label>
<span>{{detail.contactsPhone}}</span>
</el-col>
<el-col :span="12" v-show="detail.wirelessSn2">
<label>设备号(无线)2:</label>
<span>{{detail.wirelessSn2}}</span>
</el-col>
<el-col :span="12">
<label>客户联系方式:</label>
<span>{{detail.userTel}}</span>
</el-col>
</el-row>
</div>
</div>
<div class="ibox">
<div class="ibox-title">
<h3>设备信息</h3>
</div>
<div class="ibox-content">
<el-row class="base-info">
<el-col :span="12">
<label>设备状态(有线):</label>
<span>{{detail.wiredSnStatus}}</span>
<el-button size="mini" type="primary" plain style="margin-left: 10px;" @click="gotoMonitor">监控车辆</el-button>
</el-col>
<el-col :span="12">
<label>设备状态(无线){{detail.wirelessSn2?'1':''}}:</label>
<span>{{detail.wirelessSnStatus1?detail.wirelessSnStatus1:'无'}}</span>
<el-button v-show size="mini" type="primary" plain style="margin-left: 10px;">监控车辆</el-button>
</el-col>
<el-col :span="12">
<label>行驶里程:</label>
<span>{{detail.distance}}</span>
<el-button size="mini" type="primary" plain style="margin-left: 10px;" @click="gotoMileage">详情</el-button>
</el-col>
<el-col :span="12" v-show="detail.wirelessSn2">
<label>设备状态(无线)2:</label>
<span>{{detail.wirelessSnStatus2}}</span>
</el-col>
<el-col :span="12">
<label>是否产生断电报警:</label>
<span>{{detail.isPowerOff === 0 ? '是': '否'}}</span>
<el-button size="mini" type="primary" plain style="margin-left: 10px;" @click="gotoOutage">详情</el-button>
</el-col>
</el-row>
</div>
</div>
<div class="ibox">
<div class="ibox-title">
<h3 class="pull-left">警情日历</h3>
<div class="pull-left" style="margin-left: 20px;">
<p>首次报警日期:{{alarmFirst}}</p>
<p>累计报警次数:{{alarmTotalCount}}</p>
</div>
</div>
<div class="ibox-content">
<div class="calendar-wrap" v-loading="calendarLoading">
<div class="calendar-filter">
<el-select v-model="year" placeholder="请选择" width="80px" size="small" style="width: 80px;">
<el-option
v-for="item in yearOpts"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
<el-select v-model="month" placeholder="请选择" width="80px" size="small" style="width: 80px;">
<el-option
v-for="item in monthOpts"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
<div class="pull-right">
<el-button-group class="level-gp">
<el-button plain size="small" :type="getButtonType(0)" @click="chooseLevel(0)">全部等级</el-button>
<el-button plain size="small" :type="getButtonType(1)" @click="chooseLevel(1)">1级</el-button>
<el-button plain size="small" :type="getButtonType(2)" @click="chooseLevel(2)">2级</el-button>
<el-button plain size="small" :type="getButtonType(3)" @click="chooseLevel(3)">3级</el-button>
<el-button plain size="small" :type="getButtonType(4)" @click="chooseLevel(4)">4级</el-button>
<el-button plain size="small" :type="getButtonType(5)" @click="chooseLevel(5)">5级</el-button>
</el-button-group>
<el-checkbox v-model="dealStatusChecked">仅显示未处理的报警</el-checkbox>
</div>
</div>
<table class="calendar">
<tr><th>日</th><th>一</th><th>二</th><th>三</th><th>四</th><th>五</th><th>六</th></tr>
<tr v-for="(daysArr,index) in weeksArr" :key="'tr'+index">
<td v-for="(dayItem,idx) in daysArr" :class="getTdClass(dayItem)" @click="selectDay(dayItem)">
<el-badge v-if="'existIndex' in dayItem" :value="list[dayItem.existIndex].alarmLevel" class="item">
<el-button size="small" type="text" :disabled="dayItem.isActive?false:true">{{dayItem.day}}</el-button>
</el-badge>
<el-button v-else size="small" type="text" :disabled="dayItem.isActive?false:true">{{dayItem.day}}</el-button>
</td>
</tr>
</table>
<div class="alarm-wrap" v-show="list.length" v-if="currItem">
<div class="alarm-main">
<h3><i class="fa fa-bell-o"></i>风险预警</h3>
<p><label>风险等级:</label>{{currItem.alarmLevel}}</p>
<p><label>报警说明:</label>{{currItem.alarmExplain}}</p>
<p><label>情况建议:</label>{{currItem.alarmSuggest}}</p>
</div>
<div class="alarm-box">
<p v-show="currItem.resolvent"><label>采取措施:</label>{{currItem.resolvent}}</p>
<p v-show="currItem.resolvent"><label>备注:</label>{{currItem.remark}}</p>
<p v-show="currItem.resolvent"><label>{{currItem.operatorName}} </label>{{currItem.resolventTime}}</p>
<p class="cmd-row">
<el-button
type="primary"
size="small"
icon="el-icon-edit"
v-popover:popover
@click="editResolve">{{currItem.resolvent?'修改':'处理'}}
</el-button>
<el-button
type="warning"
size="small"
icon="el-icon-star-off"
v-show="detail.isAttention===0"
@click="focus">关注
</el-button>
<el-button
type="warning"
size="small"
icon="el-icon-star-off"
v-show="detail.isAttention===1"
@click="cancelFocus">取消关注
</el-button>
<el-button
type="info"
size="small"
icon="el-icon-remove-outline"
v-show="detail.isAttention===0"
@click="ignore">忽略
</el-button>
<el-button
type="info"
size="small"
icon="el-icon-remove-outline"
v-show="detail.isAttention===2"
@click="cancelIgnore">取消忽略
</el-button>
</p>
</div>
<p v-show="list.length>1">
<el-button size="mini" :disabled="currIdx===0" @click="prev"><i class="el-icon-arrow-left"></i>前一条</el-button>
<el-button size="mini" :disabled="currIdx===list.length-1" @click="next">后一条<i class="el-icon-arrow-right"></i></el-button>
</p>
<!--弹框 -->
<el-popover
ref="popover"
placement="bottom-start"
width="400"
v-model="editModalVisible"
trigger="click">
<div class="popover-header">
</div>
<el-form :model="form" :rules="rules" ref="form" :inline="false" size="mini" label-width="90px">
<el-form-item label="采取措施" prop="actionText">
<el-input type="text" v-model="form.actionText" placeholder="请选择或输入采取措施"></el-input>
<el-tag type="info" size="mini" @click.native="addActionText('暂无异常')">暂无异常</el-tag>
<el-tag type="info" size="mini" @click.native="addActionText('待观察')">待观察</el-tag>
<el-tag type="info" size="mini" @click.native="addActionText('安排检修')">安排检修</el-tag>
<el-tag type="info" size="mini" @click.native="addActionText('安排收车')">安排收车</el-tag>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input type="textarea" v-model="form.remark" placeholder="请输入至少五个字符"></el-input>
</el-form-item>
</el-form>
<div style="text-align: right;">
<el-button type="primary" size="small" @click="editSure">确认</el-button>
<el-button size="small" @click="editModalVisible=false">取消</el-button>
</div>
</el-popover>
<!-- 弹框 /-->
</div>
</div>
</div>
</div>
</template>
</v-layout>
</template>
<script>
import vDateRange from 'components/DateRange.vue'
const vVechicleSelect = () => import(/* webpackChunkName: "vVechicleSelect" */ 'components/VechicleSelect.vue');
import {exportExcel} from 'utils'
import {services} from '../../api'
import Month from 'calendar-months';
const REPORT_SERVICE = services.report;
export default{
data(){
return {
vehicleId: this.$route.query.vehicleId ? this.$route.query.vehicleId:null,
detail: {
name: '',
shopName: '',
address: '',
standno: '',
contactsPhone: '',
sqbh: '',
activeTime: '',
wiredSn: '',
wirelessSn1: '',
wirelessSn2: '',
userTel: '',
wiredSnStatus: '',
wirelessSnStatus1: '',
wirelessSnStatus2: '',
distance: '',
isPowerOff: 0,
isAttention: 1,
deviceNoes: ''
},
year: 0,
month: 0,
alarmLevel: 0,
dealStatusChecked: false,
weeksArr: [],
yearOpts: [],
monthOpts: [],
editModalVisible: false,
form: {
actionText: '',
remark: ''
},
rules: {
actionText: [
{required: true, message: '请输入采取措施', trigger: 'blur'},
{pattern: /^\S{2,20}$/, message: '2至20个字', trigger: 'blur' }
],
remark: [
{required: true, message: '请输入备注', trigger: 'blur'},
{pattern: /^\S{5,100}$/, message: '5至100个字', trigger: 'blur' }
]
},
alarmFirst: '',
alarmTotalCount: '',
list: [],
currIdx: 0,
calendarLoading: false
}
},
created(){
this.initYearAndMonthOpts();
this.getDetailDate();
//this.getCalendarData();
//this.weeksArr = this.getCalendarDays();
},
computed: {
currItem(){
return this.list[this.currIdx]
}
},
watch: {
month(newValue, oldValue){
this.filterChange()
},
year(newValue, oldValue){
this.filterChange()
},
alarmLevel(newValue, oldValue){
this.filterChange()
},
dealStatusChecked(newValue, oldValue){
this.filterChange()
}
},
methods: {
getDetailDate(){
if(this.vehicleId){
REPORT_SERVICE.getAlarmDetailById({
vehicleId: this.vehicleId
}).then((result)=>{
if(result.returnCode == 0){
for(let key in this.detail){
this.detail[key] = result.data[key]
}
}
});
}
},
getCalendarData(){
if(this.vehicleId){
this.calendarLoading = true;
this.currIdx = 0;
REPORT_SERVICE.getAlarmCalendar({
vehicleId: this.vehicleId,
alarmLevel: this.alarmLevel,
dealStatus: this.dealStatusChecked?2:0,
year: this.year,
month: this.month
}).then((result)=>{
this.calendarLoading = false;
if(result.returnCode == 0){
const data = result.data;
this.list = data.calendarList;
this.alarmFirst = data.alarmFirst;
this.alarmTotalCount = data.alarmTotalCount;
this.weeksArr = this.getCalendarDays(this.list);
}
});
}
},
editResolve(){
this.form.actionText = this.currItem.resolvent || '';
this.form.remark = this.currItem.remark || '';
},
selectDay(item){
if('existIndex' in item){
this.currIdx = item.existIndex;
}
},
getTdClass(dayItem){
let className = dayItem.isActive?'':'disabled ';
if('existIndex' in dayItem && this.currIdx === dayItem.existIndex){
className += 'selected'
}
return className
},
getButtonType(level){
if(level === this.alarmLevel){
return 'primary'
}
},
chooseLevel(level){
if(level === this.alarmLevel) return;
this.alarmLevel = level;
},
getCalendarDays(data){
const weeksArr = Month.create(this.year+'-'+this.month).calendarWeeks();
let wrapArr = [];
weeksArr.forEach((daysArr)=>{
let arr = [];
daysArr.forEach((day)=>{
let obj = {};
obj.day = day.format('D');
obj.date = day.format('YYYY-MM-DD');
data.filter((item, idx)=>{
if(moment(item.alarmTime).format('YYYY-MM-DD') == obj.date){
obj.existIndex = idx;
}
});
if(day.month() == this.month-1){
obj.isActive = true
}else{
obj.isActive = false
}
arr.push(obj)
});
wrapArr.push(arr);
});
return wrapArr;
},
initYearAndMonthOpts(){
const currYear = moment().year();
this.year = currYear;
this.month = moment().month()+1;
let arr = [];
for(let year=currYear; year>=2010; year--){
arr.push({
label: year,
value: year
});
}
this.yearOpts = arr;
arr = [];
for(let month=1; month<=12; month++){
arr.push({
label: month,
value: month
});
}
this.monthOpts = arr;
},
editSure(){
this.$refs.form.validate((valid) => {
if(valid){
REPORT_SERVICE.updateAlarmResolve({
alarmId: this.currItem.alarmId,
processId: this.currItem.processId,
remark: this.form.remark,
resolvent: this.form.actionText
}).then((result)=>{
if(result.returnCode == 0){
const data = result.data;
this.currItem.resolvent = data.resolvent;
this.currItem.remark = data.remark;
this.currItem.resolventTime = data.handleTime;
this.currItem.operatorName = data.operatorName;
this.editModalVisible = false;
}
})
}
})
},
addActionText(text){
this.form.actionText = this.form.actionText+text;
},
prev(){
if(this.currIdx === 0) return;
this.currIdx--;
},
next(){
if(this.currIdx === this.list.length-1) return;
this.currIdx++;
},
filterChange(){
if(this._timeoutId){
clearTimeout(this._timeoutId)
}
this._timeoutId = setTimeout(()=>{
this.getCalendarData()
}, 100)
},
focus(){
REPORT_SERVICE.toggleAlarmItemStatus({
vehicleId: this.vehicleId,
status: 1
}).then((result)=>{
if(result.returnCode == 0){
this.$message({
type: 'success',
message: '关注成功'
});
this.toggleAllItemStatus(1)
}else{
this.$message({
type: 'error',
message: '关注失败'
});
}
});
},
cancelFocus(){
REPORT_SERVICE.toggleAlarmItemStatus({
vehicleId: this.vehicleId,
status: 0
}).then((result)=>{
if(result.returnCode == 0){
this.$message({
type: 'success',
message: '取消关注成功'
});
this.toggleAllItemStatus(0)
}else{
this.$message({
type: 'error',
message: '取消关注失败'
});
}
});
},
cancelIgnore(){
REPORT_SERVICE.toggleAlarmItemStatus({
vehicleId: this.vehicleId,
status: 0
}).then((result)=>{
if(result.returnCode == 0){
this.$message({
type: 'success',
message: '取消忽略成功'
});
this.toggleAllItemStatus(0)
}else{
this.$message({
type: 'error',
message: '取消忽略失败'
});
}
});
},
ignore(){
this.$confirm(`<div><p>是否忽略"${this.detail.sqbh}/${this.detail.name}/${this.detail.deviceNoes}<br/>${this.detail.standno}"?</p>
<p style="color: #999;">忽略该车辆后,该车辆的历史警情继续保留,且不会产生新的综合预警。</p></div>`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
dangerouslyUseHTMLString: true
}).then(() => {
REPORT_SERVICE.toggleAlarmItemStatus({
vehicleId: this.vehicleId,
status: 2
}).then((result)=>{
if(result.returnCode == 0){
this.$message({
type: 'success',
message: '忽略成功'
});
this.toggleAllItemStatus(2)
}else{
this.$message({
type: 'error',
message: '忽略失败'
});
}
});
});
},
toggleAllItemStatus(status){
this.list.forEach((item)=>{
item.isAttention = status;
});
this.detail.isAttention = status;
},
gotoMonitor(){
let snO = {
name: this.detail.name,
standNo: this.detail.standno,
sn: this.detail.wiredSn
}
let routeData = this.$router.resolve({ path: '/monitor/monitor', query: { snArr: JSON.stringify([snO]), mode: 'position' }});
window.open(routeData.href, '_blank');
},
gotoMileage(){
let routeData = this.$router.resolve({path:"/report/mileageMapModal",query: {sn:this.detail.wiredSn,timeRange:1}});
window.open(routeData.href, '_blank');
},
gotoOutage(){
let routeData = this.$router.resolve({path:"/report/outageAlarm",query: {sn:this.detail.wiredSn}});
window.open(routeData.href, '_blank');
}
},
components:{
}
}
</script>
<style scoped>
.base-info{
max-width: 800px;
}
.base-info .el-col{
margin-bottom: 15px;
}
.base-info label{
display: inline-block;
width: 130px;
text-align: right;
margin-right: 10px;
}
.base-info .el-col{
min-height: 28px;
}
.calendar{
border: 1px solid #ccc;
border-collapse: collapse;
}
.calendar td, .calendar th{
width: 100px;
height: 30px;
border: 1px solid #ccc;
}
.calendar td{
text-align: center;
padding: 5px 0px;
cursor: pointer;
}
.calendar td:hover, .calendar td.selected{
background-color: rgba(0,153,68,0.1)
}
.calendar td.disabled:hover{
background-color: inherit;
}
.calendar td.disabled{
color: #999;
cursor: not-allowed;;
}
.calendar button{
width: 2em;
padding: 0;
color: inherit;
}
.calendar button:hover, .calendar button:visited, .calendar button:active, .calendar button:focus{
color: inherit;
}
.calendar .el-badge__content.is-fixed{
transform: translateY(-5px) translateX(30px);
}
.calendar-wrap{
margin-left: 80px;
margin-bottom: 30px;
}
.calendar-filter{
max-width: 722px;
margin-bottom: 20px;
}
.level-gp{
margin-right: 10px;
}
.alarm-wrap{
margin-top: 20px;
}
.alarm-main h3{
font-size: 16px;
}
.alarm-main h3 i{
margin-right: 5px;
}
.alarm-main label,.alarm-box label{
display: inline-block;
width: 88px;
text-align: right;
}
.alarm-box{
width: 400px;
border: 1px solid #ececec;
background-color: #f9f9f9;
}
.cmd-row{
padding-right: 20px;
text-align: right;
}
.el-tag{
cursor: pointer;
margin-right: 5px;
margin-top: 5px;
}
.el-tag--info:hover {
background-color: rgba(144, 147, 153, 0.2);
}
.ibox-title{
position: relative;
}
.focused{
color: #ffeb3b;;
}
</style>