diff --git a/README.md b/README.md index 690d347..f663a88 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,17 @@ -
{{ msg }}
diff --git a/eladmin-web/src/components/Echarts/PieChart.vue b/eladmin-web/src/components/Echarts/PieChart.vue index ff1bc52..8c92337 100644 --- a/eladmin-web/src/components/Echarts/PieChart.vue +++ b/eladmin-web/src/components/Echarts/PieChart.vue @@ -6,6 +6,7 @@ import echarts from 'echarts' require('echarts/theme/macarons') // echarts theme import { debounce } from '@/utils' +import { getPieChatData } from '@/api/dashboard/dashboard' export default { props: { @@ -24,7 +25,9 @@ export default { }, data() { return { - chart: null + chart: null, + dataList: [], + dataTitle: [], } }, mounted() { @@ -45,9 +48,22 @@ export default { this.chart = null }, methods: { - initChart() { - this.chart = echarts.init(this.$el, 'macarons') + async initChart() { + let iDataList = []; + let iDataTitle = []; + await getPieChatData().then(res => { + res.forEach(function (rItem) { + let name = rItem.text; + let value = rItem.value; + let item = { name: name, value: value } + iDataTitle.push(name) + iDataList.push(item) + }); + }) + this.dataList = iDataList; + this.dataTitle = iDataTitle; + this.chart = echarts.init(this.$el, 'macarons') this.chart.setOption({ tooltip: { trigger: 'item', @@ -56,29 +72,23 @@ export default { legend: { left: 'center', bottom: '10', - data: ['Industries', 'Technology', 'Forex', 'Gold', 'Forecasts'] + data: this.dataTitle }, calculable: true, series: [ { - name: 'WEEKLY WRITE ARTICLES', + name: '案件类型统计', type: 'pie', roseType: 'radius', radius: [15, 95], center: ['50%', '38%'], - data: [ - { value: 320, name: 'Industries' }, - { value: 240, name: 'Technology' }, - { value: 149, name: 'Forex' }, - { value: 100, name: 'Gold' }, - { value: 59, name: 'Forecasts' } - ], + data: this.dataList, animationEasing: 'cubicInOut', animationDuration: 2600 } ] }) - } + }, } } diff --git a/eladmin-web/src/layout/components/Navbar.vue b/eladmin-web/src/layout/components/Navbar.vue index f3cd392..0cf9153 100644 --- a/eladmin-web/src/layout/components/Navbar.vue +++ b/eladmin-web/src/layout/components/Navbar.vue @@ -8,17 +8,17 @@确定删除本条数据吗?
-