User.vue 6.42 KB
Newer Older
纪泽龙's avatar
纪泽龙 committed
1 2
<!--
 * @Author: your name
纪泽龙's avatar
纪泽龙 committed
3
 * @Date: 2022-01-26 20:07:52
4
 * @LastEditTime: 2022-03-17 09:05:30
纪泽龙's avatar
纪泽龙 committed
5 6
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
纪泽龙's avatar
纪泽龙 committed
7 8

 * @FilePath: /test/hello-world/src/views/components/deviceA.vue
纪泽龙's avatar
纪泽龙 committed
9 10
-->
<template>
纪泽龙's avatar
纪泽龙 committed
11 12 13 14
  <div class="devicea-wrapper">
    <div class="title">
      {{ deviceData.nickName }}
    </div>
纪泽龙's avatar
纪泽龙 committed
15 16 17 18
    <div class="close" @click="close">
      <img src="@/assets/mapImages/closeBtn.png" alt="" />
    </div>

19
    <div class="top flex top-top">
纪泽龙's avatar
纪泽龙 committed
20 21
      <div class="group">
        <div class="left">联系人:</div>
22
        <div class="right zzz">{{ 1 }}</div>
纪泽龙's avatar
纪泽龙 committed
23 24 25
      </div>
      <div class="group">
        <div class="left">联系电话:</div>
纪泽龙's avatar
纪泽龙 committed
26
        <div v-unValue class="right zzz">
纪泽龙's avatar
纪泽龙 committed
27 28 29 30 31 32 33 34
          {{ deviceData.phone }}
        </div>
      </div>
      <div class="group">
        <div class="left">联系地址:</div>
        <div :title="deviceData.address" class="right last zzz">
          {{ deviceData.address || "-" }}
        </div>
35
      </div>
纪泽龙's avatar
纪泽龙 committed
36 37
    </div>

38 39 40 41 42 43 44 45 46
    <div class="top flex top-bottom">
      <div class="group">
        <div class="left">联系地址:</div>
        <div :title="deviceData.address" class="right last zzz">
          {{ deviceData.address || "-" }}
        </div>
      </div>
    </div>

纪泽龙's avatar
纪泽龙 committed
47 48 49 50 51 52 53
    <template v-if="deviceData.detectorCountList">
      <div class="foot">
        <div class="thead flex">
          <div class="first">设备类型</div>
          <div>设备数量</div>
          <div>在线设备</div>
          <div>离线设备</div>
54 55
          <!-- <div>历史报警</div>
          <div>已处理报警</div> -->
纪泽龙's avatar
纪泽龙 committed
56
          <div class="last">报警中</div>
纪泽龙's avatar
纪泽龙 committed
57
        </div>
纪泽龙's avatar
纪泽龙 committed
58 59 60 61 62 63 64 65 66 67 68 69 70
        <div
          v-for="data in deviceData.detectorCountList"
          :key="data.userId"
          class="tbody flex"
        >
          <div v-unValue class="first zzz">{{ data.detectorType }}</div>
          <div class="">{{ data.detectorCount }}</div>
          <div v-unValue class="">
            {{ data.onLineNum }}
          </div>
          <div v-unValue class="">
            {{ data.offLineNum }}
          </div>
71
          <!-- <div v-unValue class="">
纪泽龙's avatar
纪泽龙 committed
72 73 74 75
            {{ data.historyAlarmNum }}
          </div>
          <div v-unValue class="">
            {{ data.cancelAlarmNum }}
76
          </div> -->
纪泽龙's avatar
纪泽龙 committed
77 78 79
          <div v-unValue class="last zzz">
            {{ data.processingAlarmNum }}
          </div>
纪泽龙's avatar
纪泽龙 committed
80 81
        </div>
      </div>
纪泽龙's avatar
纪泽龙 committed
82
    </template>
纪泽龙's avatar
纪泽龙 committed
83

纪泽龙's avatar
纪泽龙 committed
84 85
    <div class="btn">
      <div @click="btnClick">感知设备</div>
纪泽龙's avatar
纪泽龙 committed
86 87 88 89 90
    </div>
  </div>
</template>

<script>
纪泽龙's avatar
纪泽龙 committed
91
import { companyType, deviceType } from "@/utils/mapClass/config.js";
92
import { listDetectorInfo } from "@/api/detector/detectorInfo";
93 94
import { detectorUserList } from "@/api/detector/detectorUser";

纪泽龙's avatar
纪泽龙 committed
95 96 97 98
export default {
  data() {
    return {
      companyType,
纪泽龙's avatar
纪泽龙 committed
99
      deviceType,
纪泽龙's avatar
纪泽龙 committed
100 101
    };
  },
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
  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;
      });
    }
纪泽龙's avatar
纪泽龙 committed
118
    this.myHttp();
119
    // console.log(this.deviceData);
120
  },
