| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- export default {
- state: {
- selectInfo: {} //选择商品信息 用页面pageType当key 查询对应模块选择的商品列表
- },
- getters: {
- getSelectInfo(state) {
- return state.selectInfo || {};
- }
- },
- actions: {
- //设置不同类别选中商品列表信息(老写法,在采购模块的花材列表使用)
- setSelectInfoByType({ commit }, { type, info }) {
- commit("SET_SELECTINFO_BY_TYPE", { type, info });
- },
- //清空不同类别选中商品列表信息(老写法,在采购模块的花材列表使用)
- resetSelectInfoByType({ commit }, type) {
- commit("SET_SELECTINFO_BY_TYPE", { type, info: [] });
- },
- //重要!!!!selectJobType区分不同业务,如开单、损耗、调拨,selectJobId用于区分相同业务下的不同主体,如调拨给不同门店,开店给不同的客户
- //保存已选花材列表(新写法)
- setSelectInfo({ commit }, { selectJobType, info,selectJobId }) {
- commit("SET_SELECTED_ITEM", { selectJobType, info,selectJobId });
- },
- //清空已选花材信息(新写法)
- reSetSelectInfo({ commit }, {selectJobType,selectJobId}) {
- commit("SET_SELECTED_ITEM", { selectJobType, info: [],selectJobId });
- }
- },
- mutations: {
- //老写法,在采购模块的花材列表使用
- ["SET_SELECTINFO_BY_TYPE"](state, { type, info }) {
- state.selectInfo = {...state.selectInfo,[type]: info};
- },
- //新写法
- SET_SELECTED_ITEM(state, { selectJobType, info,selectJobId }) {
- state.selectInfo = { ...state.selectInfo, [selectJobType+'_'+selectJobId]: info }
- }
- }
- };
|