ZZJ
2021-11-24 bbe33e5fd87e5961fdab804bfb0b4cf354e0c5b2
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
<template>
  <div class="history-module">
    <div class="title">历史报警</div>
    <div
      class="history-item"
      v-for="(item, index) in warnArrProcess"
      :key="index"
    >
      <warnDescription
        :warnDes="{
          code: item.device_sn,
          time: item.updated_at,
          warn: item.isLowBattery == 1 ? '低电量预警' : '实时抓拍预警',
        }"
      />
      <div class="button" @click="process(item)">处理</div>
    </div>
    <processWarn
      v-if="activeWarn"
      :warnObj="activeWarn"
      @close="close"
      @save="save"
    />
    <div class="mask" v-if="activeWarn" />
  </div>
</template>
 
<script>
import warnDescription from "@/pages/internetEquipment/components/warnDescription";
import processWarn from "@/pages/internetEquipment/components/processWarn";
import { handleWarn } from "@/api/helemt";
 
export default {
  data() {
    return {
      activeWarn: null,
    };
  },
  props: {
    warnArr: {
      type: Array,
    },
  },
  components: {
    warnDescription,
    processWarn,
  },
  computed: {
    warnArrProcess() {
      return this.warnArr.filter((item) => item.status != 1);
    },
  },
  methods: {
    process(item) {
      this.activeWarn = item;
    },
    close() {
      this.activeWarn = null;
    },
    save(item) {
      console.log(item);
      handleWarn({ id: item.id }).then((res) => {
        this.$set(item, "status", 1);
        this.close();
      });
    },
  },
};
</script>
 
<style scoped lang="scss">
.history-module {
  padding: 20px;
  width: 280px;
  height: 292px;
  background-color: #fff;
  box-shadow: 0px 2px 10px rgba(141, 164, 187, 0.25);
  border-radius: 15px;
  overflow-y: scroll;
 
  .title {
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 700;
    text-align: left;
  }
 
  .history-item {
    display: flex;
    width: 240px;
    height: 74px;
    margin-bottom: 4px;
    align-items: center;
    justify-content: space-between;
    background: #f9fafc;
    border-radius: 10px;
    padding: 0 10px;
    .button {
      width: 54px;
      height: 20px;
      background: #cfeee0;
      border-radius: 30px;
      font-size: 12px;
      line-height: 20px;
      color: #11aa66;
      cursor: pointer;
    }
  }
 
  .mask {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    z-index: 1;
    background-color: black;
    opacity: 0.5;
  }
}
</style>