Newer
Older
CallCenterFront / src / views / statistic / caseStatistic / components / satisfiedPie.vue
<!--事件回访满意度统计-->
<template>
  <ve-pie :data="chartData" :extend="extend" :title="title"/>
</template>

<script>
import { getCaseStatisticsByStatisfied } from '@/api/statistics'

export default {
  name: 'SatisfiedPie',
  props: {
    listQuery: {
      type: Object,
      default: function() {
        return {}
      }
    }
  },
  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: []
      }
    }
  },
  // watch: {
  //   listQuery(val) {
  //     console.log('listQuery changed')
  //     this.search()
  //   }
  // },
  // created() {
  //   this.fetchData()
  // },
  methods: {
    search() {
      this.fetchData()
    },
    fetchData() {
      getCaseStatisticsByStatisfied(this.listQuery).then(response => {
        const data = response.data
        this.chartData.rows = data
        // this.chartData.rows = [
        //   { 'type': '非常满意', 'num': 0 },
        //   { 'type': '满意', 'num': 0 },
        //   { 'type': '一般', 'num': 0 },
        //   { 'type': '不满意', 'num': 0 },
        //   { 'type': '未评价', 'num': 0 }
        // ]
      })
    }
  }
}
</script>