运行图代码调整

This commit is contained in:
joylink_cuiweidong 2020-10-21 18:40:02 +08:00
parent c684dd5149
commit 4eb69d03a6

View File

@ -204,14 +204,37 @@ export default {
}, },
handleDeleteTask() { handleDeleteTask() {
if (this.currentRow.routingCode || this.currentRow.tripNumber) { if (this.currentRow.routingCode || this.currentRow.tripNumber) {
this.$emit('dispatchDialog', { let index = -1;
name: 'deleteTask', params: { if (this.currentRow.routingCode) {
isPlan: true, index = this.model.tripConfigList.findIndex(
routingCode: this.currentRow.routingCode, elem => {
serviceNumber: this.model.serviceNumber, return elem.routingCode == this.currentRow.routingCode &&
tripNumber: this.currentRow.tripNumber elem.startTime == this.currentRow.startTime &&
} elem.endTime == this.currentRow.endTime;
}); }
);
} else {
index = this.model.tripConfigList.findIndex(
elem => { return elem.tripNumber == this.currentRow.tripNumber; }
);
}
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 { } else {
this.$messageBox(this.$t('tip.selectAPieceOfData')); this.$messageBox(this.$t('tip.selectAPieceOfData'));
} }
@ -245,25 +268,27 @@ export default {
this.model.tripConfigList.push(model); this.model.tripConfigList.push(model);
} }
}, },
handleConfirmDeleteTask(model) { // handleConfirmDeleteTask(model) {
let index = -1; // debugger;
if (model.routingCode) { // let index = -1;
index = this.model.tripConfigList.findIndex( // if (model.routingCode) {
elem => { return elem.routingCode == model.routingCode; } // index = this.model.tripConfigList.findIndex(
); // elem => { return elem.routingCode == model.routingCode; }
} else { // );
index = this.model.tripConfigList.findIndex( // } else {
elem => { return elem.tripNumber == model.tripNumber; } // index = this.model.tripConfigList.findIndex(
); // elem => { return elem.tripNumber == model.tripNumber; }
} // );
if (index >= 0) { // }
if (model.addToFront) { // // this.model.tripConfigList.
this.model.tripConfigList = this.model.tripConfigList.slice(index + 1); // if (index >= 0) {
} else { // if (model.addToFront) {
this.model.tripConfigList = this.model.tripConfigList.slice(0, index); // this.model.tripConfigList = this.model.tripConfigList.slice(index + 1);
} // } else {
} // this.model.tripConfigList = this.model.tripConfigList.slice(0, index);
}, // }
// }
// },
handleCommit() { handleCommit() {
if (this.isNew) { if (this.isNew) {
if (this.model.tripConfigList.length > 0) { if (this.model.tripConfigList.length > 0) {