<template>
  <div class="app-deviceBox">
    <div class="theme-card">
      <div class="title"><span>设备</span></div>
      <div class="content">
        <table class="deviceTb">
          <tr>
            <td style="padding: 0 7px 0 15px;">
              <div class="deviceBg eleVerHorCenter-box">
                <table class="PDAcontent">
                  <tr><td><span>{{PDANum}}</span> </td></tr>
                  <tr><td><div>{{PDAName}}</div></td></tr>
                </table>
              </div>
              <div class="deviceBg eleVerHorCenter-box marginTop">
                <table class="daoZhacontent">
                  <tr><td><span>{{daoZhaNum}}</span> </td></tr>
                  <tr><td><div>{{daoZhaName}}</div></td></tr>
                </table>
              </div>
            </td>
            <td style="padding: 0 15px 0 7px;">
              <div class="deviceBg eleVerHorCenter-box">
                <table class="diCicontent">
                  <tr><td><span>{{diCiNum}}</span> </td></tr>
                  <tr><td><div>{{diCiName}}</div></td></tr>
                </table>
              </div>
              <div class="deviceBg eleVerHorCenter-box marginTop">
                <table class="youDaocontent">
                  <tr><td><span>{{youDaoNum}}</span> </td></tr>
                  <tr><td><div>{{youDaoName}}</div></td></tr>
                </table>
              </div>
            </td>
          </tr>
        </table>
      </div>
    </div>
  </div>
</template>

<script>
import { deviceAddress, deviceAddressDY } from '../../api/api'
  export default {
    name: "device",
    data() {
      return {
        PDANum:'',//PDA数
        PDAName:'',
        diCiNum:'',//地磁数
        diCiName:'',
        daoZhaNum:'',//道闸数
        daoZhaName:'',
        youDaoNum:'',//诱导屏
        youDaoName:'',
        name: '设备'
      }
    },
    mounted() {
      this.onLoad()
    },
    methods: {
      onLoad() {
        this.$axios.all(
          [
            deviceAddress({ orgIds: this.GLOBAL.paramsvariables}),
            deviceAddressDY({ orgIds: this.GLOBAL.variables})
          ]
        )
        .then(this.$axios.spread((acctWX, acctDY) => {
          let WXdata = acctWX.data.data
          let DYdata = acctDY.data.data


          this.PDANum = WXdata[0].num+DYdata[0].num
          this.PDAName = WXdata[0].deviceName

          this.diCiNum = WXdata[1].num+DYdata[1].num
          this.diCiName = WXdata[1].deviceName

          this.daoZhaNum = WXdata[2].num+DYdata[2].num
          this.daoZhaName = WXdata[2].deviceName

          this.youDaoNum = WXdata[3].num+DYdata[3].num
          if(this.youDaoNum == 0){
            this.youDaoNum = '-'
          }
          this.youDaoName = WXdata[3].deviceName


          // this.PDANum = WXdata[0].num
          // this.PDAName = WXdata[0].deviceName
          //
          // this.diCiNum = WXdata[1].num
          // this.diCiName = WXdata[1].deviceName
          //
          // this.daoZhaNum = WXdata[2].num
          // this.daoZhaName = WXdata[2].deviceName
          //
          // this.youDaoNum = WXdata[3].num
          // if(this.youDaoNum == 0){
          //   this.youDaoNum = '-'
          // }
          // this.youDaoName = WXdata[3].deviceName


        }))
      }
    },
  }
</script>

<style scoped  lang="scss">
  .app-deviceBox {
    width: 100%;
  .theme-card{
    height: 100%;
  }
  .content{
    padding: 0px;
  }
  .marginTop{
    margin-top: 8% !important;
  }
  .deviceTb{
    margin: 0 auto;
    width: 100%;
    height: 100%;
  }
  .deviceTb >tr >td{
    vertical-align: middle;
    text-align: center;
    width: 50%;
  }
  .deviceBg{
    background: url(../../images/com/deviceBg.svg) no-repeat;
    background-size: 100% 100%;
    width: 100%;
    /*height:85%;*/
    margin:0px auto;
    /*padding: 5px;*/
    height: 40%;

    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
    -webkit-justify-content: center;
    justify-content: center;
  }
  .PDAcontent,.diCicontent,.daoZhacontent,.youDaocontent{
    margin: 0 auto;
  }
  .PDAcontent div,.diCicontent div,.daoZhacontent div,.youDaocontent div{
    font-size: 12px;
  }
  .PDAcontent span,.diCicontent span{
    background-image: -webkit-linear-gradient(bottom, #00CAFE, #2772F4);
    -webkit-background-clip:text;
    -webkit-text-fill-color:transparent;
    font-size: 24px;
  }
  .daoZhacontent span,.youDaocontent span{
    background-image: -webkit-linear-gradient(bottom, #FFBA00, #FF8100);
    -webkit-background-clip:text;
    -webkit-text-fill-color:transparent;
    font-size: 24px;
  }
  }
</style>
