<template>
|
<view>
|
<uni-section :title="'玻璃信息:'+projectNo" type="line">
|
<template v-slot:right>
|
<button @click="printInfo">打印</button>
|
</template>
|
|
<uni-list>
|
<uni-list-item v-for='(item,keys) in title' :title="item+':'" :note="glassInfo[keys]" />
|
</uni-list>
|
</uni-section>
|
</view>
|
</template>
|
|
<script setup>
|
|
import { ref } from 'vue'
|
import { onLoad } from '@dcloudio/uni-app'
|
import request from '../../utils/request';
|
let projectNo = ref(null)
|
let glassInfo = ref({})
|
let title = {
|
orderId:'订单编号',
|
customerName:'客户名称',
|
productName:'产品名称',
|
glassChild:'小片名称',
|
size:'尺寸',
|
processId:'流程卡号',
|
orderNumber:'订单序号',
|
technologyNumber:'小片序号',
|
area:"面积",
|
buildingNumber:'楼号',
|
processingNote:'加工要求',
|
//remarks:'备注'
|
|
}
|
const mPrinter = uni.requireNativePlugin('HikPrinter')
|
|
onLoad(async (option)=>{
|
projectNo.value = option.projectNo
|
await getGlassInfo(option.projectNo)
|
})
|
|
const getGlassInfo = async (projectNo) => {
|
await request.post(`/order/scannerGlassInfo/${projectNo}`).then(res => {
|
if (res.code == 200) {
|
glassInfo.value = res.data
|
}
|
}).catch(err => {
|
uni.showModal({
|
title: '提示',
|
content: err,
|
showCancel:false
|
});
|
})
|
}
|
const printInfo = () => {
|
mPrinter.openPort()
|
mPrinter.resetPrinter()
|
//设置对齐方式 0,1,2 左中右
|
mPrinter.setAlignment(1)
|
mPrinter.printTextGBK("炉内编号:"+projectNo.value+'\n')
|
mPrinter.printTextGBK(`订单(序号/小片):${glassInfo.value.orderId}(${glassInfo.value.orderNumber}/${glassInfo.value.technologyNumber})\n`)
|
mPrinter.printTextGBK(`尺寸:${glassInfo.value.size}\n`)
|
mPrinter.printTextGBK(`客户:${glassInfo.value.customerName}\n`)
|
mPrinter.printTextGBK(`小片名称:${glassInfo.value.glassChild}\n`)
|
mPrinter.printTextGBK(`${glassInfo.value.productName}\n`)
|
mPrinter.printTextGBK(`${glassInfo.value.buildingNumber}\n`)
|
mPrinter.printTextGBK(`${glassInfo.value.processingNote}\n`)
|
//mPrinter.printTextGBK(`备注:${glassInfo.value.remarks}\n`)
|
mPrinter.printTextGBK("\n")
|
mPrinter.printTextGBK("\n")
|
// mPrinter.printTextGBK("\n")
|
|
if(mPrinter.queryPrintResult(5000)){
|
mPrinter.closePort()
|
}
|
|
|
}
|
</script>
|
|
<style>
|
|
</style>
|