diff --git a/App.vue b/App.vue index 4a445ec..954c32b 100644 --- a/App.vue +++ b/App.vue @@ -7,6 +7,12 @@ export default { onLaunch: function () { this.initApp(); }, + data() { + return { + width: '--width:300px;', + height: '--height:712px;' + }; + }, methods: { // 初始化应用 initApp() { @@ -23,7 +29,8 @@ export default { // console.log(_windowsWidth,_windowsHeight); this.globalData.config = config; // 设置页面初始大小 - + // this.'--width' = _windowsWidth + 'px;'; + // this.'--height' = (_windowsHeight - 50) + 'px;'; }, checkLogin() { if (!getToken()) { @@ -38,14 +45,16 @@ export default { .content { display: flex; flex-direction: column; - background-image: url('static/images/background/background.jpg'); + background-image: linear-gradient(rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.5)), url('static/images/background/background.jpg'); + background-size: cover; + // filter: opacity(50%); font-size: 36px; font-weight: 700; width: 360px; - height: 712px; + height: 662px; } -.main-box{ - width:100%; +.main-box { + width: 100%; height: 100%; } @import '@/static/scss/index.scss'; diff --git a/api/warehouse/warehose.js b/api/warehouse/warehose.js index efd1b36..d5ebeaa 100644 --- a/api/warehouse/warehose.js +++ b/api/warehouse/warehose.js @@ -1,11 +1,75 @@ import upload from '@/utils/upload' import request from '@/utils/request' -// 获取仓库信息 -export function getWareHouseProfile(data) { +// 获取库位信息 +export function getProductLocationInfo(params) { return request({ - url: '/wms/wareHouse/getWareHouseProfile', - method: 'pose', + url: '/mes/wm/storagelocation/get_location_info', + method: 'get', + params + }) +} + +// 根据库位获取已存在货物 +export function getOldPackagelist(params) { + return request({ + url: '/mes/wm/entrywarehouse/packagelist', + method: 'get', + params + }) +} +// 判断是否是库位编码 +export function isProductionLocation(params) { + return request({ + url: '/mes/wm/entrywarehouse/is_production_location', + method: 'get', + params + }) +} + +// 判断是否为成品库箱子码 +export function isProductionPackage(params) { + return request({ + url: '/mes/wm/entrywarehouse/is_production_package', + method: 'get', + params + }) +} + +// 判断是否为满箱 +export function isFullPackage(params) { + return request({ + url: '/mes/wm/entrywarehouse/is_full_package', + method: 'get', + params + }) +} + +// 判断箱子是否已在库中 +export function isExistedWarehouse(params) { + return request({ + url: '/mes/wm/entrywarehouse/is_existed_warehouse', + method: 'get', + params + }) +} + +// 解析外箱标签编码 +export function resolutionPackage(params) { + return request({ + url: '/mes/wm/entrywarehouse/resolution_package', + method: 'get', + params + }) +} + + +// 入库 +export function handlerIntoProductWarehouse(data) { + return request({ + url: '/mes/wm/entrywarehouse/into_product_warehouse', + method: 'post', data }) -} \ No newline at end of file +} + diff --git a/components/material-item/material-item.vue b/components/material-item/material-item.vue index e036dcf..1fc7441 100644 --- a/components/material-item/material-item.vue +++ b/components/material-item/material-item.vue @@ -1,7 +1,7 @@ @@ -11,8 +11,8 @@ props:{ materialInfo:{ default:{ - title:'无数据', - time:'2024/3/12' + packageCode:'未知货物', + entryWarehouseTime:'未知入库时间' } } }, @@ -27,15 +27,22 @@ diff --git a/components/pda-scan-input/index.vue b/components/pda-scan-input/index.vue index b884890..488885c 100644 --- a/components/pda-scan-input/index.vue +++ b/components/pda-scan-input/index.vue @@ -1,15 +1,17 @@ + + diff --git a/pages/inWarehouse/inWarehouse.vue b/pages/inWarehouse/inWarehouse.vue index 9cff25c..b4c5c36 100644 --- a/pages/inWarehouse/inWarehouse.vue +++ b/pages/inWarehouse/inWarehouse.vue @@ -1,47 +1,63 @@ + + diff --git a/permission.js b/permission.js index ab18ee4..24cf416 100644 --- a/permission.js +++ b/permission.js @@ -7,7 +7,7 @@ const loginPage = "/pages/login/login" // 页面白名单 const whiteList = [ - '/pages/login/login','pages/index/index' + '/pages/login/login', 'pages/index/index', 'pages/demo/demo' ] // 检查地址白名单 @@ -22,11 +22,11 @@ list.forEach(item => { uni.addInterceptor(item, { invoke(to) { if (getToken()) { - // if (to.url === loginPage) { - // uni.reLaunch({ - // url: "/" - // }) - // } + if (to.url === loginPage) { + uni.reLaunch({ + url: loginPage + }) + } return true } else { if (checkWhite(to.url)) { diff --git a/utils/baseUrl.js b/utils/baseUrl.js new file mode 100644 index 0000000..f7457d2 --- /dev/null +++ b/utils/baseUrl.js @@ -0,0 +1,13 @@ +const BaseUrlKey = 'BaseUrl' + +export function getBaseUrl() { + return uni.getStorageSync(BaseUrlKey) +} + +export function setBaseUrl(BaseUrl) { + return uni.setStorageSync(BaseUrlKey, BaseUrl) +} + +export function removeBaseUrl() { + return uni.removeStorageSync(BaseUrlKey) +} \ No newline at end of file diff --git a/utils/request.js b/utils/request.js index 860f0ef..ef427ce 100644 --- a/utils/request.js +++ b/utils/request.js @@ -1,73 +1,89 @@ import store from '@/store' import config from '@/config' -import { getToken } from '@/utils/auth' +import { + getBaseUrl, + setBaseUrl, + removeBaseUrl +} from '@/utils/baseUrl'; +import { + getToken +} from '@/utils/auth' import errorCode from '@/utils/errorCode' -import { toast, showConfirm, tansParams } from '@/utils/common' +import { + toast, + showConfirm, + tansParams +} from '@/utils/common' let timeout = 10000 -const baseUrl = config.baseUrl - const request = config => { - // 是否需要设置 token - const isToken = (config.headers || {}).isToken === false - config.header = config.header || {} - if (getToken() && !isToken) { - config.header['Authorization'] = 'Bearer ' + getToken() - } - // get请求映射params参数 - if (config.params) { - let url = config.url + '?' + tansParams(config.params) - url = url.slice(0, -1) - config.url = url - } - return new Promise((resolve, reject) => { - uni.request({ - method: config.method || 'get', - timeout: config.timeout || timeout, - url: config.baseUrl || baseUrl + config.url, - data: config.data, - header: config.header, - dataType: 'json' - }).then(response => { - let [error, res] = response - if (error) { - toast('后端接口连接异常') - reject('后端接口连接异常') - return - } - const code = res.data.code || 200 - const msg = errorCode[code] || res.data.msg || errorCode['default'] - if (code === 401) { - showConfirm('登录状态已过期,您可以继续留在该页面,或者重新登录?').then(res => { - if (res.confirm) { - store.dispatch('LogOut').then(res => { - uni.reLaunch({ url: '/pages/login' }) - }) - } - }) - reject('无效的会话,或者会话已过期,请重新登录。') - } else if (code === 500) { - toast(msg) - reject('500') - } else if (code !== 200) { - toast(msg) - reject(code) - } - resolve(res.data) - }) - .catch(error => { - let { message } = error - if (message === 'Network Error') { - message = '后端接口连接异常' - } else if (message.includes('timeout')) { - message = '系统接口请求超时' - } else if (message.includes('Request failed with status code')) { - message = '系统接口' + message.substr(message.length - 3) + '异常' - } - toast(message) - reject(error) - }) - }) + const storageBaseUrl = 'http://' + getBaseUrl() + '/api'; + // 是否需要设置 token + const isToken = (config.headers || {}).isToken === false + config.header = config.header || {} + if (getToken() && !isToken) { + config.header['Authorization'] = 'Bearer ' + getToken() + } + // get请求映射params参数 + if (config.params) { + let url = config.url + '?' + tansParams(config.params) + url = url.slice(0, -1) + config.url = url + } + return new Promise((resolve, reject) => { + + uni.request({ + method: config.method || 'get', + timeout: config.timeout || timeout, + url: config.baseUrl || (storageBaseUrl + config.url), + data: config.data, + header: config.header, + dataType: 'json' + }).then(response => { + let [error, res] = response + console.log(response); + if (error) { + toast('后端接口连接异常') + reject('后端接口连接异常') + return + } + const code = res.data.code || 200 + const msg = errorCode[code] || res.data.msg || errorCode['default'] + if (code === 401) { + showConfirm('登录状态已过期,您可以继续留在该页面,或者重新登录?').then(res => { + if (res.confirm) { + store.dispatch('LogOut').then(res => { + uni.reLaunch({ + url: '/pages/login' + }) + }) + } + }) + reject('无效的会话,或者会话已过期,请重新登录。') + } else if (code === 500) { + toast(msg) + reject('500') + } else if (code !== 200) { + toast(msg) + reject(code) + } + resolve(res.data) + }) + .catch(error => { + let { + message + } = error + if (message === 'Network Error') { + message = '后端接口连接异常' + } else if (message.includes('timeout')) { + message = '系统接口请求超时' + } else if (message.includes('Request failed with status code')) { + message = '系统接口' + message.substr(message.length - 3) + '异常' + } + toast(message) + reject(error) + }) + }) } -export default request +export default request \ No newline at end of file