<template>
  <div class="bigscreen-personal-center">
    <nav-temp htmlType="t3" title="">
      <div class="conter-blokc" slot="mk-center">
        <div v-for="item in list" :key="item.deviceKey" class="info-crad">
          <div class="info-title">
            <img :src="titleImg" />
            {{ item.deviceName }}
          </div>
          <div class="info-block">
            <div class="device-info">
              <img :src="deviceImg" />
              <div
                class="info-state-wrap"
                :style="item.unProcessAlarmTotal > 0 ? 'color: red;' : ''"
                v-text="item.unProcessAlarmTotal > 0 ? '报警' : '正常'"
              ></div>
              <div class="info-lable">设备状态</div>
            </div>
            <div class="alarm-info" style="font-size: 20px; padding-right: 6px">
              <img :src="alarmImg" />
              <div class="info-alarm-num">{{ item.unProcessAlarmTotal }}</div>
              个
              <div class="info-lable">报警总数</div>
            </div>
            <el-button
              type="text"
              class="big-el-button"
              @click="toDeviceDetails(item)"
              icon="el-icon-search"
              >查看详情</el-button
            >
          </div>
        </div>
      </div>
    </nav-temp>
  </div>
</template>
<script>
import titleImg from "@/assets/images/big/z_title.png";
import deviceImg from "@/assets/images/big/device_1.png";
import alarmImg from "@/assets/images/big/alarm1.png";
import { listDevice } from "@/api/personal/device";
import NavTemp from './navTemp';
export default {
  name: "personalCenter",
  components: {
    NavTemp
  },
  props: [""],
  data() {
    return {
      titleImg,
      deviceImg,
      alarmImg,
      list: []
    };
  },
  created() {
    this.getDeviceList();
  },
  methods: {
    getDeviceList() {
      listDevice({
        pageNum: 1,
        pageSize: 9999
      }).then(response => {
        this.list = response.rows;
      });
    },
    toDeviceDetails(row) {
      this.$router.push({
        name: "Device_oneself",
        params: { deviceId: row.deviceId, tempType: "details" }
      });
    }
  }
};
</script>
<style lang="scss" scoped>
.bigscreen-personal-center {
  width: 100%;
  height: 100%;
  // overflow: auto;
  -ms-flex-wrap: wrap;
  // padding-top: 10px;
  float: left;
  .conter-blokc {
    width: 100%;
    height: calc(100% - 60px);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    padding-top: 10px;
    background-size: contain;
    justify-content: start;
    padding: 0 20px;
    .info-crad {
      width: 358px;
      height: 243px;
      width: 333px;
      background: rgba(0, 36, 125, 0.5);
      /* -webkit-box-shadow: 0px 0px 18px 3px rgb(73 94 255 / 70%); */
      box-shadow: 0px 0px 18px 6px #495effb3;
      margin: 4px;
      float: left;
      display: flex;
      flex-wrap: wrap;
      // background-image: url("../../../../assets/images/big/info_bg.png");
      .info-title {
        width: 100%;
        height: 70px;
        display: flex;
        padding-left: 30px;
        -webkit-box-align: center;
        -ms-flex-align: center;
        align-items: flex-end;
        font-size: 18px;
        font-family: "Source Han Sans CN";
        font-weight: 400;
        color: #ffffff;
        line-height: 20px;
        align-items: center;

        > img {
          margin-right: 5px;
        }
      }
      .info-block {
        height: calc(100% - 70px);
        width: 100%;
        display: flex;
        -ms-flex-wrap: wrap;
        flex-wrap: wrap;
        -webkit-box-align: center;
        -ms-flex-align: center;
        align-items: center;
        justify-content: flex-end;
      }
      .device-info {
        width: 50%;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        height: 80px;
        > img {
          margin-right: 10px;
          margin-left: 20px;
          width: 28px;
        }
        .info-state-wrap {
          width: calc(100% - 80px);
          height: 45px;
          font-size: 24px;
          font-family: "Source Han Sans CN";
          font-weight: 400;
          color: #04fefe;
          line-height: 42px;
        }
        .info-lable {
          font-size: 16px;
          font-family: " Source Han Sans CN";
          font-weight: 400;
          color: #ffffff;
          line-height: 22px;
          padding-left: 20px;
          height: 25px;
        }
      }
      .alarm-info {
        width: 50%;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        height: 80px;
        > img {
          margin-right: 10px;
          margin-left: 20px;
          width: 28px;
        }
        .info-alarm-num {
          font-size: 30px;
          font-family: "ShiShangZhongHeiJianTi";
          font-weight: 400;
          color: #fab03c;
          line-height: 42px;
          width: 80px;
          overflow: hidden;
        }
        .info-lable {
          font-size: 16px;
          font-family: " Source Han Sans CN";
          font-weight: 400;
          color: #ffffff;
          line-height: 22px;
          padding-left: 20px;
          height: 25px;
        }
      }
      .big-el-button {
        margin-right: 15px;
      }
    }
  }
}
</style>
