This commit is contained in:
2022-06-27 10:21:54 +08:00
commit 571e582eca
257 changed files with 41968 additions and 0 deletions

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

@@ -0,0 +1,162 @@
import * as types from '../types'
import { getStore, setStore } from '@config/mUtils.js'
const baseUrl = process.env.NODE_ENV === 'development' ? 'http://192.168.81.252:8010' : 'http://10.16.1.24:8010'
const imgip = 'http://10.16.1.24:8010'
const printUrl = 'http://10.16.1.24:8000'
const billPrintUrl = ''
const setTime = '5000'
const weightLimit = '400'
const printName = ''
const appUrl = 'http://10.16.1.24:8010/file/apk/app-release.apk'
/**
* App通用配置
*/
const state = {
baseUrl: getStore('baseUrl') || baseUrl,
imgip: getStore('imgip') || imgip,
printUrl: getStore('printUrl') || printUrl,
billPrintUrl: getStore('billPrintUrl') || billPrintUrl,
setTime: getStore('setTime') || setTime,
weightLimit: getStore('weightLimit') || weightLimit,
printName: getStore('printName') || printName,
appUrl: getStore('appUrl') || appUrl,
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)
},
setImgIp ({commit}, str) {
setStore('imgip', str)
commit(types.COM_IMG_IP, str)
},
setPrintUrl ({commit}, str) {
setStore('printUrl', str)
commit(types.COM_PRINT_URL, str)
},
setBillPrintUrl ({commit}, str) {
setStore('billPrintUrl', str)
commit(types.COM_BILL_PRINT_URL, str)
},
setRefreshTime ({commit}, str) {
setStore('setTime', str)
commit(types.COM_SET_TIME, str)
},
setWeightLimit ({commit}, str) {
setStore('weightLimit', str)
commit(types.COM_WEIGHT_LIMIT, str)
},
setPrintName ({commit}, str) {
setStore('printName', str)
commit(types.COM_PRINT_NAME, str)
},
setAppUrl ({commit}, str) {
setStore('appUrl', str)
commit(types.COM_APP_URL, 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,
imgip: state => state.imgip,
printUrl: state => state.printUrl,
billPrintUrl: state => state.billPrintUrl,
setTime: state => state.setTime,
weightLimit: state => state.weightLimit,
printName: state => state.printName,
appUrl: state => state.appUrl,
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_IMG_IP] (state, str) {
state.imgip = str
},
[types.COM_PRINT_URL] (state, str) {
state.printUrl = str
},
[types.COM_BILL_PRINT_URL] (state, str) {
state.billPrintUrl = str
},
[types.COM_SET_TIME] (state, str) {
state.setTime = str
},
[types.COM_WEIGHT_LIMIT] (state, str) {
state.weightLimit = str
},
[types.COM_PRINT_NAME] (state, str) {
state.printName = str
},
[types.COM_APP_URL] (state, str) {
state.appUrl = 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
}

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

@@ -0,0 +1,72 @@
import * as types from '../types'
// import { getStore, setStore } from '@config/mUtils.js'
const state = {
receiveMaterObj: '', // 物料收货 - 欠料查看
receivePlateArr: [], // 收货组盘 - 添加物料
materObj: {}, // 物料编码
materObj1: {}, // 传对象
fArr: [],
keepAlive: [] // 缓存页面
}
const getters = {
receiveMaterObj: state => state.receiveMaterObj,
receivePlateArr: state => state.receivePlateArr,
materObj: state => state.materObj,
materObj1: state => state.materObj1,
fArr: state => state.fArr,
keepAlive: state => state.keepAlive
}
const actions = {
receiveMaterObj ({commit}, res) {
commit(types.RECEIVE_MATER_OBJ, res)
},
receivePlateArr ({commit}, res) {
commit(types.RECEIVE_PLATE_ARR, res)
},
materObj ({commit}, res) {
commit(types.MATER_OBJ, res)
},
materObj1 ({commit}, res) {
commit(types.MATER_OBJ_1, res)
},
fArr ({commit}, res) {
commit(types.F_ARR, res)
},
setKeepAlive ({commit}, res) {
commit(types.SET_KEEP_ALIVE, res)
}
}
const mutations = {
[types.RECEIVE_MATER_OBJ] (state, res) {
state.receiveMaterObj = res
},
[types.RECEIVE_PLATE_ARR] (state, res) {
state.receivePlateArr = res
},
[types.MATER_OBJ] (state, res) {
state.materObj = res
},
[types.MATER_OBJ_1] (state, res) {
state.materObj1 = res
},
[types.F_ARR] (state, res) {
state.fArr = res
},
[types.SET_KEEP_ALIVE] (state, res) {
state.keepAlive = res
}
// setKeepAlive: (state, keepAlive) => {
// state.keepAlive = keepAlive
// }
}
export default {
state,
getters,
actions,
mutations
}

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

@@ -0,0 +1,46 @@
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 LODOPA = document.getElementById('LODOPA')
// var LODOPB = document.getElementById('LODOPB')
var head = document.head || document.getElementsByTagName('head')[0] || document.documentElement
if (LODOPA) head.removeChild(LODOPA)
// if (LODOPB) head.removeChild(LODOPB)
commit(types.SET_SIGN_OUT)
}
}
const mutations = {
[types.SET_USER_INFO] (state, res) {
state.userInfo = res
},
[types.SET_SIGN_OUT] (state) {
state.accountId = ''
}
}
export default {
state,
getters,
actions,
mutations
}

