<!-- * @Description: 城管事件数量统计 * @Author: 王晓颖 * @Date: 2020-09-07 16:39:10 --> <template> <single-layout title="案件数量统计"> <div style="width: 100%;height:100%;"> <gradient-line-chart :id="options.id" :unit="options.unit" :height="options.height" :legend="options.xAxisData" :xAxisData="options.xAxisData" :seriesData="options.seriesData" /> </div> </single-layout> </template> <script> import ChartLayout from '@/components/layout/chartLayout' import ColorfulBarChart from '@/components/barChart/colorfulBarChart' import GradientLineChart from '@/components/lineChart/gradientLineChart' import {fetchCaseByDay} from '@/api/cityManage' import SingleLayout from "../../../../../components/layout/singleLayout"; export default { name: 'socialSecurityLine', components: {SingleLayout, GradientLineChart, ColorfulBarChart, ChartLayout}, data () { return { options: { id: 'case_line1', height: '100%', width: '100%', unit: '次', xAxisData: ['9-3', '9-4', '9-5', '9-6', '9-7', '9-8', '9-9'], seriesData: [ {name: '案件总数', data: [120, 252, 101, 134, 290, 230, 110], color: '255,45,85'}, {name: '处理数', data: [110, 222, 91, 82, 278, 200, 91], color: '0,144,255'} ] } } }, created () { this.getData() }, methods: { getData () { fetchCaseByDay().then(response => { if (response.code === 200) { const data = response.data this.options.xAxisData = data.map(item => { return item.name }) const total = data.map(item => { return item.total }) const complete = data.map(item => { return item.complete }) this.options.seriesData = [ {name: '案件总数', data: total, color: '255,45,85'}, {name: '处理数', data: complete, color: '0,144,255'} ] } }) } } } </script> <style rel="stylesheet/scss" lang="scss" scoped> </style>