<!-- * @Description:各区域管网报警 * @Author: 王晓颖 * @Date: 2020-09-04 18:41:53 --> <template> <single-layout title="各区域路灯数量"> <div style="width: 100%;height:100%;"> <simple-pie-chart :id="data.id" :width="data.width" :height="data.height" :seriesData="data.data" hoverFormatter="{b}<br/>{c}个<br/>{d}%"> </simple-pie-chart> </div> </single-layout> </template> <script> import SimplePieChart from '@/components/pieChart/simplePieChart' import SingleLayout from '@/components/layout/singleLayout' import {fetchLampByArea} from '@/api/iot' export default { name: 'lampPie', components: {SingleLayout, SimplePieChart}, data () { return { data: { id: 'lamp-pie', width: '100%', height: '100%', legend: ['潭中', '潭口', '高校园区'], data: [ {value: 0, name: '潭东镇'}, {value: 0, name: '潭口镇'}, {value: 0, name: '高校园区管理处'} ] } } }, created () { // this.getData() const mockData = this.$globalJsons.globalCity this.data.data = mockData.lamp.pie }, methods: { getData () { fetchLampByArea().then(response => { if (response.code === 200) { this.data.data = response.data } }) } } } </script> <style rel="stylesheet/scss" lang="scss" scoped> </style>