rt-sim-training-client/src/store/modules/scriptRecord.js
2020-07-08 18:35:46 +08:00

108 lines
3.4 KiB
JavaScript

/**
* 实训状态数据
*/
const scriptRecord = {
namespaced: true,
state: {
mapLocation: {}, // 地图定位,
simulationPause: true,
scriptId: '',
bgSet: false,
isScriptCommand:false, // 当前是否为添加剧本动作指令状态
scriptCommand:{}, // 剧本动作添加的指令
updateRoleStatus:0, // 剧本更新角色标志
updateRoleId:'', // 剧本更新角色id
updateCoversitionStatus:0, // 剧本仿真更新会话信息
userRole:null // 剧本更新的角色
},
getters: {
mapLocation: (state)=>{
return state.mapLocation;
},
simulationPause: (state)=>{
return state.simulationPause;
},
scriptId: (state)=>{
return state.scriptId;
},
bgSet: (state)=>{
return state.bgSet;
},
isScriptCommand:(state)=>{
return state.isScriptCommand;
},
scriptCommand:(state)=>{
return state.scriptCommand;
},
updateRoleStatus:(state)=>{
return state.updateRoleStatus;
}
},
mutations: {
setMapLocation: (state, mapLocation) => {
state.mapLocation = mapLocation;
},
setSimulationPause: (state, simulationPause) => {
state.simulationPause = simulationPause;
},
setscriptId: (state, scriptId) => {
state.scriptId = scriptId;
},
setBgSet: (state, bgSet) => {
state.bgSet = bgSet;
},
setIsScriptCommand:(state, isScriptCommand) => {
state.isScriptCommand = isScriptCommand;
},
setScriptCommand:(state, scriptCommand) => {
state.scriptCommand = scriptCommand;
},
updateRole:(state, userRole) => {
if (userRole) {
const userRoleParam = userRole.split(':');
if ( state.userRole == userRoleParam[0]) {
state.updateRoleStatus += 1;
}
state.updateRoleId = userRoleParam[1];
state.userRole = userRoleParam[0];
} else {
state.updateRoleId = '';
state.userRole = '';
}
},
updateCoversitionInfo:(state) => {
state.updateCoversitionStatus += 1;
}
},
actions: {
/**
* 设置地图定位
*/
updateMapLocation: ({ commit }, mapLocation) => {
commit('setMapLocation', mapLocation);
},
updateSimulationPause: ({ commit }, simulationPause) => {
commit('setSimulationPause', simulationPause);
},
updateScriptId: ({ commit }, scriptId) => {
commit('setscriptId', scriptId);
},
updateBgSet: ({ commit }, bgSet) => {
commit('setBgSet', bgSet);
},
updateIsScriptCommand:({ commit }, isScriptCommand) => {
commit('setIsScriptCommand', isScriptCommand);
},
updateScriptCommand:({ commit }, scriptCommand) => {
commit('setScriptCommand', scriptCommand);
},
updateRole:({ commit }, userRole) => {
commit('updateRole', userRole);
},
updateCoversitionInfo:({ commit }) => {
commit('updateCoversitionInfo');
}
}
};
export default scriptRecord;