策略
This commit is contained in:
@ -12,32 +12,41 @@
|
||||
<script>
|
||||
import * as echarts from 'echarts'
|
||||
import resize from '@/mixins/ems/resize'
|
||||
|
||||
import {curveList} from '@/api/ems/dzjk'
|
||||
export default {
|
||||
inject:['$home'],
|
||||
mixins: [resize],
|
||||
data() {
|
||||
return {
|
||||
chart: null
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$nextTick(() => {
|
||||
this.initChart()
|
||||
})
|
||||
},
|
||||
beforeDestroy() {
|
||||
if (!this.chart) {
|
||||
return
|
||||
}
|
||||
this.chart.dispose()
|
||||
this.chart = null
|
||||
this.destoryChart()
|
||||
},
|
||||
methods: {
|
||||
initChart() {
|
||||
this.chart = echarts.init(document.querySelector('#tempChart'))
|
||||
this.setOptions()
|
||||
destoryChart(){
|
||||
if (!this.chart) {
|
||||
return
|
||||
}
|
||||
this.chart.dispose()
|
||||
this.chart = null
|
||||
},
|
||||
setOptions() {
|
||||
changeSiteId(){
|
||||
this.destoryChart()
|
||||
},
|
||||
init(){
|
||||
if(!this.chart){
|
||||
this.chart = echarts.init(document.getElementById('tempChart'))
|
||||
}
|
||||
const strategyId = this.$home.updateStrategyId
|
||||
const siteId=this.$home.siteId
|
||||
curveList({strategyId,siteId}).then(response => {
|
||||
this.setOption(response?.data || [])
|
||||
})
|
||||
},
|
||||
setOption(data) {
|
||||
if(!this.chart) return
|
||||
this.chart.setOption({
|
||||
color:['#FFBD00','#3C81FF'],
|
||||
legend: {
|
||||
|
||||
Reference in New Issue
Block a user