运行图代码调整

This commit is contained in:
joylink_cuiweidong 2021-03-19 13:38:53 +08:00
parent 82f8db41d1
commit 8acee05b38

View File

@ -106,17 +106,17 @@
{{ formatName(scope.row.endSectionCode) }}
</template>
</el-table-column>
<el-table-column prop="routingType" label="交路类型">
<template slot-scope="scope">
{{ routingTypeMap[scope.row.routingType] }}
</template>
<el-table-column prop="routingType" label="交路类型">
<template slot-scope="scope">
{{ routingTypeMap[scope.row.routingType] }}
</template>
</el-table-column>
<el-table-column label="类别" width="240">
<template slot-scope="scope">
{{ `${frontMap[String(scope.row.startTbFront)]} - ${frontMap[String(scope.row.endTbFront)]}` }}
</template>
<el-table-column label="类别" width="240">
<template slot-scope="scope">
{{ `${frontMap[String(scope.row.startTbFront)]} - ${frontMap[String(scope.row.endTbFront)]}` }}
</template>
</el-table-column>
<el-table-column prop="remarks" width="auto" :label="this.$t('planMonitor.description')" />
<el-table-column prop="remarks" width="auto" :label="this.$t('planMonitor.description')" />
</el-table>
</el-row>
<el-row style=" margin-bottom: 5px;margin-top: 10px;">
@ -195,7 +195,7 @@ export default {
serviceNumber: '',
planId: '',
editModel: {
routingCode: '',
routingCode: '',
endStationCode: '',
startStationCode: '',
startTime: '02:00:00',
@ -208,7 +208,7 @@ export default {
endTbFront: false
},
tripNumberList: [{ value: '', label: this.$t('planMonitor.modifying.automatic') }],
reentryData: {},
reentryData: {},
defaultSpeedLevelList: [
{ value: 'l1', label: '等级一' },
{ value: 'l2', label: '等级二' },
@ -216,17 +216,17 @@ export default {
{ value: 'l4', label: '等级四' },
{ value: 'l5', label: '等级五' }
],
routingTypeMap: {
OUTBOUND: '出库',
INBOUND: '入库',
LOOP: '环路'
},
frontMap: {
'true': '折返轨(站前)',
'false': '折返轨(站后)',
'undefined': '转换轨',
'null': '转换轨'
}
routingTypeMap: {
OUTBOUND: '出库',
INBOUND: '入库',
LOOP: '环路'
},
frontMap: {
'true': '折返轨(站前)',
'false': '折返轨(站后)',
'undefined': '转换轨',
'null': '转换轨'
}
};
},
computed: {
@ -254,16 +254,16 @@ export default {
const eTime = +new Date(`2019-01-01 ${timeStr}`);
return Number(eTime) - Number(bTime);
},
compuntedRunTime(list, index, runLevel) {
compuntedRunTime(list, index, runLevel) {
let runTime = 0;
if ((index == 0 && String(this.editModel.startTbFront) != 'undefined') ||
(index == list.length-1 && String(this.editModel.endTbFront) != 'undefined')) {
return 0
}
if ((index == 0 && String(this.editModel.startTbFront) != 'undefined') ||
(index == list.length - 1 && String(this.editModel.endTbFront) != 'undefined')) {
return 0;
}
if (index < list.length - 1) {
const stopStationObj = this.stopStationMap[[list[index].sectionCode, list[index + 1].sectionCode].toString()];
if (index < list.length - 1) {
const stopStationObj = this.stopStationMap[[list[index].sectionCode, list[index + 1].sectionCode].toString()];
if (stopStationObj) {
if (stopStationObj.runPlanLevelVO) {
runTime = parseInt(stopStationObj.runPlanLevelVO[runLevel]);
@ -280,41 +280,40 @@ export default {
computedDetailList(type = null) {
if (this.editModel.routingCode) {
let tempTime = this.computedTimeByString(this.editModel.startTime) / 1000;
const list = Object.assign([], this.editModel.arriveConfigList);
const list = Object.assign([], this.editModel.arriveConfigList);
const runLevel = this.defaultSpeedLevel || 'l1'; //
list.forEach((elem, index) => {
if (type == 'routingCode') {
if (index == 0 || index == list.length - 1) {
elem.stopTime = 0;
} else if (this.stopTimeMap[elem.stationCode]) {
elem.stopTime = this.stopTimeMap[elem.stationCode].parkingTime;
} else {
elem.stopTime = 0;
}
if (type == 'routingCode') {
if (index == 0 || index == list.length - 1) {
elem.stopTime = 0;
} else if (this.stopTimeMap[elem.stationCode]) {
elem.stopTime = this.stopTimeMap[elem.stationCode].parkingTime;
} else {
elem.stopTime = 0;
}
}
tempTime = tempTime? tempTime: this.computedTimeByString('23:59:59') / 1000 + 1;
elem.arriveTime = formatTime(tempTime)
elem.departureTime = formatTime(tempTime + elem.stopTime);
tempTime = tempTime || this.computedTimeByString('23:59:59') / 1000 + 1;
elem.arriveTime = formatTime(tempTime);
elem.departureTime = formatTime(tempTime + elem.stopTime);
const runLevelObj = this.defaultSpeedLevelList.find(speedLevel=>{ return speedLevel.value == runLevel; });
const realRunlevel = this.compuntedRunTime(list, index, runLevel);
const runLevelObj = this.defaultSpeedLevelList.find(speedLevel=>{ return speedLevel.value == runLevel; });
const realRunlevel = this.compuntedRunTime(list, index, runLevel);
elem.speedLevelTime = realRunlevel;
elem.speedLevel = runLevelObj.label;
elem.speedLevelTime = realRunlevel;
elem.speedLevel = runLevelObj.label;
let fronTime = 0;
if (index == 0 && String(this.editModel.startTbFront) == 'false') {
const data = this.reentryData[elem.stationCode] || {};
fronTime = data.tbTo || 0;
} else if (index == list.length - 2 && String(this.editModel.endTbFront) == 'false') {
const data = this.reentryData[list[index + 1].stationCode] || {};
fronTime = data.tbTo || 0;
}
let fronTime = 0;
if (index == 0 && String(this.editModel.startTbFront) == 'false') {
const data = this.reentryData[elem.stationCode]||{};
fronTime = data.tbTo || 0;
} else if (index == list.length - 2 && String(this.editModel.endTbFront) == 'false') {
const data = this.reentryData[list[index+1].stationCode]||{};
fronTime = data.tbTo || 0;
}
tempTime = tempTime + fronTime + elem.stopTime + elem.speedLevelTime;
tempTime = tempTime + fronTime + elem.stopTime + elem.speedLevelTime;
});
this.editModel.endTime = formatTime(tempTime - list[list.length - 1].stopTime);
@ -330,10 +329,10 @@ export default {
this.PlanParser = this.$theme.loadPlanParser(lineCode);
if (mapId) {
getRunplanConfig(mapId).then(resp => {
const data = resp.data;
this.reentryData = data.config.reentryData;
});
getRunplanConfig(mapId).then(resp => {
const data = resp.data;
this.reentryData = data.config.reentryData;
});
getMapStationRunUser(mapId).then(resp => {
const list = resp.data.list;
@ -364,8 +363,8 @@ export default {
this.editModel.endSectionCode = paramData.endSectionCode;
this.editModel.startSectionCode = paramData.startSectionCode;
this.editModel.id = paramData.id;
this.editModel.startTbFront = paramData.startTbFront;
this.editModel.endTbFront = paramData.endTbFront;
this.editModel.startTbFront = paramData.startTbFront;
this.editModel.endTbFront = paramData.endTbFront;
this.routingList = [];
this.routingList.push({
code:paramData.routingCode,
@ -373,8 +372,8 @@ export default {
endStationCode:paramData.endStationCode,
endSectionCode:paramData.endSectionCode,
startSectionCode:paramData.startSectionCode,
startTbFront:paramData.startTbFront,
endTbFront:paramData.endTbFront
startTbFront:paramData.startTbFront,
endTbFront:paramData.endTbFront
});
this.computedDetailList();
} else {
@ -389,14 +388,14 @@ export default {
const trainInfo = editData.trainMap[this.tripNumber];
const lastIndex = trainInfo.stationTimeList.length - 1;
this.routingList.push({
this.routingList.push({
code:resp.data.code,
startStationCode:resp.data.startStationCode,
endStationCode:resp.data.endStationCode,
endSectionCode:resp.data.endSectionCode,
startSectionCode:resp.data.startSectionCode,
startTbFront:resp.data.startTbFront,
endTbFront:resp.data.endTbFront
startTbFront:resp.data.startTbFront,
endTbFront:resp.data.endTbFront
});
this.editModel = {
@ -405,15 +404,28 @@ export default {
endTime: formatTime(trainInfo.stationTimeList[lastIndex].secondTime + 7200),
routingCode : resp.data.code,
arriveConfigList: [],
startTbFront: resp.data.startTbFront,
endTbFront: resp.data.endTbFront
startTbFront: resp.data.startTbFront,
endTbFront: resp.data.endTbFront
};
if (resp.data.startTbFront == false) {
this.editModel.startTime = formatTime(trainInfo.startSecondTime + 7200);
const newModel = {
sectionCode:resp.data.parkSectionCodeList[0].sectionCode,
stationCode:resp.data.startStationCode,
// // speedLevel:'',
departureTime: formatTime(trainInfo.startSecondTime + 7200),
arriveTime: formatTime(trainInfo.startSecondTime + 7200),
stopTime:0
};
this.editModel.arriveConfigList.push(newModel);
}
const newstationTimeList = [];
let current = {};
trainInfo.stationTimeList.forEach((stationTime, index)=>{
if (index % 2 == 0) {
if (index % 2 == 0) {
current = {};
current.stationCode = stationTime.stationCode;
current.arriveTime = stationTime.secondTime;
@ -434,6 +446,20 @@ export default {
this.editModel.arriveConfigList.push(newModel);
});
if (resp.data.endTbFront == false) {
this.editModel.endTime = formatTime(trainInfo.endSecondTime + 7200);
const length = resp.data.parkSectionCodeList.length - 1;
const newModel = {
sectionCode:resp.data.parkSectionCodeList[length].sectionCode,
stationCode:resp.data.endStationCode,
// // speedLevel:'',
departureTime: formatTime(trainInfo.endSecondTime + 7200),
arriveTime: formatTime(trainInfo.endSecondTime + 7200),
stopTime:0
};
this.editModel.arriveConfigList.push(newModel);
}
this.initRunlevel(this.editModel);
this.dialogShow = true;
this.computedDetailList();
@ -444,33 +470,33 @@ export default {
initRunlevel(paramData) {
const speedLevelData = this.stopStationMap[[paramData.arriveConfigList[0].sectionCode, paramData.arriveConfigList[1].sectionCode].toString()];
if (speedLevelData) {
switch (paramData.arriveConfigList[0].speedLevelTime) {
case speedLevelData.l1: {
this.defaultSpeedLevel = 'l1';
break;
}
case speedLevelData.l2: {
this.defaultSpeedLevel = 'l2';
break;
}
case speedLevelData.l3: {
this.defaultSpeedLevel = 'l3';
break;
}
case speedLevelData.l4: {
this.defaultSpeedLevel = 'l4';
break;
}
case speedLevelData.l5: {
this.defaultSpeedLevel = 'l5';
break;
}
default: {
this.defaultSpeedLevel = 'l1';
break;
}
}
}
switch (paramData.arriveConfigList[0].speedLevelTime) {
case speedLevelData.l1: {
this.defaultSpeedLevel = 'l1';
break;
}
case speedLevelData.l2: {
this.defaultSpeedLevel = 'l2';
break;
}
case speedLevelData.l3: {
this.defaultSpeedLevel = 'l3';
break;
}
case speedLevelData.l4: {
this.defaultSpeedLevel = 'l4';
break;
}
case speedLevelData.l5: {
this.defaultSpeedLevel = 'l5';
break;
}
default: {
this.defaultSpeedLevel = 'l1';
break;
}
}
}
},
doShow(params) {
this.loadInitData(params);