运行图编制 代码调整

This commit is contained in:
joylink_cuiweidong 2021-04-01 09:41:14 +08:00
parent 0c407dbfa9
commit 618d975d68
4 changed files with 205 additions and 279 deletions

View File

@ -59,7 +59,7 @@ const runPlan = {
trainList.forEach((train, j) => {
state.initialPlanData[service.serviceNumber].trainMap[`${train.tripNumber}`] = { oldIndex: j, tripNumber: train.tripNumber, right:train.right,
directionCode: train.directionCode, reentry: train.reentry, stationTimeList: train.stationTimeList, endSecondTime:train.endSecondTime,
startSecondTime: train.startSecondTime };
startSecondTime: train.startSecondTime, startSectionCode:train.startSectionCode, endSectionCode:train.endSectionCode };
});
});
}
@ -76,7 +76,7 @@ const runPlan = {
state.editData[service.serviceNumber].trainMap[`${train.tripNumber}`] =
{ oldIndex: j, tripNumber: train.tripNumber, directionCode: train.directionCode, right:train.right,
reentry: train.reentry, stationTimeList: train.stationTimeList, endSecondTime:train.endSecondTime,
startSecondTime: train.startSecondTime};
startSecondTime: train.startSecondTime, startSectionCode:train.startSectionCode, endSectionCode:train.endSectionCode };
});
});
}
@ -93,7 +93,7 @@ const runPlan = {
trainList.forEach((train, j) => {
state.draftEditData[service.serviceNumber].trainMap[`${train.tripNumber}`] = { oldIndex: j, tripNumber: train.tripNumber, right:train.right,
directionCode: train.directionCode, reentry: train.reentry, stationTimeList: train.stationTimeList, endSecondTime:train.endSecondTime,
startSecondTime: train.startSecondTime};
startSecondTime: train.startSecondTime, startSectionCode:train.startSectionCode, endSectionCode:train.endSectionCode };
});
});
}

View File

