<template>
  <transition
    appear
    name="animate__animated animate__move"
    enter-active-class="animate__slideInLeft"
    leave-active-class="animate__slideOutLeft"
  >
    <div class="widget-StatisticOfWI">
      <div class="head">
        <div class="title">
          <div class="icon"></div>
          <span class="site-info">预警指标统计</span>
        </div>
      </div>
      <div class="content-info">
        <div class="percentChartContent">
          <div class="pc-item" v-for="item of pcList" :key="item.title">
            <div class="pc-chart"><ComProgressPercentChart :color="item.color" /></div>
            <div class="pc-title">{{ item.title + item.value + '个' }}</div>
          </div>
        </div>
        <div class="radarChartContent">
          <div class="rc-chart">
            <ComRadarChart />
          </div>
          <div class="rc-switch">
            <div
              class="switch-item"
              v-for="(item, index) of ['重点关注', '一般关注']"
              :key="index"
              @click="current = item"
              :class="{ 'active-item': current == item }"
            >
              <div class="wrap" :class="{ active: current == item }">
                {{ item }}
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </transition>
</template>

<script lang="ts">
import { Vue, Component, Prop, Watch } from 'vue-property-decorator'
import ComProgressPercentChart from '@/views/groupPage/components/PieChart/ComProgressPercentChart.vue'
import ComRadarChart from '@/views/groupPage/components/OthersChart/ComRadarChart.vue'
//预警指标统计
@Component({ name: 'StatisticOfWI', components: { ComProgressPercentChart, ComRadarChart } })
export default class StatisticOfWI extends Vue {
  current = '重点关注'
  pcList: Array<any> = [
    { title: '指标总数', value: 120, color: ['#F5ED72', '#02C1A4'] },
    { title: '报警指标', value: 70, color: ['#FFA16D', '#F02828'] },
    { title: '推测指标', value: 50, color: ['#02D4F3', '#0976FE'] }
  ]
}
</script>

<style lang="scss" scoped>
.animate__slideInLeft,
.animate__slideOutLeft {
  animation-duration: 3s; //动画持续时间
  animation-delay: 0s; //动画延迟时间
}
.widget-StatisticOfWI {
  $size20: 0.104167rem /* 20/192 */;
  z-index: 2;
  //position
  bottom: 0.052083rem /* 10/192 */;
  margin-left: $size20 /* 20/192 */;
  position: absolute;
  //size
  height: calc(100% - 2.895833rem /* 556/192 */);
  width: 2.083333rem /* 400/192 */;
  color: #eee;
  .head {
    height: 0.166667rem /* 32/192 */;
    width: 100%;
    background: linear-gradient(-90deg, rgba(43, 167, 255, 0.2) 0%, rgba(43, 167, 255, 0.08) 100%);
    font-family: Source Han Sans CN-HEAVY;
    .title {
      width: 100%;
      height: 100%;
      display: flex;
      font-weight: 400;
      align-items: center;
      .icon {
        height: 0.166667rem /* 32/192 */;
        width: 0.34375rem /* 66/192 */;
        background: url('~@/views/groupPage/images/模块图标/智慧预警/预警指标.png') no-repeat center center;
        background-size: 100% 100%;
      }
      span {
        flex: 1;
        font-weight: bold;
        font-size: 0.083333rem /* 16/192 */;
        color: #ffffff;
        padding: 0.041667rem /* 8/192 */;
        background: linear-gradient(0deg, #9bd2fa 0%, #ffffff 100%);
        background-clip: text;
        -webkit-text-fill-color: transparent;
      }
    }
  }
  .content-info {
    width: 100%;
    height: calc(100% - 0.166667rem);
    display: inline-block;
    font-family: Source Han Sans CN;
    background: linear-gradient(0deg, rgba(14, 167, 255, 0.16) 0%, rgba(14, 167, 255, 0.02) 100%);
  }
  .percentChartContent {
    margin-top: 0.104167rem /* 20/192 */;
    height: 0.65625rem /* 126/192 */;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.057292rem /* 11/192 */;
    .pc-item {
      display: flex;
      align-items: center;
      justify-content: space-evenly;
      flex-flow: column;
      background: #062239;
      .pc-chart {
        height: calc(100% - 0.229167rem /* 44/192 */);
        width: 100%;
      }
      .pc-title {
        height: 0.072917rem /* 14/192 */;
        font-size: 0.072917rem /* 14/192 */;
        font-family: Source Han Sans CN;
        font-weight: 400;
        color: #0ea7ff;
      }
    }
  }
  .radarChartContent {
    height: calc(100% - 0.760417rem /* 146/192 */);
    width: 100%;
    display: flex;
    flex-flow: column;
    align-items: center;
    .rc-chart {
      width: 100%;
      height: calc(100% - 0.260417rem /* 50/192 */);
    }
    .rc-switch {
      margin-top: 0.052083rem /* 10/192 */;
      height: 0.15625rem /* 30/192 */;
      width: 0.833333rem /* 160/192 */;
      display: flex;
      justify-content: center;
      align-items: center;
      border: 1px solid #3cacf7;
      .switch-item {
        height: 100%;
        width: 0.416667rem /* 80/192 */;
        display: flex;
        justify-content: center;
        align-items: center;
        font-size: 0.072917rem /* 14/192 */;
        font-weight: 400;
        color: #84bde5;
        cursor: pointer;
      }
      .wrap {
        height: 55%;
        width: 88%;
        display: flex;
        justify-content: center;
        align-items: center;
      }
      .active-item {
        background: #1ddcff;
      }
      .active {
        background: #072034;
        box-shadow: 0 0 8px 6px #072034;
        border-radius: 1px;
        color: #ffffff;
      }
    }
  }
}
</style>