Bottom.vue 8.82 KB
Newer Older
1 2 3
<template>
  <div class="wrapper">
    <div class="left">
纪泽龙's avatar
纪泽龙 committed
4
      <div class="top">
纪泽龙's avatar
纪泽龙 committed
5
        <span class="title">设备报警最新记录</span>
纪泽龙's avatar
纪泽龙 committed
6
        <span @click="repeatClick" class="repeat">刷新</span>
纪泽龙's avatar
纪泽龙 committed
7 8 9 10 11

        <transition name="fade">
          <span v-show="repeatFinshed" class="repeat2"> 数据刷新成功</span>
        </transition>

纪泽龙's avatar
纪泽龙 committed
12
        <span @click="moreClick" class="more">更多</span>
纪泽龙's avatar
纪泽龙 committed
13
      </div>
14

15 16 17 18 19 20 21 22 23 24
      <div class="bottom right-bottom-data-left">
        <!-- <div class="table-top">
          <div>编号</div>
          <div>名称</div>
          <div>类型</div>
          <div>内容</div>
          <div>事件</div>
        </div> -->
        <!-- <div class="one">设备编号:<span>1123123123</span></div>
        <div class="two">报警时间:<span>34523452345</span></div> -->
纪泽龙's avatar
纪泽龙 committed
25

纪泽龙's avatar
纪泽龙 committed
26 27 28 29
        <el-table
          size="mini"
          :data="tableData"
          style="width: 100%"
纪泽龙's avatar
纪泽龙 committed
30 31
          :height="tableHeight"
          class="el-bottom"
纪泽龙's avatar
纪泽龙 committed
32
        >
33
          <el-table-column prop="deviceCode" label="设备编号" width="100">
34
          </el-table-column>
纪泽龙's avatar
纪泽龙 committed
35
          <el-table-column prop="deviceName" label="设备名称" width="150">
36
          </el-table-column>
纪泽龙's avatar
纪泽龙 committed
37
          <el-table-column prop="alarmType" label="报警类型" width="">
38
          </el-table-column>
纪泽龙's avatar
纪泽龙 committed
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
          <el-table-column prop="createTime" label="报警开始时间" width="">
          </el-table-column>
          <el-table-column label="处理状态" align="center" prop="dealStatus">
            <template slot-scope="scope">
              <span v-if="scope.row.orderId == null || scope.row.orderId == ''"
                >未生成工单</span
              >
              <span v-else-if="!scope.row.dealStatus && scope.row.orderId"
                >暂未处理</span
              >
              <span v-else-if="scope.row.dealStatus == 1">不需处理</span>
              <span v-else-if="scope.row.dealStatus == 2">已处理完成</span>
              <span v-else-if="scope.row.dealStatus == 3">未处理完成</span>
              <span v-else> - </span>
            </template>
54
          </el-table-column>
纪泽龙's avatar
纪泽龙 committed
55
          <el-table-column prop="alarmValue" label="报警内容" width="100">
56 57
          </el-table-column>
        </el-table>
58 59
      </div>
    </div>
纪泽龙's avatar
纪泽龙 committed
60

纪泽龙's avatar
纪泽龙 committed
61
    <!-- <div class="right">
62 63 64 65 66 67
      <template v-for="(item, index) in list">
        <div
          class="right-content"
          :class="{ three: index == 2 }"
          :key="item.type"
        >
68
          <div class="text-icon">
69 70 71 72
            <i
              class="iconfont"
              :class="[iconClass(item), { iconFontSize: item.type == 4 }]"
            ></i>
73 74
          </div>
          <div class="text">
纪泽龙's avatar
纪泽龙 committed
75 76
            <div class="top">{{ typeName[item.type] }}</div>
            <div class="bottom">
纪泽龙's avatar
纪泽龙 committed
77
              {{ item.number }}{{ item.type == 99 ? "M" : "个" }}
纪泽龙's avatar
纪泽龙 committed
78
            </div>
79 80 81
          </div>
        </div>
      </template>
纪泽龙's avatar
纪泽龙 committed
82
    </div> -->
83 84 85 86
  </div>
</template>

<script>
纪泽龙's avatar
纪泽龙 committed
87 88
import { listDeviceAlarm } from "@/api/dataMonitoring/deviceAlarm";

