张晓波
2023-09-19 164694c47c35d6654df69b533e8dbf8b5423efc5
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
<template>
  <div id="app">
    <transition>
      <router-view />
    </transition>
  </div>
</template>
 
<script>
 
export default {
  name: 'App',
  data(){
    return{
      closeNotify:null,
      timer:null,//定时器
      alarmList:[
      ],//报警信息组
    }
  },
  mounted(){
    this.timer = setInterval(()=>{
      this.getAlarmDatas()
    },60000)
  },
  methods:{
      //展示报警信息
      showAlarmTips(){
        const h = this.$createElement
        this.alarmList.forEach((item)=>{
          this.closeNotify =window.setTimeout(()=>{
              this.$notify({
                position: 'bottom-right',
                showClose:true,
                duration:5000,
                dangerouslyUseHTMLString: true,
                message:h("div",{class:"alarm_tips"},[
                  h("div",{class:"alarm_tip_header"},[
                    h("div",{class:"alarm_tip_text"},'钢筋预警'),
                  ]),
                  h("div",{class:"alarm_tip_content"},[
                    h("div",{class:'alarm_tip_content_text'},`${item.steelName}`),
                    h("div",{class:"alarm_tip_content_datas"},'已低于预警库存')
                  ]),
                ])
              });
          },0)
        })
      },
      //获取报警数据
       getAlarmDatas(){
         this.$api.Rebar.alarmTipsBear({}).then(res=>{
          if(res.statusMsg =='ok'){
            this.alarmList = res.data
            this.showAlarmTips()
          }else{
            this.$message.warning(res.statusMsg)
          }
        })
      },
  }
}
</script>
 
<style lang="scss">
html,
body,
#app {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  font-size: calc(100vw / 137);
  // font-size: 14px;
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
 
  .el-tooltip__popper {
    max-width: 800px;
  }
}
.el-notification{
  background: url("./assets/alarm_bg.png") no-repeat;
  background-size: 100% 100%;
}
.alarm_tips{
  display: flex;
  flex-direction: column;
  position: relative;
  line-height: 45px;
 
  .alarm_tip_header{
    width: 100%;
    display: flex;
    justify-content: space-between;
    position: absolute;
    top: -20px;
    
    .alarm_tip_text{
      color:#fff;
      font-size: 16px;
      margin-left: 10px;
      padding-right:35px;
      position: relative;
      &::before{
        content: "";
        position: absolute;
        top: 14px;
        left: -20px;
        width: 15px;
        height: 15px;
        background: url("./assets/alarm_icons.png") no-repeat;
        background-size: 100% 100%;
      }
    }
    .alarm_tip_time{
      color: #999;
    }
    .alarm_tip_close{
      color: #f42829;
      cursor: pointer;
    }
  }
  .alarm_tip_content{
    display: flex;
    padding-top: 5px;
    .alarm_tip_content_text{
      padding-top: 15px;
      color: #f42829;
    }
    .alarm_tip_content_datas{
      padding-left: 15px;
      padding-top: 15px;
      color: #fff;
    }
  }
}
 
.el-form-item {
  margin-bottom: 1.5rem;
}
.el-year-table td .cell{
  color: #fff;
}
.el-picker-panel__icon-btn{
  color: #fff;
}
.el-year-table td.today .cell{
  color: #1890ff ;
  font-weight: bold
}
input::-webkit-outer-spin-button,input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}
</style>