uu
This commit is contained in:
parent
405015882a
commit
396e61fc0f
@ -34,15 +34,19 @@ export default {
|
|||||||
prtPercentage: 0, // 打印进度
|
prtPercentage: 0, // 打印进度
|
||||||
paperWidth: 480,
|
paperWidth: 480,
|
||||||
imgRes: {},
|
imgRes: {},
|
||||||
|
prtQueList: [],
|
||||||
|
lastExeMark: undefined,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
this.initData()
|
this.initData()
|
||||||
},
|
},
|
||||||
unmounted() {
|
unmounted() {
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async initData() {
|
async initData() {
|
||||||
|
|
||||||
},
|
},
|
||||||
// 打印
|
// 打印
|
||||||
handlePrint(){
|
handlePrint(){
|
||||||
@ -81,15 +85,32 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 给外部调用api,打印自定义图
|
// 给外部调用api,打印自定义图
|
||||||
async callPrint({ paperWidth, imgRes } = {}) {
|
async callPrint(obj) {
|
||||||
this.paperWidth = paperWidth || this.paperWidth
|
this.prtQueList.push(obj)
|
||||||
this.imgRes = imgRes
|
clearTimeout(this.lastExeMark)
|
||||||
|
this.lastExeMark = setTimeout(()=> {
|
||||||
|
this.finallyExecPrint()
|
||||||
|
}, 500)
|
||||||
|
},
|
||||||
|
|
||||||
|
async finallyExecPrint() {
|
||||||
let conSta = await this.$refs.curBlueTooth.autoConnect()
|
let conSta = await this.$refs.curBlueTooth.autoConnect()
|
||||||
this.$emit('autoConnectCallback', conSta)
|
this.$emit('autoConnectCallback', conSta)
|
||||||
if(conSta) {
|
|
||||||
await this.handlePrint()
|
for(let i = 0; i < this.prtQueList.length; i ++) {
|
||||||
return true
|
let { paperWidth, imgRes } = this.prtQueList[i]
|
||||||
|
if(imgRes) {
|
||||||
|
this.paperWidth = paperWidth || this.paperWidth
|
||||||
|
this.imgRes = imgRes
|
||||||
|
if(conSta) {
|
||||||
|
await this.handlePrint()
|
||||||
|
this.prtQueList[i] = undefined // 打印成功 清除当前数据
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
this.prtQueList = []
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user