import * as types from '../types' import { getStore, setStore } from '@config/utils.js' const state = { materObj: {}, // 物料查询-盘点修改 hcxCheckObj: {}, // 缓存线盘点 - 盘点修改, defaultActive: getStore('defaultActive') || '1', sideActive: getStore('sideActive') || '1' } const getters = { materObj: state => state.materObj, hcxCheckObj: state => state.hcxCheckObj, defaultActive: state => state.defaultActive } const actions = { materObj ({commit}, res) { commit(types.MATER_OBJ, res) }, hcxCheckObj ({commit}, res) { commit(types.HCX_CHECK_OBJ, res) }, getDefaultActive ({commit}, res) { setStore('defaultActive', res) commit(types.GET_DEFAULT_ACTIVE, res) } } const mutations = { [types.MATER_OBJ] (state, res) { state.materObj = res }, [types.HCX_CHECK_OBJ] (state, res) { state.hcxCheckObj = res }, [types.GET_DEFAULT_ACTIVE] (state, res) { state.defaultActive = res } } export default { state, getters, actions, mutations }