@ -420,6 +420,7 @@ export default {
this.addModel.endSectionCode = row.endSectionCode;
this.addModel.startSectionCode = row.startSectionCode;
this.addModel.routingCode = row.id;
debugger;
this.addModel.startTbFront = row.startTbFront;
this.addModel.endTbFront = row.endTbFront;
this.computedDetailList('routingCode');

View File

@ -98,90 +98,83 @@ export default {
const tripNumber = tripNumberList[index];
const trainInfo = editData.trainMap[tripNumber];
const lastIndex = trainInfo.stationTimeList.length - 1;
const model = {
planId: this.$route.query.planId,
SDTNumber: `${this.model.serviceNumber}${tripNumber}`
const taskObj = {
id:index + 1,
tripNumber: tripNumber,
startStationCode:trainInfo.stationTimeList[0].stationCode,
endStationCode:trainInfo.stationTimeList[lastIndex].stationCode,
startTime: formatTime(trainInfo.stationTimeList[0].secondTime + 7200),
endTime: formatTime(trainInfo.stationTimeList[lastIndex - 1].secondTime + 7200),
arriveConfigList: [],
startSectionCode:trainInfo.startSectionCode,
endSectionCode:trainInfo.endSectionCode,
endTbFront:undefined,
startTbFront:undefined
};
getRoutingBySDTNumber(model).then(resp => {
const taskObj = {
id:index + 1,
tripNumber: tripNumber,
startStationCode: resp.data.startStationCode,
startTime: formatTime(trainInfo.stationTimeList[0].secondTime + 7200),
endStationCode: resp.data.endStationCode,
endTime: formatTime(trainInfo.stationTimeList[lastIndex - 1].secondTime + 7200),
routingCode : resp.data.id,
endSectionCode:resp.data.endSectionCode,
startSectionCode:resp.data.startSectionCode,
arriveConfigList: [],
endTbFront:resp.data.endTbFront,
startTbFront:resp.data.startTbFront
if (trainInfo.startSectionCode != trainInfo.stationTimeList[0].sectionCode) {
taskObj.startTbFront = false;
taskObj.startTime = formatTime(trainInfo.startSecondTime + 7200);
const newModel = {
sectionCode:trainInfo.startSectionCode,
stationCode:trainInfo.stationTimeList[0].stationCode,
// // speedLevel:'',
departureTime: formatTime(trainInfo.startSecondTime + 7200),
arriveTime: formatTime(trainInfo.startSecondTime + 7200),
stopTime:0
};
if (resp.data.startTbFront == false) {
taskObj.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
};
taskObj.arriveConfigList.push(newModel);
}
const newstationTimeList = [];
let current = {};
trainInfo.stationTimeList.forEach((stationTime, index)=>{
if (index % 2 == 0) {
current = {};
current.stationCode = stationTime.stationCode;
current.arriveTime = stationTime.secondTime;
} else {
current.departureTime = stationTime.secondTime;
newstationTimeList.push(current);
}
});
newstationTimeList.forEach((newstationTime, index)=>{
const newModel = {
stationCode:newstationTime.stationCode,
// speedLevel:'',
arriveTime: formatTime(newstationTime.arriveTime + 7200),
departureTime: formatTime(newstationTime.departureTime + 7200),
stopTime:newstationTime.departureTime - newstationTime.arriveTime
};
if (resp.data.startTbFront == false) {
newModel.sectionCode = resp.data.parkSectionCodeList[index + 1].sectionCode;
} else {
newModel.sectionCode = resp.data.parkSectionCodeList[index].sectionCode;
}
if (index < newstationTimeList.length - 1) {
newModel.speedLevelTime = newstationTimeList[index + 1].arriveTime - newstationTime.departureTime;
// newModel.speedLevel=
}
taskObj.arriveConfigList.push(newModel);
});
if (resp.data.endTbFront == false) {
taskObj.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
};
taskObj.arriveConfigList.push(newModel);
}
// arriveTime: ""
// departureTime: "07:00:00"
// speedLevel: "()"
this.model.tripConfigList.push(taskObj);
index++;
if (index <= tripNumberList.length - 1) {
this.getEachTripNumber(editData, tripNumberList, index);
taskObj.arriveConfigList.push(newModel);
}
const newstationTimeList = [];
let current = {};
trainInfo.stationTimeList.forEach((stationTime, index)=>{
if (index % 2 == 0) {
current = {};
current.stationCode = stationTime.stationCode;
current.sectionCode = stationTime.sectionCode;
current.arriveTime = stationTime.secondTime;
} else {
current.departureTime = stationTime.secondTime;
newstationTimeList.push(current);
}
});
newstationTimeList.forEach((newstationTime, index)=>{
if (trainInfo.startSectionCode != trainInfo.stationTimeList[0].sectionCode) {
index += 1;
}
const newModel = {
sectionCode:newstationTime.sectionCode,
stationCode:newstationTime.stationCode,
arriveTime: formatTime(newstationTime.arriveTime + 7200),
departureTime: formatTime(newstationTime.departureTime + 7200),
stopTime:newstationTime.departureTime - newstationTime.arriveTime
};
taskObj.arriveConfigList.push(newModel);
});
if (trainInfo.endSectionCode != trainInfo.stationTimeList[lastIndex].sectionCode) {
taskObj.endTbFront = false;
taskObj.endTime = formatTime(trainInfo.endSecondTime + 7200);
const newModel = {
sectionCode:trainInfo.endSectionCode,
stationCode:trainInfo.stationTimeList[lastIndex].stationCode,
// // speedLevel:'',
departureTime: formatTime(trainInfo.endSecondTime + 7200),
arriveTime: formatTime(trainInfo.endSecondTime + 7200),
stopTime:0
};
taskObj.arriveConfigList.push(newModel);
} else {
if (trainInfo.reentry) {
taskObj.endTbFront = true;
}
}
this.model.tripConfigList.push(taskObj);
index++;
if (index <= tripNumberList.length - 1) {
this.getEachTripNumber(editData, tripNumberList, index);
}
},
loadInitData(params) {
this.isNew = params.isNew;
@ -220,7 +213,6 @@ export default {
});
},
handleEditTask() {
// routingCode || this.currentRow.tripNumber
if (this.currentRow.id) {
this.$emit('dispatchDialog', {
name: 'modifyingTask', params: {

View File

@ -81,44 +81,6 @@
</el-row>
</el-col>
</el-row>
<el-row style="margin-bottom: 5px;">
{{ $t('planMonitor.modifying.route') }}
</el-row>
<el-row>
<el-table :data="routingList" border :height="140">
<el-table-column prop="startStationCode" :label="$t('planMonitor.modifying.startingStation')">
<template slot-scope="scope">
{{ formatName(scope.row.startStationCode) }}
</template>
</el-table-column>
<el-table-column prop="startSectionCode" :label="$t('planMonitor.modifying.startSection')">
<template slot-scope="scope">
{{ formatName(scope.row.startSectionCode) }}
</template>
</el-table-column>
<el-table-column prop="endStationCode" :label="$t('planMonitor.modifying.endStationTitle')">
<template slot-scope="scope">
{{ formatName(scope.row.endStationCode) }}
</template>
</el-table-column>
<el-table-column prop="endSectionCode" :label="$t('planMonitor.modifying.endSection')">
<template slot-scope="scope">
{{ 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>
<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>
</el-row>
<el-row style=" margin-bottom: 5px;margin-top: 10px;">
{{ '经停转换轨 / 站台轨:' }}
</el-row>
@ -190,12 +152,13 @@ export default {
stopStationMap: {},
stopTimeMap:{},
defaultSpeedLevel: 'l1',
routingList: [],
tripNumber: '',
serviceNumber: '',
planId: '',
startTbFront:undefined,
endTbFront:undefined,
editModel: {
routingCode: '',
// routingCode: '',
endStationCode: '',
startStationCode: '',
startTime: '02:00:00',
@ -203,9 +166,7 @@ export default {
arriveConfigList: [],
tripNumber: '',
planId: '',
serviceNumber: '',
startTbFront: false,
endTbFront: false
serviceNumber: ''
},
tripNumberList: [{ value: '', label: this.$t('planMonitor.modifying.automatic') }],
reentryData: {},
@ -220,12 +181,6 @@ export default {
OUTBOUND: '出库',
INBOUND: '入库',
LOOP: '环路'
},
frontMap: {
'true': '折返轨(站前)',
'false': '折返轨(站后)',
'undefined': '转换轨',
'null': '转换轨'
}
};
},
@ -257,8 +212,8 @@ export default {
compuntedRunTime(list, index, runLevel) {
let runTime = 0;
if ((index == 0 && String(this.editModel.startTbFront) == false) ||
(index == list.length - 1 && String(this.editModel.endTbFront) == false)) {
if ((index == 0 && String(this.startTbFront) == false) ||
(index == list.length - 1 && String(this.endTbFront) == false)) {
return 0;
}
@ -278,55 +233,55 @@ export default {
return runTime;
},
computedDetailList(type = null) {
if (this.editModel.routingCode) {
let tempTime = this.computedTimeByString(this.editModel.startTime) / 1000;
const list = Object.assign([], this.editModel.arriveConfigList);
const runLevel = this.defaultSpeedLevel || 'l1'; //
// if (this.editModel.routingCode) {
let tempTime = this.computedTimeByString(this.editModel.startTime) / 1000;
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;
}
}
tempTime = tempTime || this.computedTimeByString('23:59:59') / 1000 + 1;
elem.arriveTime = formatTime(tempTime);
if (index == list.length - 1 && String(this.editModel.endTbFront) == 'true') {
const data = this.reentryData[list[index].stationCode] || {};
elem.departureTime = formatTime(tempTime + elem.stopTime + data.tbFront || 0);
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.departureTime = formatTime(tempTime + elem.stopTime);
elem.stopTime = 0;
}
}
const runLevelObj = this.defaultSpeedLevelList.find(speedLevel=>{ return speedLevel.value == runLevel; });
const realRunlevel = this.compuntedRunTime(list, index, runLevel);
tempTime = tempTime || this.computedTimeByString('23:59:59') / 1000 + 1;
elem.arriveTime = formatTime(tempTime);
elem.speedLevelTime = realRunlevel;
elem.speedLevel = runLevelObj.label;
if (index == list.length - 1 && String(this.endTbFront) == 'true') {
const data = this.reentryData[list[index].stationCode] || {};
elem.departureTime = formatTime(tempTime + elem.stopTime + data.tbFront || 0);
} else {
elem.departureTime = formatTime(tempTime + elem.stopTime);
}
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;
} else if (index == list.length - 1 && String(this.editModel.endTbFront) == 'true') {
const data = this.reentryData[list[index].stationCode] || {};
fronTime = data.tbFront || 0;
}
const runLevelObj = this.defaultSpeedLevelList.find(speedLevel=>{ return speedLevel.value == runLevel; });
const realRunlevel = this.compuntedRunTime(list, index, runLevel);
tempTime = tempTime + fronTime + elem.stopTime + elem.speedLevelTime;
});
elem.speedLevelTime = realRunlevel;
elem.speedLevel = runLevelObj.label;
this.editModel.endTime = formatTime(tempTime - list[list.length - 1].stopTime);
}
let fronTime = 0;
if (index == 0 && String(this.startTbFront) == 'false') {
const data = this.reentryData[elem.stationCode] || {};
fronTime = data.tbTo || 0;
} else if (index == list.length - 2 && String(this.endTbFront) == 'false') {
const data = this.reentryData[list[index + 1].stationCode] || {};
fronTime = data.tbTo || 0;
} else if (index == list.length - 1 && String(this.endTbFront) == 'true') {
const data = this.reentryData[list[index].stationCode] || {};
fronTime = data.tbFront || 0;
}
tempTime = tempTime + fronTime + elem.stopTime + elem.speedLevelTime;
});
this.editModel.endTime = formatTime(tempTime - list[list.length - 1].stopTime);
// }
},
loadInitData(params) {
const lineCode = this.$route.query.lineCode;
@ -364,7 +319,7 @@ export default {
const paramData = params.rowData;
this.initRunlevel(paramData);
this.editModel.arriveConfigList = paramData.arriveConfigList;
this.editModel.routingCode = paramData.routingCode;
// this.editModel.routingCode = paramData.routingCode;
this.editModel.startStationCode = paramData.startStationCode;
this.editModel.endStationCode = paramData.endStationCode;
this.editModel.startTime = paramData.startTime;
@ -372,111 +327,89 @@ 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.routingList = [];
this.routingList.push({
code:paramData.routingCode,
startStationCode:paramData.startStationCode,
endStationCode:paramData.endStationCode,
endSectionCode:paramData.endSectionCode,
startSectionCode:paramData.startSectionCode,
startTbFront:paramData.startTbFront,
endTbFront:paramData.endTbFront
});
this.startTbFront = paramData.startTbFront;
this.endTbFront = paramData.endTbFront;
this.computedDetailList();
} else {
const model = {
planId: this.$route.query.planId || this.loadRunPlanId,
SDTNumber: `${this.serviceNumber}${this.tripNumber}`
};
this.routingList = [];
getRoutingBySDTNumber(model).then(resp => { //
const editData = this.$store.state.runPlan.editData[this.serviceNumber];
if (editData) {
const trainInfo = editData.trainMap[this.tripNumber];
const lastIndex = trainInfo.stationTimeList.length - 1;
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
});
this.editModel = {
tripNumber: this.tripNumber,
startTime: formatTime(trainInfo.stationTimeList[0].secondTime + 7200),
endTime: formatTime(trainInfo.stationTimeList[lastIndex].secondTime + 7200),
routingCode : resp.data.id,
arriveConfigList: [],
startTbFront: resp.data.startTbFront,
endTbFront: resp.data.endTbFront
const editData = this.$store.state.runPlan.editData[this.serviceNumber];
if (editData) {
const trainInfo = editData.trainMap[this.tripNumber];
const lastIndex = trainInfo.stationTimeList.length - 1;
this.editModel = {
tripNumber: this.tripNumber,
startTime: formatTime(trainInfo.stationTimeList[0].secondTime + 7200),
endTime: formatTime(trainInfo.stationTimeList[lastIndex].secondTime + 7200),
arriveConfigList: [],
startStationCode:trainInfo.stationTimeList[0].stationCode,
endStationCode:trainInfo.stationTimeList[lastIndex].stationCode,
startSectionCode:trainInfo.startSectionCode,
endSectionCode:trainInfo.endSectionCode
};
if (trainInfo.startSectionCode != trainInfo.stationTimeList[0].sectionCode) {
this.startTbFront = false;
this.editModel.startTime = formatTime(trainInfo.startSecondTime + 7200);
const newModel = {
sectionCode:trainInfo.startSectionCode,
stationCode:trainInfo.stationTimeList[0].stationCode,
// // speedLevel:'',
departureTime: formatTime(trainInfo.startSecondTime + 7200),
arriveTime: formatTime(trainInfo.startSecondTime + 7200),
stopTime:0
};
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) {
current = {};
current.stationCode = stationTime.stationCode;
current.arriveTime = stationTime.secondTime;
} else {
current.departureTime = stationTime.secondTime;
newstationTimeList.push(current);
}
});
newstationTimeList.forEach((newstationTime, index)=>{
if (resp.data.startTbFront == false) {
index += 1;
}
const newModel = {
sectionCode:resp.data.parkSectionCodeList[index].sectionCode,
stationCode:newstationTime.stationCode,
arriveTime: formatTime(newstationTime.arriveTime + 7200),
departureTime: formatTime(newstationTime.departureTime + 7200),
stopTime:newstationTime.departureTime - newstationTime.arriveTime
};
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();
this.editModel.arriveConfigList.push(newModel);
}
});
const newstationTimeList = [];
let current = {};
trainInfo.stationTimeList.forEach((stationTime, index)=>{
if (index % 2 == 0) {
current = {};
current.stationCode = stationTime.stationCode;
current.sectionCode = stationTime.sectionCode;
current.arriveTime = stationTime.secondTime;
} else {
current.departureTime = stationTime.secondTime;
newstationTimeList.push(current);
}
});
newstationTimeList.forEach((newstationTime, index)=>{
if (trainInfo.startSectionCode != trainInfo.stationTimeList[0].sectionCode) {
index += 1;
}
const newModel = {
sectionCode:newstationTime.sectionCode,
stationCode:newstationTime.stationCode,
arriveTime: formatTime(newstationTime.arriveTime + 7200),
departureTime: formatTime(newstationTime.departureTime + 7200),
stopTime:newstationTime.departureTime - newstationTime.arriveTime
};
this.editModel.arriveConfigList.push(newModel);
});
if (trainInfo.endSectionCode != trainInfo.stationTimeList[lastIndex].sectionCode) {
this.endTbFront = false;
this.editModel.endTime = formatTime(trainInfo.endSecondTime + 7200);
const newModel = {
sectionCode:trainInfo.endSectionCode,
stationCode:trainInfo.stationTimeList[lastIndex].stationCode,
// // speedLevel:'',
departureTime: formatTime(trainInfo.endSecondTime + 7200),
arriveTime: formatTime(trainInfo.endSecondTime + 7200),
stopTime:0
};
this.editModel.arriveConfigList.push(newModel);
} else {
if (trainInfo.reentry) {
this.endTbFront = true;
}
}
this.initRunlevel(this.editModel);
this.dialogShow = true;
this.computedDetailList();
}
}
},
initRunlevel(paramData) {
@ -520,7 +453,7 @@ export default {
buildModel() {
return {
planId: this.$route.query.planId || this.loadRunPlanId,
routingCode: this.editModel.routingCode,
// routingCode: this.editModel.routingCode,
tripNumber: this.tripNumber,
startTime:this.editModel.arriveConfigList[0].arriveTime,
endTime: this.editModel.arriveConfigList[this.editModel.arriveConfigList.length - 1].departureTime,