User.vue 8.52 KB
Newer Older
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 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 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 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
<!--
 * @Author: your name
 * @Date: 2022-01-26 20:07:52
 * @LastEditTime: 2022-03-17 09:05:30
 * @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.nickName }}
    </div>
    <div class="close" @click="close">
      <!-- <img src="@/assets/mapImages/closeBtn.png" alt="" /> -->
      <i class="el-icon-close" style="font-size:20px;color:#5dfefe;"></i>
    </div>
    <p style="background-image: linear-gradient(to right, #5dfefe, #071738); width:100%;height:1px;"></p>
    <div>
        <div class="top flex top-top">
      <div class="group" style="width:20%">
        <div class="left">联系人:</div>
        <div class="right zzz">{{ deviceData.linkman }}</div>
      </div>
      <div class="group" style="width:30%">
        <div class="left">联系电话:</div>
        <div v-unValue class="right zzz">
          {{ deviceData.phone }}
        </div>
      </div>
      <div class="group" style="width:30%">
        <div class="left">联系地址:</div>
        <div :title="deviceData.address" class="right last zzz">
          {{ deviceData.address || "-" }}
        </div>
      </div>
    </div>

    <!-- <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> -->

    <template v-if="deviceData.detectorCountList">
      <div class="foot">
        <div class="thead flex">
          <div class="first">设备类型</div>
          <div>设备数量</div>
          <div>在线设备</div>
          <div>离线设备</div>
          <!-- <div>历史报警</div>
          <div>已处理报警</div> -->
          <div class="last">报警中</div>
        </div>
        <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>
          <!-- <div v-unValue class="">
            {{ data.historyAlarmNum }}
          </div>
          <div v-unValue class="">
            {{ data.cancelAlarmNum }}
          </div> -->
          <div v-unValue class="last zzz">
            {{ data.processingAlarmNum }}
          </div>
        </div>
      </div>
    </template>
    </div>
    

    <div style="width:100%;display: flex;">
      <div class="btn">
        <div>感知设备</div>
      </div>
      <p style="width:85%;height:10px;background-color: #022346;margin-top: 22px;margin-left: -10px;"></p>
      <div @click="btnClick">
        <img  @click="flag = !flag" src="../../assets/second/box-down.png" :class="{ 'arrowTransform': !flag, 'arrowTransformReturn': flag}" alt="" style="width:30px;height:30px;margin-top: 12px;cursor: pointer;">
        </div>
    </div>
      <UserCenter
      :title="centerTitle"
      :show="userCenterShow"
      ref="userCenter"
      :detcetorList="detcetorList"
      :userId="centerUserId"
      :total="centerTotal"
      :pageSize="5"
      v-show="!isShow"
    />
    
  </div>
</template>

<script>
import {
  getUser,
} from "@/api/bigWindow/getDevice";
import { companyType, deviceType } from "@/utils/mapClass/config.js";
import { listDetectorInfo } from "@/api/detector/detectorInfo";
import { detectorUserList } from "@/api/detector/detectorUser";
import UserCenter from "@/components/bigWindow/UserCenter.vue";

export default {
  components: {
    UserCenter,
  },
  data() {
    return {
      flag: true,
      isShow: true ,
      companyType,
      deviceType,
      centerTitle: "",
      detcetorList: [],
      centerUserId: null,
      centerTotal: null,
      userCenterShow: false,
    };
  },
  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;
      });
    }
    this.myHttp();
    // console.log(this.deviceData);
  },
  methods: {
    //用户的设备center
    getDetectorInfoList(httpFunc, queryParams, title) {
      console.log(queryParams);
      return httpFunc(queryParams).then((res) => {
        // console.log("queryParamssssssssssss", res);
        if (res.code == 200) {
          this.detcetorList = res.rows;
          this.centerUserId = queryParams.userId;
          // 总数据
          this.centerTotal = res.total;
          // this.$refs.userCenter.fade = "fade";
          this.otherCenterShow = false;
          this.userCenterShow = true;
          this.centerTitle = title;
          // 传递回去
          return res.code;
        }
      });
    },
    close() {
      this.mapClass.infowindowClose();
    },
    btnClick() {
      this.isShow = !this.isShow;
      // this.vueRoot.centerDataFunc(this.deviceData.pressureFlows);
      this.getDetectorInfoList(
        listDetectorInfo,
        { userId: this.deviceData.userId,pageNum: 1, pageSize: 5, },
        this.deviceData.nickName
      );
    },
    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;
        }
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.arrowTransform {
        transition: 0s;
        transform-origin: center;
        transform: rotateZ(180deg);
    }

    .arrowTransformReturn {
        transition: 0s;
        transform-origin: center;
        transform: rotateZ(0deg);
    }
.devicea-wrapper {
  box-shadow: 0px 0px 10px #54e0ef inset;
  background-color: #071738;
  padding: 10px;
  position: relative;
  width: 740px;
  .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;
    box-sizing: border-box;
    &.top-top {
      // div{
      //   width: 33%;
      // }
    }
    .group {
      height: 30px;
      display: flex;
      justify-content: space-between;
      box-sizing: border-box;
      div {
        flex: 1;
        box-sizing: border-box;
        text-align: left;
        font-size: 14px;
        color: #ffffff;
        line-height: 30px;
        padding: 0 5px;

        &.last {
          border-right: none;
        }
      }
      .left {
        text-align: left;
      }
    }
    &.top-bottom {
      .left {
        flex: none;
        width: 192px !important;
      }
      .right {
        flex: 1;
      }
    }
  }
  // .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;
    background: url('../../assets/second/box-bg.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    padding: 1px;
    .thead,
    .tbody {
      div {
        flex: 1;
        text-align: left;
        box-sizing: border-box;
        text-align: center;
        border: 1px solid #1b365d;
      }
      // .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;
    div {
      font-size: 14px;
      color: #ffffff;
      background: url('../../assets/second/boxbtn-bg.png');
      background-size: 100% 100%;
      background-repeat: no-repeat;
      padding: 7px 15px;
    }
  }
  .flex {
    display: flex;
    justify-content: space-between;
  }
}
</style>