<template>
  <transition
    appear
    name="animate__animated animate__move"
    enter-active-class="animate__slideInRight"
    leave-active-class="animate__slideOutRight"
  >
    <div class="widget-ProjectInfo" v-if="show">
      <div class="head">
        <div class="title">
          <div class="icon"></div>
          <span class="site-info">项目情况</span>
          <div class="tab-list">
            <div class="tab-item" :class="{ 'tab-active': currentActive == 'num' }" @click="currentActive = 'num'">
              按数量统计
            </div>
            <div class="tab-item" :class="{ 'tab-active': currentActive == 'money' }" @click="currentActive = 'money'">
              按金额统计
            </div>
          </div>
        </div>
      </div>
      <div class="content-info">
        <div class="content-item">
          <div class="title">
            <div class="icon"></div>
            <span class="item-name">项目状态统计</span>
          </div>
          <div class="content statusContent">
            <div class="statusItem" v-for="item of statusList" :key="item.title">
              <div class="chart">
                <ComAnimateChart :img="item.img" :fontSize="$listeners.fontSize" />
              </div>
              <div class="statusInfo">
                <div class="value">{{ item.value + item.unit }}</div>
                <div class="name">{{ item.title }}</div>
              </div>
            </div>
          </div>
        </div>
        <div class="content-item">
          <div class="title">
            <div class="icon"></div>
            <span class="item-name">分公司项目统计</span>
          </div>
          <div class="content">
            <ComStatisticPieChart />
          </div>
        </div>
        <div class="content-item">
          <div class="title">
            <div class="icon"></div>
            <span class="item-name">项目投资排行榜</span>
          </div>
          <div class="content scrollContent">
            <ComBarChart />
          </div>
        </div>
      </div>
    </div>
  </transition>
</template>

<script>
import ComAnimateChart from '@/views/groupPage/components/ComAnimateChart.vue'
import ComStatisticPieChart from '@/views/groupPage/components/ComStatisticPieChart.vue'
import ComBarChart from '@/views/groupPage/components/ComBarChart.vue'
export default {
  name: 'ProjectInfo', //项目情况
  components: {
    ComAnimateChart,
    ComStatisticPieChart,
    ComBarChart
  },
  props: {
    show: {}
  },
  data() {
    return {
      statusList: [
        { title: '前期项目', value: 11, unit: '个', img: require('@/views/groupPage/images/模块图标/前期项目.png') },
        { title: '建设项目', value: 10, unit: '个', img: require('@/views/groupPage/images/模块图标/建设项目.png') },
        { title: '暂停项目', value: 1, unit: '个', img: require('@/views/groupPage/images/模块图标/暂停项目.png') },
        { title: '移交项目', value: 0, unit: '个', img: require('@/views/groupPage/images/模块图标/移交项目.png') }
      ],
      currentActive: 'num'
    }
  },
  watch: {
    show(n, o) {}
  },
  computed: {},
  mounted() {},
  methods: {}
}
</script>

<style lang='scss' scoped>
.animate__slideInRight,
.animate__slideOutRight {
  animation-duration: 3s; //动画持续时间
  animation-delay: 0s; //动画延迟时间
}
.widget-ProjectInfo {
  $size10: 0.052083rem /* 10/192 */;
  $size20: 0.104167rem /* 20/192 */;
  z-index: 2;
  //position
  bottom: $size10 /* 10/192 */;
  margin-right: $size20 /* 20/192 */;
  right: 0;
  position: absolute;
  //size
  height: calc(100% - 0.557292rem /* 107/192 */);
  width: 2.083333rem /* 400/192 */;
  //background
  background-color: rgba(20, 24, 47, 0.5);
  color: #eee;
  box-shadow: 0 0 20px rgba(1, 9, 20, 1);
  //font
  font-family: Source Han Sans CN-HEAVY;
  .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%);
    .title {
      width: 100%;
      height: 100%;
      display: flex;
      font-weight: 400;
      .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 {
        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;
        flex: 0.5;
      }
      .tab-list {
        display: flex;
        align-items: center;
        justify-content: space-around;
        width: 0.78125rem /* 150/192 */;
        flex: 0.5;
        font-family: Source Han Sans CN;
        font-size: 0.072917rem /* 14/192 */;
        font-weight: 400;
        .tab-item {
          cursor: pointer;
          height: 100%;
          display: flex;
          align-items: center;
        }
        .tab-active {
          color: #119cff;
          border-bottom: 3px solid;
          border-image: linear-gradient(0deg, rgba(17, 156, 255, 0.9) 0%, rgba(17, 156, 255, 0.02) 3%) 1;
        }
      }
    }
  }
  .content-info {
    width: 100%;
    height: calc(100% - 0.166667rem);
    overflow: auto;
    padding: 2px;
    .content-item {
      font-family: Source Han Sans CN-Medium;
      width: 100%;
      height: 33%;
      float: left;
      overflow: hidden;
      .title {
        width: 100%;
        display: flex;
        // padding: .145833rem 0 .104167rem 0;
        padding: 0.145833rem 0 0.026042rem /* 5/192 */ 0;
        .icon {
          height: 0.072917rem /* 14/192 */;
          width: 0.078125rem /* 15/192 */;
          margin-right: 0.046875rem /* 9/192 */;
          background: url('~@/views/groupPage/images/三角.png') no-repeat center center;
          background-size: 100% 100%;
        }
        .item-name {
          color: #ffffff;
          font-size: 0.072917rem /* 14/192 */;
          font-weight: 500;
        }
        .item-info {
          color: #2ba7ff;
          font-size: 0.072917rem /* 14/192 */;
          font-weight: 500;
        }
      }
      .content {
        height: calc(100% - 0.234375rem /* 45/192 */);
        width: 100%;
      }
      .scrollContent {
        overflow: auto;
      }
      .statusContent {
        display: grid;
        grid-template-columns: 1fr 1fr; //有几列
        grid-template-rows: 50% 50%; //有几行
        grid-gap: 0.104167rem /* 20/192 */;
        padding: 0.15625rem /* 30/192 */ 0.052083rem /* 10/192 */;
        .statusItem {
          width: 100%;
          height: 100%;
          display: flex;
          align-items: center;
          .chart {
            flex: 0.3;
            height: 100%;
          }
          .statusInfo {
            height: 80%;
            flex: 0.7;
            display: flex;
            flex-flow: column;
            align-items: center;
            justify-content: center;
            margin-left: -15%;
            background-image: radial-gradient(circle at -10% 50%, transparent 30%, rgba(43, 167, 255, 0.16) 21px);
            .value,
            .name {
              height: 50%;
              width: 100%;
              display: flex;
              align-items: center;
              justify-content: center;
              font-family: Source Han Sans CN;
            }
            .value {
              font-size: 0.083333rem /* 16/192 */;
              font-weight: bold;
              color: #ffffff;
              text-shadow: 0px 3px 8px rgba(3, 15, 32, 0.6);
            }
            .name {
              font-size: 0.072917rem /* 14/192 */;
              font-weight: 400;
              color: #2ba7ff;
            }
          }
        }
      }
    }
  }
}
</style>