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

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