Newer
Older
smartwell_front / src / views / dashboard / components / WellCountByDept.vue
<template>
  <ve-bar :data="chartData" :grid="grid" :title="title" :extend="extend" :settings="chartSettings" />
</template>

<script>
// 引入视觉映射组件
// import 'echarts/lib/component/visualMap'
import { wellStaticByDept } from '@/api/data/dataStatics'

export default {
  name: 'WellCountByDept',
  data() {
    this.extend = {
      series: {
        label: { show: true, position: 'right' }
      }
    }
    this.grid = {
      right: 60
    }
    this.title = {
      text: '点位数量统计'
    }
    this.chartSettings = {
      itemStyle: {
        'barCategoryGap': 5
      },
      barWidth: 15,
      labelMap: {
        'deptName': '权属单位',
        'wellCount': '点位数量'
      },
      dimension: ['deptName'],
      metrics: ['wellCount']
    }
    return {
      chartData: {
        columns: ['wellTypeName', 'wellCount'],
        rows: []
      }
    }
  },
  mounted() {
    this.fetchData()
  },
  methods: {
    fetchData() {
      wellStaticByDept().then(response => {
        this.chartData.rows = response.data
      })
    }
  }
}
</script>