运行图编制 代码调整

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,30 +98,26 @@ 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}`
};
getRoutingBySDTNumber(model).then(resp => {
const taskObj = {
id:index + 1,
tripNumber: tripNumber,
startStationCode: resp.data.startStationCode,
startStationCode:trainInfo.stationTimeList[0].stationCode,
endStationCode:trainInfo.stationTimeList[lastIndex].stationCode,
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
startSectionCode:trainInfo.startSectionCode,
endSectionCode:trainInfo.endSectionCode,
endTbFront:undefined,
startTbFront:undefined
};
if (resp.data.startTbFront == false) {
if (trainInfo.startSectionCode != trainInfo.stationTimeList[0].sectionCode) {
taskObj.startTbFront = false;
taskObj.startTime = formatTime(trainInfo.startSecondTime + 7200);
const newModel = {
sectionCode:resp.data.parkSectionCodeList[0].sectionCode,
stationCode:resp.data.startStationCode,
sectionCode:trainInfo.startSectionCode,
stationCode:trainInfo.stationTimeList[0].stationCode,
// // speedLevel:'',
departureTime: formatTime(trainInfo.startSecondTime + 7200),
arriveTime: formatTime(trainInfo.startSecondTime + 7200),
@ -135,53 +131,50 @@ export default {
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,
// 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) {
if (trainInfo.endSectionCode != trainInfo.stationTimeList[lastIndex].sectionCode) {
taskObj.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,
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;
}
}
// arriveTime: ""
// departureTime: "07:00:00"
// speedLevel: "()"
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,7 +233,7 @@ export default {
return runTime;
},
computedDetailList(type = null) {
if (this.editModel.routingCode) {
// if (this.editModel.routingCode) {
let tempTime = this.computedTimeByString(this.editModel.startTime) / 1000;
const list = Object.assign([], this.editModel.arriveConfigList);
const runLevel = this.defaultSpeedLevel || 'l1'; //
@ -297,7 +252,7 @@ export default {
tempTime = tempTime || this.computedTimeByString('23:59:59') / 1000 + 1;
elem.arriveTime = formatTime(tempTime);
if (index == list.length - 1 && String(this.editModel.endTbFront) == 'true') {
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 {
@ -311,13 +266,13 @@ export default {
elem.speedLevel = runLevelObj.label;
let fronTime = 0;
if (index == 0 && String(this.editModel.startTbFront) == 'false') {
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.editModel.endTbFront) == 'false') {
} 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.editModel.endTbFront) == 'true') {
} else if (index == list.length - 1 && String(this.endTbFront) == 'true') {
const data = this.reentryData[list[index].stationCode] || {};
fronTime = data.tbFront || 0;
}
@ -326,7 +281,7 @@ export default {
});
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,56 +327,30 @@ 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
startStationCode:trainInfo.stationTimeList[0].stationCode,
endStationCode:trainInfo.stationTimeList[lastIndex].stationCode,
startSectionCode:trainInfo.startSectionCode,
endSectionCode:trainInfo.endSectionCode
};
if (resp.data.startTbFront == false) {
if (trainInfo.startSectionCode != trainInfo.stationTimeList[0].sectionCode) {
this.startTbFront = false;
this.editModel.startTime = formatTime(trainInfo.startSecondTime + 7200);
const newModel = {
sectionCode:resp.data.parkSectionCodeList[0].sectionCode,
stationCode:resp.data.startStationCode,
sectionCode:trainInfo.startSectionCode,
stationCode:trainInfo.stationTimeList[0].stationCode,
// // speedLevel:'',
departureTime: formatTime(trainInfo.startSecondTime + 7200),
arriveTime: formatTime(trainInfo.startSecondTime + 7200),
@ -437,6 +366,7 @@ export default {
if (index % 2 == 0) {
current = {};
current.stationCode = stationTime.stationCode;
current.sectionCode = stationTime.sectionCode;
current.arriveTime = stationTime.secondTime;
} else {
current.departureTime = stationTime.secondTime;
@ -445,11 +375,11 @@ export default {
});
newstationTimeList.forEach((newstationTime, index)=>{
if (resp.data.startTbFront == false) {
if (trainInfo.startSectionCode != trainInfo.stationTimeList[0].sectionCode) {
index += 1;
}
const newModel = {
sectionCode:resp.data.parkSectionCodeList[index].sectionCode,
sectionCode:newstationTime.sectionCode,
stationCode:newstationTime.stationCode,
arriveTime: formatTime(newstationTime.arriveTime + 7200),
departureTime: formatTime(newstationTime.departureTime + 7200),
@ -458,25 +388,28 @@ export default {
this.editModel.arriveConfigList.push(newModel);
});
if (resp.data.endTbFront == false) {
if (trainInfo.endSectionCode != trainInfo.stationTimeList[lastIndex].sectionCode) {
this.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,
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,