You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
520 lines
14 KiB
520 lines
14 KiB
<template> |
|
<u-navbar title="工作台" placeholder border=true leftIcon=''></u-navbar> |
|
<view class="mabox" v-for="item in tablist"> |
|
<view class="boxtitl"> |
|
{{item.name}} |
|
</view> |
|
<view class="minboxlist"> |
|
<view @click="gopathpage(ite.router)" v-for="ite in item.minilist"> |
|
<image mode="widthFix" :src="ite.icon"></image> |
|
<view class="minboxlist_title">{{ite.name}}</view> |
|
</view> |
|
</view> |
|
</view> |
|
<!-- #ifdef APP --> |
|
<saomiao2></saomiao2> |
|
<!-- <saomiao></saomiao> |
|
<saomiao1></saomiao1> |
|
<saomiao2></saomiao2> |
|
<saomiao3></saomiao3> |
|
<saomiao4></saomiao4> --> |
|
<!-- #endif --> |
|
<tips ref="tip"></tips> |
|
<!-- <Tabber checkstate='home'></Tabber> --> |
|
</template> |
|
|
|
<script lang="ts" setup> |
|
import { |
|
onLoad, |
|
onShow, |
|
onHide, |
|
onUnload, |
|
onPullDownRefresh |
|
} from '@dcloudio/uni-app' |
|
import { |
|
appMenuroutes, |
|
appbuttons, |
|
AppPdaversiondetail |
|
} from "@/api/user.js" |
|
import { getImageCache } from '@/utils/cacheimg.js' |
|
import { listtype } from '@/interfaces/home/index' |
|
// import Tabber from '@/compoment/Tabber/Tabber.vue' |
|
import { inject, reactive, toRefs, watchEffect, ref } from "vue"; |
|
import utils from '../../utils/utils'; |
|
const tip = ref(null) |
|
let details = reactive<listtype>({ tablist: [] }); |
|
// let details = reactive<listtype>({ |
|
// tablist: [ |
|
// { |
|
// type: 1, |
|
// name: '工作台', |
|
// minilist: [ |
|
// { |
|
// icon: 'http://htys.oss-cn-chengdu.aliyuncs.com/htys/afb031efec7d2f8620ee68c71f87a80e.png', |
|
// name: '订单查询', |
|
// router: '/pagesHome/pages/orderInquiry/orderInquiry', |
|
// }, |
|
// ] |
|
// }, |
|
// { |
|
// type: 1, |
|
// name: '库内', |
|
// minilist: [ |
|
// { |
|
// icon: 'http://htys.oss-cn-chengdu.aliyuncs.com/htys/afb031efec7d2f8620ee68c71f87a80e.png', |
|
// name: '分拣打托', |
|
// router: '/pagesHome/pages/scansorting/scansorting', |
|
// }, |
|
// // { |
|
// // icon: 'http://htys.oss-cn-chengdu.aliyuncs.com/htys/afb031efec7d2f8620ee68c71f87a80e.png', |
|
// // name: '订单分拣', |
|
// // router: '/pagesHome/pages/ordersorting/ordersorting', |
|
// // }, |
|
// // { |
|
// // icon: 'http://htys.oss-cn-chengdu.aliyuncs.com/htys/afb031efec7d2f8620ee68c71f87a80e.png', |
|
// // name: '库存品分拣', |
|
// // router: '/pagesHome/pages/lnventorysorting/lnventorysorting', |
|
// // }, |
|
// { |
|
// icon: 'http://htys.oss-cn-chengdu.aliyuncs.com/htys/afb031efec7d2f8620ee68c71f87a80e.png', |
|
// name: '扫码上架', |
|
// router: '/pagesHome/pages/ScanUpType/ScanUpType', |
|
// }, |
|
// { |
|
// icon: 'http://htys.oss-cn-chengdu.aliyuncs.com/htys/afb031efec7d2f8620ee68c71f87a80e.png', |
|
// name: '手动上架', |
|
// router: '/pagesHome/pages/PeopleScanUpType/PeopleScanUpType', |
|
// }, |
|
// { |
|
// icon: 'http://htys.oss-cn-chengdu.aliyuncs.com/htys/afb031efec7d2f8620ee68c71f87a80e.png', |
|
// name: '移库', |
|
// router: '/pagesHome/pages/RelocationType/RelocationType', |
|
// }, |
|
// { |
|
// icon: 'http://htys.oss-cn-chengdu.aliyuncs.com/htys/afb031efec7d2f8620ee68c71f87a80e.png', |
|
// name: '滞留', |
|
// router: '/pagesHome/pages/Retention/Retention', |
|
// }, |
|
// { |
|
// icon: 'http://htys.oss-cn-chengdu.aliyuncs.com/htys/afb031efec7d2f8620ee68c71f87a80e.png', |
|
// name: '合托', |
|
// router: '/pagesHome/pages/MergeTray/MergeTray', |
|
// }, |
|
// { |
|
// icon: 'http://htys.oss-cn-chengdu.aliyuncs.com/htys/afb031efec7d2f8620ee68c71f87a80e.png', |
|
// name: '下架', |
|
// router: '/pagesHome/pages/DownGoodsType/DownGoodsType', |
|
// }, |
|
// { |
|
// icon: 'http://htys.oss-cn-chengdu.aliyuncs.com/htys/afb031efec7d2f8620ee68c71f87a80e.png', |
|
// name: '空置托盘', |
|
// router: '/pagesHome/pages/RemoveTray/RemoveTray', |
|
// }, |
|
// { |
|
// icon: 'http://htys.oss-cn-chengdu.aliyuncs.com/htys/afb031efec7d2f8620ee68c71f87a80e.png', |
|
// name: '复核', |
|
// router: '/pagesHome/pages/Check/Check', |
|
// }, |
|
// ] |
|
// }, |
|
// { |
|
// type: 1, |
|
// name: '出库', |
|
// minilist: [ |
|
// { |
|
// icon: 'http://htys.oss-cn-chengdu.aliyuncs.com/htys/afb031efec7d2f8620ee68c71f87a80e.png', |
|
// name: '拣货扫描', |
|
// router: '/pagesHome/pages/pickingScan/pickingScan', |
|
// }, |
|
// { |
|
// icon: 'http://htys.oss-cn-chengdu.aliyuncs.com/htys/afb031efec7d2f8620ee68c71f87a80e.png', |
|
// name: '自提扫描', |
|
// router: '/pagesHome/pages/SelfPickupScan/SelfPickupScan', |
|
// }, |
|
// ] |
|
// }, |
|
// { |
|
// type: 1, |
|
// name: '配送', |
|
// minilist: [ |
|
// { |
|
// icon: 'http://htys.oss-cn-chengdu.aliyuncs.com/htys/afb031efec7d2f8620ee68c71f87a80e.png', |
|
// name: '装车扫描', |
|
// router: '/pagesHome/pages/LoadingScan/LoadingScan', |
|
// }, |
|
// { |
|
// icon: 'http://htys.oss-cn-chengdu.aliyuncs.com/htys/afb031efec7d2f8620ee68c71f87a80e.png', |
|
// name: '签收扫描', |
|
// router: '/pagesHome/pages/signinScan/signinScan', |
|
// }, |
|
// ] |
|
// }, |
|
// { |
|
// type: 1, |
|
// name: '离线上传', |
|
// minilist: [ |
|
// { |
|
// icon: 'http://htys.oss-cn-chengdu.aliyuncs.com/htys/afb031efec7d2f8620ee68c71f87a80e.png', |
|
// name: '离线上传', |
|
// router: '/pagesHome/pages/OfflineUpload/OfflineUpload', |
|
// }, |
|
// ] |
|
// }, |
|
// ] |
|
// }) |
|
|
|
function gopathpage(path : string) { |
|
uni.navigateTo({ |
|
url: path |
|
}) |
|
} |
|
|
|
async function init() { |
|
let tabber = uni.getStorageSync('homerouter') |
|
if (tabber) { |
|
details.tablist = tabber |
|
return |
|
} |
|
let res = await appMenuroutes({}) |
|
console.log(res, '-------------'); |
|
console.log('刷新后') |
|
if (res.code == 200) { |
|
//读取并处理缓存图标并把菜单写入缓存 |
|
getimgcache(res.data[0]) |
|
// 本地强行写入菜单 |
|
// details.tablist = [ |
|
// { |
|
// type: 1, |
|
// name: '库内', |
|
// minilist: [ |
|
// { |
|
// icon: 'http://htys.oss-cn-chengdu.aliyuncs.com/htys/afb031efec7d2f8620ee68c71f87a80e.png', |
|
// name: '订单分拣', |
|
// router: '/pagesHome/pages/ordersorting/ordersorting', |
|
// }, |
|
// { |
|
// icon: 'http://htys.oss-cn-chengdu.aliyuncs.com/htys/afb031efec7d2f8620ee68c71f87a80e.png', |
|
// name: '库存品分拣', |
|
// router: '/pagesHome/pages/lnventorysorting/lnventorysorting', |
|
// }, |
|
// { |
|
// icon: 'http://htys.oss-cn-chengdu.aliyuncs.com/htys/afb031efec7d2f8620ee68c71f87a80e.png', |
|
// name: '扫码上架', |
|
// router: '/pagesHome/pages/ScanUpType/ScanUpType', |
|
// }, |
|
// { |
|
// icon: 'http://htys.oss-cn-chengdu.aliyuncs.com/htys/afb031efec7d2f8620ee68c71f87a80e.png', |
|
// name: '手动上架', |
|
// router: '/pagesHome/pages/PeopleScanUpType/PeopleScanUpType', |
|
// }, |
|
// { |
|
// icon: 'http://htys.oss-cn-chengdu.aliyuncs.com/htys/afb031efec7d2f8620ee68c71f87a80e.png', |
|
// name: '移库', |
|
// router: '/pagesHome/pages/RelocationType/RelocationType', |
|
// }, |
|
// { |
|
// icon: 'http://htys.oss-cn-chengdu.aliyuncs.com/htys/afb031efec7d2f8620ee68c71f87a80e.png', |
|
// name: '滞留', |
|
// router: '/pagesHome/pages/Retention/Retention', |
|
// }, |
|
// { |
|
// icon: 'http://htys.oss-cn-chengdu.aliyuncs.com/htys/afb031efec7d2f8620ee68c71f87a80e.png', |
|
// name: '合托', |
|
// router: '/pagesHome/pages/MergeTray/MergeTray', |
|
// }, |
|
// { |
|
// icon: 'http://htys.oss-cn-chengdu.aliyuncs.com/htys/afb031efec7d2f8620ee68c71f87a80e.png', |
|
// name: '下架', |
|
// router: '/pagesHome/pages/DownGoodsType/DownGoodsType', |
|
// }, |
|
// { |
|
// icon: 'http://htys.oss-cn-chengdu.aliyuncs.com/htys/afb031efec7d2f8620ee68c71f87a80e.png', |
|
// name: '空置托盘', |
|
// router: '/pagesHome/pages/RemoveTray/RemoveTray', |
|
// }, |
|
// { |
|
// icon: 'http://htys.oss-cn-chengdu.aliyuncs.com/htys/afb031efec7d2f8620ee68c71f87a80e.png', |
|
// name: '复核', |
|
// router: '/pagesHome/pages/Check/Check', |
|
// }, |
|
// ] |
|
// }, |
|
// { |
|
// type: 1, |
|
// name: '出库', |
|
// minilist: [ |
|
// { |
|
// icon: 'http://htys.oss-cn-chengdu.aliyuncs.com/htys/afb031efec7d2f8620ee68c71f87a80e.png', |
|
// name: '拣货扫描', |
|
// router: '/pagesHome/pages/pickingScan/pickingScan', |
|
// }, |
|
// { |
|
// icon: 'http://htys.oss-cn-chengdu.aliyuncs.com/htys/afb031efec7d2f8620ee68c71f87a80e.png', |
|
// name: '自提扫描', |
|
// router: '/pagesHome/pages/SelfPickupScan/SelfPickupScan', |
|
// }, |
|
// ] |
|
// }, |
|
// { |
|
// type: 1, |
|
// name: '配送', |
|
// minilist: [ |
|
// { |
|
// icon: 'http://htys.oss-cn-chengdu.aliyuncs.com/htys/afb031efec7d2f8620ee68c71f87a80e.png', |
|
// name: '装车扫描', |
|
// router: '/pagesHome/pages/LoadingScan/LoadingScan', |
|
// }, |
|
// { |
|
// icon: 'http://htys.oss-cn-chengdu.aliyuncs.com/htys/afb031efec7d2f8620ee68c71f87a80e.png', |
|
// name: '签收扫描', |
|
// router: '/pagesHome/pages/signinScan/signinScan', |
|
// }, |
|
// ] |
|
// }, |
|
// { |
|
// type: 1, |
|
// name: '离线上传', |
|
// minilist: [ |
|
// { |
|
// icon: 'http://htys.oss-cn-chengdu.aliyuncs.com/htys/afb031efec7d2f8620ee68c71f87a80e.png', |
|
// name: '离线上传', |
|
// router: '/pagesHome/pages/OfflineUpload/OfflineUpload', |
|
// }, |
|
// ] |
|
// }, |
|
// ] |
|
} else { |
|
uni.showToast({ |
|
title: res.msg, |
|
icon: 'none' |
|
}) |
|
} |
|
} |
|
async function initbuts() { |
|
let authbut = uni.getStorageSync('authbuts') |
|
console.log('authbut :>> ', authbut); |
|
if (authbut) { |
|
return |
|
} |
|
let butres = await appbuttons({}) |
|
console.log(butres.data); |
|
let qxan = [] |
|
butres.data.map(item => { |
|
item.children.map(ite => { |
|
qxan.push({ name: ite.name, code: ite.code }) |
|
}) |
|
}) |
|
uni.setStorageSync('authbuts', qxan) |
|
} |
|
onShow(() => { |
|
updateApp() |
|
init() |
|
|
|
// print() |
|
}) |
|
onLoad(() => { |
|
|
|
initbuts() |
|
}) |
|
|
|
// 下拉刷新 |
|
onPullDownRefresh(() => { |
|
const timer = setTimeout(() => { |
|
init() |
|
initbuts() |
|
|
|
// 关闭刷新动画 |
|
uni.stopPullDownRefresh() |
|
clearTimeout(timer) |
|
}, 500) |
|
}) |
|
|
|
function print() { |
|
// #ifdef APP |
|
const util = (inject('utils') as any) |
|
let text = '! 0 200 200 500 1\r\n' |
|
text += 'SETBOLD 2\r\n' |
|
text += `T 56 0 0 0 OPLYA成都市230700015YA7\r\n` |
|
text += 'LINE 0 50 420 50 3\r\n' |
|
text += `T 55 0 0 60 客户\r\n` |
|
text += 'LINE 40 50 40 110 3\r\n' |
|
text += `T 55 0 50 60 客户名称\r\n` |
|
text += 'LINE 40 80 420 80 3\r\n' |
|
text += `T 55 0 50 90 四川成都龙泉驿西河镇\r\n` |
|
text += 'LINE 0 110 420 110 3\r\n' |
|
text += `T 55 0 0 120 物料\r\n` |
|
text += 'LINE 40 110 40 140 3\r\n' |
|
text += `T 55 0 60 120 物料名称31\r\n` |
|
text += 'LINE 0 140 420 140 3\r\n' |
|
text += 'B QR 150 150 M 2 U 4\r\n' |
|
text += 'MA,123141515215212\r\n' |
|
text += 'ENDQR\r\n' |
|
text += `T 55 0 140 260 123141515215212\r\n` |
|
text += 'PRINT\r\n' |
|
|
|
|
|
// let text='! 0 200 200 500 1\r\n' |
|
// text+='SETBOLD 2\r\n' |
|
// text+='B QR 80 40 M 2 U 8\r\n' |
|
// text+='MA,TESTCodeBJ2308020043\r\n' |
|
// text+='ENDQR\r\n' |
|
// text+=`T 56 0 15 280 TESTCodeBJ2308020043\r\n` |
|
// text+='PRINT\r\n' |
|
let sylist = util.initbl() |
|
console.log(sylist); |
|
sylist.map(item => { |
|
console.log(item); |
|
if (item.uuids) { |
|
util.getbl(item, text) |
|
} |
|
}) |
|
// #endif |
|
} |
|
watchEffect(() => { |
|
if (details.tablist.length > 0) { |
|
uni.setStorageSync('homerouter', details.tablist) |
|
} |
|
}) |
|
async function getimgcache(list) { |
|
let maxarr = [] |
|
if (!list) return |
|
for (let item of list.children) { |
|
let arr = { |
|
type: 1, |
|
name: item.name, |
|
minilist: [] |
|
} |
|
for (let ite of item.children) { |
|
|
|
let result = null; |
|
if (ite.source != null) { |
|
result = await getImageCache(ite.source) |
|
} |
|
|
|
let obj = { |
|
icon: result, |
|
name: ite.name, |
|
router: ite.path |
|
} |
|
arr.minilist.push(obj) |
|
} |
|
maxarr.push(arr) |
|
} |
|
details.tablist = maxarr |
|
console.log(details.tablist); |
|
// details.tablist.map((item,index)=>{ |
|
// item.minilist.map(async (ite,inde)=>{ |
|
// let result = await getImageCache('http://htys.oss-cn-chengdu.aliyuncs.com/htys/afb031efec7d2f8620ee68c71f87a80e.png') |
|
// console.log("image cache", result); |
|
// if (result) { |
|
// details.tablist[index].minilist[inde].icon=result |
|
|
|
// } else { |
|
// details.tablist[index].minilist[inde].icon=ite.icon |
|
// } |
|
// }) |
|
// }) |
|
// setTimeout(()=>{ |
|
// console.log(details.tablist); |
|
// },3500) |
|
} |
|
|
|
async function updateApp() { |
|
let version = await utils.getversion() |
|
// let version = { |
|
// version: '1.0.9', |
|
// pkName: 'com.hwy.pda' |
|
// } |
|
let data = { |
|
betenantCode: uni.getStorageSync('userinfo').tenant_id, |
|
versionCode: version.version.split('.').join(''), |
|
versionType: version.pkName.indexOf('test') != -1 ? '1' : version.pkName.indexOf('bate') != -1 ? '2' : '3', |
|
} |
|
console.log('data', data); |
|
let response = await AppPdaversiondetail(data) |
|
console.log('response :>> ', response); |
|
if (response.code == 200 && response.data) { |
|
console.log(response.data); |
|
console.log('有可更新包'); |
|
if (response.data.noSensation == '2' && response.data.link.indexOf('wgt') != -1) { |
|
utils.updatefile1(response.data.link) |
|
} else { |
|
tip.value.setdetails({ |
|
title: '提示', |
|
content: '检测到有新版本,请问是否更新?', |
|
confirmTxt: '更新', |
|
isshow: true, |
|
isshowcancel: true, |
|
success: async () => { |
|
utils.updatefile(response.data.link) |
|
tip.value.setisshow(false) |
|
}, |
|
cancel: () => { |
|
tip.value.setisshow(false) |
|
if (response.data.isUpdates == '2') { |
|
plus.runtime.quit(); |
|
} |
|
}, |
|
close: () => { |
|
tip.value.setisshow(false) |
|
if (response.data.isUpdates == '2') { |
|
plus.runtime.quit(); |
|
} |
|
} |
|
}) |
|
} |
|
} |
|
} |
|
const { tablist } = toRefs(details) |
|
</script> |
|
|
|
<style lang="scss"> |
|
.mabox { |
|
display: flex; |
|
flex-direction: column; |
|
padding: 20upx 0; |
|
box-sizing: border-box; |
|
width: 686upx; |
|
margin: auto; |
|
background-color: #ffffff; |
|
margin-bottom: 20upx; |
|
margin-top: 10upx; |
|
border-radius: 10upx; |
|
box-shadow: 0rpx 2rpx 10rpx 0rpx #e2e2e380; |
|
|
|
.boxtitl { |
|
font-size: 34upx; |
|
font-weight: 500; |
|
margin-bottom: 10upx; |
|
// margin-left: 10upx; |
|
border-bottom: 1upx solid #EEEEEE; |
|
padding: 0upx 20upx; |
|
padding-bottom: 20upx; |
|
color: #092C4D; |
|
} |
|
|
|
.minboxlist { |
|
display: flex; |
|
flex-wrap: wrap; |
|
align-items: center; |
|
// justify-content: space-between; |
|
padding-top: 10upx; |
|
|
|
>view { |
|
width: 25%; |
|
display: flex; |
|
flex-direction: column; |
|
align-items: center; |
|
margin-bottom: 15upx; |
|
|
|
>image { |
|
width: 100upx; |
|
} |
|
|
|
>view { |
|
font-size: 26upx; |
|
} |
|
} |
|
} |
|
} |
|
</style> |