diff --git a/src/views/planMonitor/data2json/parser.js b/src/views/planMonitor/data2json/parser.js index 9a35a8cda..187bdfc60 100644 --- a/src/views/planMonitor/data2json/parser.js +++ b/src/views/planMonitor/data2json/parser.js @@ -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); diff --git a/src/views/planMonitor/editTool/menus/addTask.vue b/src/views/planMonitor/editTool/menus/addTask.vue index a8fe0d7bd..5cd5def09 100644 --- a/src/views/planMonitor/editTool/menus/addTask.vue +++ b/src/views/planMonitor/editTool/menus/addTask.vue @@ -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; diff --git a/src/views/planMonitor/editTool/menus/editPlanningTrain.vue b/src/views/planMonitor/editTool/menus/editPlanningTrain.vue index af105586e..0a2a9c436 100644 --- a/src/views/planMonitor/editTool/menus/editPlanningTrain.vue +++ b/src/views/planMonitor/editTool/menus/editPlanningTrain.vue @@ -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 { diff --git a/src/views/planMonitor/editTool/menus/modifyingTask.vue b/src/views/planMonitor/editTool/menus/modifyingTask.vue index 886f5ccca..16af2256d 100644 --- a/src/views/planMonitor/editTool/menus/modifyingTask.vue +++ b/src/views/planMonitor/editTool/menus/modifyingTask.vue @@ -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, diff --git a/src/views/planMonitor/newEditTool/menus/addTask.vue b/src/views/planMonitor/newEditTool/menus/addTask.vue index bca350c95..14ad27528 100644 --- a/src/views/planMonitor/newEditTool/menus/addTask.vue +++ b/src/views/planMonitor/newEditTool/menus/addTask.vue @@ -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; diff --git a/src/views/planMonitor/newEditTool/menus/editPlanningTrain.vue b/src/views/planMonitor/newEditTool/menus/editPlanningTrain.vue index 368fc7ef7..6bd1bc492 100644 --- a/src/views/planMonitor/newEditTool/menus/editPlanningTrain.vue +++ b/src/views/planMonitor/newEditTool/menus/editPlanningTrain.vue @@ -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 { diff --git a/src/views/planMonitor/newEditTool/menus/modifyingTask.vue b/src/views/planMonitor/newEditTool/menus/modifyingTask.vue index 3c9d5530e..bbbb9b23b 100644 --- a/src/views/planMonitor/newEditTool/menus/modifyingTask.vue +++ b/src/views/planMonitor/newEditTool/menus/modifyingTask.vue @@ -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,