This commit is contained in:
2022-11-09 10:02:49 +08:00
commit 520c394d45
152 changed files with 24430 additions and 0 deletions

124
src/vuex/modules/com.js Normal file
View File

@@ -0,0 +1,124 @@
import * as types from '../types'
import { getStore, setStore } from '@config/mUtils.js'
const baseUrl = process.env.NODE_ENV === 'development' ? 'http://192.168.81.153:8010' : 'http://192.168.81.153:8010'
const acsip = process.env.NODE_ENV === 'development' ? 'http://192.168.81.153:8010' : 'http://192.168.81.153:8010'
const printUrl = process.env.NODE_ENV === 'development' ? 'http://192.168.81.139:8000' : 'http://192.168.81.139:8000'
const setTime = '10'
/**
* App通用配置
*/
const state = {
baseUrl: getStore('baseUrl') || baseUrl,
acsip: getStore('acsip') || acsip,
printUrl: getStore('printUrl') || printUrl,
setTime: getStore('setTime') || setTime,
loading: false,
showToast: false,
showAlert: false,
showSuccess: true,
showFail: false,
toastMsg: '',
alertMsg: ''
}
const actions = {
setBaseUrl ({commit}, str) {
setStore('baseUrl', str)
commit(types.COM_BASE_URL, str)
},
setAcsIp ({commit}, str) {
setStore('acsip', str)
commit(types.COM_ACS_IP, str)
},
setPrintUrl ({commit}, str) {
setStore('printUrl', str)
commit(types.COM_PRINT_URL, str)
},
setRefreshTime ({commit}, str) {
setStore('setTime', str)
commit(types.COM_SET_TIME, str)
},
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 getters = {
baseUrl: state => state.baseUrl,
acsip: state => state.acsip,
printUrl: state => state.printUrl,
setTime: state => state.setTime,
loading: state => state.loading,
showToast: state => state.showToast,
showAlert: state => state.showAlert
}
const mutations = {
[types.COM_BASE_URL] (state, str) {
state.baseUrl = str
},
[types.COM_ACS_IP] (state, str) {
state.acsip = str
},
[types.COM_PRINT_URL] (state, str) {
state.printUrl = str
},
[types.COM_SET_TIME] (state, str) {
state.setTime = str
},
[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
}

45
src/vuex/modules/data.js Normal file
View File

@@ -0,0 +1,45 @@
import * as types from '../types'
// import { getStore, setStore } from '@config/mUtils.js'
const state = {
publicObj: '', // 物料收货 - 欠料查看
publicArr: [], // 收货组盘 - 添加物料
keepAlive: [] // 缓存页面
}
const getters = {
publicObj: state => state.publicObj,
publicArr: state => state.publicArr,
keepAlive: state => state.keepAlive
}
const actions = {
publicObj ({commit}, res) {
commit(types.PUBLIC_OBJ, res)
},
publicArr ({commit}, res) {
commit(types.PUBLIC_ARR, res)
},
setKeepAlive ({commit}, res) {
commit(types.SET_KEEP_ALIVE, res)
}
}
const mutations = {
[types.PUBLIC_OBJ] (state, res) {
state.publicObj = res
},
[types.PUBLIC_ARR] (state, res) {
state.publicArr = res
},
[types.SET_KEEP_ALIVE] (state, res) {
state.keepAlive = res
}
}
export default {
state,
getters,
actions,
mutations
}

43
src/vuex/modules/user.js Normal file
View File

@@ -0,0 +1,43 @@
import * as types from '../types'
const state = {
userInfo: localStorage.getItem('userInfo') || '' // 用户信息
}
const getters = {
userInfo: state => state.userInfo
}
const actions = {
userInfo ({ commit }, res) {
localStorage.setItem('userInfo', res)
commit(types.SET_USER_INFO, res)
},
setSignOut ({ commit }) {
let loginname = localStorage.getItem('userInfo') !== '' && localStorage.getItem('userInfo') !== null ? JSON.parse(localStorage.getItem('userInfo')).loginname : ''
localStorage.removeItem('userInfo')
if (loginname !== '') {
let obj = {loginname: loginname}
localStorage.setItem('userInfo', JSON.stringify(obj))
}
var LODOP = document.getElementById('LODOP')
var head = document.head || document.getElementsByTagName('head')[0] || document.documentElement
if (LODOP) head.removeChild(LODOP)
commit(types.SET_SIGN_OUT)
}
}
const mutations = {
[types.SET_USER_INFO] (state, res) {
state.userInfo = res
},
[types.SET_SIGN_OUT] (state) {
}
}
export default {
state,
getters,
actions,
mutations
}