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

View File

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

View File

@ -525,14 +525,56 @@ export default {
rowKey (row) { rowKey (row) {
return row.id; return row.id;
}, },
handleBatchPrint(){ handleBatchPrint(printCnt){
// this.$confirm("确定打印?", "提示", { this.$confirm("确定打印?", "提示", {
// cancelButtonText: "不打印", cancelButtonText: "不打印",
confirmButtonText: "确定打印",
type: "warning",
distinguishCancelAndClose: true,
closeOnClickModal: false
}).then(() => {
let orderList=[];
this.currentSelection.forEach(item=>{
orderList.push(item.billCode);
});
// 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: "确定打印", // confirmButtonText: "确定打印",
// type: "warning", // cancelButtonText: "不打印",
// distinguishCancelAndClose: true, // distinguishCancelAndClose: true,
// closeOnClickModal: false // closeOnClickModal: false,
// }).then(() => { // 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=[]; // let orderList=[];
// this.currentSelection.forEach(item=>{ // this.currentSelection.forEach(item=>{
// orderList.push(item.billCode); // orderList.push(item.billCode);
@ -540,47 +582,9 @@ export default {
// // batchPrint(orderList,tplCode,orderDetailList) // // batchPrint(orderList,tplCode,orderDetailList)
// this.$refs.tanexPrinter.batchPrint(orderList,null,this.currentSelection); // this.$refs.tanexPrinter.batchPrint(orderList,null,this.currentSelection);
// }
// }).catch(() => {}); // }).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)
this.$refs.tanexPrinter.batchPrint(orderList,null,this.currentSelection);
}
}).catch(() => {});
}, },
handlePrintPreview(){ handlePrintPreview(){
let orderList=[]; let orderList=[];