<!--
 * @Author: 纪泽龙 jizelong@qq.com
 * @Date: 2022-06-21 09:24:11
 * @LastEditors: 纪泽龙 jizelong@qq.com
 * @LastEditTime: 2022-10-10 10:01:57
 * @FilePath: /danger-manage-web/src/components/bigWindow/Danger.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
        

-->
  
<template>
  <div class="danger-wrapper">
    <div class="close" @click="close">
      <img src="@/assets/images/closeBtn.png" alt="" />
    </div>
    <div class="up pb10" :class="{ noBroder: deviceData.colorNum > 2 }">
      <div class="one flex fz16">
        <div class="flex-item">
          <span class="left">设备名称:</span
          ><span v-unValue class="right">{{ deviceData.sbmc }}</span>
        </div>
        <div class="flex-item">
          <span class="left">设备编号:</span
          ><span v-unValue class="right">{{ deviceData.sbbh }}</span>
        </div>
        <div class="flex-item">
          <span class="left">探测介质:</span
          ><span v-unValue class="right">{{ deviceData.tcjz }}</span>
        </div>
        <div class="flex-item">
          <span class="left">设备状态:</span
          ><span v-unValue class="right">{{ deviceData.sbzt }}</span>
        </div>
      </div>
      <div class="item" v-if="deviceData.jcz">
        <span class="left">监测值:</span
        ><span v-unValue class="right">{{ deviceData.jcz }}</span>
      </div>
    </div>
  </div>
</template>

<script>
import { getInfo } from "@/api/map/deviceInfo";

export default {
  name: "tcq",
  data() {
    return {
      deviceData: null,
    };
  },
  created() {
    // console.log(this.deviceData);
    this.$nextTick(() => {
      this.getInfo(this.deviceData.deviceId);
    });
  },
  methods: {
    getInfo(id) {
      getInfo(id).then((res) => {
        const data = res.data;
        const obj = {
          deviceId: data.mapDeviceId,
          latitude: data.latitude,
          longitude: data.longitude,
          deviceType: data.mapDeviceType,
          title: data.mapDeviceName,
          sbmc: data.mapDeviceName,
          // 号
          sbbh: item.mapDeviceNum,

          // 探测介质
          tcjz: data.mapDeviceMedium,
          sbzt: data.monitorDeviceStatus,
          jcz: data.monitorValue + "" + data.mapDeviceUnit,
          shortNum: 12,
          config: { scale: 1, textHeight: -94 },
        };
        this.deviceData = obj;
      });
    },
    close() {
      //this.handleClose();
      this.mapClass.clearInfoWindow();
    },
  },
};
</script>
<style lang="scss" scoped>
.danger-wrapper {
  background-color: rgba(9, 18, 32, 0.6);
  position: absolute;
  padding: 30px;
  padding-bottom: 0;
  box-sizing: border-box;
  width: 500px;
  // height: 510px;
  .up {
    // border-bottom: 1px solid #cccccc;
    margin-bottom: 15px;
    &.noBroder {
      // border-bottom: 0px solid #cccccc;
      margin-bottom: 10px;
    }
  }
  .tit {
    line-height: 14px;
    color: #ffffff;
    font-weight: 600;
    position: relative;
    margin-left: 12px;
    &:before {
      content: "";
      position: absolute;
      width: 5px;
      height: 15px;
      left: -12px;
      top: 0;
      background: #fff;
    }
  }
  .close {
    position: absolute;
    right: 15px;
    top: 10px;
    cursor: pointer;
  }
  .one {
    width: 100%;
    flex-wrap: wrap;
    .flex-item {
      width: 50%;
      margin-bottom: 5px;
      .left {
        color: #cccccc;
      }
      .right {
        color: #fff;
        margin-left: 5px;
      }
    }
  }
  .item {
    margin-bottom: 5px;
    .left {
      color: #cccccc;
    }
    .right {
      color: #fff;
      margin-left: 5px;
    }
    .img {
      width: 300px;
      height: 120px;
      display: inline-block;
      vertical-align: top;
      margin-left: 5px;
      img {
        width: 100%;
        height: 100%;
      }
    }
  }
}
</style>
