From 51a0ebd5fe4e4946a2c57c58527d834bd63cf0f0 Mon Sep 17 00:00:00 2001 From: yuan Date: Fri, 25 Jun 2021 15:34:35 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=8A=BD=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/jmapNew/theme/xian_01/menus/menuBar.vue | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/jmapNew/theme/xian_01/menus/menuBar.vue b/src/jmapNew/theme/xian_01/menus/menuBar.vue index aab0162ed..c4cbb1583 100644 --- a/src/jmapNew/theme/xian_01/menus/menuBar.vue +++ b/src/jmapNew/theme/xian_01/menus/menuBar.vue @@ -15,6 +15,7 @@ + + + From c7e75739c33b43e1c772fb0179cbf2739120d1ea Mon Sep 17 00:00:00 2001 From: joylink_cuiweidong <364937672@qq.com> Date: Thu, 1 Jul 2021 10:06:35 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E8=A5=BF=E5=AE=89=E4=B8=89=E5=8A=A0?= =?UTF-8?q?=E7=BA=BF=E9=80=BB=E8=BE=91=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/runplan.js | 8 + src/jmapNew/theme/xian_01/menus/menuBar.vue | 9 +- .../menus/menuDialog/addRunplanLine.vue | 314 ++++++++++++++++++ src/store/modules/runplan.js | 85 ++++- src/store/modules/socket.js | 9 +- .../newMap/displayNew/demon/runPlanView.vue | 1 + src/views/newMap/displayNew/menuSchema.vue | 16 +- src/views/newMap/mapsystemNew/index.vue | 1 + 8 files changed, 438 insertions(+), 5 deletions(-) create mode 100644 src/jmapNew/theme/xian_01/menus/menuDialog/addRunplanLine.vue diff --git a/src/api/runplan.js b/src/api/runplan.js index f0ccc4795..5aa70ac98 100644 --- a/src/api/runplan.js +++ b/src/api/runplan.js @@ -148,6 +148,14 @@ export function listUserRoutingData(mapId) { }); } +/** 根据目的地码查询用户交路数据(新版) */ +export function getUserRoutingDataByDes(mapId, destinationCode) { + return request({ + url: `/api/runPlan/userData/${mapId}/routing/select?destinationCode=${destinationCode}`, + method: 'get' + }); +} + /** 根据交路查询交路区段列表*/ export function querySectionListByRouting(routingCode) { return request({ diff --git a/src/jmapNew/theme/xian_01/menus/menuBar.vue b/src/jmapNew/theme/xian_01/menus/menuBar.vue index aab0162ed..6ae207fb1 100644 --- a/src/jmapNew/theme/xian_01/menus/menuBar.vue +++ b/src/jmapNew/theme/xian_01/menus/menuBar.vue @@ -15,6 +15,7 @@ + + diff --git a/src/store/modules/runplan.js b/src/store/modules/runplan.js index f86ad70be..0b04156ec 100644 --- a/src/store/modules/runplan.js +++ b/src/store/modules/runplan.js @@ -113,7 +113,86 @@ const runPlan = { state.planData[serviceNumber] = { oldIndex, serviceNumber, trainMap: {} }; state.planLoadedCount++; } - }, + }, + updateTrainRunplan:(state, updateServiceNumber) => { + const dataList = updateServiceNumber.serviceNumberDataList; + const length = dataList.length; + if (length > 0) { + dataList.forEach(data=>{ + const {serviceNumber, tripNumberDataList} = data; + const serviceNumberDataList = state.planData.serviceNumberDataList; + const serviceObj = serviceNumberDataList.find(serviceNumberData=>{ return serviceNumberData.serviceNumber == serviceNumber; }); + if (!serviceObj) { + // 原始计划不存在 + state.editData[serviceNumber] = { oldIndex: serviceNumberDataList.length, serviceNumber: serviceNumber, backup: undefined, trainMap: {}}; + tripNumberDataList.forEach(tripNumberData=>{ + state.editData[serviceNumber].trainMap[tripNumberData.tripNumber] = Object.assign({oldIndex:tripNumberDataList.length }, tripNumberData); + }); + state.planData.serviceNumberDataList.push({ + serviceNumber: serviceNumber, + tripNumberDataList:[...tripNumberDataList] + }); + } else { + // 原始计划存在 + tripNumberDataList.forEach(tripNumberData=>{ + if (tripNumberData.add) { + // 添加计划 + state.editData[serviceNumber].trainMap[tripNumberData.tripNumber] = Object.assign({oldIndex:serviceObj.tripNumberDataList.length }, tripNumberData); + serviceObj.tripNumberDataList.push(tripNumberData); + } else if (tripNumberData.invalid) { + // 删除计划 + if (tripNumberData.firstInvalid) { + // 删除的第一条数据处理 + } else { + + } + } + }); + // 删除 刷新 绘制 + // if (tripNumberData.invalid) { + // if (tripNumberData.firstInvalid) { + // } else { + // // delete state.editData[serviceNumber].trainMap[tripNumberData.tripNumber]; + // } + // } else { + // } + } + // if (tripNumberDataList.length > 0) { + // tripNumberDataList.forEach(tripNumberData=>{ + // if (tripNumberData.add) { + // const trainLength = Object.keys(state.initialPlanData[serviceNumber].trainMap).length; + // state.initialPlanData[serviceNumber].trainMap[tripNumberData.tripNumber] = { + // directionCode:tripNumberData.directionCode, + // endSecondTime:tripNumberData.endSecondTime, + // endSectionCode:tripNumberData.endSectionCode, + // oldIndex:trainLength, + // right:tripNumberData.right, + // reentry: tripNumberData.reentry, + // startSecondTime:tripNumberData.startSecondTime, + // startSectionCode:tripNumberData.startSectionCode, + // stationTimeList:tripNumberData.stationTimeList, + // tripNumber:tripNumberData.tripNumber + // }; + // } else if (tripNumberData.invalid) { + // if (tripNumberData.firstInvalid) { + // // 处理被删除的前一段的最后一个点的问题 + // // state.initialPlanData[serviceNumber].trainMap[tripNumberData.tripNumber] + // } else { + // delete state.initialPlanData[serviceNumber].trainMap[tripNumberData.tripNumber]; + // } + // } + // }); + // } + }); + } + state.planLoadedCount++; + // const serviceObj = state.planData[serviceNumber]; + // if (serviceObj) { + // const oldIndex = serviceObj.oldIndex; + // state.planData[serviceNumber] = { oldIndex, serviceNumber, trainMap: {} }; + // state.planLoadedCount++; + // } + }, clear: (state) => { // state.stations = []; state.planData = {}; @@ -188,6 +267,10 @@ const runPlan = { addServiceNumber: ({ commit }, serviceNumber) => { commit('addServiceNumber', serviceNumber); }, + /** 更新仿真里的运行图(西安三加线抽线逻辑) */ + updateTrainRunplan: ({ commit }, updateServiceNumber) => { + commit('updateTrainRunplan', updateServiceNumber); + }, /** 选择车次*/ setSelected: ({ commit }, selected) => { commit('setSelected', selected); diff --git a/src/store/modules/socket.js b/src/store/modules/socket.js index 9b22616fa..1b6321e14 100644 --- a/src/store/modules/socket.js +++ b/src/store/modules/socket.js @@ -189,9 +189,13 @@ function handle(state, data) { store.dispatch('training/over'); } break; - case 'Simulation_PslStatus': + case 'Simulation_PslStatus': state.simulationPslStatus = msg; break; + // 运行图加线/抽线/变化推送消息 + case 'Simulation_Trip_Plan_Change': + state.simulationPlanChange = msg; + break; } } @@ -337,7 +341,8 @@ const socket = { deviceStateMessages: null, // 新版订阅设备状态消息 simulationSpeed: 1, // 仿真倍速 simulationPause: false, - simulationPslStatus: [], //PSL面板按钮状态信息 + simulationPslStatus: [], // PSL面板按钮状态信息 + simulationPlanChange:{} // 运行图加线/抽线/变化推送消息 }, getters: { }, diff --git a/src/views/newMap/displayNew/demon/runPlanView.vue b/src/views/newMap/displayNew/demon/runPlanView.vue index fda0188dc..6231b01d9 100644 --- a/src/views/newMap/displayNew/demon/runPlanView.vue +++ b/src/views/newMap/displayNew/demon/runPlanView.vue @@ -254,6 +254,7 @@ export default { this.staticSeries = []; const stations = this.$store.state.runPlan.stations; const planData = this.$store.state.runPlan.planData; + debugger; this.kmRangeMap = this.PlanParser.convertStationsToMap(stations); if (this.$route.query.lineCode === '07') { this.pushModels(this.staticSeries, [this.PlanParser.initializeAxisX(stations)]); diff --git a/src/views/newMap/displayNew/menuSchema.vue b/src/views/newMap/displayNew/menuSchema.vue index a2d4e9c69..1511b2ea9 100644 --- a/src/views/newMap/displayNew/menuSchema.vue +++ b/src/views/newMap/displayNew/menuSchema.vue @@ -142,9 +142,22 @@ export default { this.swch = '01'; } }, - '$store.state.map.mapDataLoadedCount': function () { + // '$store.state.map.mapDataLoadedCount': function () { + // this.loadRunData(); + // }, + '$store.state.training.subscribeCount': function () { + debugger; this.loadRunData(); }, + '$store.state.socket.simulationPlanChange': function (val) { + // debugger; + // 判断是否已经加载运行图,若加载只处理运行图数据,否则,缓存数据 + if (JSON.stringify(this.$store.state.runPlan.planData) == '{}') { + + } else { + this.$store.dispatch('runPlan/updateTrainRunplan', val); + } + }, '$store.state.training.triggerFaultCount': function () { this.setFault(); }, @@ -170,6 +183,7 @@ export default { // 获取排序的车站列表 getByGroupStationList(this.group).then(response => { this.$store.dispatch('runPlan/setStations', response.data).then(() => { + debugger; loadRunPlanData(this.group, this.dataError); }); }).catch(() => { diff --git a/src/views/newMap/mapsystemNew/index.vue b/src/views/newMap/mapsystemNew/index.vue index 70f3d0a47..b2c899967 100644 --- a/src/views/newMap/mapsystemNew/index.vue +++ b/src/views/newMap/mapsystemNew/index.vue @@ -116,6 +116,7 @@ export default { }); }, async subscribe() { + debugger; this.clearSubscribe(); const header = { group: this.$route.query.group || '', 'X-Token': getToken() }; creatSubscribe(`${displayTopic}\/${this.$route.query.group}`, header); From 4e2b07829ce7eaca1234c4ff5c65a714fe808e6e Mon Sep 17 00:00:00 2001 From: joylink_cuiweidong <364937672@qq.com> Date: Fri, 2 Jul 2021 13:44:21 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E8=A5=BF=E5=AE=89=E4=B8=89=E5=8F=B7?= =?UTF-8?q?=E7=BA=BF=20=E8=BF=90=E8=A1=8C=E5=9B=BE=20=E5=8A=A0=E7=BA=BF?= =?UTF-8?q?=E6=8A=BD=E7=BA=BF=E5=8A=9F=E8=83=BD=20=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/jmapNew/theme/parser/EqualRatioParser.js | 56 +++-- .../menus/menuDialog/addRunplanLine.vue | 223 +++++++++++------- .../menus/menuDialog/deleteRunplanLine.vue | 22 +- src/store/modules/runplan.js | 71 +++--- .../newMap/displayNew/demon/runPlanView.vue | 28 ++- src/views/newMap/displayNew/menuSchema.vue | 8 +- src/views/newMap/mapsystemNew/index.vue | 1 - src/views/planSchedule/schedule.vue | 25 +- 8 files changed, 268 insertions(+), 166 deletions(-) diff --git a/src/jmapNew/theme/parser/EqualRatioParser.js b/src/jmapNew/theme/parser/EqualRatioParser.js index e847c66d1..16ec2f495 100644 --- a/src/jmapNew/theme/parser/EqualRatioParser.js +++ b/src/jmapNew/theme/parser/EqualRatioParser.js @@ -52,32 +52,50 @@ class EqualRatioParser { /** 如果车次号为空,不显示名称*/ if (train.tripNumber) { - /** 创建标记点名称和坐标*/ - // pointdata.name = `${service.serviceNumber}${train.directionCode}${train.tripNumber}`; - pointdata.name = `${service.serviceNumber}${train.tripNumber}`; - pointdata.color = '#000' || lineStyle.color; - pointdata.directionCode = train.right ? '2' : '1'; - if (!store.state.map.mapConfig.upRight) { - pointdata.directionCode = train.right ? '1' : '2'; + // 如果不是被删除的首个车次 + if (!train.firstInvalid) { + /** 创建标记点名称和坐标*/ + // pointdata.name = `${service.serviceNumber}${train.directionCode}${train.tripNumber}`; + pointdata.name = `${service.serviceNumber}${train.tripNumber}`; + pointdata.color = '#000' || lineStyle.color; + pointdata.directionCode = train.right ? '2' : '1'; + if (!store.state.map.mapConfig.upRight) { + pointdata.directionCode = train.right ? '1' : '2'; + } + pointdata.coord = [train.stationTimeList[1].secondTime, this.getCoordYByElem(stations, kmRangeMap, train.stationTimeList[1], pointdata.directionCode, false)]; + /** 给服务对象添加服务名称和标记点*/ + opt.markPointData.push(this.__createMartPoint(pointdata)); } - pointdata.coord = [train.stationTimeList[1].secondTime, this.getCoordYByElem(stations, kmRangeMap, train.stationTimeList[1], pointdata.directionCode, false)]; - /** 给服务对象添加服务名称和标记点*/ - opt.markPointData.push(this.__createMartPoint(pointdata)); /** 创建服务号名称*/ opt.name = `${service.serviceNumber}`; } - /** 计算非折返点车次点坐标集合*/ - train.stationTimeList.forEach((elem, index) => { - idx = index; - // if (index == 0 && train.stationTimeList[index].stationCode != train.stationTimeList[index + 1].stationCode || - // index == train.stationTimeList.length - 2 && train.stationTimeList[index].secondTime != train.stationTimeList[index + 1].secondTime || - // index > 0 && index < train.stationTimeList.length - 1) { - const aa = `${train.tripNumber}`; - opt.data.push([elem.secondTime, this.getCoordYByElem(stations, kmRangeMap, elem, pointdata.directionCode, false), elem.stationCode, aa]); + if (!train.firstInvalid) { + /** 计算非折返点车次点坐标集合*/ + train.stationTimeList.forEach((elem, index) => { + idx = index; + // if (index == 0 && train.stationTimeList[index].stationCode != train.stationTimeList[index + 1].stationCode || + // index == train.stationTimeList.length - 2 && train.stationTimeList[index].secondTime != train.stationTimeList[index + 1].secondTime || + // index > 0 && index < train.stationTimeList.length - 1) { + const aa = `${train.tripNumber}`; + opt.data.push([elem.secondTime, this.getCoordYByElem(stations, kmRangeMap, elem, pointdata.directionCode, false), elem.stationCode, aa]); // } - }); + }); + } else { + const deletePoint = { + symbol:'circle', + name:'breakPoint', + symbolSize:10, + itemStyle:{ + color:'#FF5A3B' + }, + coord: [train.stationTimeList[0].secondTime, this.getCoordYByElem(stations, kmRangeMap, train.stationTimeList[0], pointdata.directionCode, false)] + }; + /** 给服务对象添加服务名称和标记点*/ + // this.__createMartPoint(deletePoint) + opt.markPointData.push(deletePoint); + } /** 计算折返点车次坐标点集合*/ if (!train.backup && train.reentry && service.tripNumberDataList[j + 1] && service.tripNumberDataList[j + 1].stationTimeList) { diff --git a/src/jmapNew/theme/xian_01/menus/menuDialog/addRunplanLine.vue b/src/jmapNew/theme/xian_01/menus/menuDialog/addRunplanLine.vue index 8b3d7a7fe..b31b8e8fa 100644 --- a/src/jmapNew/theme/xian_01/menus/menuDialog/addRunplanLine.vue +++ b/src/jmapNew/theme/xian_01/menus/menuDialog/addRunplanLine.vue @@ -13,11 +13,11 @@ 表号: - + 车次号: - + 目的地码: @@ -30,7 +30,7 @@ /> - + 交路: { + if (value && value.id != '') { + return callback(); + } else { + return callback(new Error('请选择交路')); + } + }; + + const crules = { + serviceNumber: [ + { required: true, trigger: 'blur', validator:this.validateService} + // message: '请输入表号', + ], + tripNumber: [ + { required: true, message: '请输入车次号', trigger: 'blur' } + ], + destinationCode:[ + { required: true, message: '请选择目的地码', trigger: 'blur' }, + { required: true, message: '请选择目的地码', trigger: 'change' } + ], + routing:[ + { required: true, validator: validateRouting, trigger: 'blur' }, + { required: true, validator: validateRouting, trigger: 'change' } + ], + startTime:[ + { required: true, message: '请选择开始时间', trigger: 'blur' }, + { required: true, message: '请选择开始时间', trigger: 'change' } + ] + }; + return crules; } }, mounted() { @@ -166,10 +193,42 @@ export default { this.$store.dispatch('training/emitTipFresh'); }); }, + validateService (rule, value, callback) { + if (typeof value == 'string' && value.trim().length == 0) { + return callback(new Error('请输入表号')); + } else { + let newValue = parseInt(value); + if (newValue) { + if (newValue > 0 & newValue < 9) { + newValue = '0' + newValue; + } + this.addModel.serviceNumber = newValue; + return callback(); + } else { + this.addModel.serviceNumber = ''; + } + } + }, doClose() { this.$refs['routing'].blur(); this.$refs['destinationCode'].blur(); this.$refs['startTime'].hidePicker(); + this.$refs['form'].resetFields(); + this.addModel = { + serviceNumber:'', + tripNumber:'', + destinationCode:'', + startTime:'', + routing:{ + startStationCode:'', + endStationCode:'', + endSectionCode:'', + startSectionCode:'', + id:'', + startTbFront: null, + endTbFront: null + } + }, this.loading = false; this.dialogShow = false; this.$store.dispatch('training/emitTipFresh'); @@ -187,76 +246,80 @@ export default { } }, commit() { - const runplanLine = {serviceNumber:this.addModel.serviceNumber, tripConfigList:[{ - startStationCode:this.addModel.routing.startStationCode, - endStationCode:this.addModel.routing.endStationCode, - endSectionCode:this.addModel.routing.endSectionCode, - startSectionCode:this.addModel.routing.startSectionCode, - routingCode:this.addModel.routing.id, - id:1, - tripNumber:this.addModel.tripNumber, - startTime:this.addModel.startTime - }] }; - // - // startTbFront - // startTbFront - // endTbFront - const arriveConfigList = []; - const that = this; - querySectionListByRouting(that.addModel.routing.id).then(resp=>{ - const length = resp.data.length - 1; - resp.data.forEach((parkSectionCode, index)=>{ - const arriveConfig = {arriveTime:'', departureTime:'', sectionCode:parkSectionCode.sectionCode, stationCode:parkSectionCode.stationCode}; - const prev = arriveConfigList[index - 1]; - const reentryData = that.reentryData[parkSectionCode.stationCode] || {}; - if (index == 0) { - arriveConfig.departureTime = that.addModel.startTime; - } else if (index < length) { - if (String(that.addModel.routing.startTbFront) == 'false' && index == 1) { - // const reentryData = that.reentryData[parkSectionCode.stationCode] || {}; - arriveConfig.arriveTime = formatTime(this.computedTimeByString(prev.departureTime) / 1000 + (reentryData.tbTo || 0)); - } else { - const runLevel = that.stopStationMap[[prev.sectionCode, parkSectionCode.sectionCode].toString()] || {}; - arriveConfig.arriveTime = formatTime(this.computedTimeByString(prev.departureTime) / 1000 + (runLevel.l3 || 0)); - } - const nowParking = that.stopTimeMap[parkSectionCode.stationCode] || {}; - arriveConfig.departureTime = formatTime(this.computedTimeByString(arriveConfig.arriveTime) / 1000 + nowParking.parkingTime || 0 ); - } else { - if (String(that.addModel.routing.endTbFront) == 'false') { - // const reentryData = that.reentryData[parkSectionCode.stationCode] || {}; - arriveConfig.arriveTime = formatTime(this.computedTimeByString(prev.departureTime) / 1000 + (reentryData.tbTo || 0)); - } else { - const runLevel = that.stopStationMap[[prev.sectionCode, parkSectionCode.sectionCode].toString()] || {}; - arriveConfig.arriveTime = formatTime(this.computedTimeByString(prev.departureTime) / 1000 + (runLevel.l3 || 0)); - } - arriveConfig.departureTime = ''; - } - // if (index == 0) { - // arriveConfig.departureTime = that.addModel.startTime; - // } else if (index < resp.data.length - 1) { - // const prev = arriveConfigList[index - 1]; - // // startSectionCode; - // // endSectionCode; - // const runLevel = that.stopStationMap[[prev.sectionCode, parkSectionCode.sectionCode].toString()] || 0; - // arriveConfig.arriveTime = prev.departureTime + that.stopTimeMap[prev.stationCode] || 0 + runLevel ? runLevel.l3 : 0; + this.$refs['form'].validate((valid) => { + if (valid) { + const runplanLine = {serviceNumber:this.addModel.serviceNumber, tripConfigList:[{ + startStationCode:this.addModel.routing.startStationCode, + endStationCode:this.addModel.routing.endStationCode, + endSectionCode:this.addModel.routing.endSectionCode, + startSectionCode:this.addModel.routing.startSectionCode, + routingCode:this.addModel.routing.id, + id:1, + tripNumber:this.addModel.tripNumber, + startTime:this.addModel.startTime + }] }; // - // // elem.stopTime = this.stopTimeMap[elem.stationCode].parkingTime; - // } else { - // arriveConfig.arriveTime = ''; - // } - // { } - arriveConfigList.push(arriveConfig); - }); - runplanLine.tripConfigList[0].arriveConfigList = arriveConfigList; - runplanLine.tripConfigList[0].endTime = arriveConfigList[arriveConfigList.length - 1].arriveTime; + // startTbFront + // startTbFront + // endTbFront + const arriveConfigList = []; + const that = this; + querySectionListByRouting(that.addModel.routing.id).then(resp=>{ + const length = resp.data.length - 1; + resp.data.forEach((parkSectionCode, index)=>{ + const arriveConfig = {arriveTime:'', departureTime:'', sectionCode:parkSectionCode.sectionCode, stationCode:parkSectionCode.stationCode}; + const prev = arriveConfigList[index - 1]; + const reentryData = that.reentryData[parkSectionCode.stationCode] || {}; + if (index == 0) { + arriveConfig.departureTime = that.addModel.startTime; + } else if (index < length) { + if (String(that.addModel.routing.startTbFront) == 'false' && index == 1) { + // const reentryData = that.reentryData[parkSectionCode.stationCode] || {}; + arriveConfig.arriveTime = formatTime(this.computedTimeByString(prev.departureTime) / 1000 + (reentryData.tbTo || 0)); + } else { + const runLevel = that.stopStationMap[[prev.sectionCode, parkSectionCode.sectionCode].toString()] || {}; + arriveConfig.arriveTime = formatTime(this.computedTimeByString(prev.departureTime) / 1000 + (runLevel.l3 || 0)); + } + const nowParking = that.stopTimeMap[parkSectionCode.stationCode] || {}; + arriveConfig.departureTime = formatTime(this.computedTimeByString(arriveConfig.arriveTime) / 1000 + nowParking.parkingTime || 0 ); + } else { + if (String(that.addModel.routing.endTbFront) == 'false') { + // const reentryData = that.reentryData[parkSectionCode.stationCode] || {}; + arriveConfig.arriveTime = formatTime(this.computedTimeByString(prev.departureTime) / 1000 + (reentryData.tbTo || 0)); + } else { + const runLevel = that.stopStationMap[[prev.sectionCode, parkSectionCode.sectionCode].toString()] || {}; + arriveConfig.arriveTime = formatTime(this.computedTimeByString(prev.departureTime) / 1000 + (runLevel.l3 || 0)); + } + arriveConfig.departureTime = ''; + } + // if (index == 0) { + // arriveConfig.departureTime = that.addModel.startTime; + // } else if (index < resp.data.length - 1) { + // const prev = arriveConfigList[index - 1]; + // // startSectionCode; + // // endSectionCode; + // const runLevel = that.stopStationMap[[prev.sectionCode, parkSectionCode.sectionCode].toString()] || 0; + // arriveConfig.arriveTime = prev.departureTime + that.stopTimeMap[prev.stationCode] || 0 + runLevel ? runLevel.l3 : 0; + // + // // elem.stopTime = this.stopTimeMap[elem.stationCode].parkingTime; + // } else { + // arriveConfig.arriveTime = ''; + // } + // { } + arriveConfigList.push(arriveConfig); + }); + runplanLine.tripConfigList[0].arriveConfigList = arriveConfigList; + runplanLine.tripConfigList[0].endTime = arriveConfigList[arriveConfigList.length - 1].arriveTime; - if (this.group) { - sendCommandNew(this.group, 'RunPlan_Add_Trip', runplanLine).then((response) => { - this.$message.success('添加计划车成功'); - this.doClose(); - // 重新加载 仿真运行图 - }).catch(error => { - this.$messageBox('添加计划车失败:' + error.$message); + if (this.group) { + sendCommandNew(this.group, 'RunPlan_Add_Trip', runplanLine).then((response) => { + this.$message.success('添加计划车成功'); + this.doClose(); + // 重新加载 仿真运行图 + }).catch(error => { + this.$messageBox('添加计划车失败:' + error.$message); + }); + } }); } }); diff --git a/src/jmapNew/theme/xian_01/menus/menuDialog/deleteRunplanLine.vue b/src/jmapNew/theme/xian_01/menus/menuDialog/deleteRunplanLine.vue index adbf35dd7..fb15cc0a9 100644 --- a/src/jmapNew/theme/xian_01/menus/menuDialog/deleteRunplanLine.vue +++ b/src/jmapNew/theme/xian_01/menus/menuDialog/deleteRunplanLine.vue @@ -18,7 +18,7 @@ :rules="rules" > - + @@ -56,7 +56,8 @@ export default { { required: true, trigger: "blur", - message: "请输入表号" + validator:this.validateService + // message: "请输入表号" } ], tripNumber: [ @@ -95,6 +96,22 @@ export default { this.dialogShow = false; this.$store.dispatch("training/emitTipFresh"); }, + validateService (rule, value, callback) { + if (typeof value == 'string' && value.trim().length == 0) { + return callback(new Error('请输入表号')); + } else { + let newValue = parseInt(value); + if (newValue) { + if (newValue > 0 & newValue < 9) { + newValue = '0' + newValue; + } + this.model.serviceNumber = newValue; + return callback(); + } else { + this.model.serviceNumber = ''; + } + } + }, commit() { this.$refs.form.validate(valid => { if (valid) { @@ -103,6 +120,7 @@ export default { sendCommandNew(group, "RunPlan_Delete_Trip", data) .then(resp => { console.log(resp); + this.$message.success('删除计划车成功'); this.doClose(); }) .catch(e => { diff --git a/src/store/modules/runplan.js b/src/store/modules/runplan.js index 476abcda4..a56649ab3 100644 --- a/src/store/modules/runplan.js +++ b/src/store/modules/runplan.js @@ -16,7 +16,8 @@ const runPlan = { runPlanMap: {}, // 运行图数据map(以id和version 为标识) runPlanInfo: {}, // 运行图信息 loadRunPlanCount: 0, // 运行图加载数据完成 - serviceNumberDataList: [] // 运行图数据 + serviceNumberDataList: [], // 运行图数据 + updateTrainRpData:{} // 更新仿真运行图数据 }, getters: { stations: (state) => { @@ -75,6 +76,10 @@ const runPlan = { state.planLoadedCount++; } }, + setUpdateTrainRpData: (state, updateTrainRpData) => { + state.updateTrainRpData = updateTrainRpData; + }, + updateTrainRunplan:(state, updateServiceNumber) => { const dataList = updateServiceNumber.serviceNumberDataList; const length = dataList.length; @@ -84,7 +89,7 @@ const runPlan = { const serviceNumberDataList = state.planData.serviceNumberDataList; const serviceObj = serviceNumberDataList.find(serviceNumberData=>{ return serviceNumberData.serviceNumber == serviceNumber; }); if (!serviceObj) { - // 原始计划不存在 + // 原始计划不存在 添加 state.editData[serviceNumber] = { oldIndex: serviceNumberDataList.length, serviceNumber: serviceNumber, backup: undefined, trainMap: {}}; tripNumberDataList.forEach(tripNumberData=>{ state.editData[serviceNumber].trainMap[tripNumberData.tripNumber] = Object.assign({oldIndex:tripNumberDataList.length }, tripNumberData); @@ -96,54 +101,32 @@ const runPlan = { } else { // 原始计划存在 tripNumberDataList.forEach(tripNumberData=>{ - if (tripNumberData.add) { - // 添加计划 - state.editData[serviceNumber].trainMap[tripNumberData.tripNumber] = Object.assign({oldIndex:serviceObj.tripNumberDataList.length }, tripNumberData); - serviceObj.tripNumberDataList.push(tripNumberData); - } else if (tripNumberData.invalid) { + if (tripNumberData.invalid) { // 删除计划 + const index = serviceObj.tripNumberDataList.findIndex(tripNumberInfo=>{ return tripNumberInfo.tripNumber == tripNumberData.tripNumber; }); if (tripNumberData.firstInvalid) { // 删除的第一条数据处理 + serviceObj.tripNumberDataList[index].stationTimeList.splice(1, tripNumberData.stationTimeList.length - 1); + serviceObj.tripNumberDataList[index].firstInvalid = tripNumberData.firstInvalid; + delete state.editData[serviceNumber].trainMap[tripNumberData.tripNumber]; + // state.editData[serviceNumber].trainMap[tripNumberData.tripNumber].stationTimeList.splice(1, tripNumberData.stationTimeList.length - 1); } else { - + serviceObj.tripNumberDataList.splice(index, 1); + delete state.editData[serviceNumber].trainMap[tripNumberData.tripNumber]; + } + } else { + if (tripNumberData.add) { + // 添加计划 + state.editData[serviceNumber].trainMap[tripNumberData.tripNumber] = Object.assign({oldIndex:serviceObj.tripNumberDataList.length }, tripNumberData); + serviceObj.tripNumberDataList.push(tripNumberData); } } }); - // 删除 刷新 绘制 - // if (tripNumberData.invalid) { - // if (tripNumberData.firstInvalid) { - // } else { - // // delete state.editData[serviceNumber].trainMap[tripNumberData.tripNumber]; - // } - // } else { - // } + // 处理所有的车次号删除 + if (serviceObj.tripNumberDataList.length == 1 && serviceObj.tripNumberDataList[0].firstInvalid) { + delete state.editData[serviceNumber]; + } } - // if (tripNumberDataList.length > 0) { - // tripNumberDataList.forEach(tripNumberData=>{ - // if (tripNumberData.add) { - // const trainLength = Object.keys(state.initialPlanData[serviceNumber].trainMap).length; - // state.initialPlanData[serviceNumber].trainMap[tripNumberData.tripNumber] = { - // directionCode:tripNumberData.directionCode, - // endSecondTime:tripNumberData.endSecondTime, - // endSectionCode:tripNumberData.endSectionCode, - // oldIndex:trainLength, - // right:tripNumberData.right, - // reentry: tripNumberData.reentry, - // startSecondTime:tripNumberData.startSecondTime, - // startSectionCode:tripNumberData.startSectionCode, - // stationTimeList:tripNumberData.stationTimeList, - // tripNumber:tripNumberData.tripNumber - // }; - // } else if (tripNumberData.invalid) { - // if (tripNumberData.firstInvalid) { - // // 处理被删除的前一段的最后一个点的问题 - // // state.initialPlanData[serviceNumber].trainMap[tripNumberData.tripNumber] - // } else { - // delete state.initialPlanData[serviceNumber].trainMap[tripNumberData.tripNumber]; - // } - // } - // }); - // } }); } state.planLoadedCount++; @@ -218,6 +201,10 @@ const runPlan = { updateTrainRunplan: ({ commit }, updateServiceNumber) => { commit('updateTrainRunplan', updateServiceNumber); }, + /** 设置需要更新的仿真运行图数据 (西安三加线抽线逻辑) */ + setUpdateTrainRpData: ({ commit }, updateTrainRpData) => { + commit('setUpdateTrainRpData', updateTrainRpData); + }, /** 选择车次*/ setSelected: ({ commit }, selected) => { commit('setSelected', selected); diff --git a/src/views/newMap/displayNew/demon/runPlanView.vue b/src/views/newMap/displayNew/demon/runPlanView.vue index 941b2f10a..46e9aa0aa 100644 --- a/src/views/newMap/displayNew/demon/runPlanView.vue +++ b/src/views/newMap/displayNew/demon/runPlanView.vue @@ -157,7 +157,7 @@ export default { mounted() { this.staticSeries = []; this.selectSeries = []; this.runSeries = []; this.runPlanData = {}; this.PlanParser = this.$theme.loadPlanParser(this.$route.query.lineCode); - this.loadChartPage(); + // this.loadChartPage(); EventBus.$on('clearRunSeries', () => { this.runSeries = []; }); @@ -246,7 +246,6 @@ export default { this.staticSeries = []; const stations = this.$store.state.runPlan.stations; const planData = this.$store.state.runPlan.planData; - debugger; this.kmRangeMap = this.PlanParser.convertStationsToMap(stations); if (this.$route.query.lineCode === '07') { this.pushModels(this.staticSeries, [this.PlanParser.initializeAxisX(stations)]); @@ -524,13 +523,18 @@ export default { axisTooltip(param) { const station = (this.$store.getters['map/getDeviceByCode'](param.data[2])) || { name: '', kmRange: '' }; if (this.$route.query.lineCode !== '07') { - return [ - `Point Data
`, - `车站名称: ${station.name}
`, - `车站公里标: ${station.kmRange} km
`, - `到站时间: ${timeFormat(param.data[0] + this.PlanParser.getTranslation())} (${param.data[0]})
` - ].join(''); + if (station.name) { + return [ + `Point Data
`, + `车站名称: ${station.name}
`, + `车站公里标: ${station.kmRange} km
`, + `到站时间: ${timeFormat(param.data[0] + this.PlanParser.getTranslation())} (${param.data[0]})
` + ].join(''); + } else { + return ''; + } } else { + return [ `Point Data
`, `车站名称: ${station.name}
`, @@ -559,8 +563,12 @@ export default { } } else if (this.seriesMap[serviceNumber]) { markPoint = deepAssign({}, this.seriesMap[serviceNumber].markPoint); - markPoint.data.forEach(each => { - each.label.color = '#f00'; + markPoint.data.forEach((each, index) => { + if (each.symbol == 'circle') { + markPoint.data.splice(index, 1); + } else { + each.label.color = '#f00'; + } }); data = this.seriesMap[serviceNumber].data; } diff --git a/src/views/newMap/displayNew/menuSchema.vue b/src/views/newMap/displayNew/menuSchema.vue index 1511b2ea9..5b11be398 100644 --- a/src/views/newMap/displayNew/menuSchema.vue +++ b/src/views/newMap/displayNew/menuSchema.vue @@ -146,14 +146,12 @@ export default { // this.loadRunData(); // }, '$store.state.training.subscribeCount': function () { - debugger; this.loadRunData(); }, '$store.state.socket.simulationPlanChange': function (val) { - // debugger; // 判断是否已经加载运行图,若加载只处理运行图数据,否则,缓存数据 if (JSON.stringify(this.$store.state.runPlan.planData) == '{}') { - + this.$store.dispatch('runPlan/setUpdateTrainRpData', val); } else { this.$store.dispatch('runPlan/updateTrainRunplan', val); } @@ -163,6 +161,9 @@ export default { }, '$store.state.runPlan.loadRunPlanCount': function () { this.viewDisabled = false; + if (JSON.stringify(this.$store.state.runPlan.updateTrainRpData) != '{}') { + this.$store.dispatch('runPlan/updateTrainRunplan', this.$store.state.runPlan.updateTrainRpData); + } }, '$store.state.socket.simulationSpeed': function (val) { this.speed = val; @@ -183,7 +184,6 @@ export default { // 获取排序的车站列表 getByGroupStationList(this.group).then(response => { this.$store.dispatch('runPlan/setStations', response.data).then(() => { - debugger; loadRunPlanData(this.group, this.dataError); }); }).catch(() => { diff --git a/src/views/newMap/mapsystemNew/index.vue b/src/views/newMap/mapsystemNew/index.vue index b2c899967..70f3d0a47 100644 --- a/src/views/newMap/mapsystemNew/index.vue +++ b/src/views/newMap/mapsystemNew/index.vue @@ -116,7 +116,6 @@ export default { }); }, async subscribe() { - debugger; this.clearSubscribe(); const header = { group: this.$route.query.group || '', 'X-Token': getToken() }; creatSubscribe(`${displayTopic}\/${this.$route.query.group}`, header); diff --git a/src/views/planSchedule/schedule.vue b/src/views/planSchedule/schedule.vue index 41e8a9d1d..54ca9a3ad 100644 --- a/src/views/planSchedule/schedule.vue +++ b/src/views/planSchedule/schedule.vue @@ -490,13 +490,18 @@ export default { axisTooltip(param) { const station = (this.$store.getters['map/getDeviceByCode'](param.data[2])) || { name: '', kmRange: '' }; if (this.$route.query.lineCode !== '07') { - return [ - `Point Data
`, - `车站名称: ${station.name}
`, - `车站公里标: ${station.kmRange} km
`, - `到站时间: ${timeFormat(param.data[0] + this.PlanParser.getTranslation())} (${param.data[0]})
` - ].join(''); + if (station.name) { + return [ + `Point Data
`, + `车站名称: ${station.name}
`, + `车站公里标: ${station.kmRange} km
`, + `到站时间: ${timeFormat(param.data[0] + this.PlanParser.getTranslation())} (${param.data[0]})
` + ].join(''); + } else { + return ''; + } } else { + return [ `Point Data
`, `车站名称: ${station.name}
`, @@ -525,8 +530,12 @@ export default { } } else { markPoint = deepAssign({}, item.markPoint); - markPoint.data.forEach(each=>{ - each.label.color = '#f00'; + markPoint.data.forEach((each, index)=>{ + if (each.symbol == 'circle') { + markPoint.data.splice(index, 1); + } else { + each.label.color = '#f00'; + } }); data = item.data; }