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: {}, // 选择的对象
|
2020-10-27 16:51:57 +08:00
|
|
|
refreshCount: 0, // 刷新页面重新加载
|
|
|
|
width: 800, // 运行图canvas 容器 宽度
|
|
|
|
height: 600 // 运行图canvas 容器 高度
|
2020-10-14 18:50:03 +08:00
|
|
|
},
|
|
|
|
getters: {
|
|
|
|
stations: (state) => {
|
|
|
|
return state.stations || [];
|
2020-10-27 16:51:57 +08:00
|
|
|
},
|
|
|
|
planData: (state) => {
|
|
|
|
return state.planData || [];
|
|
|
|
}
|
2020-10-14 18:50:03 +08:00
|
|
|
},
|
|
|
|
mutations: {
|
2020-10-27 16:51:57 +08:00
|
|
|
setWidth: (state, width) => {
|
2020-10-14 18:50:03 +08:00
|
|
|
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-27 16:51:57 +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;
|