Newer
Older
CloudBrainNew / src / views / cityManage / components / wisdomTraffic / trafficCase / trafficCaseAreaPie.vue
<!--
 * @Description:案件来源
 * @Author: 王晓颖
 * @Date: 2020-09-04 18:41:53
 -->
<template>
  <single-layout title="事件分布">
    <div style="width: 100%;height:100%;padding:0rem 0.1rem">
      <simple-pie-chart
        :id="data.id"
        :width="data.width"
        :height="data.height"
        :seriesData="data.data">
      </simple-pie-chart>
      <!--<Corner1/>-->
    </div>
  </single-layout>
</template>

<script>
import SimplePieChart from '@/components/pieChart/simplePieChart'
import {fetchCaseArea} from '@/api/smartTraffic'
import SingleLayout from '@/components/layout/singleLayout'
import mockData from '../../../../../../static/city.json'
export default {
  name: 'trafficCaseAreaPie',
  components: {SingleLayout, SimplePieChart},
  data () {
    return {
      data: {
        id: 'traffic-case-area-pie',
        width: '100%',
        height: '100%',
        legend: ['潭东镇', '潭口镇', '高校园区'],
        data: [
          {value: 0, name: '潭东镇'},
          {value: 0, name: '潭口镇'},
          {value: 0, name: '高校园区'}
        ]
      }
    }
  },
  created () {
    // this.getData()
    this.data.data = mockData.traffic.event.pie
  },
  methods: {
    getData () {
      fetchCaseArea().then(response => {
        if (response.code === 200) {
          const data = response.data
          this.data.legend = data.map(item => { return item.name })
          this.data.data = response.data
        }
      })
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>

</style>