This commit is contained in:
zyy 2020-11-11 16:56:53 +08:00
commit b0f2e8d8ae
7 changed files with 41 additions and 82 deletions

View File

@ -75,7 +75,8 @@ export default {
parseTrainData(filename) {
return new Promise((resolve, reject) => {
const name = '车站 列车编号';
const name2 = '车站 列车编号'
const name2 = '车站 列车编号';
const name3 = '__EMPTY';
const groupList = ['down', 'up', 'to'];
const jsonResult = {};
@ -90,20 +91,22 @@ export default {
if (i%3 == 0) {
json.station = el[name]||el[name2];
keyList.forEach(key => {
let on = '';
let out = '';
let leave = '';
for (var idx = 0; idx < 3; idx++) {
const item = dataList[i+idx];
if(item.__EMPTY == '下车人数') {
out = item[key];
} else if (item.__EMPTY == '上车人数') {
on = item[key]
} else if (item.__EMPTY == '载离人数') {
leave = item[key];
if (![name, name2, name3].includes(key)) {
let on = '';
let out = '';
let leave = '';
for (var idx = 0; idx < 3; idx++) {
const item = dataList[i+idx];
if(item[name3] == '下车人数') {
out = item[key];
} else if (item[name3] == '上车人数') {
on = item[key]
} else if (item[name3] == '载离人数') {
leave = item[key];
}
}
json.dataList.push({trainNo: key, on, out, leave });
}
json.dataList.push({trainNo: key, on, out, leave });
})
jsonList.push(json);
}
@ -122,6 +125,7 @@ export default {
}
jsonResult[groupList.shift()] = jsonList;
console.log(dataList, jsonList)
}
console.log(jsonResult);

View File

@ -404,8 +404,8 @@ export default {
arriveConfigList.push({arriveTime:'', departureTime:'', sectionCode:parkSectionCode.sectionCode, stationCode:parkSectionCode.stationCode});
});
this.$set(this.addModel, 'arriveConfigList', arriveConfigList);
// this.addModel.startStationCode = row.startStationCode;
// this.addModel.endStationCode = row.endStationCode;
this.addModel.startStationCode = row.startStationCode;
this.addModel.endStationCode = row.endStationCode;
// this.addModel.endSectionCode = row.endSectionCode;
// this.addModel.startSectionCode = row.startSectionCode;
this.addModel.routingCode = row.code;

View File

@ -104,6 +104,7 @@ export default {
};
getRoutingBySDTNumber(model).then(resp => {
const taskObj = {
id:index + 1,
tripNumber: tripNumber,
startStationCode: resp.data.startStationCode,
startTime: formatTime(trainInfo.stationTimeList[0].secondTime + 7200),
@ -162,7 +163,6 @@ export default {
});
},
loadInitData(params) {
debugger;
this.isNew = params.isNew;
this.model.planId = this.$route.query.planId;
this.model.serviceNumber = params.serviceNumber;
@ -199,7 +199,8 @@ export default {
});
},
handleEditTask() {
if (this.currentRow.routingCode || this.currentRow.tripNumber) {
// routingCode || this.currentRow.tripNumber
if (this.currentRow.id) {
this.$emit('dispatchDialog', {
name: 'modifyingTask', params: {
isPlan: true,
@ -213,38 +214,12 @@ export default {
}
},
handleDeleteTask() {
if (this.currentRow.routingCode || this.currentRow.tripNumber) {
if (this.currentRow.id) {
let index = -1;
if (this.currentRow.routingCode) {
index = this.model.tripConfigList.findIndex(
elem => {
return elem.routingCode == this.currentRow.routingCode &&
elem.startTime == this.currentRow.startTime &&
elem.endTime == this.currentRow.endTime;
}
);
} else {
index = this.model.tripConfigList.findIndex(
elem => { return elem.tripNumber == this.currentRow.tripNumber; }
);
}
index = this.model.tripConfigList.findIndex(
elem => { return elem.id == this.currentRow.id; }
);
this.model.tripConfigList.splice(index, 1);
// const tripConfigList = Object.assign([], this.model.tripConfigList);
// tripConfigList.forEach(tripConfig=>{
// if (tripConfig.routingCode == model.routingCode) {
// Object.assign(tripConfig, model);
// }
// });
// this.model.tripConfigList = tripConfigList;
// this.$emit('dispatchDialog', {
// name: 'deleteTask', params: {
// isPlan: true,
// routingCode: this.currentRow.routingCode,
// serviceNumber: this.model.serviceNumber,
// tripNumber: this.currentRow.tripNumber
// }
// });
} else {
this.$messageBox(this.$t('tip.selectAPieceOfData'));
}
@ -252,7 +227,7 @@ export default {
handleConfirmUpdateTask(model) {
const tripConfigList = Object.assign([], this.model.tripConfigList);
tripConfigList.forEach(tripConfig=>{
if (tripConfig.routingCode == model.routingCode) {
if (tripConfig.id == model.id) {
Object.assign(tripConfig, model);
}
});
@ -272,6 +247,7 @@ export default {
// } else {
// this.model.tripConfigList.push(model);
// }
model.id = this.model.tripConfigList.length + 1;
if (model.addToFront) {
this.model.tripConfigList = [model, ...this.model.tripConfigList];
} else {

View File

@ -399,6 +399,7 @@ export default {
this.editModel.endTime = params.rowData.endTime;
this.editModel.endSectionCode = params.rowData.endSectionCode;
this.editModel.startSectionCode = params.rowData.startSectionCode;
this.editModel.id = params.rowData.id;
this.routingList = [];
this.routingList.push({
code:params.rowData.routingCode,

View File

@ -411,8 +411,8 @@ export default {
arriveConfigList.push({arriveTime:'', departureTime:'', sectionCode:parkSectionCode.sectionCode, stationCode:parkSectionCode.stationCode});
});
this.$set(this.addModel, 'arriveConfigList', arriveConfigList);
// this.addModel.startStationCode = row.startStationCode;
// this.addModel.endStationCode = row.endStationCode;
this.addModel.startStationCode = row.startStationCode;
this.addModel.endStationCode = row.endStationCode;
// this.addModel.endSectionCode = row.endSectionCode;
// this.addModel.startSectionCode = row.startSectionCode;
this.addModel.routingCode = row.code;

View File

@ -112,6 +112,7 @@ export default {
};
getRoutingBySDTNumber(model).then(resp => {
const taskObj = {
id:index + 1,
tripNumber: tripNumber,
startStationCode: resp.data.startStationCode,
startTime: formatTime(trainInfo.stationTimeList[0].secondTime + 7200),
@ -206,7 +207,8 @@ export default {
});
},
handleEditTask() {
if (this.currentRow.routingCode || this.currentRow.tripNumber) {
// if (this.currentRow.routingCode || this.currentRow.tripNumber) {
if (this.currentRow.id) {
this.$emit('dispatchDialog', {
name: 'modifyingTask', params: {
isPlan: true,
@ -220,38 +222,12 @@ export default {
}
},
handleDeleteTask() {
if (this.currentRow.routingCode || this.currentRow.tripNumber) {
if (this.currentRow.id) {
let index = -1;
if (this.currentRow.routingCode) {
index = this.model.tripConfigList.findIndex(
elem => {
return elem.routingCode == this.currentRow.routingCode &&
elem.startTime == this.currentRow.startTime &&
elem.endTime == this.currentRow.endTime;
}
);
} else {
index = this.model.tripConfigList.findIndex(
elem => { return elem.tripNumber == this.currentRow.tripNumber; }
);
}
index = this.model.tripConfigList.findIndex(
elem => { return elem.id == this.currentRow.id; }
);
this.model.tripConfigList.splice(index, 1);
// const tripConfigList = Object.assign([], this.model.tripConfigList);
// tripConfigList.forEach(tripConfig=>{
// if (tripConfig.routingCode == model.routingCode) {
// Object.assign(tripConfig, model);
// }
// });
// this.model.tripConfigList = tripConfigList;
// this.$emit('dispatchDialog', {
// name: 'deleteTask', params: {
// isPlan: true,
// routingCode: this.currentRow.routingCode,
// serviceNumber: this.model.serviceNumber,
// tripNumber: this.currentRow.tripNumber
// }
// });
} else {
this.$messageBox(this.$t('tip.selectAPieceOfData'));
}
@ -259,7 +235,7 @@ export default {
handleConfirmUpdateTask(model) {
const tripConfigList = Object.assign([], this.model.tripConfigList);
tripConfigList.forEach(tripConfig=>{
if (tripConfig.routingCode == model.routingCode) {
if (tripConfig.id == model.id) {
Object.assign(tripConfig, model);
}
});
@ -279,6 +255,7 @@ export default {
// } else {
// this.model.tripConfigList.push(model);
// }
model.id = this.model.tripConfigList.length + 1;
if (model.addToFront) {
this.model.tripConfigList = [model, ...this.model.tripConfigList];
} else {

View File

@ -399,6 +399,7 @@ export default {
this.editModel.endTime = params.rowData.endTime;
this.editModel.endSectionCode = params.rowData.endSectionCode;
this.editModel.startSectionCode = params.rowData.startSectionCode;
this.editModel.id = params.rowData.id;
this.routingList = [];
this.routingList.push({
code:params.rowData.routingCode,