Newer
Older
CallCenterFront / src / views / statistic / callStatistic / components / callRatePie.vue
StephanieGitHub on 6 May 2020 1 KB MOD: 统计调试
<!--事件回访满意度统计-->
<template>
  <ve-pie :data="chartData" :extend="extend" :title="title"/>
</template>

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

export default {
  name: 'CallRatePie',
  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() {
  },
  methods: {
    search() {
      this.fetchData()
    },
    fetchData() {
      callSuccessStatistics(this.query).then(response => {
        const data = response.data
        this.chartData.rows = data
        if (data.length === 0) {
          this.chartData.rows = [
            { 'type': '10秒接通量', 'num': 0 },
            { 'type': '20秒接通量', 'num': 0 },
            { 'type': '30秒接通量', 'num': 0 },
            { 'type': '30秒以上接通量', 'num': 0 }
          ]
        }
      })
    }
  }
}
</script>