89 90 91 92 93 94
export default {
  props: {
    list: {
      type: Array,
    },
  },
纪泽龙's avatar
纪泽龙 committed
95
  data() {
96
    return {
纪泽龙's avatar
纪泽龙 committed
97 98
      timer: null,
      repeatFinshed: false,
纪泽龙's avatar
纪泽龙 committed
99 100 101 102 103 104
      typeName: {
        1: "调压箱",
        2: "阀门井",
        3: "流量计",
        4: "压力表",
        99: "管道",
105
      },
纪泽龙's avatar
纪泽龙 committed
106
      iconList: {
纪泽龙's avatar
纪泽龙 committed
107 108 109 110
        1: "icon-tyxgs",
        2: "icon-fmjgs",
        3: "icon-lljgs",
        4: "icon-ylbgs",
纪泽龙's avatar
纪泽龙 committed
111 112
        99: "icon-gdcd",
      },
纪泽龙's avatar
纪泽龙 committed
113
      tableHeight: 170,
114 115
      tableData: [
        {
纪泽龙's avatar
纪泽龙 committed
116
          deviceCode: "2016-05-03",
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 160 161 162 163 164
          name: "王小虎",
          province: "上海",
          city: "普陀区",
          address: "上海市普陀区金沙江路",
        },
        {
          date: "2016-05-02",
          name: "王小虎",
          province: "上海",
          city: "普陀区",
          address: "上海市普陀区金沙江路 1518 弄",
        },
        {
          date: "2016-05-04",
          name: "王小虎",
          province: "上海",
          city: "普陀区",
          address: "上海市普陀区金沙江路 1518 弄",
        },
        {
          date: "2016-05-01",
          name: "王小虎",
          province: "上海",
          city: "普陀区",
          address: "上海市普陀区金沙江路 1518 弄",
        },
        {
          date: "2016-05-08",
          name: "王小虎",
          province: "上海",
          city: "普陀区",
          address: "上海市普陀区金沙江路 1518 弄",
        },
        {
          date: "2016-05-06",
          name: "王小虎",
          province: "上海",
          city: "普陀区",
          address: "上海市普陀区金沙江路 1518 弄",
        },
        {
          date: "2016-05-07",
          name: "王小虎",
          province: "上海",
          city: "普陀区",
          address: "上海市普陀区金沙江路 1518 弄",
        },
      ],
纪泽龙's avatar
纪泽龙 committed
165
    };
166 167 168
  },
  created() {
    console.log("list", this.list);
纪泽龙's avatar
纪泽龙 committed
169
    this.getList();
170
  },
纪泽龙's avatar
纪泽龙 committed
171

纪泽龙's avatar
纪泽龙 committed
172 173
  methods: {
    iconClass(item) {
174
      return this.iconList[item.type];
纪泽龙's avatar
纪泽龙 committed
175
    },
纪泽龙's avatar
纪泽龙 committed
176
    moreClick() {
纪泽龙's avatar
纪泽龙 committed
177
      this.$router.push("/dataMonitoring/deviceAlarm?back=1");
纪泽龙's avatar
纪泽龙 committed
178 179
      // route.push(`dataMonitoring/deviceAlarm`)
    },
纪泽龙's avatar
纪泽龙 committed
180 181
    repeatClick() {
      // this.tableData=[];
纪泽龙's avatar
纪泽龙 committed
182
      if (this.repeatFinshed) return;
纪泽龙's avatar
纪泽龙 committed
183
      this.getList(true);
纪泽龙's avatar
纪泽龙 committed
184
    },
纪泽龙's avatar
纪泽龙 committed
185
    getList(bool) {
纪泽龙's avatar
纪泽龙 committed
186 187 188 189 190 191 192 193 194
      this.loading = true;
      listDeviceAlarm({ pageNum: 1, pageSize: 10 }).then((res) => {
        if (res.code == 200) {
          const arr = res.rows.map((item) => {
            const {
              deviceCode,
              deviceName,
              alarmType,
              createTime,
纪泽龙's avatar
纪泽龙 committed
195
              dealStatus,
纪泽龙's avatar
纪泽龙 committed
196
              alarmValue,
纪泽龙's avatar
纪泽龙 committed
197
              orderId,
纪泽龙's avatar
纪泽龙 committed
198 199 200 201 202 203
            } = item;
            return {
              deviceCode,
              deviceName,
              alarmType,
              createTime,
纪泽龙's avatar
纪泽龙 committed
204
              dealStatus,
纪泽龙's avatar
纪泽龙 committed
205
              alarmValue,
纪泽龙's avatar
纪泽龙 committed
206
              orderId,
纪泽龙's avatar
纪泽龙 committed
207 208
            };
          });
纪泽龙's avatar
纪泽龙 committed
209 210 211 212 213 214 215 216
          this.tableData = arr;
          if (bool) {
            this.timer = null;
            this.repeatFinshed = true;
            this.timer = setTimeout(() => {
              this.repeatFinshed = false;
            }, 1000);
          }
纪泽龙's avatar
纪泽龙 committed
217 218 219
        }
      });
    },
纪泽龙's avatar
纪泽龙 committed
220
  },
221 222 223 224 225
};
</script>

