From 74919a6b81cba595377007e0632a91ef774d0550 Mon Sep 17 00:00:00 2001 From: lVAL Date: Wed, 11 Nov 2020 16:13:48 +0800 Subject: [PATCH 1/2] =?UTF-8?q?data2json=20=E8=BF=87=E6=BB=A4=20=E5=88=97?= =?UTF-8?q?=E8=BD=A6=E6=95=B0=E6=8D=AE=20=E7=9A=84=E4=B8=A4=E8=A1=8C?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/planMonitor/data2json/parser.js | 30 +++++++++++++---------- 1 file changed, 17 insertions(+), 13 deletions(-) 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); From e2eae2945b22a91abce9acdcae262538a0b988fd Mon Sep 17 00:00:00 2001 From: joylink_cuiweidong <364937672@qq.com> Date: Wed, 11 Nov 2020 16:40:07 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=BF=90=E8=A1=8C=E5=9B=BE=E7=BC=96?= =?UTF-8?q?=E5=88=B6=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../planMonitor/editTool/menus/addTask.vue | 4 +- .../editTool/menus/editPlanningTrain.vue | 42 ++++--------------- .../editTool/menus/modifyingTask.vue | 1 + .../planMonitor/newEditTool/menus/addTask.vue | 4 +- .../newEditTool/menus/editPlanningTrain.vue | 41 ++++-------------- .../newEditTool/menus/modifyingTask.vue | 1 + 6 files changed, 24 insertions(+), 69 deletions(-) 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,