2024-04-24 07:15:19 +00:00
|
|
|
import { COMMONKEY } from "../actionKey"
|
|
|
|
|
import {
|
|
|
|
|
setSessionXToken,
|
|
|
|
|
getSessionXToken,
|
|
|
|
|
setSessionUserInfo,
|
|
|
|
|
getSessionUserInfo
|
|
|
|
|
} from "@/session"
|
2024-04-25 07:54:13 +00:00
|
|
|
import * as apiService from "@/common/api"
|
2024-04-24 07:15:19 +00:00
|
|
|
import { goto } from "@/common/untool"
|
2024-04-27 03:19:18 +00:00
|
|
|
import { transListKeyTitle } from "@/common/util"
|
2024-04-24 07:15:19 +00:00
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
state: {
|
2024-04-24 08:59:00 +00:00
|
|
|
dicData: {}
|
2024-04-24 07:15:19 +00:00
|
|
|
},
|
|
|
|
|
mutations: {
|
2024-04-24 08:59:00 +00:00
|
|
|
[COMMONKEY.GETDIC](state, provider) {
|
2024-04-24 07:15:19 +00:00
|
|
|
state.dicData = provider
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
getters: {
|
|
|
|
|
// packInfo(state) {
|
|
|
|
|
// return state.user
|
|
|
|
|
// }
|
|
|
|
|
},
|
|
|
|
|
actions: {
|
2024-04-27 03:19:18 +00:00
|
|
|
async [COMMONKEY.GETDIC]({
|
2024-04-24 07:15:19 +00:00
|
|
|
dispatch,
|
|
|
|
|
commit,
|
|
|
|
|
state,
|
|
|
|
|
rootState
|
|
|
|
|
}, options) {
|
2024-04-25 07:54:13 +00:00
|
|
|
const resInfo = await apiService.getDicDataJson()
|
2024-04-24 08:59:00 +00:00
|
|
|
let data = {}
|
|
|
|
|
// 转换接口返回的数据字典
|
|
|
|
|
resInfo?.data?.map?.((item)=> {
|
|
|
|
|
let key = Object.keys(item).filter(i=> i != 'desc')[0]
|
|
|
|
|
if(key) {
|
2024-04-27 03:19:18 +00:00
|
|
|
let list = transListKeyTitle({ valKey:'value', titleKey: 'label', list: item[key] })
|
|
|
|
|
data[key] = list
|
2024-04-24 08:59:00 +00:00
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
commit(COMMONKEY.GETDIC, data)
|
2024-04-24 07:15:19 +00:00
|
|
|
},
|
2024-04-27 03:19:18 +00:00
|
|
|
|
2024-04-24 07:15:19 +00:00
|
|
|
}
|
|
|
|
|
}
|