<style lang="scss"  scoped>
.wrapper {
226 227
  // width: 978px;
  height: 200px;
228
  position: fixed;
229 230
  right: 10px;
  bottom: 10px;
231 232 233
  // background-color: #fff;
  display: flex;
  justify-content: space-between;
纪泽龙's avatar
纪泽龙 committed
234

235 236 237
  & > div {
  }
  .left {
纪泽龙's avatar
纪泽龙 committed
238 239
    width: 716px;
    height: 198px;
240 241
    margin-right: 12px;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.16);
242 243
    // background-color: #fff;
    // color: #fff;
244 245
    font-size: 14px;
    font-weight: 400;
纪泽龙's avatar
纪泽龙 committed
246 247 248 249 250
    background-image: url(../../../../assets/images/bottomBg.png);

    .el-table__body-wrappe {
      height: 140px !important;
    }
251
    .top {
纪泽龙's avatar
纪泽龙 committed
252 253
      height: 19px;
      // background-color: #053b6a;
254
      color: #fff;
纪泽龙's avatar
纪泽龙 committed
255 256 257
      // line-height: 32px;
      // padding-left: 12px;
      position: relative;
纪泽龙's avatar
纪泽龙 committed
258

纪泽龙's avatar
纪泽龙 committed
259 260 261 262 263 264

      .title{
        position: absolute;
        left:50%;
        margin-left:-92px;
        top:-5px;
纪泽龙's avatar
纪泽龙 committed
265 266
      }
      .repeat {
纪泽龙's avatar
纪泽龙 committed
267 268 269 270
        position: absolute;
        top:-5px;
        right: 160px;
        color: #fff;
纪泽龙's avatar
纪泽龙 committed
271 272 273 274
        cursor: pointer;
        &:hover {
          color: #2788ea;
        }
纪泽龙's avatar
纪泽龙 committed
275
      
纪泽龙's avatar
纪泽龙 committed
276
      }
纪泽龙's avatar
纪泽龙 committed
277
      .repeat2 {
纪泽龙's avatar
纪泽龙 committed
278 279
        position: absolute;
        right: 206px;
纪泽龙's avatar
纪泽龙 committed
280
        color: #67c23a;
纪泽龙's avatar
纪泽龙 committed
281
      }
纪泽龙's avatar
纪泽龙 committed
282
      .more {
纪泽龙's avatar
纪泽龙 committed
283 284 285 286
        position: absolute;
        right: 38px;
        top: -5px;
        color: #fff;
纪泽龙's avatar
纪泽龙 committed
287 288 289 290 291 292 293
        float: right;
        margin-right: 20px;
        cursor: pointer;
        &:hover {
          color: #2788ea;
        }
      }
294 295
    }
    .bottom {
纪泽龙's avatar
纪泽龙 committed
296 297
      width: 680px;
      margin: 0 auto;
298 299 300
    }
  }
  .right {
301
    width: 740px;
302 303
    display: flex;
    flex-wrap: wrap;
304
    // justify-content: space-between;
305
    align-content: flex-start;
306
    // margin-top: 7px;
307 308 309 310 311 312
    & > .right-content {
      background-color: #fff;
      width: 238px;
      height: 82px;
      margin-bottom: 29px;
      box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.16);
313
      margin-right: 10px;
314
      display: flex;
315 316 317
      &.three {
        margin-right: 0px;
      }
318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341
      // align-items: center;
      .text-icon {
        line-height: 82px;
        padding-left: 22px;
        margin-right: 22px;
        i {
          color: #053b6a;
          font-size: 60px;
        }
      }
      .text {
        font-size: 14px;
        padding-top: 16px;
        .top {
          color: #000;
          margin-bottom: 10px;
          font-weight: 600;
        }
        .bottom {
          color: #2788ea;
        }
      }
    }
  }
纪泽龙's avatar
纪泽龙 committed
342
  // 单独调整下最后一个icon的大小
343
  .iconFontSize {
纪泽龙's avatar
纪泽龙 committed
344 345
    font-size: 50px !important;
  }
纪泽龙's avatar
纪泽龙 committed
346 347 348 349 350 351 352 353 354 355 356 357 358
  .fade-enter-to,
  .fade-leave {
    opacity: 1;
  }
  .fade-leave-active {
    transition: opacity 0.5s;
  }
  .fade-enter-active {
    transition: opacity 0s;
  }
  .fade-enter, .fade-leave-to /* .fade-leave-active below version 2.1.8 */ {
    opacity: 0;
  }
359 360
}
</style>