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