From f7fabecc3671e05fe63c4e28a13c74fa59962c9b Mon Sep 17 00:00:00 2001 From: fan <18706759286@163.com> Date: Wed, 30 Jun 2021 17:44:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4runPlan=20=E5=BC=83=E7=94=A8?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/runplan.js | 55 +------------------ src/utils/loaddata.js | 3 - .../iscsSystem/stationConfig/schedule.vue | 12 +--- .../newMap/displayNew/demon/planSchedule.vue | 10 +--- .../newMap/displayNew/demon/runPlanLoad.vue | 1 - .../newMap/displayNew/demon/runPlanView.vue | 10 +--- .../displayNew/demon/runPlanViewWindow.vue | 20 ++----- 7 files changed, 11 insertions(+), 100 deletions(-) diff --git a/src/store/modules/runplan.js b/src/store/modules/runplan.js index f86ad70be..948582dad 100644 --- a/src/store/modules/runplan.js +++ b/src/store/modules/runplan.js @@ -12,9 +12,7 @@ const runPlan = { width: 800, // 运行图canvas 容器 宽度 height: 600, // 运行图canvas 容器 高度 refreshCount: 0, // 刷新页面重新加载 - initialPlanData: {}, // 运行图原始数据 draftSelected: {}, // 草稿运行图选中对象 - draftStations: [], // 草稿运行图车站列表 runPlanMap: {}, // 运行图数据map(以id和version 为标识) runPlanInfo: {}, // 运行图信息 loadRunPlanCount: 0, // 运行图加载数据完成 @@ -24,9 +22,6 @@ const runPlan = { stations: (state) => { return state.stations || []; }, - draftStations: (state) => { - return state.draftStations || []; - }, getRunPlanData: (state) => { if (!state.runPlanInfo || !state.runPlanInfo.templateId) { return ''; @@ -47,24 +42,6 @@ const runPlan = { setStations: (state, stations) => { state.stations = stations; }, - setDraftStations: (state, stations) => { - state.draftStations = stations; - }, - setInitialPlanData: (state, data) => { - state.initialPlanData = {}; - if (data && data.serviceNumberDataList && data.serviceNumberDataList.length) { - const serviceList = data.serviceNumberDataList; - serviceList.forEach((service, i) => { - const trainList = service.tripNumberDataList; - state.initialPlanData[service.serviceNumber] = { oldIndex: i, serviceNumber: service.serviceNumber, backup: service.backup, trainMap: {} }; - trainList.forEach((train, j) => { - state.initialPlanData[service.serviceNumber].trainMap[`${train.tripNumber}`] = { oldIndex: j, tripNumber: train.tripNumber, right:train.right, - directionCode: train.directionCode, reentry: train.reentry, stationTimeList: train.stationTimeList, endSecondTime:train.endSecondTime, - startSecondTime: train.startSecondTime, startSectionCode:train.startSectionCode, endSectionCode:train.endSectionCode }; - }); - }); - } - }, setPlanData: (state, data) => { state.planData = data; state.editData = {}; @@ -84,22 +61,6 @@ const runPlan = { } state.planLoadedCount++; }, - setDraftPlanData: (state, data) => { - state.draftPlanData = data; - state.draftEditData = {}; - if (data && data.serviceNumberDataList && data.serviceNumberDataList.length) { - const serviceList = data.serviceNumberDataList; - serviceList.forEach((service, i) => { - const trainList = service.tripNumberDataList; - state.draftEditData[service.serviceNumber] = { oldIndex: i, serviceNumber: service.serviceNumber, backup: service.backup, trainMap: {} }; - trainList.forEach((train, j) => { - state.draftEditData[service.serviceNumber].trainMap[`${train.tripNumber}`] = { oldIndex: j, tripNumber: train.tripNumber, right:train.right, - directionCode: train.directionCode, reentry: train.reentry, stationTimeList: train.stationTimeList, endSecondTime:train.endSecondTime, - startSecondTime: train.startSecondTime, startSectionCode:train.startSectionCode, endSectionCode:train.endSectionCode }; - }); - }); - } - }, setSelected: (state, selected) => { state.selected = selected; }, @@ -113,7 +74,7 @@ const runPlan = { state.planData[serviceNumber] = { oldIndex, serviceNumber, trainMap: {} }; state.planLoadedCount++; } - }, + }, clear: (state) => { // state.stations = []; state.planData = {}; @@ -158,13 +119,6 @@ const runPlan = { resolve(mapModel); }); }, - /** 设置草稿stations数据 */ - setDraftStations: ({ commit }, mapModel) => { - return new Promise((resolve) =>{ - commit('setDraftStations', mapModel); - resolve(mapModel); - }); - }, /** 重置运行图数据更新池 */ resetRunPlanData:({ commit }) => { commit('resetRunPlanData'); @@ -177,13 +131,6 @@ const runPlan = { setPlanData: ({ commit }, data) => { commit('setPlanData', data); }, - setDraftPlanData: ({ commit }, data) => { - commit('setDraftPlanData', data); - }, - /** 设置初始运行图数据 */ - setInitialPlanData: ({ commit }, data) => { - commit('setInitialPlanData', data); - }, /** 增加服务号*/ addServiceNumber: ({ commit }, serviceNumber) => { commit('addServiceNumber', serviceNumber); diff --git a/src/utils/loaddata.js b/src/utils/loaddata.js index 6986c3420..f08ca5b0c 100644 --- a/src/utils/loaddata.js +++ b/src/utils/loaddata.js @@ -69,12 +69,10 @@ export function loadRunPlanData(group, dataError) { dbReadData('runPlan', store.state.runPlan.runPlanInfo.templateId, store.state.runPlan.runPlanInfo.version, async (runPlanData, version) =>{ if (runPlanData && runPlanData.version == version) { await store.dispatch('runPlan/setPlanData', runPlanData); - await store.dispatch('runPlan/setInitialPlanData', runPlanData); await store.dispatch('runPlan/loadRunPlanCountIncrease'); } else if (runPlanData) { getEveryDayRunPlanNew(group).then(async (resp) => { await store.dispatch('runPlan/setPlanData', resp.data); - await store.dispatch('runPlan/setInitialPlanData', resp.data); await store.dispatch('runPlan/loadRunPlanCountIncrease'); resp.data.templateId = store.state.runPlan.runPlanInfo.templateId; resp.data.version = store.state.runPlan.runPlanInfo.version; @@ -85,7 +83,6 @@ export function loadRunPlanData(group, dataError) { } else { getEveryDayRunPlanNew(group).then(async (resp) => { await store.dispatch('runPlan/setPlanData', resp.data); - await store.dispatch('runPlan/setInitialPlanData', resp.data); await store.dispatch('runPlan/loadRunPlanCountIncrease'); resp.data.templateId = store.state.runPlan.runPlanInfo.templateId; resp.data.version = store.state.runPlan.runPlanInfo.version; diff --git a/src/views/iscs/iscsSystem/stationConfig/schedule.vue b/src/views/iscs/iscsSystem/stationConfig/schedule.vue index 689ba6095..64eb0c874 100644 --- a/src/views/iscs/iscsSystem/stationConfig/schedule.vue +++ b/src/views/iscs/iscsSystem/stationConfig/schedule.vue @@ -199,16 +199,8 @@ export default { }, updateRunPlanData(data) { const stations = this.$store.state.runPlan.stations; - const initialPlanData = this.$store.state.runPlan.initialPlanData; data.forEach(item => { - if (item && initialPlanData[item.serviceNumber]) { - Object.keys(initialPlanData[item.serviceNumber].trainMap).forEach(ele => { - if (initialPlanData[item.serviceNumber].trainMap[ele + ''].tripNumber == item.tripNumber) { - item.directionCode = initialPlanData[item.serviceNumber].trainMap[ele + ''].directionCode; - } - }); - item.secondTime = item.second; - } + item.secondTime = item.second; }); this.kmRangeMap = this.PlanParser.convertStationsToMap(stations); this.runSeries = this.PlanParser.updateDataToModels(data, stations, this.kmRangeMap, @@ -234,7 +226,7 @@ export default { await this.loadInitData(); this.inter && clearInterval(this.inter); } catch (error) { - console.log(error); + console.log(error); this.$messageBox(`加载运行图数据失败`); } }, diff --git a/src/views/newMap/displayNew/demon/planSchedule.vue b/src/views/newMap/displayNew/demon/planSchedule.vue index 7bb819e81..ffc7b6876 100644 --- a/src/views/newMap/displayNew/demon/planSchedule.vue +++ b/src/views/newMap/displayNew/demon/planSchedule.vue @@ -271,16 +271,8 @@ export default { }, updateRunPlanData(data) { const stations = this.$store.state.runPlan.stations; - const initialPlanData = this.$store.state.runPlan.initialPlanData; data.forEach(item => { - if (item && initialPlanData[item.serviceNumber]) { - Object.keys(initialPlanData[item.serviceNumber].trainMap).forEach(ele => { - if (initialPlanData[item.serviceNumber].trainMap[ele + ''].tripNumber == item.tripNumber) { - item.directionCode = initialPlanData[item.serviceNumber].trainMap[ele + ''].directionCode; - } - }); - item.secondTime = item.second; - } + item.secondTime = item.second; }); this.kmRangeCoordMap = this.PlanConvert.convertStationsToMap(stations); this.runSeries = this.PlanConvert.updateDataToModels(data, stations, this.kmRangeCoordMap, diff --git a/src/views/newMap/displayNew/demon/runPlanLoad.vue b/src/views/newMap/displayNew/demon/runPlanLoad.vue index de3cb5d80..19c693c04 100644 --- a/src/views/newMap/displayNew/demon/runPlanLoad.vue +++ b/src/views/newMap/displayNew/demon/runPlanLoad.vue @@ -48,7 +48,6 @@ export default { }, beforeDestroy() { this.$store.dispatch('runPlan/setPlanData', []); - this.$store.dispatch('runPlan/setInitialPlanData', []); }, mounted() { // this.menus = this.$theme.loadPlanComponent(this.$route.query.lineCode); diff --git a/src/views/newMap/displayNew/demon/runPlanView.vue b/src/views/newMap/displayNew/demon/runPlanView.vue index fda0188dc..3ed828d9b 100644 --- a/src/views/newMap/displayNew/demon/runPlanView.vue +++ b/src/views/newMap/displayNew/demon/runPlanView.vue @@ -230,16 +230,8 @@ export default { }, updateRunPlanData(data) { const stations = this.$store.state.runPlan.stations; - const initialPlanData = this.$store.state.runPlan.initialPlanData; data.forEach(item => { - if (item && initialPlanData[item.serviceNumber]) { - Object.keys(initialPlanData[item.serviceNumber].trainMap).forEach(ele => { - if (initialPlanData[item.serviceNumber].trainMap[ele + ''].tripNumber == item.tripNumber) { - item.directionCode = initialPlanData[item.serviceNumber].trainMap[ele + ''].directionCode; - } - }); - item.secondTime = item.second; - } + item.secondTime = item.second; }); this.kmRangeMap = this.PlanParser.convertStationsToMap(stations); this.runSeries = this.PlanParser.updateDataToModels(data, stations, this.kmRangeMap, diff --git a/src/views/newMap/displayNew/demon/runPlanViewWindow.vue b/src/views/newMap/displayNew/demon/runPlanViewWindow.vue index 5e3812ef0..40a9f9fe4 100644 --- a/src/views/newMap/displayNew/demon/runPlanViewWindow.vue +++ b/src/views/newMap/displayNew/demon/runPlanViewWindow.vue @@ -232,16 +232,8 @@ export default { }, updateRunPlanData(data) { const stations = this.$store.state.runPlan.stations; - const initialPlanData = this.$store.state.runPlan.initialPlanData; data.forEach(item => { - if (item && initialPlanData[item.serviceNumber]) { - Object.keys(initialPlanData[item.serviceNumber].trainMap).forEach(ele => { - if (initialPlanData[item.serviceNumber].trainMap[ele + ''].tripNumber == item.tripNumber) { - item.directionCode = initialPlanData[item.serviceNumber].trainMap[ele + ''].directionCode; - } - }); - item.secondTime = item.second; - } + item.secondTime = item.second; }); this.kmRangeMap = this.PlanParser.convertStationsToMap(stations); this.runSeries = this.PlanParser.updateDataToModels(data, stations, this.kmRangeMap, @@ -257,11 +249,11 @@ export default { const stations = this.$store.state.runPlan.stations; const planData = this.$store.state.runPlan.planData; this.kmRangeMap = this.PlanParser.convertStationsToMap(stations); - if (this.$route.query.lineCode === '07') { - this.pushModels(this.staticSeries, [this.PlanParser.initializeAxisX(stations)]); - } else { - this.pushModels(this.staticSeries, [this.PlanParser.initializeAxisY(stations)]); - } + if (this.$route.query.lineCode === '07') { + this.pushModels(this.staticSeries, [this.PlanParser.initializeAxisX(stations)]); + } else { + this.pushModels(this.staticSeries, [this.PlanParser.initializeAxisY(stations)]); + } this.staticSeries = this.pushModels(this.staticSeries, this.PlanParser.convertDataToModels(planData, stations, this.kmRangeMap, { color: '#000', width: 0.5 })); this.staticSeries.forEach(item => { this.seriesMap[item.name] = item;