dict.js
762 Bytes
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
import { getAllDict } from '@/api/dict'
const state = {
dicData: {},
addDict: false,
}
const mutations = {
SET_DATA: (state, data) => {
state.addDict = true
state.dicData = data
},
RESET_DICT: (state) => {
state.addDict = false
}
}
const actions = {
/**
* @description: generateDic
* @param {*} commit
* @author: renchao
*/
generateDic ({ commit }) {
return new Promise(async (resolve) => {
let { result: res } = await getAllDict()
commit('SET_DATA', res)
resolve(true)
})
},
/**
* @description: resetdict
* @param {*} commit
* @author: renchao
*/
resetdict ({ commit }) {
commit('RESET_DICT')
}
}
export default {
namespaced: true,
state,
mutations,
actions
}