<template>
  <div class="app-container">
    <div class="topitme ">
      <div class="e-tag">
        <img src="~@/assets/equipControl/设备数量.png" alt="">
        <div class="e-text">
          <span class="e-text-number">89</span>
          <span class="e-text-word">设备数量</span>
        </div>
      </div>
      <div class="e-tag">
        <img src="~@/assets/equipControl/设备异常.png" alt="">
        <div class="e-text">
          <span class="e-text-number">3</span>
          <span class="e-text-word">设备异常</span>
        </div>
      </div>
      <div class="e-tag">
        <img src="~@/assets/equipControl/设备预警.png" alt="">
        <div class="e-text">
          <span class="e-text-number">13</span>
          <span class="e-text-word">设备预警</span>
        </div>
      </div>
      <div class="e-tag">
        <img src="~@/assets/equipControl/设备故障.png" alt="">
        <div class="e-text">
          <span class="e-text-number">3</span>
          <span class="e-text-word">设备故障</span>
        </div>
      </div>
      <div class="e-tag">
        <img src="~@/assets/equipControl/运行中.png" alt="">
        <div class="e-text">
          <span class="e-text-number">7</span>
          <span class="e-text-word">运行中</span>
        </div>
      </div>
    </div>
    <div class="container">
      <div class="c-item boxShadow">
        <div class="c-item_title">
          <img src="~@/assets/equipControl/通风设备.png" alt="">
          <span>通风设备</span>
        </div>
        <div class="c-item-main">
          <div class="main_part">
            <div class="part">
              <span class="part-text">数 量</span>
              <span class="part-num">{{CountOfVentilate }}</span>
            </div>
            <img src="~@/assets/equipControl/半透数量.png" alt="">
          </div>
          <div class="main_part">
            <div class="part">
              <span class="part-text">在线设备</span>
              <span class="part-num">{{OnlineOfVentilate}}</span>
            </div>
            <img src="~@/assets/equipControl/半透在线设备.png" alt="">
          </div>
          <div class="main_part">
            <div class="part">
              <span class="part-text">使用率</span>
              <span class="part-num">{{UsageRateOfVentilate}}</span>
            </div>
            <img src="~@/assets/equipControl/半透使用率.png" alt="">
          </div>
          <div class="main_part">
            <div class="part">
              <span class="part-text">运行中</span>
              <span class="part-num">{{InServiceOfVentilate}}</span>
            </div>
            <img src="~@/assets/equipControl/半透运行中.png" alt="">
          </div>
        </div>
      </div>
      <div class="c-item boxShadow">
        <div class="c-item_title">
          <img src="~@/assets/equipControl/照明设备.png" alt="">
          <span>照明设备</span>
        </div>
        <div class="c-item-main">
          <div class="main_part">
            <div class="part">
              <span class="part-text">数 量</span>
              <span class="part-num">{{CountBasicDeviceControlIllumination}}</span>
            </div>
            <img src="~@/assets/equipControl/半透数量.png" alt="">
          </div>
          <div class="main_part">
            <div class="part">
              <span class="part-text">在线设备</span>
              <span class="part-num">{{OnlineOfLighting}}</span>
            </div>
            <img src="~@/assets/equipControl/半透在线设备.png" alt="">
          </div>
          <div class="main_part">
            <div class="part">
              <span class="part-text">使用率</span>
              <span class="part-num">{{UsageRateOfLighting}}</span>
            </div>
            <img src="~@/assets/equipControl/半透使用率.png" alt="">
          </div>
          <div class="main_part">
            <div class="part">
              <span class="part-text">运行中</span>
              <span class="part-num">{{InServiceOfLighting}}</span>
            </div>
            <img src="~@/assets/equipControl/半透运行中.png" alt="">
          </div>
        </div>
      </div>
      <div class="c-item boxShadow">
        <div class="c-item_title">
          <img src="~@/assets/equipControl/控温设备.png" alt="">
          <span>控温设备</span>
        </div>
        <div class="c-item-main">
          <div class="main_part">
            <div class="part">
              <span class="part-text">数 量</span>
              <span class="part-num">{{countDeviceControlHeat}}</span>
            </div>
            <img src="~@/assets/equipControl/半透数量.png" alt="">
          </div>
          <div class="main_part">
            <div class="part">
              <span class="part-text">在线设备</span>
              <span class="part-num">{{OnlineBasicDeviceControlHeat}}</span>
            </div>
            <img src="~@/assets/equipControl/半透在线设备.png" alt="">
          </div>
          <div class="main_part">
            <div class="part">
              <span class="part-text">使用率</span>
              <span class="part-num">{{UsageRateDeviceControlHeat}}</span>
            </div>
            <img src="~@/assets/equipControl/半透使用率.png" alt="">
          </div>
          <div class="main_part">
            <div class="part">
              <span class="part-text">运行中</span>
              <span class="part-num">{{InServiceDeviceControlHeat}}</span>
            </div>
            <img src="~@/assets/equipControl/半透运行中.png" alt="">
          </div>
        </div>
      </div>
    </div>
  </div>
  </div>
