<!--
 * @Descripttion: 
 * @version: 
 * @Author: JC9527
 * @Date: 2023-08-15 09:44:13
 * @LastEditors: JC9527
 * @LastEditTime: 2023-08-18 12:05:14
-->
<template>
  <div class="left-box">
    <div class="item left-list-title" :style="itemTwo">
      <title-box title="今日事件情况"></title-box>
      <div class="item-main">
        <div class="lists">
          <div class="bgc"></div>
          <div class="list-text"> · 上报事件总数</div>
          <div class="list-bottom">
            <img src="@/assets/images/incident.png" alt="">
            <div class="list-num">200</div>
          </div>
        </div>
        <div class="lists">
          <div class="bgc"></div>
          <div class="list-text"> · 已派发任务</div>
          <div class="list-bottom">
            <img src="@/assets/images/incident.png" alt="">
            <div class="list-num">180</div>
          </div>
        </div>
        <div class="lists">
          <div class="bgc"></div>
          <div class="list-text"> · 未派发任务</div>
          <div class="list-bottom">
            <img src="@/assets/images/incident.png" alt="">
            <div class="list-num">20</div>
          </div>
        </div>
      </div>
    </div>
    <div class="item left-list-title" :style="itemTwo">
      <title-box title="今日任务情况"></title-box>
      <div class="item-main">
        <div class="lists">
          <div class="bgc"></div>
          <div class="list-text"> · 处理任务总数</div>
          <div class="list-bottom">
            <img src="@/assets/images/task.png" alt="">
            <div class="list-num">200</div>
          </div>
        </div>
        <div class="lists">
          <div class="bgc"></div>
          <div class="list-text"> · 任务立案数量</div>
          <div class="list-bottom">
            <img src="@/assets/images/task.png" alt="">
            <div class="list-num">180</div>
          </div>
        </div>
        <div class="lists">
          <div class="bgc"></div>
          <div class="list-text"> · 任务结案数量</div>
          <div class="list-bottom">
            <img src="@/assets/images/task.png" alt="">
            <div class="list-num">20</div>
          </div>
        </div>
      </div>
    </div>
    <div class="item lfet-list-one" id="parent-getHeight" :style="itemOne">
      <title-box title="人员在线情况"></title-box>
      <map-number title="在线人员总数" :onLine="100" :sum="150" type="人" :numberArray="peopleArray" :height="oneHeight"></map-number>
    </div>
    <div class="item lfet-list-two" :style="itemOne">
      <title-box title="车辆在线情况"></title-box>
      <map-number title="在线车辆总数" :onLine="10" :sum="18" type="辆" :numberArray="vehicleArray" :height="oneHeight"></map-number>
    </div>
  </div>
</template>
<script>
import titleBox from '../../components/title/index.vue'
import mapNumber from '../../components/mapLeftNumber/index.vue'
export default {
  name:'mapLeftContent',
  components:{titleBox,mapNumber},
  data() {
    return {
      peopleArray:[
        {
          title:'李飞'
        },{
          title:'李飞'
        },{
          title:'李飞'
        },{
          title:'李飞'
        },{
          title:'李飞'
        },{
          title:'李飞'
        },{
          title:'李飞'
        },{
          title:'李飞'
        },{
          title:'李飞'
        },{
          title:'李飞'
        },
      ],
      vehicleArray:[
        {
          title:'苏A123456'
        },{
          title:'苏A123456'
        },{
          title:'苏A123456'
        },{
          title:'苏A123456'
        },{
          title:'苏A123456'
        },{
          title:'苏A123456'
        },{
          title:'苏A123456'
        },{
          title:'苏A123456'
        },{
          title:'苏A123456'
        },{
          title:'苏A123456'
        },
      ],
      itemOne:{
        height:'',
      },
      itemTwo:{
        height:'',
      },
      oneHeight:0,
      screenHeight:'',
    }
  },
  methods:{
    getDomHeight(){
      this.$nextTick(()=>{
        let dom = document.getElementsByClassName('lfet-list-one');
        let dom2 = document.getElementsByClassName('left-list-title');
        let height2 = dom2[0].getBoundingClientRect();
        let height = dom[0].getBoundingClientRect();
        let windowHeight = window.innerHeight;
        let relativeHeight = (windowHeight - height.top) / 2 - 14;
        let sum = relativeHeight * 2 - 2;
        let relativeHeight2 = (windowHeight - height2.top - sum) / 2 - 55;
        this.itemOne.height = relativeHeight + 'px';
        this.itemTwo.height = relativeHeight2 + 'px';
        this.oneHeight = Number(relativeHeight);
      })
    }
  },
  mounted(){
    window.addEventListener("resize", () => {
      this.screenHeight = document.body.clientHeight;
      this.getDomHeight();
    });
    this.getDomHeight();
  },
}
</script>
<style lang="scss" scoped>
.left-box {
  display: grid;
  grid-column: 1fr;
  grid-row-gap: 24px;
  height: 100%;
  .item {
    // background: rgba(222, 225, 230, 0.6);
    .item-main {
      margin-top: 5px;
      display: flex;
      justify-content: space-between;
      padding-left: 17px;
      .lists {
        // padding: 5px;
        width: 141px;
        display: flex;
        flex-direction: column;
        // justify-content: space-between;
        position: relative;
        
        .bgc {
          position: absolute;
          left: 0;
          top: 0;
          right: 0;
          bottom: 0;
          width: 141px;
          background: linear-gradient(180deg, #0073FF 0%, rgba(0,71,129,0) 100%);
          opacity: 0.5;
        }
        .list-text {
          font-size: 15px;
          height: 38px;
          font-family: Source Han Sans CN-Regular, Source Han Sans CN;
          font-weight: 400;
          color: #D3EEF2;
          line-height: 22px;
          background-image: url("../../../assets/images/masking.png");
          background-size: 100% 100%;
          padding: 16px 0 0 8px;
        }
        .list-bottom {
          display: flex;
          padding-left: 24px;
          margin-top: 11px;
          img {
            width: 37px;
            height: 40px;
            margin-right: 14px;
          }
          .list-num {
            font-size: 32px;
            font-family: D-DIN-Regular, D-DIN;
            font-weight: 400;
            color: #D3EEF2;
            line-height: 35px;
            letter-spacing: 1px
          }
        }
      }
    }
  }
  .lfet-list-one {
    height: 100%;
  }
  .left-list-title {
    height: 100%;
  }
}
</style>
