小bug
This commit is contained in:
parent
e53ef58edb
commit
e0cc367300
|
|
@ -352,8 +352,7 @@ export default {
|
||||||
fullscreen: false, //全屏
|
fullscreen: false, //全屏
|
||||||
qczddialogTableVisible: false,
|
qczddialogTableVisible: false,
|
||||||
waterData: {},
|
waterData: {},
|
||||||
summryAllData: null,
|
summryAllDataJson: null,
|
||||||
echartIndex: 0,
|
|
||||||
maintainLogList: [],
|
maintainLogList: [],
|
||||||
dateType: 'monthDays',
|
dateType: 'monthDays',
|
||||||
dateTypeOptions: [ {
|
dateTypeOptions: [ {
|
||||||
|
|
@ -431,55 +430,37 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
changeDateType() {
|
changeDateType() {
|
||||||
// this.summryAllData = null;
|
|
||||||
this.initChartData();
|
this.initChartData();
|
||||||
},
|
},
|
||||||
initChartData() {
|
initChartData() {
|
||||||
this.riverList = [];
|
let that = this;
|
||||||
this.summryAllData = [];
|
this.summryAllDataJson = {};
|
||||||
getIndexSummry({summrayMode: this.dateType, statsionCode: this.stationCode}).then(res => {
|
getIndexSummry({summrayMode: this.dateType, stationCode: this.stationCode}).then(res => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
this.summryAllData = res.result;
|
res.result.map(item => {
|
||||||
let len = this.summryAllData.length;
|
that.summryAllDataJson[item.stationCode] = item;
|
||||||
this.summryAllData.map((item1, index) => {
|
|
||||||
if (index % 2 === 0 && item1['datas'] && (index + 1) < len) {
|
|
||||||
let data1 = item1['datas'];
|
|
||||||
let keys = Object.keys(data1);
|
|
||||||
let data2 = this.summryAllData[index + 1]['datas'];
|
|
||||||
let data3 = {}
|
|
||||||
let item3 = JSON.parse(JSON.stringify(item1));
|
|
||||||
if (data2) {
|
|
||||||
keys.map(key => {
|
|
||||||
if (data1[key] instanceof Array) {
|
|
||||||
data3[key] = []
|
|
||||||
data1[key].map((itemSub, index) => {
|
|
||||||
data3[key].push((data2[key][index] - data1[key][index]).toFixed(2))
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
item3['datas'] = data3;
|
|
||||||
this.riverList.push(item3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
this.initEchartDom(this.echartIndex)
|
this.initEchartDom()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 折线图数据
|
// 折线图数据
|
||||||
initEchartDom(index) {
|
initEchartDom(times) {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
let domKey = `myChartDiv0`;
|
let domKey = `myChartDiv0`;
|
||||||
let divDom = document.getElementById(domKey);
|
let divDom = document.getElementById(domKey);
|
||||||
if (!divDom) {
|
if (!divDom) {
|
||||||
console.log('没找到dom:', domKey, divDom)
|
console.warn('没找到dom,两秒后重试:', domKey, divDom)
|
||||||
|
if(times!==2){
|
||||||
|
setTimeout(()=>{this.initEchartDom(2)}, 1500);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(this.echartObj){
|
if(this.echartObj){
|
||||||
this.echartObj.dispose();
|
this.echartObj.dispose();
|
||||||
}
|
}
|
||||||
this.echartObj = this.$echarts.init(divDom);
|
this.echartObj = this.$echarts.init(divDom);
|
||||||
let data = this.summryAllData[index];
|
let data = this.summryAllDataJson[this.stationCode];
|
||||||
console.log('开始初始化echart:' )
|
console.log('开始初始化echart:' )
|
||||||
let dataObj = [];
|
let dataObj = [];
|
||||||
let i = 0;
|
let i = 0;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue