Newer
Older
CloudBrainNew / src / views / cityPlan / components / gaugeItem.vue
StephanieGitHub on 4 Feb 2021 2 KB first commit
<!--
 * @Description:
 * @Author: 王晓颖
 * @Date:
 -->
<template>
  <div class="container">
    <echart-gauge2
      :id="chartId"
      :width="width"
      :height="height"
      :color="color"
      :series-data="data"
    />
    <div class="land">
      <p class="landTil">{{title}}</p>
      <div class="landDetails">
        <div class="landSize">
          <span>{{totalTitle}}</span>
          <div class="size">{{data.total}}<span>{{unit}}</span></div>
        </div>
        <div class="landSize">
          <span>{{alreadyTitle}}</span>
          <div class="size" :style="{color:color}">{{data.already}}<span>{{unit}}</span></div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import EchartGauge2 from '../../../components/echart/EchartGauge2'
export default {
  name: 'gaugeItem',
  components: {EchartGauge2},
  props: {
    chartId: {
      type: String,
      required: true
    },
    width: {
      type: Number | String,
      default: 50
    },
    height: {
      type: Number | String,
      default: 50
    },
    color: {
      type: String,
      default: 'blue'
    },
    title: {
      type: String,
      default: '标题'
    },
    alreadyTitle: {
      type: String,
      default: '总面积'
    },
    totalTitle: {
      type: String,
      default: '已建面积'
    },
    data: {
      type: Object,
      default: () => {
        return {already: '34', total: '100', rate: 34}
      }
    },
    unit: {
      type: String,
      default: '亩'
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
.container{
  width:100%;
  .land {
    width: 100%;
    margin-top: -.04rem;
  }
  .landTil {
    color: #00caff;
    font-size: 0.07rem;
    text-align: center;
    margin-bottom: 0.05rem;
  }
  .landSize {
    width: 50%;
    float: left;
    text-align: center;
    span {
      font-size: 0.05rem;
      color: #00a3d7;
    }
  }
  .size {
    margin-top: .03rem;
    color: #00faa8;
    font-weight:bold;
    font-size: 0.06rem;
    span {
      font-size: 0.05rem;
    }
  }
}
</style>