16
src/vuex/store.js Normal file
View File

@@ -0,0 +1,16 @@
import Vue from 'vue'
import Vuex from 'vuex'
import user from './modules/user'
import com from './modules/com'
import data from './modules/data'
Vue.use(Vuex)
export default new Vuex.Store({
modules: {
user,
com,
data
}
})

32
src/vuex/types.js Normal file
View File

@@ -0,0 +1,32 @@
// 公共
export const COM_BASE_URL = 'COM_BASE_URL' // 服务器地址
export const COM_IMG_IP = 'COM_IMG_IP' // 图片存储地址
export const COM_PRINT_URL = 'COM_PRINT_URL' // 标签打印地址
export const COM_BILL_PRINT_URL = 'COM_BILL_PRINT_URL' // 单据打印地址
export const COM_SET_TIME = 'COM_SET_TIME' // 刷新时间
export const COM_WEIGHT_LIMIT = 'COM_WEIGHT_LIMIT' // 托盘限重
export const COM_LOADING_STATUS = 'COM_LOADING_STATUS'
export const COM_SHOW_TOAST = 'COM_SHOW_TOAST' // 显示toast
export const COM_SHOW_SUCCESS = 'COM_SHOW_SUCCESS' // 显示成功toast
export const COM_SHOW_FAIL = 'COM_SHOW_FAIL' // 显示失败toast
export const COM_TOAST_MSG = 'COM_TOAST_MSG' // 显示toast文字
export const COM_SHOW_ALERT = 'COM_SHOW_ALERT'
export const COM_ALERT_MSG = 'COM_ALERT_MSG'
export const COM_PRINT_NAME = 'COM_PRINT_NAME'
export const COM_APP_URL = 'COM_APP_URL'
// 用户
export const SET_USER_INFO = 'SET_USER_INFO'
export const SET_SIGN_OUT = 'SET_SIGN_OUT'
// 物料收货 - 欠料查看
export const RECEIVE_MATER_OBJ = 'RECEIVE_MATER_OBJ'
// 收货组盘 - 添加物料
export const RECEIVE_PLATE_ARR = 'RECEIVE_PLATE_ARR'
// 物料信息查询
export const MATER_OBJ = 'MATER_OBJ'
export const MATER_OBJ_1 = 'MATER_OBJ_1'
// 数组
export const F_ARR = 'F_ARR'
// 缓存页面
export const SET_KEEP_ALIVE = 'SET_KEEP_ALIVE'