1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
const state = {
device: 'desktop',
sidebar: {
opened: true,
withoutAnimation: false
},
openMenuIndex: [], // 默认打开的菜单
pageState: null
};
const mutations = {
TOGGLE_SIDEBAR: state => {
state.sidebar.opened = !state.sidebar.opened;
state.sidebar.withoutAnimation = false;
},
TOOGLE_DEVICE: (state, _device) => {
state.device = _device;
},
CLOSE_SIDEBAR: (state, withoutAnimation) => {
state.sidebar.opened = false;
state.sidebar.withoutAnimation = withoutAnimation;
},
CHANGE_OPENMENU: (state, menuIndex) => {
if (!state.openMenuIndex.includes(menuIndex)) {
state.openMenuIndex.push(menuIndex);
}
},
CHANGE_PAGESTATE: (state, pageState) => {
state.pageState = pageState;
}
};
const actions = {
toggleSideBar({ commit }) {
commit('TOGGLE_SIDEBAR');
},
closeSideBar({ commit }, { withoutAnimation }) {
commit('CLOSE_SIDEBAR', withoutAnimation);
},
toggleDevice({ commit }, device) {
commit('TOGGLE_DEVICE', device);
},
changeOpenMenu({ commit }, menuIndex) {
commit('CHANGE_OPENMENU', menuIndex);
},
// eslint-disable-next-line
moduleInversionWorkOrder({ commit }, data) {
return new Promise((resolve, reject) => {
inversionWorkOrder(data)
.then(response => {
let _data = checkResponseCode(response);
resolve(_data);
})
.catch(error => {
reject(error);
});
});
},
};
export default {
state,
mutations,
actions
};
|