This commit is contained in:
linfso 2024-10-15 07:43:50 +08:00
parent 7bd0d221eb
commit 1d5ebe5182
3 changed files with 72 additions and 54 deletions

View File

@ -32,6 +32,17 @@
<i class="el-icon-plus" title="放大"></i>
</div>
<div class="prev" @click="prePage">
打印份数
</div>
<div class="page">
<el-input-number
v-model.number="printCnt"
:min="1"
size="mini"
/>
</div>
<div class="tools">
<div style="width:100%;text-align: right;">
<!-- <el-button title="" type="primary" v-if="isA4" @click="showSinglePage(1)">切换单页</el-button> -->
@ -113,6 +124,8 @@ export default {
pdfUtils:new PdfUtils(),
printCnt:null,
loading: false,
}
@ -157,6 +170,7 @@ export default {
},
},
mounted() {
this.printCnt=1;
this.initA4List();
this.showFirstFile();
window.addEventListener('mousewheel', this.handleScroll, { passive: false })
@ -420,7 +434,7 @@ export default {
if(this.isA4){
printJS(this.loadPdfUrl);
}else{
this.$emit("onPrint");
this.$emit("onPrint",this.printCnt);
}
},
showSinglePage(page){

View File

@ -822,8 +822,8 @@
},
// 响应PDF预览
onPdfViewPrint(){
this.$emit("onPrint");
onPdfViewPrint(printCnt){
this.$emit("onPrint",printCnt);
},
handleClose(){
this.openPdfView=false;

View File

@ -525,61 +525,65 @@ export default {
rowKey (row) {
return row.id;
},
handleBatchPrint(){
// this.$confirm("确定打印?", "提示", {
// cancelButtonText: "不打印",
// confirmButtonText: "确定打印",
// type: "warning",
// distinguishCancelAndClose: true,
// closeOnClickModal: false
// }).then(() => {
// let orderList=[];
// this.currentSelection.forEach(item=>{
// orderList.push(item.billCode);
// });
handleBatchPrint(printCnt){
this.$confirm("确定打印?", "提示", {
cancelButtonText: "不打印",
confirmButtonText: "确定打印",
type: "warning",
distinguishCancelAndClose: true,
closeOnClickModal: false
}).then(() => {
let orderList=[];
this.currentSelection.forEach(item=>{
orderList.push(item.billCode);
});
// // batchPrint(orderList,tplCode,orderDetailList)
// this.$refs.tanexPrinter.batchPrint(orderList,null,this.currentSelection);
// }).catch(() => {});
this.$prompt('确定打印,输入打印份数', "提示", {
confirmButtonText: "确定打印",
cancelButtonText: "不打印",
distinguishCancelAndClose: true,
closeOnClickModal: false,
inputValue: 1,
inputValidator (value) {
if (value) {
return true;
}else{
return false;
}
},
inputErrorMessage: "文件名不能为空"
}).then(async ({ value }) => {
let cnt=parseInt(value);
if(cnt){
let orderList=[];
this.currentSelection.forEach(item=>{
orderList.push(item.billCode);
});
for(let i=0; i<cnt; i++){
// batchPrint(orderList,tplCode,orderDetailList)
this.$refs.tanexPrinter.batchPrint(orderList,null,this.currentSelection);
}
}else{
let orderList=[];
this.currentSelection.forEach(item=>{
orderList.push(item.billCode);
});
// batchPrint(orderList,tplCode,orderDetailList)
// batchPrint(orderList,tplCode,orderDetailList)
if(printCnt){
this.$refs.tanexPrinter.batchPrint(orderList,null,this.currentSelection);
}else{
for(let i=0; i<printCnt; i++){
this.$refs.tanexPrinter.batchPrint(orderList,null,this.currentSelection);
}
}
}
}).catch(() => {});
// this.$prompt('确定打印,输入打印份数', "提示", {
// confirmButtonText: "确定打印",
// cancelButtonText: "不打印",
// distinguishCancelAndClose: true,
// closeOnClickModal: false,
// inputValue: 1,
// inputValidator (value) {
// if (value) {
// return true;
// }else{
// return false;
// }
// },
// inputErrorMessage: "文件名不能为空"
// }).then(async ({ value }) => {
}).catch(() => {});
// let cnt=parseInt(value);
// if(cnt){
// let orderList=[];
// this.currentSelection.forEach(item=>{
// orderList.push(item.billCode);
// });
// for(let i=0; i<cnt; i++){
// // batchPrint(orderList,tplCode,orderDetailList)
// this.$refs.tanexPrinter.batchPrint(orderList,null,this.currentSelection);
// }
// }else{
// let orderList=[];
// this.currentSelection.forEach(item=>{
// orderList.push(item.billCode);
// });
// // batchPrint(orderList,tplCode,orderDetailList)
// this.$refs.tanexPrinter.batchPrint(orderList,null,this.currentSelection);
// }
// }).catch(() => {});
},
handlePrintPreview(){