</template>
<script>
import {
   getDeviceControlHeat, 
   getOnlineDeviceControlHeat,
   getUsageRateDeviceControlHeat,
   getInServiceDeviceControlHeat,
   getCountOfZm,
   getOnlineOfLighting,
   getUsageRateOfLighting,
   getInServiceOfLighting,

   getCountOfVentilate,
   getOnlineOfVentilate,
   getUsageRateOfVentilate,
   getInServiceOfVentilate,

   getCountOfDevice,
   } from '@/api/equipControl/index'
export default {
  data () {
    return {
      // 控温设备
      countDeviceControlHeat:'',
      OnlineBasicDeviceControlHeat:'',
      UsageRateDeviceControlHeat:'',
      InServiceDeviceControlHeat:'',

      CountBasicDeviceControlIllumination:'',
      OnlineOfLighting:'',
      UsageRateOfLighting:'',
      InServiceOfLighting:'',

      CountOfVentilate:'',
      OnlineOfVentilate:'',
      UsageRateOfVentilate:'',
      InServiceOfVentilate:'',

      CountOfDevice:'',
    }

  },
  mounted () {
    this.getCountBasicDeviceControlHeat()
    this.getOnlineBasicDeviceControlHeat()
    this.getUsageRateBasicDeviceControlHeat()
    this.getInServiceBasicDeviceControlHeat()
    this.getCountOfDeviceZm()
    this.getOnlineOfDeviceZm()
    this.getUsageRateOfDeviceZm()
    this.getInServiceOfDeviceZm()

    this.getCountOfDeviceVentilate()
    this.getOnlineOfDeviceVentilate()
    this.getUsageRateOfDeviceVentilate()
    this.getInServiceOfDeviceVentilate()

    this.getCount()
  },
  methods: {
    getCountBasicDeviceControlHeat () {
      getDeviceControlHeat().then(res => {
        this.countDeviceControlHeat = res
      }).catch(err => {
        console.log(err)
      })
    },
    getOnlineBasicDeviceControlHeat () {
      getOnlineDeviceControlHeat().then(res => {
        this.OnlineBasicDeviceControlHeat = res
      }).catch(err => {
        console.log(err)
      })
    },
    getUsageRateBasicDeviceControlHeat () {
      getUsageRateDeviceControlHeat().then(res => {
        this.UsageRateDeviceControlHeat = res
      }).catch(err => {
        console.log(err)
      })
    },
    getInServiceBasicDeviceControlHeat () {
      getInServiceDeviceControlHeat().then(res => {
        this.InServiceDeviceControlHeat = res
      }).catch(err => {
        console.log(err)
      })
    },
    // 照明设备
    getCountOfDeviceZm(){
      getCountOfZm().then(res => {
        this.CountBasicDeviceControlIllumination = res
      }).catch(err => {
        console.log(err)
      })
    },
    getOnlineOfDeviceZm(){
      getOnlineOfLighting().then(res => {
        console.log(res, 'getOnlineOfLighting')
        this.OnlineOfLighting = res
      }).catch(err => {
        console.log(err)
      })
    },
    getUsageRateOfDeviceZm(){
      getUsageRateOfLighting().then(res => {
        console.log(res, 'getUsageRateOfLighting')
        this.UsageRateOfLighting = res
      }).catch(err => {
        console.log(err)
      })
    },
    getInServiceOfDeviceZm(){
      getInServiceOfLighting().then(res => {
        console.log(res, 'getInServiceOfLighting')
        this.InServiceOfLighting = res
      }).catch(err => {
        console.log(err)
      })
    },
// 通风设备
    getCountOfDeviceVentilate(){
      getCountOfVentilate().then(res => {
        console.log(res, 'getCountOfVentilate')
        this.CountOfVentilate = res
      }).catch(err => {
        console.log(err)
      })
    },

    
    getOnlineOfDeviceVentilate(){
      getOnlineOfVentilate().then(res => {
        console.log(res, 'getOnlineOfVentilate')
        this.OnlineOfVentilate = res
      }).catch(err => {
        console.log(err)
      })
    },
    getUsageRateOfDeviceVentilate(){
      getUsageRateOfVentilate().then(res => {
        console.log(res, 'getUsageRateOfVentilate')
        this.UsageRateOfVentilate = res
      }).catch(err => {
        console.log(err)
      })
    },
    getInServiceOfDeviceVentilate(){
      getInServiceOfVentilate().then(res => {
        console.log(res, 'getInServiceOfVentilate')
        this.InServiceOfVentilate = res
      }).catch(err => {
        console.log(err)
      })
    },
    // 设备数量
    getCount(){
      getCountOfDevice().then(res => {
        console.log(res, 'getCountOfDevice')
        this.CountOfDevice = res
      }).catch(err => {
        console.log(err)
      })
    },
  }
}
</script>

