alarmpush.vue 1.6 KB
<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>