alarmpush.vue
1.6 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
<template>
<div>
</div>
</template>
<script>
import {mapGetters} from 'vuex'
export default {
data(){
return{
notification:'',
alamData:''
}
},
methods:{
alertAlarm(val){
let str = ''
switch (val.params.msg_type) {
case 'black_face':
str = '非注册人员'
break;
case 'white_face':
str = '人脸白名单'
break;
case 'black_car':
str = '非注册车辆'
break;
case 'white_car':
str = '车辆白名单'
break;
case 'behavior':
str = '违规行为'
break;
}
this.notification = this.$notify({
title: '提示',
message: '您有一条新的'+ str +'报警信息!',
position: 'bottom-right',
type: 'warning',
onClick: this.showDetail,
customClass: 'alarm',
url: val.params.msg_url,
duration:5000
});
},
showDetail(url) {
debugger
if(this.alamData.params.msg_type == 'black_face') {
this.$router.push('/alarm/facealarm/illegalInfiltration')
}
if(this.alamData.params.msg_type == 'black_car') {
this.$router.push('/alarm/caralarm/illegalrecord')
}
if(this.alamData.params.msg_type == 'behavior') {
this.$router.push('/alarm/behaviouralanalysis/securityAlert')
}
}
},
computed:{
...mapGetters([
'alarm',
]),
},
watch:{
alarm(val){
this.alertAlarm(val);
this.alamData = val;
},
}
}
</script>
<style lang="stylus">
.alarm {
cursor pointer
}
</style>