南昌市物联网技防平台-前端
shuishen
2021-04-08 a4e06ccd3cd976fbe4eef99e188d42ec9f3ad054
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
<template>
  <el-row>
    <el-col
      class="card-container"
      :span="1"
      v-for="(item, index) in option"
      :key="index"
    >
      <a href="">
        <el-card
          :style="
            item.state == ''
              ? item.onlineStatus == 1
                ? 'background: #1DBB99e6'
                : 'background: #C9C9C9e6'
              : 'background: #F48F57e6'
          "
          @click="alert(1)"
        >
          <div>{{ item.deviceName }}</div>
          <div>{{ item.street }}</div>
 
          <div class="cet">
            {{
              item.state == ""
                ? item.onlineStatus == 1
                  ? "设备在线"
                  : "设备掉线"
                : "设备故障"
            }}
          </div>
 
          <img src="/img/alarm.png" alt="" />
 
          <div class="bot">
            <span>
              {{ item.deviceNumber }}
            </span>
            <span>
              {{ item.stime }}
            </span>
          </div>
        </el-card>
      </a>
    </el-col>
  </el-row>
</template>
 
<script>
import { getList } from "@/api/supervisory/card";
export default {
  data() {
    return {
      option: [],
    };
  },
  created() {
    getList().then((res) => {
      var a = [],
        b = [],
        c = [];
 
      res.data.data.forEach((item) => {
        if (item.state != "") a.push(item);
        if (item.state == "" && item.onlineStatus != 1) b.push(item);
        if (item.state == "" && item.onlineStatus == 1) c.push(item);
      });
 
      this.option = a.concat(c.concat(b));
    });
  },
};
</script>
 
<style lang="scss">
.card-container {
  padding: 0 10px;
  height: 172px !important;
  box-sizing: border-box;
  margin-bottom: 20px !important;
  min-width: 368px;
  max-width: 370px;
  a {
    width: 100%;
    height: 100%;
    cursor: pointer;
    .el-card {
      height: 100%;
      color: #180808;
      &:hover {
        transform: scale(1.04);
      }
      .el-card__body {
        position: relative;
        height: 100%;
        box-sizing: border-box;
        .bot {
          position: absolute;
          left: 16px;
          bottom: 16px;
          width: calc(100% - 32px);
          span:nth-child(1) {
            float: left;
          }
          span:nth-child(2) {
            float: right;
          }
        }
        .cet {
          position: absolute;
          top: 50%;
          left: 16px;
        }
        div {
          line-height: 24px;
          font-size: 14px;
        }
        img {
          position: absolute;
          right: 16px;
          top: 40%;
          width: 40px;
        }
      }
    }
    &:hover {
      color: #180808;
      text-decoration: none;
    }
  }
}
</style>