<!--能源使用情况-->
<template>
  <div class="energy-use">
    <secondary-title :title="title">
      <template>
        <div class="right-tab">
          <div class="tab-type" v-for="item of tabDataList" :class="activeTab === item.value? 'active-tab':''"
               @click="tabChange(item.value)">
            {{ item.name }}
          </div>
        </div>
      </template>
    </secondary-title>
    <div class="energy-use-info">
      <div class="electricity-water-usage">
        <div class="electricity-usage">
          <div class="electricity-icon"></div>
          <div class="electricity-info">
            <div class="_title">今日用电[kwh]</div>
            <div class="_value">1244</div>
          </div>
        </div>
        <div class="water-usage">
          <div class="water-icon"></div>
          <div class="water-info">
            <div class="_title">今日用水[m³]</div>
            <div class="_value">185</div>
          </div>
        </div>
      </div>
      <third-level-label :title="thirdLevelLabel">
        <template>
          <div class="electricity-water-tab">
            <div class="_title" :class="electricityWaterTab === 0? 'activeTitle':''" @click="changeTitle(0)">用电</div>
            <div class="_line">|</div>
            <div class="_title" :class="electricityWaterTab === 1? 'activeTitle':''" @click="changeTitle(1)">用水</div>
          </div>
        </template>
      </third-level-label>
      <div class="electricity-water-trends">
        <electricity-water-charts :data-source="electricityWaterDataSource"/>
      </div>
    </div>

  </div>
</template>

<script>

import ElectricityWaterCharts from "@/components/charts/ElectricityWaterCharts";

export default {
  name: "EnergyUse",
  components: {ElectricityWaterCharts},
  data() {
    return {
      title: '能源使用情况',
      thirdLevelLabel: '水电使用趋势',
      tabDataList: [
        {
          name: '今日',
          value: '0'
        },
        {
          name: '本月',
          value: '1'
        },
        {
          name: '上月',
          value: '2'
        }
      ],
      activeTab: '0',
      electricityWaterDataSource: [
        {
          attr: '用电',
          name: '00:00',
          value: '10'
        },
        {
          attr: '用电',
          name: '01:00',
          value: '30'
        },
        {
          attr: '用电',
          name: '02:00',
          value: '20',
        },
        {
          attr: '用电',
          name: '03:00',
          value: '20'
        },
        {
          attr: '用电',
          name: '04:00',
          value: '30'
        },
        {
          attr: '用电',
          name: '05:00',
          value: '10'
        },
        {
          attr: '用电',
          name: '06:00',
          value: '16'
        },
        {
          attr: '用电',
          name: '07:00',
          value: '30'
        }
      ],
      electricityWaterTab: 0
    }
  },
  methods: {
    tabChange(val) {
      this.activeTab = val
    },
    //用电、用水tab切换
    changeTitle(val) {
      this.electricityWaterTab = val
    }
  }
}
</script>

<style scoped lang="less">
@import "assets/styles/mixin";

.energy-use {
  height: 877px;
  width: 100%;
  background-image: linear-gradient(62deg, rgba(8, 31, 55, 0.10) 0%, rgba(18, 50, 81, 0.10) 100%);
  /*  border: 1px solid transparent; !* 先将边框颜色设置为透明 *!
    border-image: linear-gradient(rgba(79, 182, 238, 0), rgba(39, 127, 216, 1)); !* 使用线性渐变作为边框图片 *!
    border-image-slice: 1; !* 指定切分边框图像的位置 *!*/
  .flex-column;

  .energy-use-info {
    flex: 1;
    height: 0;
    padding: 0 50px;
    .flex-column;

    .electricity-water-usage {
      height: 247px;
      .flex-row;
      justify-content: space-between;

      .electricity-usage {
        .flex-row;

        .electricity-icon {
          width: 132px;
          height: 159px;
          .bg("~/assets/peakCoalImages/right/electricity-icon.webp");
        }

        .electricity-info {
          padding-left: 20px;
        }
      }

      .water-usage {
        .flex-row;

        .water-icon {
          width: 132px;
          height: 159px;
          .bg("~/assets/peakCoalImages/right/water-icon.webp");
        }

        .water-info {
          padding-left: 20px;
        }
      }

      ._title {
        font-family: MicrosoftYaHei;
        font-size: 34.3px;
        color: #6AC4FF;
        letter-spacing: 2.26px;
        font-weight: 400;
      }

      ._value {
        font-family: YouSheBiaoTiHei;
        font-size: 85.76px;
        color: #FFFFFF;
        letter-spacing: 5.64px;
        font-weight: 400;
      }
    }

    .electricity-water-trends {
      flex: 1;
      height: 0;
    }

  }

  .right-tab {
    height: 100%;
    .flex-row;
    justify-content: space-between;
    width: 480px;

    .tab-type {
      width: 144px;
      height: 59px;
      .bg("~/assets/peakCoalImages/left/pollutant-type-default-bg.png");
      font-family: MicrosoftYaHei;
      font-size: 29.97px;
      color: rgba(216, 240, 255, 0.50);
      letter-spacing: 0;
      text-align: center;
      line-height: 59px;
      text-shadow: 0 0 11px #0091FF;
      font-weight: 400;
      cursor: pointer;
    }

    .active-tab {
      .bg("~/assets/peakCoalImages/left/pollutant-type-active-bg.png");
      color: #D8F0FF;
      text-shadow: 0 0 33px #0091FF;
      font-weight: 400;
    }
  }

  .electricity-water-tab {
    width: 180px;
    height: 100%;
    .flex-row;
    justify-content: space-between;

    ._title {
      font-family: PingFangSC-Semibold;
      font-size: 30.01px;
      color: rgba(106, 196, 255, 0.60);
      letter-spacing: 0;
      text-align: right;
      line-height: 42px;
      font-weight: 600;
      cursor: pointer;
    }

    .activeTitle {
      color: #6AC4FF;
    }

    ._line {
      color: #6AC4FF;
    }
  }

}
</style>
