Cz.vue 9.08 KB
Newer Older
纪泽龙's avatar
纪泽龙 committed
1 2 3
<!--
 * @Author: your name
 * @Date: 2022-01-26 20:07:52
4
 * @LastEditTime: 2022-03-23 15:19:40
纪泽龙's avatar
纪泽龙 committed
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE

 * @FilePath: /test/hello-world/src/views/components/deviceA.vue
-->
<template>
  <div class="devicea-wrapper">
    <div class="title">
      {{
        deviceData.deviceName ? deviceData.deviceName : deviceData.stationName
      }}
    </div>
    <div class="close" @click="close">
      <img src="@/assets/mapImages/closeBtn.png" alt="" />
    </div>

21
    <!-- <div class="top flex">
纪泽龙's avatar
纪泽龙 committed
22 23 24 25 26 27 28
      <div class="group">
        <div class="left">所属公司:</div>
        <div class="right zzz">{{ companyType[deviceData.companyType] }}</div>
      </div>
      <div class="group">
        <div class="left">设备类型:</div>
        <div class="right zzz">
纪泽龙's avatar
纪泽龙 committed
29
          {{ deviceType[deviceData.iconType] }}
纪泽龙's avatar
纪泽龙 committed
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
        </div>
      </div>
      <div class="group">
        <div class="left">设备地址:</div>
        <div
          v-if="deviceData.deviceAddr"
          :title="deviceData.deviceAddr"
          class="right last zzz"
        >
          {{ deviceData.deviceAddr || "-" }}
        </div>
        <div
          v-else-if="deviceData.stationAddr"
          :title="deviceData.stationAddr"
          class="right last zzz"
        >
          {{ deviceData.stationAddr || "-" }}
        </div>
纪泽龙's avatar
纪泽龙 committed
48
        <div v-else>-</div>
纪泽龙's avatar
纪泽龙 committed
49
      </div>
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
    </div> -->
     <div class="top flex">
      <div class="top-left">
        <div class="group">
          <div class="left">所属公司:</div>
          <div class="right zzz">{{ companyType[deviceData.companyType] }}</div>
        </div>
        <div class="group">
          <div class="left">设备类型:</div>
          <div class="right zzz">
            {{ deviceType[deviceData.iconType] }}
          </div>
        </div>
        <div class="group">
          <div class="left last">设备地址:</div>
          <div
            v-if="deviceData.deviceAddr"
            :title="deviceData.deviceAddr"
            class="right last zzz"
          >
            {{ deviceData.deviceAddr || "-" }}
          </div>
          <div
            v-else-if="deviceData.stationAddr"
            :title="deviceData.stationAddr"
            class="right last zzz"
          >
            {{ deviceData.stationAddr || "-" }}
          </div>
79
          <div v-else class="right last zzz">-</div>
80 81 82
        </div>
      </div>
      <div class="top-right">
83

84 85 86 87 88
        <el-image
          v-if="deviceData.pictureAddress"
          style="width: 100px; height: 100px"
          :src="deviceData.pictureAddress"
          :preview-src-list="[deviceData.pictureAddress ]"
89
          :z-index="999999"
90 91 92 93
        >
        </el-image>
        <div class="imgtext" v-else>暂无图片</div>
      </div>
纪泽龙's avatar
纪泽龙 committed
94 95 96 97 98
    </div>

    <div class="middle">{{ profile }}</div>

    <div class="foot">
99
      <div class="thead flex" v-if="list.length>0">
纪泽龙's avatar
纪泽龙 committed
100 101 102 103
        <div class="first">设备类型</div>
        <div>设备数量</div>
        <div>在线设备</div>
        <div>离线设备</div>
104 105
        <!-- <div>历史报警</div>
        <div>已处理报警</div> -->
纪泽龙's avatar
纪泽龙 committed
106 107
        <div class="last">报警中</div>
      </div>
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
      <template v-if="list.length > 0">
        <div
          class="tbody flex"
          v-for="deviceData in list"
          :key="deviceData.inAlarm+Math.random()"
        >
          <div v-unValue class="first zzz">
            {{ typeList[deviceData.dataType] }}
          </div>
          <div v-unValue class="">{{ deviceData.numberPressureGauges }}</div>
          <div v-unValue class="">
            {{ deviceData.onlineEquipment }}
          </div>
          <div v-unValue class="">
            {{ deviceData.offlineEquipment }}
          </div>
124
          <!-- <div v-unValue class="">
125 126 127 128
            {{ deviceData.historicalAlarm }}
          </div>
          <div v-unValue class="">
            {{ deviceData.alarmProcessed }}
129
          </div> -->
130 131 132
          <div v-unValue class="last">
            {{ deviceData.inAlarm }}
          </div>
纪泽龙's avatar
纪泽龙 committed
133
        </div>
134
      </template>
纪泽龙's avatar
纪泽龙 committed
135 136
    </div>

137
    <div class="btn" v-if="list.length>0">
纪泽龙's avatar
纪泽龙 committed
138 139 140 141 142 143 144
      <div @click="btnClick">感知设备</div>
    </div>
  </div>
</template>

<script>
import { companyType, deviceType } from "@/utils/mapClass/config.js";
145 146
import { getCzDevice } from "@/api/bigWindow/getDevice.js";

