|
|
|
@ -36,15 +36,36 @@ const livePrint = ref(null);
|
|
|
|
|
|
|
|
|
|
|
|
function print(printData, title) {
|
|
|
|
function print(printData, title) {
|
|
|
|
if (window.hiwebSocket.opened && window.hiwebSocket.printerList.length) {
|
|
|
|
if (window.hiwebSocket.opened && window.hiwebSocket.printerList.length) {
|
|
|
|
|
|
|
|
let mylivePrint = null;
|
|
|
|
|
|
|
|
let printerList = window.hiwebSocket.printerList.map(item => {
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
|
|
|
label: item.name,
|
|
|
|
|
|
|
|
value: item.name
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
console.log("printerList", printerList)
|
|
|
|
|
|
|
|
if (printerList && printerList.length) {
|
|
|
|
|
|
|
|
mylivePrint = printerList.find(item => item.label.indexOf("ZDesigner ZD888-203dpi ZPL") > -1).value;
|
|
|
|
|
|
|
|
console.log("livePrint2==>",mylivePrint);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!livePrint){
|
|
|
|
|
|
|
|
mylivePrint = "ZDesigner ZD888-203dpi ZPL (副本 2)";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(mylivePrint){
|
|
|
|
|
|
|
|
hiprintTemplate.value.print2(printData, { printer: mylivePrint, title });
|
|
|
|
|
|
|
|
}else{
|
|
|
|
hiprintTemplate.value.print2(printData, { printer: livePrint.value, title });
|
|
|
|
hiprintTemplate.value.print2(printData, { printer: livePrint.value, title });
|
|
|
|
// hiprintTemplate.value.on('printSuccess', function (e) {
|
|
|
|
}
|
|
|
|
// console.log('printSuccess');
|
|
|
|
// hiprintTemplate.value.print2(printData, { printer: livePrint.value, title });
|
|
|
|
|
|
|
|
hiprintTemplate.value.on('printSuccess', function (e) {
|
|
|
|
|
|
|
|
console.log('printSuccess');
|
|
|
|
|
|
|
|
|
|
|
|
// })
|
|
|
|
})
|
|
|
|
// // 发送任务到打印机失败
|
|
|
|
// // 发送任务到打印机失败
|
|
|
|
// hiprintTemplate.value.on('printError', function (e) {
|
|
|
|
hiprintTemplate.value.on('printError', function (e) {
|
|
|
|
// console.log('printError');
|
|
|
|
console.log('printError');
|
|
|
|
// })
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -88,6 +109,8 @@ watch(
|
|
|
|
|
|
|
|
|
|
|
|
livePrint.value = temp.value.panels[0].livePrint;
|
|
|
|
livePrint.value = temp.value.panels[0].livePrint;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log("livePrint.value", livePrint.value)
|
|
|
|
|
|
|
|
|
|
|
|
data.printValue.forEach(item => {
|
|
|
|
data.printValue.forEach(item => {
|
|
|
|
// 判断是否漆包打印
|
|
|
|
// 判断是否漆包打印
|
|
|
|
if (data.templateType.includes('enamelCoverReport')) {
|
|
|
|
if (data.templateType.includes('enamelCoverReport')) {
|
|
|
|
|