运行图调整

This commit is contained in:
fan 2020-07-31 18:57:27 +08:00
parent 988f38fbb3
commit 3215bec260
2 changed files with 34 additions and 22 deletions

View File

@ -46,8 +46,9 @@ function handle(state, data) {
break;
case 'Simulation_RunFact': // 仿真-列车实际到发车站消息
if (!Array.isArray(msg)) {
// console.log([msg], '列车实际到发车站消息');
state.trainStationList = [msg];
} else {
state.trainStationList = msg;
}
break;
case 'Simulation_Error': // 仿真-异常消息

View File

@ -200,7 +200,9 @@ export default {
dialogShow: false,
series: [],
oldseries:[],
trainLabelPosition:0
trainLabelPosition:0,
updateCount: 0,
op: null
};
},
computed: {
@ -224,6 +226,12 @@ export default {
maxHeight() {
this.setPosition();
},
updateCount() {
if (this.updateCount > 0) {
this.myChart && this.myChart.setOption(this.op, true);
this.updateCount = 0;
}
},
'$store.state.runPlan.planLoadedCount': async function () {
try {
await this.loadChartPage();
@ -244,6 +252,11 @@ export default {
if (!val) {
this.$store.dispatch('runPlan/resetRunPlanData');
}
},
'$store.state.socket.trainStationList': function (val) {
if (val.length) {
this.updateRunPlanData(val);
}
}
},
mounted() {
@ -264,9 +277,9 @@ export default {
this.setPosition();
this.loadInitData(this.series);
this.inter && clearInterval(this.inter);
this.inter = setInterval(() => {
this.updateRunningData();
}, 1000);
// this.inter = setInterval(() => {
// this.updateRunningData();
// }, 1000);
} catch (e) {
console.error(e);
} finally {
@ -339,22 +352,24 @@ export default {
const stations = this.$store.state.runPlan.stations;
const planData = this.$store.state.runPlan.planData;
const initialPlanData = this.$store.state.runPlan.initialPlanData;
if (data[0] && initialPlanData[data[0].serviceNumber]) {
Object.keys(initialPlanData[data[0].serviceNumber].trainMap).forEach(item => {
if (initialPlanData[data[0].serviceNumber].trainMap[item + ''].tripNumber == data[0].tripNumber) {
data[0].directionCode = initialPlanData[data[0].serviceNumber].trainMap[item + ''].directionCode;
}
});
}
if (data[0]) {
data[0].secondTime = data[0].second;
}
data && data.length && data.forEach(item => {
if (item && initialPlanData[item.serviceNumber]) {
Object.keys(initialPlanData[item.serviceNumber].trainMap).forEach(ele => {
if (initialPlanData[data[0].serviceNumber].trainMap[ele + ''].tripNumber == item.tripNumber) {
data[0].directionCode = initialPlanData[item.serviceNumber].trainMap[ele + ''].directionCode;
}
});
item.secondTime = item.second;
}
});
const op = this.myChart.getOption();
op.series = this.PlanConvert.updateDataToModels(data, stations, this.kmRangeCoordMap,
planData, op.series, { color: '#FF00DE', width: 2 }
);
this.series = op.series;
this.myChart.setOption(op, true);
this.op = op;
this.updateCount++;
// this.myChart.setOption(op, true);
}
},
async loadChartPage() {
@ -525,12 +540,8 @@ export default {
data: data
});
this.trainLabelPosition = op.series.length;
setTimeout(() => {
this.myChart && this.myChart.setOption(op, true);
setTimeout(()=>{
this.$store.dispatch('runPlan/updateAllowUpdate', true);
}, 300);
}, 50);
this.op = op;
this.updateCount++;
},
mouseClick(params) {
const model = {