首页看板、电表报表接口联调,部分接口参数更新

This commit is contained in:
白菜
2025-07-09 21:16:54 +08:00
parent b3b4d9c0dc
commit b8827248cb
10 changed files with 159 additions and 134 deletions

View File

@ -11,7 +11,6 @@
<style scoped lang="scss"></style>
<script>
import * as echarts from 'echarts'
require('echarts/theme/macarons') // echarts theme
import resize from '@/mixins/ems/resize'
export default {
@ -21,11 +20,6 @@ export default {
chart: null
}
},
mounted() {
this.$nextTick(() => {
this.initChart()
})
},
beforeDestroy() {
if (!this.chart) {
return
@ -34,11 +28,15 @@ export default {
this.chart = null
},
methods: {
initChart() {
this.chart = echarts.init(document.querySelector('#sbgjzbChart'), 'macarons')
this.setOptions()
initChart(data) {
this.chart = echarts.init(document.querySelector('#sbgjzbChart'))
this.setOption(data)
},
setOptions() {
setOption(data) {
const source= []
data.forEach(item => {
source.push({value: item.alarmNum, name: item.type})
})
this.chart.setOption({
color:['#FFBE29','#3C81FF','#A796FF','#FC6B69','#58F3AA'],
tooltip: {
@ -53,13 +51,7 @@ export default {
name: '设备告警占比',
type: 'pie',
radius: '50%',
data: [
{ value: 1048, name: '数据一' },
{ value: 735, name: '数据二' },
{ value: 580, name: '数据三' },
{ value: 484, name: '数据四' },
{ value: 300, name: '数据五' }
],
data:source,
emphasis: {
itemStyle: {
shadowBlur: 10,