动态列车list数据处理调整

This commit is contained in:
fan 2020-11-10 18:18:48 +08:00
parent 3eba44aa67
commit 0f6af4d835
2 changed files with 1 additions and 33 deletions

View File

@ -874,11 +874,10 @@ const map = {
let isExist = false; let isExist = false;
state.activeTrainList.forEach(elem => { state.activeTrainList.forEach(elem => {
if (elem == data.code) { if (elem == data.code) {
isExist = true;
if (data.dispose) { if (data.dispose) {
state.activeTrainList.splice(state.activeTrainList.indexOf(data.code), 1); state.activeTrainList.splice(state.activeTrainList.indexOf(data.code), 1);
state.activeTrainListChange += 1; state.activeTrainListChange += 1;
} else {
isExist = true;
} }
} }
}); });

View File

@ -22,36 +22,6 @@ const runPlan = {
}, },
draftStations: (state) => { draftStations: (state) => {
return state.draftStations || []; return state.draftStations || [];
},
convertPlanData: (state) => () => {
const data = { serviceNumberDataList: [] };
const serviceNumberList = Object.keys(state.editData).sort((a, b) => {
return state.editData[a].oldIndex - state.editData[b].oldIndex;
});
serviceNumberList.forEach(serviceNumber => {
const serviceObj = {
serviceNumber: serviceNumber,
tripNumberDataList: []
};
if (state.editData[serviceNumber].backup) {
serviceObj['backup'] = state.editData[serviceNumber].backup;
}
const trainMap = state.editData[serviceNumber].trainMap;
const tripNumberList = Object.keys(trainMap).sort((a, b) => {
return trainMap[a].oldIndex - trainMap[b].oldIndex;
});
tripNumberList.forEach(tripNumber => {
serviceObj.tripNumberDataList.push(trainMap[tripNumber]);
});
data.serviceNumberDataList.push(serviceObj);
});
return data;
} }
}, },
mutations: { mutations: {
@ -77,7 +47,6 @@ const runPlan = {
const trainList = service.tripNumberDataList; const trainList = service.tripNumberDataList;
state.initialPlanData[service.serviceNumber] = { oldIndex: i, serviceNumber: service.serviceNumber, backup: service.backup, trainMap: {} }; state.initialPlanData[service.serviceNumber] = { oldIndex: i, serviceNumber: service.serviceNumber, backup: service.backup, trainMap: {} };
trainList.forEach((train, j) => { trainList.forEach((train, j) => {
// ${train.directionCode}
state.initialPlanData[service.serviceNumber].trainMap[`${train.tripNumber}`] = { oldIndex: j, tripNumber: train.tripNumber, directionCode: train.directionCode, reentry: train.reentry, stationTimeList: train.stationTimeList }; state.initialPlanData[service.serviceNumber].trainMap[`${train.tripNumber}`] = { oldIndex: j, tripNumber: train.tripNumber, directionCode: train.directionCode, reentry: train.reentry, stationTimeList: train.stationTimeList };
}); });
}); });