<style lang="scss" scoped>
.topitme {
  display: flex;
  justify-content: space-between;
  align-items: center;
  // background-color: #fff;
  // border-radius: 10px;
  .e-tag {
    height: 100px;
    width: 19%;
    padding: 0 25px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 5px -5px 10px -4px #efe3e3, -5px 5px 10px -4px #efe3e3;
    .e-text {
      display: flex;
      flex-direction: column;
      // align-items: center;
      .e-text-number {
        color: #5283e7;
        font-size: 30px;
      }
      .e-text-word {
        font-size: 15px;
      }
    }
  }
}

.container {
  // margin-top: 10px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  .c-item {
    width: 100%;
    height: 170px;
    border-radius: 10px;
    background-color: #fff;

    display: flex;
    justify-content: flex-start;
    padding: 10px;
    margin-top: 15px;
    .c-item_title {
      width: 200px;
      height: 150px;
      // background-color: green;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: space-evenly;
      img {
        width: 80px;
        height: 80px;
      }
      span {
        font-size: 15px;
      }
    }
    .c-item-main {
      width: 100%;
      height: 150px;
      // background-color: #FFF;
      padding: 10px 0;
      display: flex;
      justify-content: space-between;

      .main_part {
        min-width: 180px;
        height: 130px;
        display: flex;
        justify-content: space-between;
        background-color: #fafafa;
        padding: 10px 10px 10px 20px;
        border-radius: 10px;
        border: 1px solid #ccc;
        .part {
          display: flex;
          flex-direction: column;
          justify-content: space-evenly;
          .part-text {
            font-size: 15px;
          }
          .part-num {
            font-size: 25px;
            font-weight: 800;
            color: #5283e7;
          }
        }
        img {
          width: 60px;
          height: 60px;
          align-self: flex-end;
        }
      }
    }
  }
  // .c-item:nth-of-type(n+2) {
  //   margin-top: 15px;
  // }
}
</style>