<!--事件回访满意度统计--> <template> <ve-pie :data="chartData" :extend="extend" :title="title"/> </template> <script> import { callSatisfiedStatistics } from '@/api/statistics' export default { name: 'SatisfiedPie', props: { query: { type: Object, required: true } }, data() { this.extend = { series: { label: { show: true, position: 'outside', formatter: '{b}:{c}' } } } this.chartSettings = { labelMap: { 'type': '满意度', 'num': '0' }, dimension: 'type', metrics: 'num' } this.title = { text: '' } return { chartData: { columns: ['type', 'num'], rows: [] } } }, mounted() { // this.fetchData() }, methods: { search() { this.fetchData() }, fetchData() { callSatisfiedStatistics(this.query).then(response => { const data = response.data this.chartData.rows = data if (data.length === 0) { this.chartData.rows = [ { 'type': '非常满意', 'num': 0 }, { 'type': '满意', 'num': 0 }, { 'type': '一般', 'num': 0 }, { 'type': '不满意', 'num': 0 }, { 'type': '未评价', 'num': 0 } ] } }) } } } </script>