删除runPlan 弃用代码

This commit is contained in:
fan 2021-06-30 17:44:58 +08:00
parent 4707434ed4
commit f7fabecc36
7 changed files with 11 additions and 100 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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(`加载运行图数据失败`);
}
},

View File

@ -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,

View File

@ -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);

View File

@ -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,

View File

@ -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;