md
This commit is contained in:
parent
423af408cc
commit
98548783d1
@ -18,6 +18,8 @@
|
||||
|
||||
</template>
|
||||
<script>
|
||||
import {dateToStr} from '@/utils/custom'
|
||||
|
||||
export default {
|
||||
name: "elDateAdvPicker",
|
||||
model: {
|
||||
@ -167,13 +169,18 @@ export default {
|
||||
this.datetimeRange = newVal;
|
||||
},
|
||||
datetimeRange(newVal, oldVal) {
|
||||
this.$emit("input", this.datetimeRange);
|
||||
// this.$emit("input", this.datetimeRange);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
dateTimeChange(value) {
|
||||
this.$emit("input", this.datetimeRange);
|
||||
this.$emit('dateTimeChange', value)
|
||||
|
||||
|
||||
const startDate=dateToStr(this.datetimeRange[0]);
|
||||
const endDate=dateToStr(this.datetimeRange[1])
|
||||
// this.datetimeRange
|
||||
this.$emit("input", [startDate,endDate]);
|
||||
this.$emit('dateTimeChange', [startDate,endDate])
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,8 +31,8 @@
|
||||
</div>
|
||||
<div class="tools">
|
||||
<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-else @click="showA4Page(1)">切换A4</el-button>
|
||||
<!-- <el-button title="" type="primary" v-if="isA4" @click="showSinglePage(1)">切换单页</el-button> -->
|
||||
<!-- <el-button title="" type="primary" v-else @click="showA4Page(1)">切换A4</el-button> -->
|
||||
<el-button title="" type="primary" icon="el-icon-download" @click="downPDF">下载</el-button>
|
||||
<el-button title="" type="primary" icon="el-icon-printer" @click="printPDF">打印</el-button>
|
||||
</div>
|
||||
@ -155,6 +155,7 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
||||
this.initA4List();
|
||||
this.showFirstFile();
|
||||
window.addEventListener('mousewheel', this.handleScroll, { passive: false })
|
||||
@ -204,9 +205,13 @@ export default {
|
||||
// }
|
||||
|
||||
if(this.isA4){
|
||||
this.scale=75;
|
||||
this.preScale=75;
|
||||
this.pageCount=this.cacheA4FileList.length;
|
||||
setTimeout( this.showA4Page(this.cacheA4FileList.length),2000);
|
||||
}else{
|
||||
this.scale=20;
|
||||
this.preScale=20;
|
||||
this.pageCount=this.cacheFileList.length;
|
||||
setTimeout( this.showSinglePage(1),2000);
|
||||
}
|
||||
@ -315,18 +320,18 @@ export default {
|
||||
if(this.isA4){
|
||||
if(this.cacheA4FileList&&this.cacheA4FileList.length>0){
|
||||
this.cacheA4FileList.forEach(async item=>{
|
||||
|
||||
if(!item.pdfUrl){
|
||||
// 分页生成文件,只渲染第一页
|
||||
let thisSubList=item.childreen;
|
||||
let needGenList=[];
|
||||
for(let j=0;j<thisSubList.length;j++){
|
||||
needGenList.push(thisSubList[j].pdfBase64)
|
||||
}
|
||||
item.pdfUrl=await this.pdfUtils.mergePdfToA4(needGenList);
|
||||
this.downPdfFile(item.billCode,item.pdfUrl);
|
||||
}else{
|
||||
this.downPdfFile(item.billCode,item.pdfUrl);
|
||||
}
|
||||
|
||||
this.downPdfFile(item.billCode,item.pdfUrl);
|
||||
|
||||
});
|
||||
}
|
||||
}else{
|
||||
@ -356,23 +361,23 @@ export default {
|
||||
printPDF() {
|
||||
// this.$refs.pdf.print()
|
||||
if(this.isA4){
|
||||
if(this.cacheA4FileList&&this.cacheA4FileList.length>0){
|
||||
this.cacheA4FileList.forEach(async item=>{
|
||||
if(!item.pdfUrl){
|
||||
item.pdfUrl = this.pdfUtils.getBlobUrl(pdfBase64);
|
||||
}
|
||||
// 分页生成文件,只渲染第一页
|
||||
let thisSubList=item.childreen;
|
||||
let needGenList=[];
|
||||
for(let j=0;j<thisSubList.length;j++){
|
||||
needGenList.push(thisSubList[j].pdfBase64)
|
||||
}
|
||||
item.pdfUrl=await this.pdfUtils.mergePdfToA4(needGenList);
|
||||
|
||||
this.loadPdfUrl=item.pdfUrl;
|
||||
this.$refs.pdf.print();
|
||||
});
|
||||
}
|
||||
// if(this.cacheA4FileList&&this.cacheA4FileList.length>0){
|
||||
// this.cacheA4FileList.forEach(async item=>{
|
||||
// if(!item.pdfUrl){
|
||||
// let thisSubList=item.childreen;
|
||||
// let needGenList=[];
|
||||
// for(let j=0;j<thisSubList.length;j++){
|
||||
// needGenList.push(thisSubList[j].pdfBase64)
|
||||
// }
|
||||
// item.pdfUrl=await this.pdfUtils.mergePdfToA4(needGenList);
|
||||
// this.loadPdfUrl=item.pdfUrl;
|
||||
// }else{
|
||||
// this.loadPdfUrl=item.pdfUrl;
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
this.$refs.pdf.print();
|
||||
// window.print();
|
||||
}else{
|
||||
this.$emit("onPrint");
|
||||
}
|
||||
|
||||
@ -419,6 +419,7 @@ export default class PdfUtils {
|
||||
let y=0;
|
||||
let width=0;
|
||||
let height=0;
|
||||
let spaceWidth=2;
|
||||
for (let buffer of pdfBuffers) {
|
||||
const [page] = await pdfDoc.embedPdf(buffer);
|
||||
const pageDims = page.scale(1.0);
|
||||
@ -437,28 +438,28 @@ export default class PdfUtils {
|
||||
// Optional yScale
|
||||
// Optional ySkew
|
||||
|
||||
let rateDif=pageDims.width/pageDims.height;
|
||||
// let rateDif=pageDims.width/pageDims.height;
|
||||
// width = drawHeight*rateDif
|
||||
width = drawWidth-1*rateDif;
|
||||
height = drawHeight-1;
|
||||
width = pageDims.width;
|
||||
height = pageDims.height;
|
||||
|
||||
|
||||
|
||||
if(i==0){
|
||||
x=0;
|
||||
x=spaceWidth;
|
||||
y=pageA4.getHeight()/2;
|
||||
}
|
||||
else if(i==1){
|
||||
x=pageA4.getWidth()/2;
|
||||
x=spaceWidth+pageA4.getWidth()/2;
|
||||
y=pageA4.getHeight()/2;
|
||||
}
|
||||
else if(i==2){
|
||||
x=0;
|
||||
y=0;
|
||||
x=spaceWidth;
|
||||
y=spaceWidth;
|
||||
}
|
||||
else if(i==3){
|
||||
x=pageA4.getWidth()/2;
|
||||
y=0;
|
||||
x=spaceWidth+pageA4.getWidth()/2;
|
||||
y=spaceWidth;
|
||||
}
|
||||
|
||||
pageA4.drawPage(page, {
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
</span>
|
||||
</template>
|
||||
<el-option
|
||||
v-for="item in printTplList.filter(el=>isInitA4?(el.tplCode == 'A4-EP'?true:false):true)"
|
||||
v-for="item in printTplList"
|
||||
:key="item.tplCode"
|
||||
:label="item.tplName"
|
||||
:value="item.tplCode"
|
||||
@ -200,6 +200,9 @@
|
||||
this.printTplList=[];
|
||||
|
||||
this.printTplList=this.tanexPrinter.getPrintTplList();
|
||||
const newList=this.printTplList.filter(item=>item.tplCode == 'A4-EP');
|
||||
this.printTplList=newList;
|
||||
|
||||
// console.log(this.printTplList)
|
||||
|
||||
this.selTplCode=this.printTplList[0].tplCode;
|
||||
|
||||
@ -138,7 +138,7 @@
|
||||
</el-col>
|
||||
|
||||
<el-col :span="1.5">
|
||||
<TanexPrinterPanel ref="tanexPrinter" :isShowPinters="true" :isShowTpl="true" :isInitA4="true" :isShowSubBillRange="true" @onPrint="handleBatchPrint"></TanexPrinterPanel>
|
||||
<TanexPrinterPanel ref="tanexPrinter" :isShowPinters="false" :isShowTpl="false" :isInitA4="true" :isShowSubBillRange="false" @onPrint="handleBatchPrint"></TanexPrinterPanel>
|
||||
</el-col>
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user