|
|
|
|
@ -0,0 +1,534 @@
|
|
|
|
|
<template>
|
|
|
|
|
<div class="wrap">
|
|
|
|
|
<!-- <h1>打印机序号:{{ prtSN }}</h1>
|
|
|
|
|
<h1>固件版本:{{ prtFWVer }}</h1>
|
|
|
|
|
<h1>打印状态:{{ prtStatusDesc }}</h1> -->
|
|
|
|
|
|
|
|
|
|
<div v-if="imgList.length > 0">
|
|
|
|
|
<div class="batch-print-btn">
|
|
|
|
|
<el-button type="primary" @click="batchPrint">批量打印</el-button>
|
|
|
|
|
<el-button type="primary" @click="showLogDrawer = true">打印日志</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="print-preview-title">打印预览</div>
|
|
|
|
|
<div class="print-preview-img-box">
|
|
|
|
|
<img :src="img" class="print-preview-img" v-for="(img, index) in imgList" :key="index" />
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<!-- <el-button @click="setTemplatePrint">设置模版打印</el-button> -->
|
|
|
|
|
|
|
|
|
|
<el-drawer
|
|
|
|
|
title="打印日志"
|
|
|
|
|
:visible.sync="showLogDrawer"
|
|
|
|
|
direction="rtl"
|
|
|
|
|
size="50%"
|
|
|
|
|
:with-header="true"
|
|
|
|
|
>
|
|
|
|
|
<div class="log-drawer-content">
|
|
|
|
|
<div style="margin-bottom: 10px">
|
|
|
|
|
<div>打印机序号:{{ prtSN }}</div>
|
|
|
|
|
<div>固件版本:{{ prtFWVer }}</div>
|
|
|
|
|
<div>打印状态:{{ prtStatusDesc }}</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="log-list">
|
|
|
|
|
<div
|
|
|
|
|
v-for="(log, i) in logs"
|
|
|
|
|
:key="i"
|
|
|
|
|
:class="['log-item', { 'log-error': log.type === 'error' }]"
|
|
|
|
|
>
|
|
|
|
|
<span class="log-time">{{ log.time }}</span>
|
|
|
|
|
<span class="log-text">{{ log.text }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</el-drawer>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import { sendPostRequestApi } from '@/api/print'
|
|
|
|
|
import { show as getMaterialInfo } from '@/api/inventory'
|
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
connectRes: '', // 连接设备返回结果
|
|
|
|
|
labelContent: '', // 模版返回结果
|
|
|
|
|
prtSN: '', // 打印机序列号
|
|
|
|
|
prtFWVer: '', // 固件版本
|
|
|
|
|
prtStatusDesc: '', // 打印状态描述
|
|
|
|
|
ids: [], // 物资ID列表
|
|
|
|
|
materialList: [], // 存储所有物资信息
|
|
|
|
|
imgList: [], // 存储所有图片路径
|
|
|
|
|
showLogDrawer: false,
|
|
|
|
|
logs: [] // { type: 'success'|'error'|'info', text: string, time: 'HH:mm:ss' }
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
async created() {
|
|
|
|
|
if (this.$route.query.ids) {
|
|
|
|
|
this.ids = this.$route.query.ids.split(',')
|
|
|
|
|
} else {
|
|
|
|
|
this.$message.error('请先选择物资')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取打印机信息
|
|
|
|
|
await this.getInfo()
|
|
|
|
|
// 设置模版打印
|
|
|
|
|
// await this.setTemplatePrint()
|
|
|
|
|
// 获取所有物资信息
|
|
|
|
|
await this.getAllMaterialInfo()
|
|
|
|
|
// 更改每一个标签中的值 并生成预览图片
|
|
|
|
|
await this.changeLabelValue(false)
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
// 统一添加日志
|
|
|
|
|
addLog(type, text) {
|
|
|
|
|
const two = n => (n < 10 ? '0' + n : '' + n)
|
|
|
|
|
const d = new Date()
|
|
|
|
|
const time = `${two(d.getHours())}:${two(d.getMinutes())}:${two(d.getSeconds())}`
|
|
|
|
|
this.logs.push({ type, text, time })
|
|
|
|
|
},
|
|
|
|
|
// 发送请求
|
|
|
|
|
async sendPostRequest(funcId, funcName, data, showMessage = false) {
|
|
|
|
|
const res = await sendPostRequestApi(funcId, funcName, data)
|
|
|
|
|
if (res.rtnCode === '0') {
|
|
|
|
|
if (showMessage) {
|
|
|
|
|
this.$message.success(funcName + '成功')
|
|
|
|
|
}
|
|
|
|
|
this.addLog('success', funcName + '成功')
|
|
|
|
|
return res.outParams ? res.outParams : true
|
|
|
|
|
} else {
|
|
|
|
|
this.$message.error(funcName + '失败:' + res.rsltMsg)
|
|
|
|
|
this.addLog('error', funcName + '失败:' + res.rsltMsg)
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// 辅助函数:根据字符数计算 height
|
|
|
|
|
getHeight(text) {
|
|
|
|
|
console.log('text', text)
|
|
|
|
|
console.log('text.length', text.length)
|
|
|
|
|
return text && text.length > 14 ? 8 : 4
|
|
|
|
|
},
|
|
|
|
|
// 获取打印机信息
|
|
|
|
|
async getInfo() {
|
|
|
|
|
try {
|
|
|
|
|
await this.sendPostRequest('web_DSTP2x_SetLibLang', '设置语言', { language: '0' }, true)
|
|
|
|
|
//枚举设备
|
|
|
|
|
const devRes = await this.sendPostRequest('web_DSTP2x_EnumDev', '获取打印设备', {
|
|
|
|
|
enumType: '1'
|
|
|
|
|
}, true)
|
|
|
|
|
console.log('devRes', devRes)
|
|
|
|
|
const index = devRes.enumList.indexOf(',')
|
|
|
|
|
if (index !== -1) {
|
|
|
|
|
const devList = devRes.enumList.split(',')
|
|
|
|
|
devRes.enumList = devList[0]
|
|
|
|
|
}
|
|
|
|
|
// 连接打印设备
|
|
|
|
|
this.connectRes = await this.sendPostRequest('web_DSTP2x_ConnEnumeratedDev', '连接打印设备', {
|
|
|
|
|
devName: devRes.enumList
|
|
|
|
|
}, true)
|
|
|
|
|
// 获取打印机序列号
|
|
|
|
|
const snRes = await this.sendPostRequest('web_DSTP2x_GetPrtSN', '获取打印机序列号', {
|
|
|
|
|
devHdl: this.connectRes.devHdl
|
|
|
|
|
})
|
|
|
|
|
if (snRes.prtSN) {
|
|
|
|
|
this.prtSN = snRes.prtSN
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取固件版本
|
|
|
|
|
const fwVerRes = await this.sendPostRequest('web_DSTP2x_GetPrtFWVer', '获取固件版本', {
|
|
|
|
|
devHdl: this.connectRes.devHdl
|
|
|
|
|
})
|
|
|
|
|
if (fwVerRes.prtFWVer) {
|
|
|
|
|
this.prtFWVer = fwVerRes.prtFWVer
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取打印状态
|
|
|
|
|
const statusRes = await this.sendPostRequest('web_DSTP2x_GetPrtStatus', '获取打印状态', {
|
|
|
|
|
devHdl: this.connectRes.devHdl
|
|
|
|
|
}, true)
|
|
|
|
|
if (statusRes.prtStatusDesc) {
|
|
|
|
|
const statusStr = this.getAllStatus(
|
|
|
|
|
statusRes.mainStatusCode,
|
|
|
|
|
statusRes.warnCode,
|
|
|
|
|
statusRes.errorCode
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
this.prtStatusDesc = statusRes.prtStatusDesc + '\n' + statusStr
|
|
|
|
|
}
|
|
|
|
|
// 设置仿真类型
|
|
|
|
|
await this.sendPostRequest('web_DSTP2x_SetPrnEmulation', '设置仿真类型', {
|
|
|
|
|
devHdl: this.connectRes.devHdl,
|
|
|
|
|
emulation: '0'
|
|
|
|
|
})
|
|
|
|
|
console.log('设置仿真类型成功')
|
|
|
|
|
// 设置超时时间
|
|
|
|
|
await this.sendPostRequest('web_DSTP2x_SetCommTimeout', '设置超时时间', {
|
|
|
|
|
devHdl: this.connectRes.devHdl,
|
|
|
|
|
commType: '1',
|
|
|
|
|
sendTimeout: '20000',
|
|
|
|
|
recvTimeout: '20000'
|
|
|
|
|
})
|
|
|
|
|
console.log('设置超时时间成功')
|
|
|
|
|
// 保留消息提示,但不再在此处写日志,避免与 sendPostRequest 重复
|
|
|
|
|
this.$message.success('连接打印机成功')
|
|
|
|
|
} catch (error) {
|
|
|
|
|
this.$message.error(error || '请求失败')
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// 设置模版打印
|
|
|
|
|
async setTemplatePrint(isprint) {
|
|
|
|
|
// 创建画布
|
|
|
|
|
this.labelContent = await this.sendPostRequest('web_DSTP2x_CreateLabelContext', '创建画布', {
|
|
|
|
|
width: '80',
|
|
|
|
|
height: '40'
|
|
|
|
|
}, true)
|
|
|
|
|
if (this.labelContent) {
|
|
|
|
|
// 设置文本字体
|
|
|
|
|
await this.sendPostRequest('web_DSTP2x_LcDraw_SetTextFontSize', '设置文本字体', {
|
|
|
|
|
lcHdl: this.labelContent.lcHdl,
|
|
|
|
|
fontSize: '10.0',
|
|
|
|
|
temporary: '0'
|
|
|
|
|
})
|
|
|
|
|
// 设置文本字体名称
|
|
|
|
|
await this.sendPostRequest('web_DSTP2x_LcDraw_SetTextFontName', '设置文本字体名称', {
|
|
|
|
|
lcHdl: this.labelContent.lcHdl,
|
|
|
|
|
temporary: '0',
|
|
|
|
|
fontName: '宋体'
|
|
|
|
|
})
|
|
|
|
|
// 设置文本是否自动换行
|
|
|
|
|
await this.sendPostRequest(
|
|
|
|
|
'web_DSTP2x_LcDraw_SetTextAutoLineFeed',
|
|
|
|
|
'设置文本是否自动换行',
|
|
|
|
|
{
|
|
|
|
|
lcHdl: this.labelContent.lcHdl,
|
|
|
|
|
isAutoLineFeed: '1',
|
|
|
|
|
temporary: '0'
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
// 设置标签模板的打印模式
|
|
|
|
|
await this.sendPostRequest(
|
|
|
|
|
'web_DSTP2x_SetLcPrnMode',
|
|
|
|
|
'设置标签画布的打印模式',
|
|
|
|
|
{
|
|
|
|
|
lcHdl: this.labelContent.lcHdl,
|
|
|
|
|
prnMode: isprint ? '0' : '3'
|
|
|
|
|
}, true
|
|
|
|
|
)
|
|
|
|
|
} else {
|
|
|
|
|
this.$message.error('创建画布失败')
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// 更改每一个标签中的值 在画布上绘制标签
|
|
|
|
|
async changeLabelValue(isprint) {
|
|
|
|
|
if (!isprint) {
|
|
|
|
|
this.imgList = []
|
|
|
|
|
}
|
|
|
|
|
for (let index = 0; index < this.materialList.length; index++) {
|
|
|
|
|
// 顺序执行,避免并发写模板造成覆盖
|
|
|
|
|
await this.setTemplatePrint(isprint)
|
|
|
|
|
const item = this.materialList[index]
|
|
|
|
|
const date = this.$moment(new Date()).format('YYYY-MM-DD')
|
|
|
|
|
const chanquan = item.chanquanxinxi_detail ? item.chanquanxinxi_detail.value : '市河道处'
|
|
|
|
|
const code = item.id + ''
|
|
|
|
|
const material_info_type = item.material_info_type
|
|
|
|
|
? '类别:' + item.material_info_type
|
|
|
|
|
: '类别'
|
|
|
|
|
const zichanmingcheng = item.zichanmingcheng
|
|
|
|
|
? '物资名称:' + item.zichanmingcheng
|
|
|
|
|
: '物资名称'
|
|
|
|
|
const guige = item.wuziguige ? '规格:' + item.wuziguige : '规格'
|
|
|
|
|
const xinghao = item.guigexinghao ? '型号:' + item.guigexinghao : '型号'
|
|
|
|
|
const pici = item.rukupici ? '批次:' + item.rukupici : '批次'
|
|
|
|
|
const total_num =
|
|
|
|
|
item.wuzileixing === '一物一码' ? '同批数量:' + item.total_num : '数量:' + item.total_num
|
|
|
|
|
const piciNum = pici + ' ' + total_num
|
|
|
|
|
const shunxuhao = item.wuzileixing === '一物一码' ? '批内序号:' + item.shunxuhao : ' '
|
|
|
|
|
let hexId = parseInt(item.id, 10).toString(16).toUpperCase()
|
|
|
|
|
if (hexId.length % 2 !== 0) {
|
|
|
|
|
hexId = '0' + hexId
|
|
|
|
|
}
|
|
|
|
|
// 绘制标签文本内容
|
|
|
|
|
// 日期
|
|
|
|
|
await this.sendPostRequest('web_DSTP2x_Lbl_DrawText', '设置日期文本内容', {
|
|
|
|
|
lcHdl: this.labelContent.lcHdl,
|
|
|
|
|
x: '4',
|
|
|
|
|
y: '2',
|
|
|
|
|
w: '19',
|
|
|
|
|
h: '4',
|
|
|
|
|
data: date
|
|
|
|
|
})
|
|
|
|
|
// 渠道
|
|
|
|
|
await this.sendPostRequest('web_DSTP2x_Lbl_DrawText', '设置渠道文本内容', {
|
|
|
|
|
lcHdl: this.labelContent.lcHdl,
|
|
|
|
|
x: '36',
|
|
|
|
|
y: '2',
|
|
|
|
|
w: '30',
|
|
|
|
|
h: '4',
|
|
|
|
|
data: chanquan
|
|
|
|
|
})
|
|
|
|
|
// 物资ID
|
|
|
|
|
|
|
|
|
|
await this.sendPostRequest('web_DSTP2x_Lbl_DrawBarCode', '设置二维码文本内容', {
|
|
|
|
|
lcHdl: this.labelContent.lcHdl,
|
|
|
|
|
x: '4',
|
|
|
|
|
y: '7',
|
|
|
|
|
w: '28',
|
|
|
|
|
h: '28',
|
|
|
|
|
codeType: '58',
|
|
|
|
|
data: code
|
|
|
|
|
})
|
|
|
|
|
// 动态计算每个文本字段的 y 坐标和 height
|
|
|
|
|
// 物资类别 - y 固定为 7
|
|
|
|
|
let currentY = 7
|
|
|
|
|
const materialInfoTypeHeight = this.getHeight(material_info_type)
|
|
|
|
|
await this.sendPostRequest('web_DSTP2x_Lbl_DrawText', '设置物资类别文本内容', {
|
|
|
|
|
lcHdl: this.labelContent.lcHdl,
|
|
|
|
|
x: '34',
|
|
|
|
|
y: currentY.toString(),
|
|
|
|
|
w: '47',
|
|
|
|
|
h: materialInfoTypeHeight.toString(),
|
|
|
|
|
data: material_info_type
|
|
|
|
|
})
|
|
|
|
|
currentY = currentY + materialInfoTypeHeight
|
|
|
|
|
|
|
|
|
|
// 物资名称
|
|
|
|
|
const zichanmingchengHeight = this.getHeight(zichanmingcheng)
|
|
|
|
|
await this.sendPostRequest('web_DSTP2x_Lbl_DrawText', '设置物资名称文本内容', {
|
|
|
|
|
lcHdl: this.labelContent.lcHdl,
|
|
|
|
|
x: '34',
|
|
|
|
|
y: currentY.toString(),
|
|
|
|
|
w: '46',
|
|
|
|
|
h: zichanmingchengHeight.toString(),
|
|
|
|
|
data: zichanmingcheng
|
|
|
|
|
})
|
|
|
|
|
currentY = currentY + zichanmingchengHeight
|
|
|
|
|
|
|
|
|
|
// 物资规格
|
|
|
|
|
const guigeHeight = this.getHeight(guige)
|
|
|
|
|
await this.sendPostRequest('web_DSTP2x_Lbl_DrawText', '设置物资规格文本内容', {
|
|
|
|
|
lcHdl: this.labelContent.lcHdl,
|
|
|
|
|
x: '34',
|
|
|
|
|
y: currentY.toString(),
|
|
|
|
|
w: '46',
|
|
|
|
|
h: guigeHeight.toString(),
|
|
|
|
|
data: guige
|
|
|
|
|
})
|
|
|
|
|
currentY = currentY + guigeHeight
|
|
|
|
|
|
|
|
|
|
// 物资型号
|
|
|
|
|
const xinghaoHeight = this.getHeight(xinghao)
|
|
|
|
|
await this.sendPostRequest('web_DSTP2x_Lbl_DrawText', '设置物资型号文本内容', {
|
|
|
|
|
lcHdl: this.labelContent.lcHdl,
|
|
|
|
|
x: '34',
|
|
|
|
|
y: currentY.toString(),
|
|
|
|
|
w: '46',
|
|
|
|
|
h: xinghaoHeight.toString(),
|
|
|
|
|
data: xinghao
|
|
|
|
|
})
|
|
|
|
|
currentY = currentY + xinghaoHeight
|
|
|
|
|
|
|
|
|
|
// 批次
|
|
|
|
|
const piciNumHeight = 4
|
|
|
|
|
await this.sendPostRequest('web_DSTP2x_Lbl_DrawText', '设置批次文本内容', {
|
|
|
|
|
lcHdl: this.labelContent.lcHdl,
|
|
|
|
|
x: '34',
|
|
|
|
|
y: currentY.toString(),
|
|
|
|
|
w: '46',
|
|
|
|
|
h: piciNumHeight.toString(),
|
|
|
|
|
data: piciNum
|
|
|
|
|
})
|
|
|
|
|
currentY = currentY + piciNumHeight
|
|
|
|
|
|
|
|
|
|
// 批内序号
|
|
|
|
|
const shunxuhaoHeight = 4
|
|
|
|
|
await this.sendPostRequest('web_DSTP2x_Lbl_DrawText', '设置批内序号文本内容', {
|
|
|
|
|
lcHdl: this.labelContent.lcHdl,
|
|
|
|
|
x: '34',
|
|
|
|
|
y: currentY.toString(),
|
|
|
|
|
w: '46',
|
|
|
|
|
h: shunxuhaoHeight.toString(),
|
|
|
|
|
data: shunxuhao
|
|
|
|
|
})
|
|
|
|
|
// EPC
|
|
|
|
|
await this.sendPostRequest('web_DSTP2x_LcRfid_SetData', '设置EPC文本内容', {
|
|
|
|
|
lcHdl: this.labelContent.lcHdl,
|
|
|
|
|
rfidRgnType: '1',
|
|
|
|
|
rfidDataFmt: '2',
|
|
|
|
|
data: hexId
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const printRes = await this.sendPostRequest('web_DSTP2x_PrintLc', `第${index + 1}次打印`, {
|
|
|
|
|
devHdl: this.connectRes.devHdl,
|
|
|
|
|
lcHdl: this.labelContent.lcHdl,
|
|
|
|
|
outFileType: '1',
|
|
|
|
|
rfidReadType: '3'
|
|
|
|
|
}, true)
|
|
|
|
|
if (printRes) {
|
|
|
|
|
if (!isprint) {
|
|
|
|
|
this.imgList.push(printRes.outFile)
|
|
|
|
|
// 预览成功日志(专属)
|
|
|
|
|
this.addLog('success', `第${index + 1}次生成预览图片成功`)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 完成后清理
|
|
|
|
|
await this.sendPostRequest('web_DSTP2x_DeleteLabelContext', `删除${index + 1}画布句柄`, {
|
|
|
|
|
lcHdl: this.labelContent.lcHdl
|
|
|
|
|
}, true)
|
|
|
|
|
this.labelContent = ''
|
|
|
|
|
}
|
|
|
|
|
if (isprint) {
|
|
|
|
|
await this.sendPostRequest('web_DSTP2x_DisconnDev', '断开设备连接', {
|
|
|
|
|
devHdl: this.connectRes.devHdl
|
|
|
|
|
}, true)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// 批量打印
|
|
|
|
|
async batchPrint() {
|
|
|
|
|
// await this.sendPostRequest('web_DSTP2x_SetLcPrnMode', '设置标签画布的打印模式', {
|
|
|
|
|
// lcHdl: this.labelContent.lcHdl,
|
|
|
|
|
// prnMode: '0'
|
|
|
|
|
// })
|
|
|
|
|
await this.changeLabelValue(true)
|
|
|
|
|
},
|
|
|
|
|
// 获取所有物资信息
|
|
|
|
|
async getAllMaterialInfo() {
|
|
|
|
|
try {
|
|
|
|
|
this.materialList = []
|
|
|
|
|
for (const id of this.ids) {
|
|
|
|
|
const materialInfo = await this.getMaterialInfo(id)
|
|
|
|
|
if (materialInfo) {
|
|
|
|
|
this.materialList.push(materialInfo)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
console.log('所有物资信息:', this.materialList)
|
|
|
|
|
this.$message.success(`已获取 ${this.materialList.length} 条物资信息`)
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('获取物资信息失败:', error)
|
|
|
|
|
this.$message.error('获取物资信息失败')
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// 获取物资详情
|
|
|
|
|
async getMaterialInfo(id) {
|
|
|
|
|
try {
|
|
|
|
|
const res = await getMaterialInfo({ id: id })
|
|
|
|
|
if (res) {
|
|
|
|
|
return res
|
|
|
|
|
}
|
|
|
|
|
return null
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error(`获取物资 ${id} 详情失败:`, error)
|
|
|
|
|
return null
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// 打印机状态值
|
|
|
|
|
getAllStatus(mainStatus, warnStatus, errStatus) {
|
|
|
|
|
const mainStatusGroup = [
|
|
|
|
|
'Device idle',
|
|
|
|
|
'Device busy',
|
|
|
|
|
'Cache is not empty',
|
|
|
|
|
'Cache is empty',
|
|
|
|
|
'The panel is in the set state',
|
|
|
|
|
'Label reading and writing completed',
|
|
|
|
|
'The retry and invalidation process is in progress',
|
|
|
|
|
'The make-up printing process is in progress',
|
|
|
|
|
'RFID automatic verification in progress',
|
|
|
|
|
'RFID custom command in progress',
|
|
|
|
|
'No RFID module'
|
|
|
|
|
]
|
|
|
|
|
const warnStatusGroup = ['Paper is about to run out']
|
|
|
|
|
const errStatusGroup = [
|
|
|
|
|
'Label or black label positioning error',
|
|
|
|
|
'Paper jam',
|
|
|
|
|
'Paper tearing error',
|
|
|
|
|
'Lack of paper',
|
|
|
|
|
'Knife error',
|
|
|
|
|
'Paper loading error',
|
|
|
|
|
'Carbon tape error',
|
|
|
|
|
'Lifting the print head',
|
|
|
|
|
'Printing head overheating',
|
|
|
|
|
'EPC data missing in print data',
|
|
|
|
|
'RFID re printing failed',
|
|
|
|
|
'RFID calibration failed',
|
|
|
|
|
'RFID error',
|
|
|
|
|
'Pause or offline'
|
|
|
|
|
]
|
|
|
|
|
const mainStatusArr = mainStatus.split(',')
|
|
|
|
|
const warnStatusArr = warnStatus.split(',')
|
|
|
|
|
const errStatusArr = errStatus.split(',')
|
|
|
|
|
|
|
|
|
|
let rtnStr = '主状态: '
|
|
|
|
|
for (let i = 0; i < mainStatusArr.length; i++) {
|
|
|
|
|
const idx = mainStatusArr[i] - 1
|
|
|
|
|
rtnStr += mainStatusGroup[idx]
|
|
|
|
|
rtnStr += '; '
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (warnStatus && warnStatusArr.length > 0) {
|
|
|
|
|
rtnStr += '警告状态: '
|
|
|
|
|
for (let i = 0; i < warnStatusArr.length; i++) {
|
|
|
|
|
const idx = warnStatusArr[i] - 1
|
|
|
|
|
rtnStr += warnStatusGroup[idx]
|
|
|
|
|
rtnStr += '; '
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (errStatus && errStatusArr.length > 0) {
|
|
|
|
|
rtnStr += '错误状态: '
|
|
|
|
|
for (let i = 0; i < errStatusArr.length; i++) {
|
|
|
|
|
const idx = errStatusArr[i] - 1
|
|
|
|
|
rtnStr += errStatusGroup[idx]
|
|
|
|
|
rtnStr += '; '
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return rtnStr
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
.wrap {
|
|
|
|
|
padding: 40px;
|
|
|
|
|
}
|
|
|
|
|
.log-drawer-content {
|
|
|
|
|
padding: 0 20px 20px 20px;
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
}
|
|
|
|
|
.print-preview-title {
|
|
|
|
|
font-size: 20px;
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
margin-bottom: 10px;
|
|
|
|
|
}
|
|
|
|
|
.print-preview-img {
|
|
|
|
|
width: 320px;
|
|
|
|
|
height: 160px;
|
|
|
|
|
}
|
|
|
|
|
.print-preview-img-box {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-wrap: wrap;
|
|
|
|
|
gap: 10px;
|
|
|
|
|
}
|
|
|
|
|
.batch-print-btn {
|
|
|
|
|
margin-bottom: 10px;
|
|
|
|
|
}
|
|
|
|
|
.log-list {
|
|
|
|
|
max-height: calc(100vh - 240px);
|
|
|
|
|
overflow-y: auto;
|
|
|
|
|
}
|
|
|
|
|
.log-item {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
line-height: 24px;
|
|
|
|
|
}
|
|
|
|
|
.log-time {
|
|
|
|
|
color: #909399;
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
}
|
|
|
|
|
.log-text {
|
|
|
|
|
margin-left: 8px;
|
|
|
|
|
}
|
|
|
|
|
.log-error .log-text {
|
|
|
|
|
color: #f56c6c;
|
|
|
|
|
}
|
|
|
|
|
</style>
|