<template>
  <div class="panel sbgk">
    <!--<img :class="{ 'arrowTransform': !flag, 'arrowTransformReturn': flag}" src="./aa.png" alt="" @click="flag = !flag">-->

    <div class="panel-tit">设备工况</div>
    <div class="pie-box">
      <div class="pie-item">
        <pie-sounder v-on:GetKey="GetCon"></pie-sounder>
      </div>
      <div class="pie-item">
        <pie-camera v-on:Camera="CameCon"></pie-camera>
      </div>
    </div>
    <div class="num-analysis">
      <div>
        <ul style="display:flex;">
          <li>
            <p class="num-tit">布防</p>
            <p class="num-no">{{sf}}</p>
          </li>
          <li style="border-right: 1px dashed #42a4ff;">
            <p class="num-tit">撤防</p>
            <p class="num-no" style="color: #f84803;">{{cf}}</p>
          </li>
          <li>
            <p class="num-tit">旁路</p>
            <p class="num-no">{{pl}}</p>
          </li>
        </ul>
      </div>
      <div>
        <ul>
          <li>
            <p class="num-tit">录像机总数</p>
            <p class="num-no" style="color: #00acff">{{total}}</p>
          </li>
          <li>
            <p class="num-tit">异常数量</p>
            <p class="num-no" style="color: #fec400">{{error}}</p>
          </li>

          <!-- <li @click="postMsg('total', '摄像头')">
            <p class="num-tit">设备总数</p>
            <p class="num-no" style="color: #00acff">{{total}}</p>
          </li>
          <li @click="postMsg('error', '摄像头')">
            <p class="num-tit">异常数量</p>
            <p class="num-no" style="color: #fec400">{{error}}</p>
          </li> -->
        </ul>
      </div>
    </div>

    <div class="panel-footer"></div>
  </div>
</template>
<script>
import pieSounder from "./pieSounder";
import PieCamera from "./pieCamera";

export default {
  components: { pieSounder, PieCamera },
  name: "sbgk",
  data() {
    return {
      flag: false,
      sf:0,//周界设防
      cf:0,//周界撤防
      pl:0,//周界旁路

      total:0,//摄像机总数
      error:0,//摄像机在线数量
    };
  },
  mounted() {

  },
  methods: {
    GetCon(val){
      this.sf = val.sf
      this.cf = val.cf
      this.pl = val.pl
    },
    CameCon(val){
      this.total=val.total
      this.error=val.total-val.online
    },
    postMsg(state, name) {
      var myframe = document.getElementById("otherPage"); //获取iframe
      myframe.contentWindow.postMessage({ state: state, name: name }, "*"); //childDomain是子页面的源（协议+主机+端口号）
    },
  },
};
</script>

<style lang="scss" scoped>

// 设备工况
.panel.sbgk {
  z-index: 2;
}
//  .arrowTransform{
//     transition: 0.2s;
//     transform-origin: center;
//     transform: rotateZ(180deg);
//   }
//   .arrowTransformReturn{
//     transition: 0.2s;
//     transform-origin: center;
//     transform: rotateZ(0deg);
//   }
.pie-item {
  width: 50%;
  height: 24rem;
  display: inline-block;
  vertical-align: top;
}
.num-analysis {
  margin: 1rem;
  display: flex;
}
.num-analysis > div {
  width: 50%;
  border: 1px solid #3486da;
  display: inline-block;
  background: #074198;
}
.num-analysis > div:first-child {
  margin-right: 1rem;
}

.num-analysis ul li {
  padding: 0 1rem;
  margin: 10px 0;
  float: left;
  width: 50%;

  text-align: center;
  position: relative;
}

.num-analysis ul li:first-child {
  border-right: 1px dashed #42a4ff;
}
.num-tit {
  font-size: 1.4rem;
  margin-bottom: 1rem;
  white-space: nowrap;  //强制不换行
}
.num-no {
  font-size: 1.8rem;
  color: #04f9ab;
  font-family: "impact";
}
</style>
