|
@ -1,178 +1,185 @@ |
|
|
<template> |
|
|
<template> |
|
|
<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"> |
|
|
<view class="top"> |
|
|
<view class="top"> |
|
|
<view class="mb-kw"> |
|
|
<view class="mb-kw"> |
|
|
目标库位:<text>{{data.toLocationCode}}</text> |
|
|
目标库位:<text>{{ data.toLocationCode }}</text> |
|
|
</view> |
|
|
</view> |
|
|
<view class="mb-text"> |
|
|
<view class="mb-text"> |
|
|
任务编号:<text>{{data.number}}</text> |
|
|
任务编号:<text>{{ data.number }}</text> |
|
|
</view> |
|
|
</view> |
|
|
<view class="mb-text"> |
|
|
<view class="mb-text"> |
|
|
创建人:<text>{{data.creator||''}}</text> |
|
|
创建人:<text>{{ data.creator || '' }}</text> |
|
|
</view> |
|
|
</view> |
|
|
<view class="mb-text"> |
|
|
<view class="mb-text"> |
|
|
创建时间:<text>{{data.createTime}}</text> |
|
|
创建时间:<text>{{ formatDate(data.createTime) }}</text> |
|
|
</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> |
|
|
<u-th>批次</u-th> |
|
|
<u-th>批次</u-th> |
|
|
<u-th>包装号</u-th> |
|
|
<u-th>包装号</u-th> |
|
|
<u-th>包装规格</u-th> |
|
|
<u-th>包装规格</u-th> |
|
|
<u-th>数量</u-th> |
|
|
<u-th>数量</u-th> |
|
|
<u-th>计量单位</u-th> |
|
|
<u-th>计量单位</u-th> |
|
|
</u-tr> |
|
|
</u-tr> |
|
|
<u-tr v-for="(cur,key) in data.sublist" :key='key'> |
|
|
<u-tr v-for="(cur, key) in data.sublist" :key="key"> |
|
|
<u-td>{{cur.itemCode}}</u-td> |
|
|
<u-td>{{ cur.itemCode }}</u-td> |
|
|
<u-td>{{cur.itemDesc1}}</u-td> |
|
|
<u-td>{{ cur.itemDesc1 }}</u-td> |
|
|
<u-td>{{cur.batch}}</u-td> |
|
|
<u-td>{{ cur.batch }}</u-td> |
|
|
<u-td>{{cur.packingNumber}}</u-td> |
|
|
<u-td>{{ cur.packingNumber }}</u-td> |
|
|
<u-td>{{cur.packUnit}}</u-td> |
|
|
<u-td>{{ cur.packUnit }}</u-td> |
|
|
<u-td>{{cur.packQty}}</u-td> |
|
|
<u-td>{{ cur.packQty }}</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" |
|
|
<button @click="printImage" style="background: rgb(60, 156, 255) !important ; color: white; margin-top: 80rpx">打印</button> |
|
|
style='background:rgb(60, 156, 255) !important ;color: white;margin-top: 80rpx;'> 打印</button> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
|
|
|
|
|
|
</view> |
|
|
|
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script> |
|
|
<script> |
|
|
import { |
|
|
import { getJimuPutawayJobDetail } from '@/api/request2.js' |
|
|
getJimuPutawayJobDetail |
|
|
import { dateFormat } from '@/common/basic.js' |
|
|
} from '@/api/request2.js'; |
|
|
// 打印页面的模板 |
|
|
// 打印页面的模板 |
|
|
const htmlFileUrl = '/hybrid/html/pointPutawayJob.html' |
|
|
const htmlFileUrl = '/hybrid/html/pointPutawayJob.html'; |
|
|
// #ifdef APP |
|
|
// #ifdef APP |
|
|
const testModule = uni.requireNativePlugin('TestModule') |
|
|
var testModule = uni.requireNativePlugin("TestModule") |
|
|
// #endif |
|
|
// #endif |
|
|
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
|
|
name: 'pointPutawayJob', |
|
|
|
|
|
data() { |
|
|
|
|
|
return { |
|
|
|
|
|
data: { |
|
|
|
|
|
sublist:[] |
|
|
|
|
|
}, |
|
|
|
|
|
newHtmlContent: '', //打印传入的html |
|
|
|
|
|
isLoadFinish: false, |
|
|
|
|
|
ids:'' |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
methods: { |
|
|
|
|
|
// #ifdef APP |
|
|
|
|
|
// 打印 |
|
|
|
|
|
printImage() { |
|
|
|
|
|
testModule.doHTMLPrint(this.newHtmlContent) |
|
|
|
|
|
}, |
|
|
|
|
|
// 读取html文件 |
|
|
|
|
|
readFile(path, callback) { |
|
|
|
|
|
plus.io.resolveLocalFileSystemURL(path, function(entry) { |
|
|
|
|
|
entry.file(function(file) { |
|
|
|
|
|
var reader = new plus.io.FileReader(); |
|
|
|
|
|
reader.onloadend = function(e) { |
|
|
|
|
|
callback(e.target.result); |
|
|
|
|
|
}; |
|
|
|
|
|
reader.readAsText(file); |
|
|
|
|
|
}, function(e) { |
|
|
|
|
|
console.log("读取文件失败:" + e.message); |
|
|
|
|
|
}); |
|
|
|
|
|
}, function(e) { |
|
|
|
|
|
console.log("获取图片资源失败:" + e.message); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
// #endif |
|
|
|
|
|
}, |
|
|
|
|
|
watch: { |
|
|
|
|
|
isLoadFinish: { |
|
|
|
|
|
handler(newVal, oldVal) { |
|
|
|
|
|
if (newVal == true) { |
|
|
|
|
|
// 读取html文件将文件中的内容图换成当前页面的数据 |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
export default { |
|
|
}, |
|
|
name: 'pointPutawayJob', |
|
|
immediate: true |
|
|
data() { |
|
|
|
|
|
return { |
|
|
|
|
|
data: { |
|
|
|
|
|
sublist: [] |
|
|
|
|
|
}, |
|
|
|
|
|
newHtmlContent: '', // 打印传入的html |
|
|
|
|
|
isLoadFinish: false, |
|
|
|
|
|
ids: '' |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
} |
|
|
methods: { |
|
|
}, |
|
|
// #ifdef APP |
|
|
|
|
|
// 打印 |
|
|
|
|
|
printImage() { |
|
|
|
|
|
testModule.doHTMLPrint(this.newHtmlContent) |
|
|
|
|
|
}, |
|
|
|
|
|
// 读取html文件 |
|
|
|
|
|
readFile(path, callback) { |
|
|
|
|
|
plus.io.resolveLocalFileSystemURL( |
|
|
|
|
|
path, |
|
|
|
|
|
function (entry) { |
|
|
|
|
|
entry.file( |
|
|
|
|
|
function (file) { |
|
|
|
|
|
const reader = new plus.io.FileReader() |
|
|
|
|
|
reader.onloadend = function (e) { |
|
|
|
|
|
callback(e.target.result) |
|
|
|
|
|
} |
|
|
|
|
|
reader.readAsText(file) |
|
|
|
|
|
}, |
|
|
|
|
|
function (e) { |
|
|
|
|
|
console.log(`读取文件失败:${e.message}`) |
|
|
|
|
|
} |
|
|
|
|
|
) |
|
|
|
|
|
}, |
|
|
|
|
|
function (e) { |
|
|
|
|
|
console.log(`获取图片资源失败:${e.message}`) |
|
|
|
|
|
} |
|
|
|
|
|
) |
|
|
|
|
|
}, |
|
|
|
|
|
// #endif |
|
|
|
|
|
formatDate(val) { |
|
|
|
|
|
return dateFormat(val) |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
watch: { |
|
|
|
|
|
isLoadFinish: { |
|
|
|
|
|
handler(newVal, oldVal) { |
|
|
|
|
|
if (newVal == true) { |
|
|
|
|
|
// 读取html文件将文件中的内容图换成当前页面的数据 |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
immediate: true |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
onLoad(option) { |
|
|
onLoad(option) { |
|
|
if (option.data) { |
|
|
if (option.data) { |
|
|
this.data = JSON.parse(decodeURIComponent(option.data)); |
|
|
this.data = JSON.parse(decodeURIComponent(option.data)) |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
async onShow() { |
|
|
async onShow() { |
|
|
await getJimuPutawayJobDetail(this.data.ids).then(res=>{ |
|
|
await getJimuPutawayJobDetail({ |
|
|
this.data.sublist = res.data |
|
|
masterIds: this.data.ids |
|
|
}) |
|
|
}).then((res) => { |
|
|
// 获取数据 |
|
|
this.data.sublist = res.data |
|
|
// this.data = [{ |
|
|
}) |
|
|
// toLocationCode: 'C13-12-11', |
|
|
// 获取数据 |
|
|
// jobNumber: '555555', |
|
|
// this.data = [{ |
|
|
// creator: '就是我', |
|
|
// toLocationCode: 'C13-12-11', |
|
|
// createTime: '2019-12-12 05:00:00', |
|
|
// jobNumber: '555555', |
|
|
// sublist: [{ |
|
|
// creator: '就是我', |
|
|
// itemNumber: '66', |
|
|
// createTime: '2019-12-12 05:00:00', |
|
|
// itemDes: 'hahah', |
|
|
// sublist: [{ |
|
|
// batch: '201450513', |
|
|
// itemNumber: '66', |
|
|
// packingNumber: '201450513', |
|
|
// itemDes: 'hahah', |
|
|
// packUnit: '201450513', |
|
|
// batch: '201450513', |
|
|
// packQty: '40', |
|
|
// packingNumber: '201450513', |
|
|
// uom: '张' |
|
|
// packUnit: '201450513', |
|
|
// },{ |
|
|
// packQty: '40', |
|
|
// itemNumber: '77', |
|
|
// uom: '张' |
|
|
// itemDes: '8888', |
|
|
// },{ |
|
|
// batch: '201450513', |
|
|
// itemNumber: '77', |
|
|
// packingNumber: '201450513', |
|
|
// itemDes: '8888', |
|
|
// packUnit: '201450513', |
|
|
// batch: '201450513', |
|
|
// packQty: '40', |
|
|
// packingNumber: '201450513', |
|
|
// uom: '张' |
|
|
// packUnit: '201450513', |
|
|
// }] |
|
|
// packQty: '40', |
|
|
// }, { |
|
|
// uom: '张' |
|
|
// toLocationCode: 'C13-12-11', |
|
|
// }] |
|
|
// jobNumber: '555555', |
|
|
// }, { |
|
|
// creator: '就是我', |
|
|
// toLocationCode: 'C13-12-11', |
|
|
// createTime: '2019-12-12 05:00:00', |
|
|
// jobNumber: '555555', |
|
|
// sublist: [{ |
|
|
// creator: '就是我', |
|
|
// itemNumber: '66', |
|
|
// createTime: '2019-12-12 05:00:00', |
|
|
// itemDes: 'hahah', |
|
|
// sublist: [{ |
|
|
// batch: '201450513', |
|
|
// itemNumber: '66', |
|
|
// packingNumber: '', |
|
|
// itemDes: 'hahah', |
|
|
// packUnit: '', |
|
|
// batch: '201450513', |
|
|
// packQty: '', |
|
|
// packingNumber: '', |
|
|
// uom: '' |
|
|
// packUnit: '', |
|
|
// }] |
|
|
// packQty: '', |
|
|
// }, { |
|
|
// uom: '' |
|
|
// toLocationCode: 'C13-12-11', |
|
|
// }] |
|
|
// jobNumber: '555555', |
|
|
// }, { |
|
|
// creator: '就是我', |
|
|
// toLocationCode: 'C13-12-11', |
|
|
// createTime: '2019-12-12 05:00:00', |
|
|
// jobNumber: '555555', |
|
|
// sublist: [{ |
|
|
// creator: '就是我', |
|
|
// itemNumber: '66', |
|
|
// createTime: '2019-12-12 05:00:00', |
|
|
// itemDes: 'hahah', |
|
|
// sublist: [{ |
|
|
// batch: '201450513', |
|
|
// itemNumber: '66', |
|
|
// packingNumber: '', |
|
|
// itemDes: 'hahah', |
|
|
// packUnit: '', |
|
|
// batch: '201450513', |
|
|
// packQty: '', |
|
|
// packingNumber: '', |
|
|
// uom: '' |
|
|
// packUnit: '', |
|
|
// }] |
|
|
// packQty: '', |
|
|
// }] |
|
|
// uom: '' |
|
|
this.$nextTick(async () => { |
|
|
// }] |
|
|
let str = '' |
|
|
// }] |
|
|
this.readFile(htmlFileUrl, (htmlContent) => { |
|
|
this.$nextTick(async () => { |
|
|
this.newHtmlContent = htmlContent |
|
|
let str = '' |
|
|
// this.data.forEach(item => { |
|
|
this.readFile(htmlFileUrl, (htmlContent) => { |
|
|
str += `<div class="box" style="page-break-before:always;"><br /> |
|
|
this.newHtmlContent = htmlContent |
|
|
|
|
|
// this.data.forEach(item => { |
|
|
|
|
|
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> |
|
|
目标库位:<span>${this.data.toLocationCode}</span> |
|
@ -184,8 +191,8 @@ |
|
|
创建人:<span>${this.data.creator}</span> |
|
|
创建人:<span>${this.data.creator}</span> |
|
|
</div> |
|
|
</div> |
|
|
<div class="mb-text"> |
|
|
<div class="mb-text"> |
|
|
创建时间:<span>${this.data.createTime}</span> |
|
|
创建时间:<span>${this.formatDate(this.data.createTime)}</span> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
<table style="margin-top: 20rpx;" style='border-collapse: collapse;'> |
|
|
<table style="margin-top: 20rpx;" style='border-collapse: collapse;'> |
|
|
<tr> |
|
|
<tr> |
|
@ -201,9 +208,9 @@ |
|
|
</table> |
|
|
</table> |
|
|
<div> |
|
|
<div> |
|
|
` |
|
|
` |
|
|
let str1 = '' |
|
|
let str1 = '' |
|
|
this.data.sublist.forEach((cur, key) => { |
|
|
this.data.sublist.forEach((cur, key) => { |
|
|
str1 += ` |
|
|
str1 += ` |
|
|
<tr> |
|
|
<tr> |
|
|
<td>${cur.itemCode}</td> |
|
|
<td>${cur.itemCode}</td> |
|
|
<td>${cur.itemDesc1}</td> |
|
|
<td>${cur.itemDesc1}</td> |
|
@ -214,103 +221,96 @@ |
|
|
<td>${cur.uom}</td> |
|
|
<td>${cur.uom}</td> |
|
|
</tr> |
|
|
</tr> |
|
|
` |
|
|
` |
|
|
}) |
|
|
}) |
|
|
str = str.replace( |
|
|
str = str.replace('tableTrTd', str1) |
|
|
"tableTrTd", str1) |
|
|
// }) |
|
|
// }) |
|
|
this.newHtmlContent = this.newHtmlContent.replace('mainBody', str) // 替换物品代码 |
|
|
this.newHtmlContent = this.newHtmlContent.replace( |
|
|
}) |
|
|
"mainBody", str); //替换物品代码 |
|
|
}) |
|
|
}); |
|
|
} |
|
|
|
|
|
} |
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
} |
|
|
|
|
|
</script> |
|
|
</script> |
|
|
|
|
|
|
|
|
<style> |
|
|
<style> |
|
|
.box { |
|
|
.box { |
|
|
font-size: 26rpx; |
|
|
font-size: 26rpx; |
|
|
/* display: flex; */ |
|
|
/* display: flex; */ |
|
|
padding: 20rpx; |
|
|
padding: 20rpx; |
|
|
border: 1px solid #dedede; |
|
|
border: 1px solid #dedede; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.left { |
|
|
|
|
|
border-top: 1px solid #b1b1b1; |
|
|
|
|
|
border-left: 1px solid #b1b1b1; |
|
|
|
|
|
flex: 1; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.left-item { |
|
|
|
|
|
display: flex; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.label { |
|
|
.left { |
|
|
border-bottom: 1px solid #b1b1b1; |
|
|
border-top: 1px solid #b1b1b1; |
|
|
border-right: 1px solid #b1b1b1; |
|
|
border-left: 1px solid #b1b1b1; |
|
|
width: 140rpx; |
|
|
flex: 1; |
|
|
padding: 0px 10rpx; |
|
|
} |
|
|
height: 60rpx; |
|
|
|
|
|
line-height: 60rpx; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.value { |
|
|
.left-item { |
|
|
border-bottom: 1px solid #b1b1b1; |
|
|
display: flex; |
|
|
border-right: 1px solid #b1b1b1; |
|
|
} |
|
|
padding: 0px 5px; |
|
|
|
|
|
height: 60rpx; |
|
|
|
|
|
flex: 1; |
|
|
|
|
|
width: 0px; |
|
|
|
|
|
display: flex; |
|
|
|
|
|
align-items: center; |
|
|
|
|
|
word-wrap: break-word; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.right { |
|
|
.label { |
|
|
width: 50%; |
|
|
border-bottom: 1px solid #b1b1b1; |
|
|
|
|
|
border-right: 1px solid #b1b1b1; |
|
|
|
|
|
width: 140rpx; |
|
|
|
|
|
padding: 0px 10rpx; |
|
|
|
|
|
height: 60rpx; |
|
|
|
|
|
line-height: 60rpx; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
border-top: 1px solid #b1b1b1; |
|
|
.value { |
|
|
} |
|
|
border-bottom: 1px solid #b1b1b1; |
|
|
|
|
|
border-right: 1px solid #b1b1b1; |
|
|
|
|
|
padding: 0px 5px; |
|
|
|
|
|
height: 60rpx; |
|
|
|
|
|
flex: 1; |
|
|
|
|
|
width: 0px; |
|
|
|
|
|
display: flex; |
|
|
|
|
|
align-items: center; |
|
|
|
|
|
word-wrap: break-word; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
.image { |
|
|
.right { |
|
|
width: 100%; |
|
|
width: 50%; |
|
|
height: 301rpx; |
|
|
|
|
|
border-bottom: 1px solid #b1b1b1; |
|
|
|
|
|
border-top: 1px solid #b1b1b1; |
|
|
|
|
|
border-right: 1px solid #b1b1b1; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.image img { |
|
|
border-top: 1px solid #b1b1b1; |
|
|
width: calc(100% - 4px); |
|
|
} |
|
|
height: calc(100% - 4px); |
|
|
|
|
|
margin: 4rpx; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.mb-kw { |
|
|
.image { |
|
|
border-bottom: 1px solid #dedede; |
|
|
width: 100%; |
|
|
padding-bottom: 20rpx; |
|
|
height: 301rpx; |
|
|
|
|
|
border-bottom: 1px solid #b1b1b1; |
|
|
|
|
|
border-top: 1px solid #b1b1b1; |
|
|
|
|
|
border-right: 1px solid #b1b1b1; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
.image img { |
|
|
|
|
|
width: calc(100% - 4px); |
|
|
|
|
|
height: calc(100% - 4px); |
|
|
|
|
|
margin: 4rpx; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
.mb-kw text { |
|
|
.mb-kw { |
|
|
font-weight: bold; |
|
|
border-bottom: 1px solid #dedede; |
|
|
font-size: 32rpx; |
|
|
padding-bottom: 20rpx; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
.mb-text { |
|
|
.mb-kw text { |
|
|
margin-top: 10rpx; |
|
|
font-weight: bold; |
|
|
} |
|
|
font-size: 32rpx; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
::v-deep .u-th { |
|
|
.mb-text { |
|
|
font-size: 24rpx !important; |
|
|
margin-top: 10rpx; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
::v-deep .u-td { |
|
|
::v-deep .u-th { |
|
|
height: auto !important; |
|
|
font-size: 24rpx !important; |
|
|
font-size: 24rpx !important; |
|
|
} |
|
|
word-break: break-all; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
::v-deep .u-td { |
|
|
|
|
|
height: auto !important; |
|
|
|
|
|
font-size: 24rpx !important; |
|
|
|
|
|
word-break: break-all; |
|
|
|
|
|
} |
|
|
</style> |
|
|
</style> |