纪泽龙's avatar
纪泽龙 committed
121 122 123 124
  methods: {
    close() {
      this.mapClass.infowindowClose();
    },
纪泽龙's avatar
纪泽龙 committed
125 126
    btnClick() {
      // this.vueRoot.centerDataFunc(this.deviceData.pressureFlows);
纪泽龙's avatar
纪泽龙 committed
127
      this.vueRoot.getDetectorInfoList(
128
        listDetectorInfo,
纪泽龙's avatar
纪泽龙 committed
129 130 131
        { userId: this.deviceData.userId },
        this.deviceData.nickName
      );
纪泽龙's avatar
纪泽龙 committed
132
    },
纪泽龙's avatar
纪泽龙 committed
133 134 135 136 137 138 139 140 141 142
    myHttp() {
      detectorUserList({ userId: this.deviceData.userId }).then((res) => {
        if (res.code == 200) {
          const data = res.data.filter(
            (item) => item.userId == this.deviceData.userId
          )[0].detectorCountList;
          this.deviceData.detectorCountList = data;
        }
      });
    },
纪泽龙's avatar
纪泽龙 committed
143 144 145 146 147
  },
};
</script>

<style lang="scss" scoped>
纪泽龙's avatar
纪泽龙 committed
148
.devicea-wrapper {
纪泽龙's avatar
纪泽龙 committed
149 150 151
  background-color: rgba(9, 18, 32, 0.6);
  padding: 10px;
  position: relative;
152
  width: 600px;
纪泽龙's avatar
纪泽龙 committed
153
  .title {
纪泽龙's avatar
纪泽龙 committed
154 155
    // padding-top: 10px;
    // padding-left: 10px;
纪泽龙's avatar
纪泽龙 committed
156 157 158 159 160 161 162 163 164 165
    font-size: 14px;
    line-height: 14px;
    color: #ffffff;
  }
  .close {
    position: absolute;
    right: 10px;
    top: 5px;
    cursor: pointer;
  }
纪泽龙's avatar
纪泽龙 committed
166 167 168 169

  .top {
    margin-top: 10px;
    margin-bottom: 10px;
纪泽龙's avatar
纪泽龙 committed
170
    border: 1px solid #cccccc;
纪泽龙's avatar
纪泽龙 committed
171
    box-sizing: border-box;
172 173 174 175 176
    &.top-top {
      div{
        width: 33%;
      }
    }
纪泽龙's avatar
纪泽龙 committed
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191
    .group {
      height: 30px;
      flex: 1;
      display: flex;
      justify-content: space-between;
      box-sizing: border-box;
      div {
        flex: 1;
        box-sizing: border-box;
        border-right: 1px solid #cccccc;
        text-align: center;
        font-size: 14px;
        color: #ffffff;
        line-height: 30px;
        padding: 0 5px;
192

纪泽龙's avatar
纪泽龙 committed
193 194 195 196 197 198 199 200 201
        &.last {
          border-right: none;
        }
      }
      .left {
        text-align: right;
        background-color: rgba(255, 255, 255, 0.1);
      }
    }
202 203
    &.top-bottom {
      .left {
204
        flex: none;
205 206 207 208 209 210
        width: 192px !important;
      }
      .right {
        flex: 1;
      }
    }
纪泽龙's avatar
纪泽龙 committed
211 212 213 214 215 216 217 218 219 220 221 222
  }
  .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 {
纪泽龙's avatar
纪泽龙 committed
223 224
    font-size: 14px;
    color: #ffffff;
纪泽龙's avatar
纪泽龙 committed
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240
    .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;
      }
纪泽龙's avatar
纪泽龙 committed
241
    }
纪泽龙's avatar
纪泽龙 committed
242 243
    .tbody {
      border-top: none;
纪泽龙's avatar
纪泽龙 committed
244
    }
纪泽龙's avatar
纪泽龙 committed
245 246 247 248
    .thead {
      div {
        background-color: rgba(255, 255, 255, 0.1);
      }
纪泽龙's avatar
纪泽龙 committed
249
    }
纪泽龙's avatar
纪泽龙 committed
250 251 252 253 254 255 256 257 258 259
  }

  .btn {
    position: relative;
    margin-top: 10px;
    text-align: right;
    div {
      font-size: 14px;
      color: #ffffff;
      padding: 2px 4px;
纪泽龙's avatar
纪泽龙 committed
260
      box-sizing: border-box;
纪泽龙's avatar
纪泽龙 committed
261 262 263 264 265 266 267 268 269
      display: inline-block;
      cursor: pointer;
      border: 1px solid #cccccc;
      background-color: #1890ff;

      &:hover {
        // background: rgba(9, 18, 32, 0.6);
        background-color: #18baff;
      }
纪泽龙's avatar
纪泽龙 committed
270 271 272 273 274 275 276
    }
  }
  .flex {
    display: flex;
    justify-content: space-between;
  }
}
王晓倩's avatar
王晓倩 committed
277
</style>