1.1.1
This commit is contained in:
@@ -294,9 +294,10 @@ export default {
|
||||
*/
|
||||
selectCommandType(type) {
|
||||
this.commandType = type
|
||||
printerService.setCommandType(type)
|
||||
// 切换指令类型时同步更新纸张尺寸
|
||||
printerService.setPaperSize(this.paperWidth, this.paperHeight)
|
||||
// 测试页临时切换指令类型,不覆盖正式配置
|
||||
printerService.setCommandTypeTemporary(type)
|
||||
// 切换指令类型时同步更新纸张尺寸(临时生效)
|
||||
printerService.setPaperSizeTemporary(this.paperWidth, this.paperHeight)
|
||||
},
|
||||
/**
|
||||
* 选择打印纸尺寸
|
||||
@@ -304,7 +305,8 @@ export default {
|
||||
selectPaperSize(width, height) {
|
||||
this.paperWidth = width
|
||||
this.paperHeight = height
|
||||
printerService.setPaperSize(width, height)
|
||||
// 测试页临时切换纸张尺寸,不覆盖正式配置
|
||||
printerService.setPaperSizeTemporary(width, height)
|
||||
},
|
||||
/**
|
||||
* 快捷模板
|
||||
@@ -325,29 +327,29 @@ export default {
|
||||
riqi: new Date().toISOString().split('T')[0],
|
||||
zhongliang: '10kg',
|
||||
beizhu: '测试备注',
|
||||
biaoshi: '',
|
||||
biaoshi: [1, 2, 3, 4],
|
||||
qrcode: 'https://www.cswm.org.cn/qr/?code=7G6MOYELnFHZfF1Y0F8e6gjxR2K2pALNJJNhJSuOg17LV6IZfuDWUnF2qC3Rsdejs&type=WFBQ'
|
||||
}
|
||||
// 确保 service 使用当前的 commandType 和 paperSize
|
||||
printerService.setCommandType(this.commandType)
|
||||
printerService.setPaperSize(this.paperWidth, this.paperHeight)
|
||||
// 确保 service 使用当前的 commandType 和 paperSize(临时生效,不覆盖配置)
|
||||
printerService.setCommandTypeTemporary(this.commandType)
|
||||
printerService.setPaperSizeTemporary(this.paperWidth, this.paperHeight)
|
||||
this.printContent = printerService.generateWasteLabel(testData)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if (type === 'qrcode') {
|
||||
printerService.setCommandType(this.commandType)
|
||||
printerService.setPaperSize(this.paperWidth, this.paperHeight)
|
||||
if (type === 'qrcode') {
|
||||
printerService.setCommandTypeTemporary(this.commandType)
|
||||
printerService.setPaperSizeTemporary(this.paperWidth, this.paperHeight)
|
||||
this.printContent = printerService.generateQRCodeTemplate('https://www.example.com')
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if (type === 'barcode') {
|
||||
printerService.setCommandType(this.commandType)
|
||||
printerService.setPaperSize(this.paperWidth, this.paperHeight)
|
||||
if (type === 'barcode') {
|
||||
printerService.setCommandTypeTemporary(this.commandType)
|
||||
printerService.setPaperSizeTemporary(this.paperWidth, this.paperHeight)
|
||||
this.printContent = printerService.generateBarcodeTemplate('1234567890')
|
||||
return
|
||||
}
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 清空打印内容
|
||||
@@ -367,9 +369,9 @@ export default {
|
||||
|
||||
this.isPrinting = true
|
||||
try {
|
||||
// 确保打印前同步配置
|
||||
printerService.setCommandType(this.commandType)
|
||||
printerService.setPaperSize(this.paperWidth, this.paperHeight)
|
||||
// 确保打印前同步配置(测试页临时生效,不覆盖正式配置)
|
||||
printerService.setCommandTypeTemporary(this.commandType)
|
||||
printerService.setPaperSizeTemporary(this.paperWidth, this.paperHeight)
|
||||
await printerService.printText(this.printContent)
|
||||
uni.showToast({ title: '打印成功', icon: 'success' })
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user