<template> <ve-pie :data="chartData" :extend="extend" :title="title" /> </template> <script> import { wellStaticByBfzt } from '@/api/data/dataStatics' export default { data() { this.extend = { series: { label: { show: true, position: 'outside', formatter: '{b}:{c}' } } } this.chartSettings = { labelMap: { 'bfzt': '布防状态', 'wellCount': '点位数量' }, dimension: 'bfzt', metrics: 'wellCount' } this.title = { text: '布防撤防统计' } return { chartData: { columns: ['bfzt', 'wellCount'], rows: [] } } }, mounted() { // TODO:待调试真接口 this.fetchData() }, methods: { // 获取统计数据 fetchData() { wellStaticByBfzt(this.listQuery).then(response => { const data = response.data this.chartData.rows = [ { 'bfzt': '布防', 'wellCount': data.bfWell }, { 'bfzt': '撤防', 'wellCount': data.cfWell } ] }) } } } </script>