This commit is contained in:
wgx 2026-07-30 17:02:16 +08:00
parent e53ef58edb
commit e0cc367300
1 changed files with 13 additions and 32 deletions

View File

@ -352,8 +352,7 @@ export default {
fullscreen: false, //
qczddialogTableVisible: false,
waterData: {},
summryAllData: null,
echartIndex: 0,
summryAllDataJson: null,
maintainLogList: [],
dateType: 'monthDays',
dateTypeOptions: [ {
@ -431,55 +430,37 @@ export default {
})
},
changeDateType() {
// this.summryAllData = null;
this.initChartData();
},
initChartData() {
this.riverList = [];
this.summryAllData = [];
getIndexSummry({summrayMode: this.dateType, statsionCode: this.stationCode}).then(res => {
let that = this;
this.summryAllDataJson = {};
getIndexSummry({summrayMode: this.dateType, stationCode: this.stationCode}).then(res => {
if (res.code === 200) {
this.summryAllData = res.result;
let len = this.summryAllData.length;
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);
}
}
res.result.map(item => {
that.summryAllDataJson[item.stationCode] = item;
});
this.initEchartDom(this.echartIndex)
this.initEchartDom()
}
})
},
// 线
initEchartDom(index) {
initEchartDom(times) {
this.$nextTick(() => {
let domKey = `myChartDiv0`;
let divDom = document.getElementById(domKey);
if (!divDom) {
console.log('没找到dom', domKey, divDom)
console.warn('没找到dom,两秒后重试:', domKey, divDom)
if(times!==2){
setTimeout(()=>{this.initEchartDom(2)}, 1500);
}
return;
}
if(this.echartObj){
this.echartObj.dispose();
}
this.echartObj = this.$echarts.init(divDom);
let data = this.summryAllData[index];
let data = this.summryAllDataJson[this.stationCode];
console.log('开始初始化echart' )
let dataObj = [];
let i = 0;