46 lines
1.2 KiB
Vue
46 lines
1.2 KiB
Vue
<template>
|
|
<el-button
|
|
size="mini"
|
|
type="text"
|
|
icon="el-icon-print"
|
|
@click="handlePrint()"
|
|
>{{labelText}}</el-button>
|
|
</template>
|
|
<script>
|
|
import { printBarcodeLabel } from "@/api/print/print";
|
|
export default {
|
|
name: 'printLabel',
|
|
data(){
|
|
return {
|
|
|
|
}
|
|
},
|
|
props:{
|
|
businessId: null,
|
|
businessCode: null,
|
|
businessType: null,
|
|
labelText: {
|
|
type: String,
|
|
default: '打印'
|
|
}
|
|
},
|
|
methods:{
|
|
handlePrint(){
|
|
//先检查是否有配置默认的打印机
|
|
const key = 'defaultPrinter';
|
|
let printerJson = localStorage.getItem(key);
|
|
|
|
debugger;
|
|
if(printerJson !=null){
|
|
const printer = JSON.parse(printerJson);
|
|
const param = { businessId: this.businessId, businessCode: this.businessCode, businessType: this.businessType, printerCode: printer.printerCode };
|
|
printBarcodeLabel(param);
|
|
}else{
|
|
this.$modal.msgError("请在打印管理-打印机配置功能中指定默认打印机!");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
</script> |