58 lines
1.1 KiB
JavaScript
58 lines
1.1 KiB
JavaScript
import Vue from 'vue'
|
|
import Vuex from 'vuex'
|
|
import preState from 'vuex-persistedstate'
|
|
import request from '../router/axios'
|
|
|
|
Vue.use(Vuex)
|
|
|
|
const user = {
|
|
state: {
|
|
info: {},
|
|
ATime: '',
|
|
financeUser: {}
|
|
},
|
|
mutations: {
|
|
setFinanceUser(state) {
|
|
request.post("appfinancialorganizationuser/checkUser").then(res => {
|
|
state.financeUser = res.data
|
|
})
|
|
},
|
|
setUserInfo(state, userInfo) {
|
|
state.info = userInfo
|
|
},
|
|
SET_TIME(state, pay) {
|
|
state.ATime = pay
|
|
}
|
|
}
|
|
}
|
|
|
|
export default new Vuex.Store({
|
|
state: {
|
|
dicts: [],
|
|
apps: []
|
|
},
|
|
mutations: {
|
|
setDicts(state, payload) {
|
|
if (payload) {
|
|
payload.map(p => {
|
|
if (state.dicts.some(d => d.key == p.key)) {
|
|
const index = state.dicts.findIndex(d => d.key == p.key)
|
|
state.dicts.splice(index, 1)
|
|
state.dicts.push(p)
|
|
} else {
|
|
state.dicts.push(p)
|
|
}
|
|
})
|
|
}
|
|
},
|
|
addApp(state, app) {
|
|
state.apps.push(app)
|
|
},
|
|
cleanApps(state) {
|
|
state.apps = []
|
|
}
|
|
},
|
|
modules: {user},
|
|
plugins: [preState()]
|
|
})
|