2020-10-14 18:50:03 +08:00
|
|
|
const runPlan = {
|
|
|
|
namespaced: true,
|
|
|
|
|
|
|
|
state: {
|
|
|
|
stations: [], // 车站列表
|
2020-10-19 18:39:19 +08:00
|
|
|
planData: [], // 运行图原始数据
|
2020-10-14 18:50:03 +08:00
|
|
|
editData: {}, // 运行图编辑数据
|
|
|
|
planSizeCount: 0, // 运行图canvas 大小变更标识
|
|
|
|
planLoadedCount: 0, // 运行图数据更新
|
|
|
|
planUpdateCount: 0, // 运行图更新标识
|
|
|
|
selected: {}, // 选择的对象
|
|
|
|
refreshCount: 0, // 刷新页面重新加载
|
|
|
|
width: 800, // 运行图canvas 容器 宽度
|
|
|
|
height: 600, // 运行图canvas 容器 高度
|
|
|
|
},
|
|
|
|
getters: {
|
|
|
|
stations: (state) => {
|
|
|
|
return state.stations || [];
|
2020-10-19 18:39:19 +08:00
|
|
|
},
|
|
|
|
planData: (state) => {
|
|
|
|
return state.planData || [];
|
|
|
|
}
|
2020-10-14 18:50:03 +08:00
|
|
|
},
|
|
|
|
mutations: {
|
|
|
|
setWidth: (state, width) => {
|
|
|
|
state.width = width;
|
|
|
|
state.planSizeCount += 1;
|
|
|
|
},
|
|
|
|
setHeight: (state, height) => {
|
|
|
|
state.height = height;
|
|
|
|
state.planSizeCount += 1;
|
|
|
|
},
|
|
|
|
setStations: (state, stations) => {
|
|
|
|
state.stations = stations;
|
|
|
|
},
|
|
|
|
setPlanData: (state, data) => {
|
|
|
|
state.planData = data;
|
|
|
|
state.editData = {};
|
|
|
|
state.planLoadedCount++;
|
|
|
|
},
|
|
|
|
setSelected: (state, selected) => {
|
|
|
|
state.selected = selected;
|
|
|
|
},
|
|
|
|
clear: (state) => {
|
|
|
|
state.planData = {};
|
|
|
|
state.editData = {};
|
|
|
|
state.selected = {};
|
|
|
|
},
|
|
|
|
refresh: (state) => {
|
|
|
|
state.refreshCount++;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
actions: {
|
2020-10-19 18:39:19 +08:00
|
|
|
/** 更新数据*/
|
|
|
|
updateRunPlanData: ({ commit }, data) => {
|
|
|
|
commit('updateRunPlanData', data);
|
|
|
|
},
|
|
|
|
/** 设置运行图大小*/
|
2020-10-14 18:50:03 +08:00
|
|
|
resize({ commit }, opt) {
|
|
|
|
if (opt.width) {
|
|
|
|
commit('setWidth', opt.width);
|
|
|
|
}
|
|
|
|
if (opt.height) {
|
|
|
|
commit('setHeight', opt.height);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
/** 刷新页面*/
|
|
|
|
refresh: ({commit}) => {
|
|
|
|
commit('refresh');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
export default runPlan;
|