Browse Source

Merge branch 'master_hella' of http://dev.ccwin-in.com:3000/sfms3.0/sfms3.0-uniapp into master_hella

hella_online_20240829
niexiting 2 months ago
parent
commit
08a08b6975
  1. 2
      src/pages/count/job/fuzzyCountJob.vue
  2. 374
      src/pages/point/index.vue

2
src/pages/count/job/fuzzyCountJob.vue

@ -21,7 +21,7 @@
<uni-load-more :status="loadingType" />
</view>
<win-scan-button @goScan='openScanPopup' v-if="jobList.length>0"></win-scan-button>
<win-scan-button @goScan='openScanPopup' v-if="false"></win-scan-button>
<winScanPackJob title="库位" ref="scanPopup" @getResult='getScanResult'>
</winScanPackJob>
<jobList ref="jobList" @selectItem="selectItem"></jobList>

374
src/pages/point/index.vue

@ -39,7 +39,8 @@
</view>
<view class="right">
<view class="image">
<l-qrcode ref="qrcodeRef" :value="item.barcodeString" size="300rpx"></l-qrcode>
<l-qrcode ref="qrcodeRef" useCanvasToTempFilePath @success="success" :value="item.barcodeString"
size="300rpx"></l-qrcode>
</view>
<view class="left-item">
<view class="label">批次</view>
@ -81,153 +82,151 @@
name: 'point',
data() {
return {
timer:null,
originData:[],
timer: null,
originData: [],
data: [],
newHtmlContent: '', //html
isLoadFinish: false,
picIndex: 0,
picUrl: []
}
},
methods: {
// qrcodeRef
forEachQrcodeRef(el,index,elLength,wait) {
let _this = this
console.log('11111111111111');
console.log(index);
if (index == elLength) {
console.log('99999999');
return;
success(img) {
this.picUrl.push(img)
this.picIndex++
if (this.picIndex == this.data.length) {
this.isLoadFinish = true;
uni.hideLoading()
}
const item = el[index];
setTimeout(() => {
console.log(el[index]);
console.log(item.canvasToTempFilePath);
// try{
item.canvasToTempFilePath({
success: (res) => {
console.log(res);
// base64
pathToBase64(res.tempFilePath).then(base64 => {
console.log(res.tempFilePath);
_this.data[index].barcodeBase64 = base64
if (index == elLength - 1) {
_this.isLoadFinish = true
uni.hideLoading();
}else {
console.log(index);
}
this.forEachQrcodeRef(el,index+1,el.length,100)
}).catch(err => {
console.log(err);
this.forEachQrcodeRef(el,index+1,el.length,100)
})
},
fail(err) {
console.log(err)
}
})
// }catch(e){
// console.log(e)
// //TODO handle the exception
// // this.forEachQrcodeRef(el,index,el.length)
// }
},wait);
},
// stringToBase64(str) {
// console.log('999999999999999');
// console.log(str);
// //
// // var encodeUTF8 = uni.getSystemInfoSync().platform === 'android' ? 'utf-8' : 'utf8';
// // console.log('8888888888888');
// // var utf8Str = uni.encode(str, encodeUTF8);
// // console.log(utf8Str); data
// // utf8base64
// var base64Str = btoa(str);
// console.log(base64Str);
// return base64Str;
// },
// getQrCodeBase64(index) {
// let _this = this
// // 使setTimeoutDOMcanvas
// setTimeout(() => {
// const qrcodeCanvas = this.$refs.qrcodeRef.$el.querySelector('canvas');
// if (qrcodeCanvas) {
// // canvasBase64URL
// _this.data[index].barcodeBase64 = qrcodeCanvas.toDataURL('image/png');
// } else {
// console.log('xxxxxxxxxxxxxxxxx')
// }
// }, 0);
// },
getListData(){
//
// 线 线
// this.data = [{
// itemCode:'065.051-01M', //
// itemName: 'PCCLARNATEA1225BLACK9999', //
// packName: '',//
// packageCode: 'PS0513-000003', //
// batch:'20240514',//
// parentNumber:'PS0513-000003',//
// itemType:'',//
// asnNumber:'123232',//ASN
// supplierCode: 'Fewewq', //
// qty: '100', //
// printTimes:'2019-09-09 09:09:00', //
// barcodeString: 'HMQ;V1.0;Dwork1-line1;F;R2024-04-03T08:28:41;B20240403;PPN0403-000005;I399.960-12;Q5.000000;UEA;',
// barcodeBase64: '',
// productionLineCode:''//线
// }]
let _this = this
// this.$nextTick(async () => {
//
const el = _this.$refs['qrcodeRef']
_this.forEachQrcodeRef(el,0,el.length,5000);
// // })
// let _this = this
// this.$nextTick(async () => {
// //
// const el = _this.$refs['qrcodeRef']
// let str = ''
// el.forEach(async (item, index) => {
// await item.canvasToTempFilePath({
// success: async (res) => {
// // base64
// await pathToBase64(res.tempFilePath).then(base64 => {
// _this.data[index].barcodeBase64 = base64
// if (index == el.length - 1) {
// _this.isLoadFinish = true
// uni.hideLoading();
// }else {
// console.log(index);
// }
// }).catch(err => {
// console.log(err);
// })
// },
// fail(err) {
// console.log('err:::', err)
// }
// })
setHtmlData() {
let str = ''
this.readFile(htmlFileUrl, (htmlContent) => {
this.newHtmlContent = htmlContent
this.data.forEach(item => {
str += `<div class="box" style="page-break-before:always;"><br />
<div class="left">
<div class="left-item">
<div class="label">物品代码</div>
<div class="value bold-font" id="name1">${item.itemCode}</div>
</div>
<div class="left-item">
<div class="label">物品名称</div>
<div class="value" id="name2">${item.itemName}</div>
</div>
<div class="left-item">
<div class="label">包装名称</div>
<div class="value">${item.packName}</div>
</div>
<div class="left-item">
<div class="label">包装号</div>
<div class="value">${item.packageCode}</div>
</div>`
if (item.productionLineCode && item.productionLineCode.length > 0) {
str += `
<div class="left-item">
<div class="label">生产线</div>
<div class="value">${item.productionLineCode}</div>
</div>
`
} else {
str += `
<div class="left-item">
<div class="label">父包装号</div>
<div class="value">${item.parentNumber}</div>
</div>
<div class="left-item">
<div class="label">ASN</div>
<div class="value">${item.asnNumber}</div>
</div>
`
}
str += `
<div class="left-item">
<div class="label">数量</div>
<div class="value bold-font">${item.qty}</div>
</div>
</div>
<div class="right">
<div class="image">
<img id='image1' src="${item.barcodeBase64}" alt="" />
</div>
<div class="left-item">
<div class="label">批次</div>
<div class="value">${item.batch}</div>
</div>
<div class="left-item">
<div class="label">物料类型</div>
<div class="value">${item.itemType}</div>
</div>`
if (!(item.productionLineCode && item.productionLineCode.length > 0)) {
str += `
<div class="left-item">
<div class="label">供应商</div>
<div class="value">${item.supplierCode}</div>
</div>
`
}
str += `
// })
<div class="left-item">
<div class="label">打印时间</div>
<div class="value">${item.printTimes}</div>
</div>
</div>
</div>`
})
this.newHtmlContent = this.newHtmlContent.replace(
"mainBody", str); //
});
},
// })
generateBase64(index) {
// })
//
if (index == this.picUrl.length) {
this.setHtmlData()
let clearInt = setInterval(() => {
if (!this.newHtmlContent.mainBody) {
// #ifdef APP
testModule.doHTMLPrint(this.newHtmlContent)
// #endif
clearInterval(clearInt)
uni.hideLoading()
}
}, 1000)
} else {
var url = this.picUrl[index]
// #ifdef APP
plus.io.resolveLocalFileSystemURL(url, (entry) => {
// entrytest.html
entry.file((file) => {
let fileReader = new plus.io.FileReader();
fileReader.onloadend = (evt) => {
console.log("文件路径" + evt.target.result)
this.data[index].barcodeBase64 = evt.target.result
this.generateBase64(index + 1)
}
fileReader.readAsDataURL(file);
});
}, (e) => {
console.log("失败" + e)
});
// #endif
}
},
// #ifdef APP
//
printImage() {
testModule.doHTMLPrint(this.newHtmlContent)
uni.showLoading({
title: "加载中",
mask: true
})
this.generateBase64(0)
},
// #ifdef APP
// html
readFile(path, callback) {
plus.io.resolveLocalFileSystemURL(path, function(entry) {
@ -246,95 +245,7 @@
}
// #endif
},
watch: {
isLoadFinish(newVal, oldVal) {
if (newVal == true) {
// html
let str = ''
// #ifdef APP
this.readFile(htmlFileUrl, (htmlContent) => {
this.newHtmlContent = htmlContent
this.data.forEach(item => {
str += `<div class="box" style="page-break-before:always;"><br />
<div class="left">
<div class="left-item">
<div class="label">物品代码</div>
<div class="value bold-font" id="name1">${item.itemCode}</div>
</div>
<div class="left-item">
<div class="label">物品名称</div>
<div class="value" id="name2">${item.itemName}</div>
</div>
<div class="left-item">
<div class="label">包装名称</div>
<div class="value">${item.packName}</div>
</div>
<div class="left-item">
<div class="label">包装号</div>
<div class="value">${item.packageCode}</div>
</div>`
if(item.productionLineCode&&item.productionLineCode.length>0){
str += `
<div class="left-item">
<div class="label">生产线</div>
<div class="value">${item.productionLineCode}</div>
</div>
`
}else{
str += `
<div class="left-item">
<div class="label">父包装号</div>
<div class="value">${item.parentNumber}</div>
</div>
<div class="left-item">
<div class="label">ASN</div>
<div class="value">${item.asnNumber}</div>
</div>
`
}
str += `
<div class="left-item">
<div class="label">数量</div>
<div class="value bold-font">${item.qty}</div>
</div>
</div>
<div class="right">
<div class="image">
<img id='image1' src="${item.barcodeBase64}" alt="" />
</div>
<div class="left-item">
<div class="label">批次</div>
<div class="value">${item.batch}</div>
</div>
<div class="left-item">
<div class="label">物料类型</div>
<div class="value">${item.itemType}</div>
</div>`
if(!(item.productionLineCode&&item.productionLineCode.length>0)){
str += `
<div class="left-item">
<div class="label">供应商</div>
<div class="value">${item.supplierCode}</div>
</div>
`
}
str += `
<div class="left-item">
<div class="label">打印时间</div>
<div class="value">${item.printTimes}</div>
</div>
</div>
</div>`
})
this.newHtmlContent = this.newHtmlContent.replace(
"mainBody", str); //
// console.log(this.newHtmlContent)
});
// #endif
}
}
},
onLoad(option) {
uni.showLoading({
title: '加载中...',
@ -343,25 +254,7 @@
if (option.points) {
this.originData = JSON.parse(option.points);
}
},
unmounted() {
if(this.timer){
clearTimeout(this.timer)
this.timer = null
}
},
onShow() {
this.timer = setTimeout(()=>{
if(this.timer){
clearTimeout(this.timer)
this.timer = null
}
this.data = this.originData
console.log(287,'11111111')
this.$nextTick(()=> {
this.getListData()
})
},1000)
this.data = this.originData
},
}
</script>
@ -391,7 +284,8 @@
height: 100rpx;
line-height: 100rpx;
}
.bold-font{
.bold-font {
font-weight: bold;
font-size: 28rpx;
}

Loading…
Cancel
Save