diff --git a/src/views/planMonitor/editTool/menus/editPlanningTrain.vue b/src/views/planMonitor/editTool/menus/editPlanningTrain.vue index 03ca6b40e..f5c91aee8 100644 --- a/src/views/planMonitor/editTool/menus/editPlanningTrain.vue +++ b/src/views/planMonitor/editTool/menus/editPlanningTrain.vue @@ -204,14 +204,37 @@ export default { }, handleDeleteTask() { if (this.currentRow.routingCode || this.currentRow.tripNumber) { - this.$emit('dispatchDialog', { - name: 'deleteTask', params: { - isPlan: true, - routingCode: this.currentRow.routingCode, - serviceNumber: this.model.serviceNumber, - tripNumber: this.currentRow.tripNumber - } - }); + 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; } + ); + } + 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')); } @@ -245,25 +268,27 @@ export default { this.model.tripConfigList.push(model); } }, - handleConfirmDeleteTask(model) { - let index = -1; - if (model.routingCode) { - index = this.model.tripConfigList.findIndex( - elem => { return elem.routingCode == model.routingCode; } - ); - } else { - index = this.model.tripConfigList.findIndex( - elem => { return elem.tripNumber == model.tripNumber; } - ); - } - if (index >= 0) { - if (model.addToFront) { - this.model.tripConfigList = this.model.tripConfigList.slice(index + 1); - } else { - this.model.tripConfigList = this.model.tripConfigList.slice(0, index); - } - } - }, + // handleConfirmDeleteTask(model) { + // debugger; + // let index = -1; + // if (model.routingCode) { + // index = this.model.tripConfigList.findIndex( + // elem => { return elem.routingCode == model.routingCode; } + // ); + // } else { + // index = this.model.tripConfigList.findIndex( + // elem => { return elem.tripNumber == model.tripNumber; } + // ); + // } + // // this.model.tripConfigList. + // if (index >= 0) { + // if (model.addToFront) { + // this.model.tripConfigList = this.model.tripConfigList.slice(index + 1); + // } else { + // this.model.tripConfigList = this.model.tripConfigList.slice(0, index); + // } + // } + // }, handleCommit() { if (this.isNew) { if (this.model.tripConfigList.length > 0) {