init
This commit is contained in:
95
src/vuex/modules/com.js
Normal file
95
src/vuex/modules/com.js
Normal file
@@ -0,0 +1,95 @@
|
||||
import * as types from '../types'
|
||||
import { getStore, setStore } from '@config/utils.js'
|
||||
|
||||
const baseUrl = process.env.NODE_ENV === 'development' ? 'http://43.139.166.161:8018' : 'http://43.139.166.161:8018'
|
||||
const setTime = '5000'
|
||||
const state = {
|
||||
baseUrl: getStore('baseUrl') || baseUrl,
|
||||
setTime: getStore('setTime') || setTime,
|
||||
loading: false,
|
||||
showToast: false,
|
||||
showAlert: false,
|
||||
showSuccess: true,
|
||||
showFail: false,
|
||||
toastMsg: '',
|
||||
alertMsg: ''
|
||||
}
|
||||
|
||||
const getters = {
|
||||
baseUrl: state => state.baseUrl,
|
||||
setTime: state => state.setTime,
|
||||
loading: state => state.loading,
|
||||
showToast: state => state.showToast,
|
||||
showAlert: state => state.showAlert
|
||||
}
|
||||
|
||||
const actions = {
|
||||
setConfig ({commit}, res) {
|
||||
setStore('baseUrl', res.baseUrl)
|
||||
setStore('setTime', res.setTime)
|
||||
commit(types.COM_CONFIG, res)
|
||||
},
|
||||
setLoadingState ({ commit }, status) {
|
||||
commit(types.COM_LOADING_STATUS, status)
|
||||
},
|
||||
showToast ({ commit }, status) {
|
||||
commit(types.COM_SHOW_TOAST, status)
|
||||
},
|
||||
showAlert ({ commit }, status) {
|
||||
commit(types.COM_SHOW_ALERT, status)
|
||||
},
|
||||
showSuccess ({ commit }, status) {
|
||||
commit(types.COM_SHOW_SUCCESS, status)
|
||||
},
|
||||
showFail ({ commit }, status) {
|
||||
commit(types.COM_SHOW_FAIL, status)
|
||||
},
|
||||
toastMsg ({ commit }, str) {
|
||||
commit(types.COM_TOAST_MSG, str)
|
||||
},
|
||||
alertMsg ({ commit }, str) {
|
||||
commit(types.COM_ALERT_MSG, str)
|
||||
}
|
||||
}
|
||||
|
||||
const mutations = {
|
||||
[types.COM_CONFIG] (state, res) {
|
||||
state.baseUrl = res.baseUrl
|
||||
state.setTime = res.setTime
|
||||
},
|
||||
|
||||
[types.COM_LOADING_STATUS] (state, status) {
|
||||
state.loading = status
|
||||
},
|
||||
|
||||
[types.COM_SHOW_TOAST] (state, status) {
|
||||
state.showToast = status
|
||||
},
|
||||
|
||||
[types.COM_SHOW_ALERT] (state, status) {
|
||||
state.showAlert = status
|
||||
},
|
||||
|
||||
[types.COM_SHOW_SUCCESS] (state, status) {
|
||||
state.showSuccess = status
|
||||
},
|
||||
|
||||
[types.COM_SHOW_FAIL] (state, status) {
|
||||
state.showFail = status
|
||||
},
|
||||
|
||||
[types.COM_TOAST_MSG] (state, str) {
|
||||
state.toastMsg = str
|
||||
},
|
||||
|
||||
[types.COM_ALERT_MSG] (state, str) {
|
||||
state.alertMsg = str
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
state,
|
||||
actions,
|
||||
getters,
|
||||
mutations
|
||||
}
|
||||
47
src/vuex/modules/data.js
Normal file
47
src/vuex/modules/data.js
Normal file
@@ -0,0 +1,47 @@
|
||||
import * as types from '../types'
|
||||
import { getStore, setStore } from '@config/utils.js'
|
||||
|
||||
const state = {
|
||||
materObj: {}, // 物料查询-盘点修改
|
||||
hcxCheckObj: {}, // 缓存线盘点 - 盘点修改
|
||||
agvObj: getStore('agvObj') || '' // 存储对象
|
||||
}
|
||||
|
||||
const getters = {
|
||||
materObj: state => state.materObj,
|
||||
hcxCheckObj: state => state.hcxCheckObj,
|
||||
defaultActive: state => state.defaultActive,
|
||||
agvObj: state => state.agvObj
|
||||
}
|
||||
|
||||
const actions = {
|
||||
materObj ({commit}, res) {
|
||||
commit(types.MATER_OBJ, res)
|
||||
},
|
||||
hcxCheckObj ({commit}, res) {
|
||||
commit(types.HCX_CHECK_OBJ, res)
|
||||
},
|
||||
setAgvObj ({commit}, res) {
|
||||
setStore('agvObj', res)
|
||||
commit(types.SET_AGV_OBJ, res)
|
||||
}
|
||||
}
|
||||
|
||||
const mutations = {
|
||||
[types.MATER_OBJ] (state, res) {
|
||||
state.materObj = res
|
||||
},
|
||||
[types.HCX_CHECK_OBJ] (state, res) {
|
||||
state.hcxCheckObj = res
|
||||
},
|
||||
[types.SET_AGV_OBJ] (state, res) {
|
||||
state.agvObj = res
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
state,
|
||||
getters,
|
||||
actions,
|
||||
mutations
|
||||
}
|
||||
106
src/vuex/modules/user.js
Normal file
106
src/vuex/modules/user.js
Normal file
@@ -0,0 +1,106 @@
|
||||
import * as types from '../types'
|
||||
import { getStore, setStore } from '@config/utils.js'
|
||||
|
||||
// const state = {
|
||||
// accountId: getStore('accountId') || '',
|
||||
// accountName: getStore('accountName') || '',
|
||||
// userName: getStore('userName') || '',
|
||||
// deptName: getStore('deptName') || '',
|
||||
// deviceUuid: getStore('deviceUuid') || '',
|
||||
// deviceCode: getStore('deviceCode') || ''
|
||||
// }
|
||||
|
||||
// const getters = {
|
||||
// accountId: state => state.accountId,
|
||||
// accountName: state => state.accountName,
|
||||
// userName: state => state.userName,
|
||||
// deptName: state => state.deptName,
|
||||
// deviceUuid: state => state.deviceUuid,
|
||||
// deviceCode: state => state.deviceCode
|
||||
// }
|
||||
|
||||
// const actions = {
|
||||
// setUserInfo ({ commit }, res) {
|
||||
// setStore('accountId', res.account_id)
|
||||
// setStore('accountName', res.account_name)
|
||||
// setStore('userName', res.user_name)
|
||||
// setStore('deptName', res.dept_name)
|
||||
// commit(types.SET_USER_INFO, res)
|
||||
// },
|
||||
// setSignOut ({ commit }) {
|
||||
// localStorage.removeItem('accountId')
|
||||
// localStorage.removeItem('accountName')
|
||||
// localStorage.removeItem('userName')
|
||||
// localStorage.removeItem('deptName')
|
||||
// commit(types.SET_SIGN_OUT)
|
||||
// },
|
||||
// setDevice ({commit}, res) {
|
||||
// setStore('deviceUuid', res.deviceUuid)
|
||||
// setStore('deviceCode', res.deviceCode)
|
||||
// commit(types.SET_DEVICE, res)
|
||||
// }
|
||||
// }
|
||||
|
||||
// const mutations = {
|
||||
// [types.SET_USER_INFO] (state, res) {
|
||||
// state.accountId = res.account_id
|
||||
// state.accountName = res.account_name
|
||||
// state.userName = res.user_name
|
||||
// state.deptName = res.dept_name
|
||||
// },
|
||||
// [types.SET_SIGN_OUT] (state) {
|
||||
// state.accountId = ''
|
||||
// state.accountName = ''
|
||||
// state.userName = ''
|
||||
// state.deptName = ''
|
||||
// },
|
||||
// [types.SET_DEVICE] (state, res) {
|
||||
// state.deviceUuid = res.deviceUuid
|
||||
// state.deviceCode = res.deviceCode
|
||||
// }
|
||||
// }
|
||||
|
||||
const state = {
|
||||
userInfo: getStore('userInfo') || '', // 用户信息
|
||||
menus: getStore('menus') || [] // 菜单
|
||||
}
|
||||
|
||||
const getters = {
|
||||
userInfo: state => state.userInfo,
|
||||
menus: state => state.menus
|
||||
}
|
||||
|
||||
const actions = {
|
||||
userInfo ({ commit }, res) {
|
||||
setStore('userInfo', res)
|
||||
commit(types.SET_USER_INFO, res)
|
||||
},
|
||||
setSignOut ({ commit }) {
|
||||
localStorage.removeItem('userInfo')
|
||||
localStorage.removeItem('menus')
|
||||
commit(types.SET_SIGN_OUT)
|
||||
},
|
||||
getMenus ({ commit }, res) {
|
||||
setStore('menus', res)
|
||||
commit(types.GET_MENUS, res)
|
||||
}
|
||||
}
|
||||
|
||||
const mutations = {
|
||||
[types.SET_USER_INFO] (state, res) {
|
||||
state.userInfo = res
|
||||
},
|
||||
[types.SET_SIGN_OUT] (state) {
|
||||
state.accountId = ''
|
||||
},
|
||||
[types.GET_MENUS] (state, res) {
|
||||
state.menus = res
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
state,
|
||||
getters,
|
||||
actions,
|
||||
mutations
|
||||
}
|
||||
Reference in New Issue
Block a user