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] =?UTF-8?q?=E8=A5=BF=E5=AE=89=E4=B8=89=E5=8A=A0=E7=BA=BF?= =?UTF-8?q?=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);