Browse Source

打印样式修改

2024/6/19 17:19:08
hella_vue3
zhang_li 3 months ago
parent
commit
cb5964dbc2
  1. 2
      src/api/http.ts
  2. 56
      src/hybrid/html/pointPutawayJob.html
  3. 3
      src/main.ts
  4. 18
      src/mycomponents/scan/winScanLocation.vue
  5. 16
      src/mycomponents/scan/winScanPackAndLocation.vue
  6. 1
      src/pages.json
  7. 20
      src/pages/package/record/overPackageRecord.vue
  8. 147
      src/pages/pointPutawayJob/index.vue
  9. 42
      src/plugins/storage.js
  10. 2
      src/store/modules/countStore.ts

2
src/api/http.ts

@ -95,6 +95,8 @@ instance.interceptors.response.use((v) => {
} }
}) })
} else if(v.data.code == 401){ } else if(v.data.code == 401){
uni.clearStorageSync()
uni.removeStorageSync('overPackageRecord')
uni.showModal({ uni.showModal({
title: '系统提示', title: '系统提示',
content: '账号未登录,请重新登录', content: '账号未登录,请重新登录',

56
src/hybrid/html/pointPutawayJob.html

@ -17,7 +17,7 @@
<style> <style>
.box { .box {
font-size: 14px; font-size: 14px;
display: flex; border: 1px solid #dedede;
} }
@ -69,6 +69,60 @@
height: calc(100% - 4px); height: calc(100% - 4px);
margin: 2px; margin: 2px;
} }
.mb-kw {
border-bottom: 1px solid #dedede;
padding: 10px;
font-size: 15px;
}
.mb-kw div {
font-weight: bold;
font-size: 23px;
text-align: center;
}
.mb-bo {
display: flex;
}
.mb-bo .mb-left {
flex: 1
}
.mb-bo .mb-left .mb-text {
padding: 10px;
}
.mb-bo .mb-left .mb-text:nth-child(1) {
border-bottom: 1px solid #dedede;
}
.mb-bo .mb-left .mb-text div {
font-weight: bold;
font-size: 16px;
text-align: center;
}
.mb-bo .mb-right {
padding: 10px;
width: 230px;
border-left: 1px solid #dedede;
display: flex;
align-items: center;
}
.mb-bo .mb-right .mb-text {
width: 100%;
}
.mb-bo .mb-right .mb-text div {
font-weight: bold;
font-size: 20px;
text-align: center;
width: 100%;
}
</style> </style>
</head> </head>
<body> <body>

3
src/main.ts

@ -10,6 +10,7 @@ import comMessage from '@/mycomponents/common/comMessage.vue'
import tab from './plugins/tab' import tab from './plugins/tab'
import modal from './plugins/modal' import modal from './plugins/modal'
import time from './plugins/time' import time from './plugins/time'
import storage from './plugins/storage'
// unocss // unocss
@ -31,6 +32,8 @@ export function createApp() {
app.config.globalProperties.$modal = modal app.config.globalProperties.$modal = modal
// 时间对象 // 时间对象
app.config.globalProperties.$time = time app.config.globalProperties.$time = time
// 缓存
app.config.globalProperties.$storage = storage
app.component('com-message', comMessage) app.component('com-message', comMessage)

18
src/mycomponents/scan/winScanLocation.vue

@ -14,6 +14,9 @@
</view> </view>
</view> </view>
</u-popup> </u-popup>
<!-- 模拟扫描功能 -->
<win-com-scan v-show="false" ref="comscansimulate" @getResult="getScanResult" :clearResult="true" :boxFocus="true" :isShowHistory="false" headerType=""></win-com-scan>
<com-message ref="comMessageRef" /> <com-message ref="comMessageRef" />
</template> </template>
@ -43,11 +46,16 @@ const location = ref({})
const show = ref(false) const show = ref(false)
const scan = ref() const scan = ref()
const comMessageRef = ref() const comMessageRef = ref()
const comscansimulate = ref()
const openScanPopup = () => { const openScanPopup = () => {
setTimeout((res) => { setTimeout((res) => {
show.value = true show.value = true
}, 500) }, 500)
} }
const openScanPopupSimulate = (location) => {
comscansimulate.value.setItemCodeSimulate(location)
comscansimulate.value.clickScanMsg()
}
const closeScanPopup = () => { const closeScanPopup = () => {
show.value = false show.value = false
} }
@ -119,10 +127,14 @@ const checkLocationType = (type) => {
return isPass return isPass
} }
const getfocus = () => { const getfocus = () => {
scan.value.getfocus() if (scan.value) {
scan.value.getfocus()
}
} }
const losefocus = () => { const losefocus = () => {
scan.value.losefocus() if (scan.value) {
scan.value.losefocus()
}
} }
const showErrorMessage = (message) => { const showErrorMessage = (message) => {
setTimeout((r) => { setTimeout((r) => {
@ -138,7 +150,7 @@ const showErrorMessage = (message) => {
// //
const emit = defineEmits(['getLocation']) const emit = defineEmits(['getLocation'])
defineExpose({ openScanPopup }) defineExpose({ openScanPopup, openScanPopupSimulate })
</script> </script>
<style></style> <style></style>

16
src/mycomponents/scan/winScanPackAndLocation.vue

@ -17,7 +17,7 @@
placeholder-style="font-size:12px" style="padding: 5px;" @confirm="scanLocation" /> --> placeholder-style="font-size:12px" style="padding: 5px;" @confirm="scanLocation" /> -->
<view v-if="allowModifyLocation"> <view v-if="allowModifyLocation">
<uni-combox :candidates="fromLocationList" v-model="fromLocationCode" placeholder="请扫描来源库位" @confirm="" style="height: 30rpx; border: 1px solid #fff"></uni-combox> <uni-combox :candidates="fromLocationList" v-model="fromLocationCode" placeholder="请扫描来源库位" @confirm="handleConfirm" style="height: 30rpx; border: 1px solid #fff"></uni-combox>
</view> </view>
<view v-else> <view v-else>
<text style="padding: 5px"> <text style="padding: 5px">
@ -108,6 +108,10 @@ const balanceSelectRef = ref()
const comscan = ref() const comscan = ref()
const comMessageRef = ref() const comMessageRef = ref()
const location = ref() const location = ref()
const handleConfirm = () => {
emit('confirm', fromLocationCode.value)
}
// //
const openScanPopupForType = (fromLocationCodeParams, businessTypeParams) => { const openScanPopupForType = (fromLocationCodeParams, businessTypeParams) => {
businessType.value = businessTypeParams businessType.value = businessTypeParams
@ -120,9 +124,11 @@ const openScanPopupForType = (fromLocationCodeParams, businessTypeParams) => {
fromInventoryStatuses.value = getDirectoryItemArray(businessType.value.outInventoryStatuses) fromInventoryStatuses.value = getDirectoryItemArray(businessType.value.outInventoryStatuses)
inventoryStatus.value = getDirectoryItemArray(businessType.value.outInventoryStatuses) // inventoryStatus.value = getDirectoryItemArray(businessType.value.outInventoryStatuses) //
fromLocationAreaTypeList.value = getDirectoryItemArray(businessType.value.fromLocationAreaTypeList) // fromLocationAreaTypeList.value = getDirectoryItemArray(businessType.value.fromLocationAreaTypeList) //
setTimeout((res) => { if (!show.value) {
show.value = true setTimeout((res) => {
}, 500) show.value = true
}, 500)
}
} }
// //
@ -426,7 +432,7 @@ const addLocationCode = (code) => {
} }
} }
// //
const emit = defineEmits(['close', 'getCountScanResult', 'getResult']) const emit = defineEmits(['close', 'getCountScanResult', 'getResult', 'confirm'])
defineExpose({ openScanPopupForType, openScanPopupForJob, packGetFocus, packLoseFocus, closeScanPopup }) defineExpose({ openScanPopupForType, openScanPopupForJob, packGetFocus, packLoseFocus, closeScanPopup })
</script> </script>

1
src/pages.json

@ -2074,6 +2074,7 @@
} }
}, },
{ {
"path": "pages/check/checkFgLabel",
"style": { "style": {
"navigationBarTitleText": "标签成品标签", "navigationBarTitleText": "标签成品标签",
"enablePullDownRefresh": false "enablePullDownRefresh": false

20
src/pages/package/record/overPackageRecord.vue

@ -53,7 +53,7 @@
<win-scan-button @goScan="openScanPopup"></win-scan-button> <win-scan-button @goScan="openScanPopup"></win-scan-button>
</view> </view>
<win-scan-pack-and-location ref="scanPopup" @getResult="getScanResult" :allowModifyLocation="false"> </win-scan-pack-and-location> <win-scan-pack-and-location ref="scanPopup" @getResult="getScanResult" :allowModifyLocation="true" @confirm="handleConfirm"> </win-scan-pack-and-location>
<win-scan-location ref="scanLocationCode" title="来源库位" @getLocation="getLocation" :locationAreaTypeList="fromLocationAreaTypeList"></win-scan-location> <win-scan-location ref="scanLocationCode" title="来源库位" @getLocation="getLocation" :locationAreaTypeList="fromLocationAreaTypeList"></win-scan-location>
<com-message ref="comMessageRef" /> <com-message ref="comMessageRef" />
</view> </view>
@ -106,7 +106,7 @@ const scanPopup = ref()
const scanLocationCode = ref() const scanLocationCode = ref()
const toPackUnit = ref() const toPackUnit = ref()
const comMessageRef = ref() const comMessageRef = ref()
onLoad((option) => { onShow(() => {
const typeCode = 'OverPackage' const typeCode = 'OverPackage'
getBusinessType(typeCode, (res) => { getBusinessType(typeCode, (res) => {
if (res.success) { if (res.success) {
@ -164,7 +164,10 @@ const confirmSelect = (e) => {
toPackQty.value = pack.packQty toPackQty.value = pack.packQty
toPackUnitShow.value = e[0].label toPackUnitShow.value = e[0].label
} }
//
const handleConfirm = (fromLocationCode) => {
scanLocationCode.value.openScanPopupSimulate(fromLocationCode)
}
const getScanResult = (result) => { const getScanResult = (result) => {
const { balance } = result const { balance } = result
const { label } = result const { label } = result
@ -237,7 +240,13 @@ const openScanPopup = () => {
const showFromLocationPopup = () => { const showFromLocationPopup = () => {
nextTick(() => { nextTick(() => {
scanLocationCode.value.openScanPopup() const overPackageRecord = uni.getStorageSync('overPackageRecord')
if (overPackageRecord) {
scanLocationCode.value.openScanPopupSimulate(overPackageRecord)
} else {
scanLocationCode.value.openScanPopup()
}
}) })
} }
@ -372,6 +381,9 @@ const closeScanMessage = () => {
scanPopupGetFocus() scanPopupGetFocus()
} }
const getLocation = (location, code) => { const getLocation = (location, code) => {
if (code) {
uni.setStorageSync('overPackageRecord', code)
}
getFromLocationCode(location, code) getFromLocationCode(location, code)
} }
const getFromLocationCode = (location, code) => { const getFromLocationCode = (location, code) => {

147
src/pages/pointPutawayJob/index.vue

@ -2,22 +2,28 @@
<view class="content" style="padding: 30rpx 20rpx 100rpx; min-height: calc(100vh - 120rpx)"> <view class="content" style="padding: 30rpx 20rpx 100rpx; min-height: calc(100vh - 120rpx)">
<com-empty-view v-if="data.length == 0"></com-empty-view> <com-empty-view v-if="data.length == 0"></com-empty-view>
<!-- 只用于展示页面 --> <!-- 只用于展示页面 -->
<view class="box" style="margin-bottom: 20rpx"> <view class="box" style="margin-bottom: 20rpx" v-for="(item, index) in data.sublist" :key="index">
<view class="top"> <view class="top">
<view class="mb-kw"> <view class="mb-kw">
目标库位<text>{{ data.toLocationCode }}</text> 目标库位<view>{{ item.toLocationCode }}</view>
</view> </view>
<view class="mb-text"> <view class="mb-bo">
任务编号<text>{{ data.number }}</text> <view class="mb-left">
</view> <view class="mb-text">
<view class="mb-text"> 物料号<view>{{ item.itemCode }}</view>
创建人<text>{{ data.creator || '' }}</text> </view>
</view> <view class="mb-text">
<view class="mb-text"> 托包装号<view>{{ item.packingNumber }}</view>
创建时间<text>{{ formatDate(data.createTime) }}</text> </view>
</view>
<view class="mb-right">
<view class="mb-text">
数量<view>{{ item.packQty }}</view>
</view>
</view>
</view> </view>
</view> </view>
<u-table style="margin-top: 20rpx"> <!-- <u-table style="margin-top: 20rpx">
<u-tr> <u-tr>
<u-th>物品代码</u-th> <u-th>物品代码</u-th>
<u-th>物品描述</u-th> <u-th>物品描述</u-th>
@ -36,7 +42,7 @@
<u-td>{{ cur.qty }}</u-td> <u-td>{{ cur.qty }}</u-td>
<u-td>{{ cur.uom }}</u-td> <u-td>{{ cur.uom }}</u-td>
</u-tr> </u-tr>
</u-table> </u-table> -->
</view> </view>
<view class="" style="position: fixed; width: 100%; bottom: 0rpx; left: 0px"> <view class="" style="position: fixed; width: 100%; bottom: 0rpx; left: 0px">
<button @click="printImage" style="background: rgb(60, 156, 255) !important ; color: white; margin-top: 80rpx">打印</button> <button @click="printImage" style="background: rgb(60, 156, 255) !important ; color: white; margin-top: 80rpx">打印</button>
@ -178,52 +184,30 @@ export default {
let str = '' let str = ''
this.readFile(htmlFileUrl, (htmlContent) => { this.readFile(htmlFileUrl, (htmlContent) => {
this.newHtmlContent = htmlContent this.newHtmlContent = htmlContent
// this.data.forEach(item => { this.data.sublist.forEach((item) => {
str += `<div class="box" style="page-break-before:always;"><br /> str += `<div class="box" style="page-break-before:always;" ><br />
<div class="top"> <div class="top">
<div class="mb-kw"> <div class="mb-kw">
目标库位<span>${this.data.toLocationCode}</span> 目标库位<div>${item.toLocationCode}</div>
</div> </div>
<div class="mb-text"> <div class="mb-bo">
任务编号<span>${this.data.number}</span> <div class="mb-left">
</div> <div class="mb-text">
<div class="mb-text"> 物料号<div>${item.itemCode}</div>
创建人<span>${this.data.creator}</span> </div>
</div> <div class="mb-text">
<div class="mb-text"> 托包装号<div>${item.packingNumber}</div>
创建时间<span>${this.formatDate(this.data.createTime)}</span> </div>
</div> </div>
</div> <div class="mb-right">
<table style="margin-top: 20rpx;" style='border-collapse: collapse;'> <div class="mb-text">
<tr> 数量<div>${item.packQty}</div>
<th>物品代码</th> </div>
<th>物品描述</th> </div>
<th>批次</th> </div>
<th>包装号</th> </div>
<th>包装规格</th> `
<th>数量</th>
<th>计量单位</th>
<tr>
tableTrTd
</table>
<div>
`
let str1 = ''
this.data.sublist.forEach((cur, key) => {
str1 += `
<tr>
<td>${cur.itemCode}</td>
<td>${cur.itemDesc1}</td>
<td>${cur.batch}</td>
<td>${cur.packingNumber}</td>
<td>${cur.packUnit}</td>
<td>${cur.qty}</td>
<td>${cur.uom}</td>
</tr>
`
}) })
str = str.replace('tableTrTd', str1)
// })
this.newHtmlContent = this.newHtmlContent.replace('mainBody', str) // this.newHtmlContent = this.newHtmlContent.replace('mainBody', str) //
}) })
}) })
@ -235,7 +219,7 @@ export default {
.box { .box {
font-size: 26rpx; font-size: 26rpx;
/* display: flex; */ /* display: flex; */
padding: 20rpx; /* padding: 20rpx; */
border: 1px solid #dedede; border: 1px solid #dedede;
} }
@ -292,25 +276,46 @@ export default {
.mb-kw { .mb-kw {
border-bottom: 1px solid #dedede; border-bottom: 1px solid #dedede;
padding-bottom: 20rpx; padding: 20rpx;
font-size: 30rpx;
} }
.mb-kw text { .mb-kw view {
font-weight: bold;
font-size: 46rpx;
text-align: center;
}
.mb-bo {
display: flex;
}
.mb-bo .mb-left {
flex: 1;
}
.mb-bo .mb-left .mb-text {
padding: 20rpx;
}
.mb-bo .mb-left .mb-text:nth-child(1) {
border-bottom: 1px solid #dedede;
}
.mb-bo .mb-left .mb-text view {
font-weight: bold; font-weight: bold;
font-size: 32rpx; font-size: 32rpx;
text-align: center;
} }
.mb-bo .mb-right {
.mb-text { padding: 20rpx;
margin-top: 10rpx; width: 260rpx;
border-left: 1px solid #dedede;
display: flex;
align-items: center;
} }
.mb-bo .mb-right .mb-text {
::v-deep .u-th { width: 100%;
font-size: 24rpx !important;
} }
.mb-bo .mb-right .mb-text view {
::v-deep .u-td { font-weight: bold;
height: auto !important; font-size: 40rpx;
font-size: 24rpx !important; text-align: center;
word-break: break-all; width: 100%;
} }
</style> </style>

42
src/plugins/storage.js

@ -0,0 +1,42 @@
export default {
// 获取本地存储对应key
getStorage(key){
return uni.getStorageSync( key );
},
// 设置本地存储对应key
setStorage(key,value){
return uni.setStorageSync( key,value );
},
// 清除全部本地存储
clearStorage (){
const overPackageRecordPointParams = ''
if( uni.getStorageSync('overPackageRecordPointParams')){
overPackageRecordPointParams = uni.getStorageSync('overPackageRecordPointParams')
}
const overPackageJobDetailPointParams = ''
if( uni.getStorageSync('overPackageJobDetailPointParams')){
overPackageJobDetailPointParams = uni.getStorageSync('overPackageJobDetailPointParams')
}
uni.clearStorageSync();
if(overPackageRecordPointParams){
uni.setStorageSync('overPackageRecordPointParams',overPackageRecordPointParams)
}
if(overPackageJobDetailPointParams){
uni.setStorageSync('overPackageJobDetailPointParams',overPackageJobDetailPointParams)
}
},
// 清除指定key本地存储
removeStorage ( key ){
uni.removeStorageSync( key );
},
// 关闭当前页面,返回上一页面或多级页面
constant:{
id:"id",
token:"token",
avatar: 'avatar',
name: 'name',
roles: 'roles',
permissions: 'permissions'
}
}

2
src/store/modules/countStore.ts

@ -1,4 +1,5 @@
import { defineStore } from 'pinia' import { defineStore } from 'pinia'
import * as storage from '@/plugins/storage.js'
import { import {
login, login,
logout, logout,
@ -110,6 +111,7 @@ const useStore = defineStore('storeId', {
this.post = '' this.post = ''
this.dept = '' this.dept = ''
removeToken() removeToken()
storage.clearStorage()
resolve(res) resolve(res)
}).catch(error => { }).catch(error => {
reject(error) reject(error)

Loading…
Cancel
Save