先查有数据的日期,再查没数据的日期,饼图数据没清空

This commit is contained in:
任珮宇 2024-03-11 15:23:19 +08:00
parent 471666911f
commit 207c316d53

View File

@ -41,6 +41,7 @@ export default {
pieData: [],
pieColors: ['#00bcd4', '#14b2a3', '#97b94b', '#47b55d'],
pieTotal: 0,
sourceChart: null,
}
},
mounted() {
@ -113,6 +114,8 @@ export default {
this.pieData = res.result.pieData
this.pieTotal = res.result.pieTotal
this.drawRightChart()
} else {
this.sourceChart.clear()
}
} else {
this.$message.warning('This operation fails. Contact your system administrator')
@ -247,7 +250,7 @@ export default {
})
},
drawRightChart() {
let myChart = echarts.init(document.getElementById('chartRight'))
this.sourceChart = echarts.init(document.getElementById('chartRight'))
let options = {
tooltip: {
trigger: 'item',
@ -308,9 +311,9 @@ export default {
},
],
}
myChart.setOption(options)
this.sourceChart.setOption(options)
window.addEventListener('resize', function () {
myChart.resize()
this.sourceChart.resize()
})
},
},