<template>
  <div class="huankong-wrap">
    <ItemBox :title="$t('dashboard.environmentalData')" :show-point-setting="true" @handleSetting="handleSetting">
      <div v-if="airArr.length" v-loading="loading" class="box">
        <div v-for="(item,index) in airArr" :key="index" class="air-box">
          <div class="value">{{ item.value }}</div>
          <div class="label">
            <span class="air-left-jt " />
            <span class="air-icon left" />
            <span />
            <span class="name">{{ item.name }}</span>
            <span class="air-icon right" />
            <span class="air-right-jt " />
          </div>
        </div>

      </div>
      <div v-else class="box">
        <div class="empty">{{ $t("dashboard.noData") }}</div>
      </div>
    </ItemBox>
  </div>
</template>

<script>
import { DynamicConfigPoint } from '@/api/home-page/index'

export default {
  name: 'Index',
  props: {
    stationId: {
      type: Number,
      default: 0
    },
    permissionId: {
      type: Number,
      default: 0
    }
  },
  data() {
    return {
      hkList: [],
      statusData: {
        dischargCapacity: '',
        rechargeCapacity: '',
        grid: '',
        loading: false,
        permissionId: null

      },
      airArr: []
    }
  },
  computed: {

  },
  watch: {},
  created() {

  },
  mounted() { },
  methods: {
    handleSetting() {
      this.$emit('handleSetting')
    },
    async getData() {
      this.loading = true
      try {
        const res = await DynamicConfigPoint({
          pageLocation: 'airData',
          permissionId: this.permissionId,
          stationId: this.stationId })
        this.airArr = res.data
        // console.log(this.airArr)
      } catch (error) {
        // console.log(error);
      } finally {
        this.loading = false
      }
    }

  }
}
</script>
<style lang="scss" scoped>
.huankong-wrap {
  width: 100%;
  overflow: hidden;
}
.box {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  padding: 10px;
  height: 302px;
  overflow: auto;
  .empty {
    width: 100%;
    height: 280px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: Source Han Sans CN;
    font-size: 16px;
    color: rgba(206, 235, 255, 0.7);
  }
  .air-box {
    min-width: 120px;
    width: 47%;
    height: 60px;
    margin: 10px 0 0 0;
    background: url(../../../../assets/images/air-bg.png);
    background-size: 100% 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    .label {
      min-width: 86px;
      width: 100%;
      flex: 1;
      font-family: Source Han Sans CN;
      font-size: 14px;
      color: rgba(206, 235, 255, 0.7);
      display: flex;
      align-items: center;
      justify-content: center;
      .name{
        text-align: center;
        // min-width: 88px;
      }
      .air-icon {
        display: inline-block;
        width: 10px;
        height: 10px;
        background: url(../../../../assets/images/air-icon.png);
        background-size: 100% 100%;
      }
      .air-left-jt {
        display: inline-block;
        width: 8px;
        height: 8px;
        line-height: 0px;
        background: url(../../../../assets/images/air-left.png);
        background-size: 100% 100%;
        margin-right: 10px;
      }
      .air-right-jt {
        display: inline-block;
        width: 8px;
        height: 8px;
        line-height: 0px;
        background: url(../../../../assets/images/air-right.png);
        background-size: 100% 100%;
        margin-left: 10px;
      }
      .left {
        margin-right: 10px;
      }
      .right {
        margin-left: 10px;
      }
    }

    .value {
      width: 100%;
      flex: 1;
      font-family: DIN;
      font-size: 22px;
      color: #ffffff;
      text-shadow: 0px 0px 10px 0px #0094ff;
      display: flex;
      align-items: center;
      justify-content: center;
    }
  }

}

</style>
