删除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 容器 宽度 width: 800, // 运行图canvas 容器 宽度
height: 600, // 运行图canvas 容器 高度 height: 600, // 运行图canvas 容器 高度
refreshCount: 0, // 刷新页面重新加载 refreshCount: 0, // 刷新页面重新加载
initialPlanData: {}, // 运行图原始数据
draftSelected: {}, // 草稿运行图选中对象 draftSelected: {}, // 草稿运行图选中对象
draftStations: [], // 草稿运行图车站列表
runPlanMap: {}, // 运行图数据map以id和version 为标识) runPlanMap: {}, // 运行图数据map以id和version 为标识)
runPlanInfo: {}, // 运行图信息 runPlanInfo: {}, // 运行图信息
loadRunPlanCount: 0, // 运行图加载数据完成 loadRunPlanCount: 0, // 运行图加载数据完成
@ -24,9 +22,6 @@ const runPlan = {
stations: (state) => { stations: (state) => {
return state.stations || []; return state.stations || [];
}, },
draftStations: (state) => {
return state.draftStations || [];
},
getRunPlanData: (state) => { getRunPlanData: (state) => {
if (!state.runPlanInfo || !state.runPlanInfo.templateId) { if (!state.runPlanInfo || !state.runPlanInfo.templateId) {
return ''; return '';
@ -47,24 +42,6 @@ const runPlan = {
setStations: (state, stations) => { setStations: (state, stations) => {
state.stations = 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) => { setPlanData: (state, data) => {
state.planData = data; state.planData = data;
state.editData = {}; state.editData = {};
@ -84,22 +61,6 @@ const runPlan = {
} }
state.planLoadedCount++; 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) => { setSelected: (state, selected) => {
state.selected = selected; state.selected = selected;
}, },
@ -158,13 +119,6 @@ const runPlan = {
resolve(mapModel); resolve(mapModel);
}); });
}, },
/** 设置草稿stations数据 */
setDraftStations: ({ commit }, mapModel) => {
return new Promise((resolve) =>{
commit('setDraftStations', mapModel);
resolve(mapModel);
});
},
/** 重置运行图数据更新池 */ /** 重置运行图数据更新池 */
resetRunPlanData:({ commit }) => { resetRunPlanData:({ commit }) => {
commit('resetRunPlanData'); commit('resetRunPlanData');
@ -177,13 +131,6 @@ const runPlan = {
setPlanData: ({ commit }, data) => { setPlanData: ({ commit }, data) => {
commit('setPlanData', data); commit('setPlanData', data);
}, },
setDraftPlanData: ({ commit }, data) => {
commit('setDraftPlanData', data);
},
/** 设置初始运行图数据 */
setInitialPlanData: ({ commit }, data) => {
commit('setInitialPlanData', data);
},
/** 增加服务号*/ /** 增加服务号*/
addServiceNumber: ({ commit }, serviceNumber) => { addServiceNumber: ({ commit }, serviceNumber) => {
commit('addServiceNumber', 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) =>{ dbReadData('runPlan', store.state.runPlan.runPlanInfo.templateId, store.state.runPlan.runPlanInfo.version, async (runPlanData, version) =>{
if (runPlanData && runPlanData.version == version) { if (runPlanData && runPlanData.version == version) {
await store.dispatch('runPlan/setPlanData', runPlanData); await store.dispatch('runPlan/setPlanData', runPlanData);
await store.dispatch('runPlan/setInitialPlanData', runPlanData);
await store.dispatch('runPlan/loadRunPlanCountIncrease'); await store.dispatch('runPlan/loadRunPlanCountIncrease');
} else if (runPlanData) { } else if (runPlanData) {
getEveryDayRunPlanNew(group).then(async (resp) => { getEveryDayRunPlanNew(group).then(async (resp) => {
await store.dispatch('runPlan/setPlanData', resp.data); await store.dispatch('runPlan/setPlanData', resp.data);
await store.dispatch('runPlan/setInitialPlanData', resp.data);
await store.dispatch('runPlan/loadRunPlanCountIncrease'); await store.dispatch('runPlan/loadRunPlanCountIncrease');
resp.data.templateId = store.state.runPlan.runPlanInfo.templateId; resp.data.templateId = store.state.runPlan.runPlanInfo.templateId;
resp.data.version = store.state.runPlan.runPlanInfo.version; resp.data.version = store.state.runPlan.runPlanInfo.version;
@ -85,7 +83,6 @@ export function loadRunPlanData(group, dataError) {
} else { } else {
getEveryDayRunPlanNew(group).then(async (resp) => { getEveryDayRunPlanNew(group).then(async (resp) => {
await store.dispatch('runPlan/setPlanData', resp.data); await store.dispatch('runPlan/setPlanData', resp.data);
await store.dispatch('runPlan/setInitialPlanData', resp.data);
await store.dispatch('runPlan/loadRunPlanCountIncrease'); await store.dispatch('runPlan/loadRunPlanCountIncrease');
resp.data.templateId = store.state.runPlan.runPlanInfo.templateId; resp.data.templateId = store.state.runPlan.runPlanInfo.templateId;
resp.data.version = store.state.runPlan.runPlanInfo.version; resp.data.version = store.state.runPlan.runPlanInfo.version;

View File

@ -199,16 +199,8 @@ export default {
}, },
updateRunPlanData(data) { updateRunPlanData(data) {
const stations = this.$store.state.runPlan.stations; const stations = this.$store.state.runPlan.stations;
const initialPlanData = this.$store.state.runPlan.initialPlanData;
data.forEach(item => { 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.kmRangeMap = this.PlanParser.convertStationsToMap(stations);
this.runSeries = this.PlanParser.updateDataToModels(data, stations, this.kmRangeMap, this.runSeries = this.PlanParser.updateDataToModels(data, stations, this.kmRangeMap,

View File

@ -271,16 +271,8 @@ export default {
}, },
updateRunPlanData(data) { updateRunPlanData(data) {
const stations = this.$store.state.runPlan.stations; const stations = this.$store.state.runPlan.stations;
const initialPlanData = this.$store.state.runPlan.initialPlanData;
data.forEach(item => { 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.kmRangeCoordMap = this.PlanConvert.convertStationsToMap(stations);
this.runSeries = this.PlanConvert.updateDataToModels(data, stations, this.kmRangeCoordMap, this.runSeries = this.PlanConvert.updateDataToModels(data, stations, this.kmRangeCoordMap,

View File

@ -48,7 +48,6 @@ export default {
}, },
beforeDestroy() { beforeDestroy() {
this.$store.dispatch('runPlan/setPlanData', []); this.$store.dispatch('runPlan/setPlanData', []);
this.$store.dispatch('runPlan/setInitialPlanData', []);
}, },
mounted() { mounted() {
// this.menus = this.$theme.loadPlanComponent(this.$route.query.lineCode); // this.menus = this.$theme.loadPlanComponent(this.$route.query.lineCode);

View File

@ -230,16 +230,8 @@ export default {
}, },
updateRunPlanData(data) { updateRunPlanData(data) {
const stations = this.$store.state.runPlan.stations; const stations = this.$store.state.runPlan.stations;
const initialPlanData = this.$store.state.runPlan.initialPlanData;
data.forEach(item => { 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.kmRangeMap = this.PlanParser.convertStationsToMap(stations);
this.runSeries = this.PlanParser.updateDataToModels(data, stations, this.kmRangeMap, this.runSeries = this.PlanParser.updateDataToModels(data, stations, this.kmRangeMap,

View File

@ -232,16 +232,8 @@ export default {
}, },
updateRunPlanData(data) { updateRunPlanData(data) {
const stations = this.$store.state.runPlan.stations; const stations = this.$store.state.runPlan.stations;
const initialPlanData = this.$store.state.runPlan.initialPlanData;
data.forEach(item => { 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.kmRangeMap = this.PlanParser.convertStationsToMap(stations);
this.runSeries = this.PlanParser.updateDataToModels(data, stations, this.kmRangeMap, this.runSeries = this.PlanParser.updateDataToModels(data, stations, this.kmRangeMap,