运行图编制 代码调整

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) => { trainList.forEach((train, j) => {
state.initialPlanData[service.serviceNumber].trainMap[`${train.tripNumber}`] = { oldIndex: j, tripNumber: train.tripNumber, right:train.right, 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, 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}`] = state.editData[service.serviceNumber].trainMap[`${train.tripNumber}`] =
{ oldIndex: j, tripNumber: train.tripNumber, directionCode: train.directionCode, right:train.right, { oldIndex: j, tripNumber: train.tripNumber, directionCode: train.directionCode, right:train.right,
reentry: train.reentry, stationTimeList: train.stationTimeList, endSecondTime:train.endSecondTime, 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) => { trainList.forEach((train, j) => {
state.draftEditData[service.serviceNumber].trainMap[`${train.tripNumber}`] = { oldIndex: j, tripNumber: train.tripNumber, right:train.right, 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, 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.endSectionCode = row.endSectionCode;
this.addModel.startSectionCode = row.startSectionCode; this.addModel.startSectionCode = row.startSectionCode;
this.addModel.routingCode = row.id; this.addModel.routingCode = row.id;
debugger;
this.addModel.startTbFront = row.startTbFront; this.addModel.startTbFront = row.startTbFront;
this.addModel.endTbFront = row.endTbFront; this.addModel.endTbFront = row.endTbFront;
this.computedDetailList('routingCode'); this.computedDetailList('routingCode');

View File

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

View File

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