<template>
  <div id="pieCmp3" @click="jump">
    <div class="cc-details">
      <div>车位总数</div>
      <div class="card" v-for="item in parkingLotCount">{{item}}</div>
    </div>
    <div class="cc-main-container">
      <div class="ccmc-left">
        <div class="station-info">
          <div class="name">已占用车位</div>
          <span>0</span>
        </div>
        <div class="station-info">
          <div class="name">空闲车位</div>
          <span>0</span>
        </div>
      </div>
      <dv-active-ring-chart class="ccmc-middle" :config="config" />
    </div>
  </div>
</template>

<script>

export default {
  name: 'pieCmp3',
  components: {
  },
  data () {
    return {
      config: {
        data: [
          {
            name: '已占用车位',
            value: 0
          },
          {
            name: '空闲车位',
            value: 0
          },
        ],
        color: ['#00baff', '#3de7c9'],
        lineWidth: 10,
        radius: '70%',
        activeRadius: '80%',
        style:{
          fontSize:5
        }
      },
      parkingLotCount:[0]
    }
  },
  props:['carCountData'],
  watch:{
    carCountData(){
      let val = this.carCountData.parkingLotCount + ""
      this.parkingLotCount.length = 0
      for(var i =0;i<val.length;i++){
        this.parkingLotCount.push(val[i])
      }
    }
  },
  methods:{
    jump(){
      this.$router.push({path:'/community/parkinglot'})
    }
  }
}
</script>

<style lang="less">
#pieCmp3 {
  width: 100%;
  height:100%;
  margin: 0px;
  padding: 0px;
  display: flex;
  flex-direction: column;
  cursor: pointer;

  .cc-details {
    display: flex;
    justify-content: center;
    font-size: 16px;
    align-items: center;

    .card {
      background-color: rgba(4,49,128,.6);
      color: #08e5ff;
      height: 40px;
      width: 40px;
      font-size: 20px;
      font-weight: bold;
      line-height: 40px;
      text-align: center;
      margin: 10px;
    }
  }

  .cc-main-container {
    position: relative;
    flex: 1;
    display: flex;

    .ccmc-middle {
      width: 50%;
      height: 100%;
      display: flex;
      flex-direction: column;
      justify-content: center;
      .active-ring-name {
        font-size: 14px !important;
      }
    }

    .ccmc-left, .ccmc-right {
      width: 50%;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      font-size: 14px;

      span {
        font-size: 14px;
        font-weight: bold;
      }

      .station-info {
        height: 40px;
        display: flex;
        align-items: center;
      }
      .name{
        width: 2rem;
        text-align: right;
        margin-right: 20px;
      }
    }

    .ccmc-left {
      span {
        color: #36a2e1;
      }
    }

    .ccmc-right {
      align-items: flex-start;

      span {
        margin-right: 20px;
      }
    }
  }

  .label-tag {
    position: absolute;
    width: 500px;
    height: 30px;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
  }
}
</style>
