This commit is contained in:
aihe 2024-05-13 18:03:54 +08:00
parent 63874c2afd
commit 8441d5eb09
2 changed files with 8 additions and 6 deletions

View File

@ -58,12 +58,14 @@ export default {
// 打印
handlePrint(){
const that = this
let { deviceId, serviceId, characteristicId } = this.$refs.curBlueTooth.getInstance()
let data = this.$refs.curBlueTooth.getConData()
console.log("打印组件选中数据:data=====", data)
let { deviceId, serviceId, characteristicId } = data
return new Promise((resolve, reject)=> {
let { bl } = that.checkPrintParam()
if(!bl) {
return reject('打印参数校验不通过')
}
}
const opt = {
...{ deviceId, serviceId, characteristicId },
onProgress: (percentage) => {
@ -142,9 +144,9 @@ export default {
},
checkPrintParam() {
let msg = '', bl = false
let { deviceId, serviceId, characteristicId } = this.$refs.curBlueTooth.getInstance()
let { deviceId, serviceId, characteristicId } = this.$refs.curBlueTooth.getConData()
!this.imgData && (msg = '打印内容不能为空,请重试')
if(!msg && (deviceId || serviceId || characteristicId)) {
if(!msg && !(deviceId && serviceId && characteristicId)) {
msg = '请选选择打印设备'
}
msg && (showToast(msg))

View File

@ -326,8 +326,8 @@ export default {
}
}
},
getInstance() {
return this
getConData() {
return { deviceId: this.deviceId, serviceId: this.serviceId, characteristicId: this.characteristicId }
}
}
}