纪泽龙's avatar
纪泽龙 committed
147 148 149 150 151
export default {
  data() {
    return {
      companyType,
      deviceType,
152
      profile: "暂无备注",
153 154 155 156
      typeList: {
        // 1压力表    2流量计  3探测器
        1: "压力表",
        2: "流量计",
157
        3: "工业探测器",
158 159
      },
      list: [
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186
        // {
        //   numberPressureGauges: "-",
        //   onlineEquipment: "-",
        //   offlineEquipment: "-",
        //   historicalAlarm: "-",
        //   alarmProcessed: "-",
        //   inAlarm: "-",
        //   dataType: 1,
        // },
        // {
        //   numberPressureGauges: "-",
        //   onlineEquipment: "-",
        //   offlineEquipment: "-",
        //   historicalAlarm: "-",
        //   alarmProcessed: "-",
        //   inAlarm: "-",
        //   dataType: 2,
        // },
        // {
        //   numberPressureGauges: "-",
        //   onlineEquipment: "-",
        //   offlineEquipment: "-",
        //   historicalAlarm: "-",
        //   alarmProcessed: "-",
        //   inAlarm: "-",
        //   dataType: 3,
        // },
187
      ],
纪泽龙's avatar
纪泽龙 committed
188 189
    };
  },
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205
  computed: {
    prodTest() {
      return this.vueRoot.$store.state.user.systemSetting.prod_test;
    },
    company() {
      return this.vueRoot.$store.state.bigWindowCompany.company;
    },
  },
  mounted() {
    // 如果不是测试,而是真数据,就要用帧数据的东西
    if (this.prodTest != "test") {
      this.companyType = {};
      this.company.forEach((item) => {
        this.companyType[item.conpanyId] = item.companyName;
      });
    }
206
    this.myHttp()
207 208
    console.log(this.deviceData);

209

210
  },
纪泽龙's avatar
纪泽龙 committed
211 212 213 214 215
  methods: {
    close() {
      this.mapClass.infowindowClose();
    },
    btnClick() {
216 217 218 219 220 221 222 223
      const title = this.deviceData.deviceName
        ? this.deviceData.deviceName
        : this.deviceData.stationName;

      this.vueRoot.getTcqDevice(
        { devId: this.deviceData.siteStationId, relationDeviceType: 2 },
        title
      );
纪泽龙's avatar
纪泽龙 committed
224
    },
225 226
    myHttp() {
      getCzDevice({ deviceId: this.deviceData.siteStationId }).then((res) => {
227
        this.list = res.data[0].subordinateEquipmentList.filter(item=>item.numberPressureGauges>0);
228 229 230
        console.log("resresres",res)
      });
    },
纪泽龙's avatar
纪泽龙 committed
231 232 233 234 235 236 237 238 239
  },
};
</script>

<style lang="scss" scoped>
.devicea-wrapper {
  background-color: rgba(9, 18, 32, 0.6);
  padding: 10px;
  position: relative;
240
  width: 500px;
纪泽龙's avatar
纪泽龙 committed
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259
  .title {
    // padding-top: 10px;
    // padding-left: 10px;
    font-size: 14px;
    line-height: 14px;
    color: #ffffff;
  }
  .close {
    position: absolute;
    right: 10px;
    top: 5px;
    cursor: pointer;
  }

  .top {
    margin-top: 10px;
    margin-bottom: 10px;
    border: 1px solid #cccccc;
    box-sizing: border-box;
260
    .top-left {
261
      flex: 1.8;
262 263
      .group {
        height: 40px;
纪泽龙's avatar
纪泽龙 committed
264
        flex: 1;
265 266
        display: flex;
        justify-content: space-between;
纪泽龙's avatar
纪泽龙 committed
267
        box-sizing: border-box;
268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284
        div {
          flex: 1;
          box-sizing: border-box;
          border-right: 1px solid #cccccc;
          border-bottom: 1px solid #cccccc;
          text-align: center;
          font-size: 14px;
          color: #ffffff;
          line-height: 40px;
          padding: 0 5px;
          &.last {
            border-bottom: none;
          }
        }
        .left {
          text-align: right;
          background-color: rgba(255, 255, 255, 0.1);
纪泽龙's avatar
纪泽龙 committed
285
        }
286 287 288
        .right {
          flex:2;
        }
纪泽龙's avatar
纪泽龙 committed
289
      }
290 291 292 293 294 295 296 297 298
    }
    .top-right {
      flex: 1;
      display: flex;
      justify-content: center;
      align-items: center;
      .imgtext {
        color: #ffffff;
        font-size: 30px;
纪泽龙's avatar
纪泽龙 committed
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366
      }
    }
  }
  .middle {
    width: 100%;
    padding: 5px;
    border: 1px solid #ffffff;
    box-sizing: border-box;
    font-size: 14px;
    color: #ffffff;
    text-indent: 2em;
    margin-bottom: 10px;
  }
  .foot {
    font-size: 14px;
    color: #ffffff;
    .thead,
    .tbody {
      border: 1px solid #cccccc;
      div {
        flex: 1;
        text-align: left;
        border-right: 1px solid #cccccc;
        box-sizing: border-box;
        padding: 0 5px;
      }
      .first {
        flex: 2;
      }
      .last {
        border-right: none;
      }
    }
    .tbody {
      border-top: none;
    }
    .thead {
      div {
        background-color: rgba(255, 255, 255, 0.1);
      }
    }
  }

  .btn {
    position: relative;
    margin-top: 10px;
    text-align: right;
    div {
      font-size: 14px;
      color: #ffffff;
      padding: 2px 4px;
      box-sizing: border-box;
      display: inline-block;
      cursor: pointer;
      border: 1px solid #cccccc;
      background-color: #1890ff;

      &:hover {
        // background: rgba(9, 18, 32, 0.6);
        background-color: #18baff;
      }
    }
  }
  .flex {
    display: flex;
    justify-content: space-between;
  }
}
王晓倩's avatar
王晓倩 committed
367
</style>