Newer
Older
CloudBrainNew / src / views / cityConstruction / components / projects / components / projectTotal.vue
StephanieGitHub on 29 Mar 2021 1 KB ADD: 智慧项管数据联调
<!--
 * @Description: 项目整体概况
 * @Author: 王晓颖
 * @Date: 2020-12-01 16:11:45
 -->
<template>
    <div class="PlanningLand">
      <div class="item">
        <image-block :data="data"/>
      </div>
      <div class="item-line">
        {{radio}}
      </div>
    </div>
  <!--</chart-layout>-->
</template>

<script>
import {fetchProjectCount} from '@/api/projectManage'
import ImageBlock from '@/components/block/imageBlock'
import {getYear} from '@/utils/formatDate'

export default {
  name: 'ProjectTotal',
  components: {ImageBlock},
  data () {
    return {
      year: getYear(),
      radio: '同比增长:+10%',
      icon: require('@/assets/images/construction/icon-total.png'),
      data: {
        name: '总项目',
        value: 0,
        unit: '个'
      }
    }
  },
  mounted () {
    this.getData()
  },
  methods: {
    getData () {
      fetchProjectCount(this.year).then(res => {
        if (res.code === 200) {
          this.data = {
            name: '总项目',
            value: res.data.total,
            unit: '个'
          }
          // if(res.data.radio.includes('+')){
          this.radio = '同比增长:' + res.data.radio
          // }else{
          //   this.radio = '同比增长:'+res.data.radio
          // }
        }
      })
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
.PlanningLand{
  width: 100%;
  height:100%;
  display: flex;
  padding-left:0.01rem;
  justify-content: center;
  flex-direction: column;
  align-items: center;
  .item {
    /*width:100%;*/
  }
  .item-line {
    width:100%;
    padding:0.01rem;
    color:white;
    text-align: center;
    color:rgb(0, 232, 255);
    font-size:0.1rem;
  }
}
</style>