Browse Source

fix dashboard.vue 默认数据

old
wangqing 5 years ago
parent
commit
73bb751e28
  1. 36
      src/views/home/dashboard.vue

36
src/views/home/dashboard.vue

@ -340,26 +340,30 @@ export default {
}, },
getProjectSubmitSource() { getProjectSubmitSource() {
this.$api.get('/user/project/report/source', {params: {projectKey: this.activeProjectKey}}).then(res => { this.$api.get('/user/project/report/source', {params: {projectKey: this.activeProjectKey}}).then(res => {
this.barChartOptionData.yAxis.data = res.data.map(item => { if (res.data && res.data.length) {
return item.browserName ? item.browserName : '其他' this.barChartOptionData.yAxis.data = res.data.map(item => {
}) return item.browserName ? item.browserName : '其他'
this.barChartOptionData.series = [ })
{ this.barChartOptionData.series = [
barWidth: 30, {
name: '数量', barWidth: 30,
type: 'bar', name: '数量',
data: res.data.map(item => { type: 'bar',
return item.count data: res.data.map(item => {
}) return item.count
} })
] }
]
}
}) })
}, },
getProjectSubmitDevice() { getProjectSubmitDevice() {
this.$api.get('/user/project/report/device', {params: {projectKey: this.activeProjectKey}}).then(res => { this.$api.get('/user/project/report/device', {params: {projectKey: this.activeProjectKey}}).then(res => {
this.pieChartOptionData.series[0].data = res.data.map(item => { if (res.data && res.data.length) {
return {value: item.count, name: item.osName ? item.osName : '其他'} this.pieChartOptionData.series[0].data = res.data.map(item => {
}) return {value: item.count, name: item.osName ? item.osName : '其他'}
})
}
}) })
} }
} }

Loading…
Cancel
Save