This commit is contained in:
linfso 2024-06-29 11:34:07 +08:00
parent 75078a0ccb
commit e6e1154788
10 changed files with 253 additions and 125 deletions

View File

@ -291,7 +291,6 @@ export default {
this.showA4Page(this.currentPage) this.showA4Page(this.currentPage)
} }
}, },
// 下载
downPDF() { downPDF() {
// 下载所有预览的PDF文件 // 下载所有预览的PDF文件
if(this.isA4){ if(this.isA4){
@ -304,25 +303,67 @@ export default {
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); this.downPdfFile(item.pdfUrl);
}else{ }else{
this.downPdfFile(item.billCode,item.pdfUrl); this.downPdfFile(item.pdfUrl);
} }
}); });
} }
}else{ }else{
if(this.cacheFileList&&this.cacheFileList.length>0){ if(this.cacheFileList&&this.cacheFileList.length>0){
this.cacheFileList.forEach( item=>{ // this.cacheFileList.forEach( item=>{
if(!item.pdfUrl){ // if(!item.pdfUrl){
item.pdfUrl = this.pdfUtils.getBlobUrl(item.pdfBase64); // item.pdfUrl = this.pdfUtils.getBlobUrl(item.pdfBase64);
// }
// this.downPdfFile(item.billCode,item.pdfUrl);
// });
this.$prompt('请输入保存文件名', "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
closeOnClickModal: false,
inputValidator (value) {
if (value) {
return true;
}else{
return false;
} }
this.downPdfFile(item.billCode,item.pdfUrl); },
}); inputErrorMessage: "文件名不能为空"
}).then(async ({ value }) => {
let fileName=value+".pdf";
let needGenList=[];
for(let j=0;j<this.cacheFileList.length;j++){
needGenList.push(this.cacheFileList[j].pdfBase64)
}
this.pdfUtils.mergePdf3(needGenList,fileName,true);
}).catch(() => {});
} }
} }
}, },
downPdfFile(fileName,pdfUrl){ downPdfFile(pdfUrl){
this.$prompt('请输入保存文件名', "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
closeOnClickModal: false,
inputValidator (value) {
if (value) {
return true;
}else{
return false;
}
},
inputErrorMessage: "文件名不能为空"
}).then(async ({ value }) => {
let fileName=value+".pdf";
var tempLink = document.createElement('a') var tempLink = document.createElement('a')
tempLink.style.display = 'none' tempLink.style.display = 'none'
tempLink.href = pdfUrl tempLink.href = pdfUrl
@ -333,6 +374,8 @@ export default {
document.body.appendChild(tempLink) document.body.appendChild(tempLink)
tempLink.click() tempLink.click()
document.body.removeChild(tempLink) document.body.removeChild(tempLink)
}).catch(() => {});
}, },
// 打印 // 打印
printPDF() { printPDF() {

View File

@ -33,12 +33,14 @@
<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" size="mini" style="padding: 5px 10px;" @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" size="mini" style="padding: 5px 10px;" @click="printPDF">打印</el-button>
</div> </div>
</div> </div>
</div> </div>
<div style="min-height:1600px;margin: 0 auto;overflow: auto;"> <div style="min-height:1600px;margin: 0 auto;overflow: auto;">
<!-- <el-scrollbar>
<div style="min-height:600px;margin: 0 auto;overflow: auto;"> -->
<div class="pdf-wrapper"> <div class="pdf-wrapper">
<pdf <pdf
:src="currentPdfUrl" :src="currentPdfUrl"
@ -48,13 +50,8 @@
ref="pdf" ref="pdf"
></pdf> ></pdf>
</div> </div>
<!-- </div> -->
<!-- </el-scrollbar> -->
<!-- <div>
<XdPdf :pdfUrl="loadPdfUrl"></XdPdf>
</div> -->
</div> </div>
</div> </div>
</div> </div>
@ -302,9 +299,9 @@ export default {
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); this.downPdfFile(item.pdfUrl);
}else{ }else{
this.downPdfFile(item.billCode,item.pdfUrl); this.downPdfFile(item.pdfUrl);
} }
}); });
@ -319,17 +316,50 @@ export default {
// }); // });
this.$prompt('请输入保存文件名', "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
closeOnClickModal: false,
inputValidator (value) {
if (value) {
return true;
}else{
return false;
}
},
inputErrorMessage: "文件名不能为空"
}).then(async ({ value }) => {
let fileName=value+".pdf";
let needGenList=[]; let needGenList=[];
for(let j=0;j<this.cacheFileList.length;j++){ for(let j=0;j<this.cacheFileList.length;j++){
needGenList.push(this.cacheFileList[j].pdfBase64) needGenList.push(this.cacheFileList[j].pdfBase64)
} }
let fileName=new Date().getTime()+".pdf";
this.pdfUtils.mergePdf3(needGenList,fileName,true); this.pdfUtils.mergePdf3(needGenList,fileName,true);
}).catch(() => {});
} }
} }
}, },
downPdfFile(fileName,pdfUrl){ downPdfFile(pdfUrl){
this.$prompt('请输入保存文件名', "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
closeOnClickModal: false,
inputValidator (value) {
if (value) {
return true;
}else{
return false;
}
},
inputErrorMessage: "文件名不能为空"
}).then(async ({ value }) => {
let fileName=value+".pdf";
var tempLink = document.createElement('a') var tempLink = document.createElement('a')
tempLink.style.display = 'none' tempLink.style.display = 'none'
tempLink.href = pdfUrl tempLink.href = pdfUrl
@ -340,6 +370,9 @@ export default {
document.body.appendChild(tempLink) document.body.appendChild(tempLink)
tempLink.click() tempLink.click()
document.body.removeChild(tempLink) document.body.removeChild(tempLink)
}).catch(() => {});
}, },
// 打印 // 打印
printPDF() { printPDF() {
@ -460,7 +493,7 @@ export default {
display: flex; display: flex;
z-index: 9999; z-index: 9999;
position: absolute; position: absolute;
top: 5px; top: 0px;
right: 30px; right: 30px;
} }
.pdf-bar { .pdf-bar {
@ -471,7 +504,7 @@ export default {
z-index: 1; z-index: 1;
width: 100%; width: 100%;
height: 50px; height: 36px;
border: 1px solid #ddd; border: 1px solid #ddd;
box-sizing: border-box; box-sizing: border-box;
text-align: center; text-align: center;

View File

@ -67,7 +67,7 @@
<el-button type="text" size="mini" style="padding: 7px 5px;" icon="el-icon-setting" @click="setTbShowTpl" :disabled="!isNeedDbSaveTpl"></el-button> <el-button type="text" size="mini" style="padding: 7px 5px;" icon="el-icon-setting" @click="setTbShowTpl" :disabled="!isNeedDbSaveTpl"></el-button>
</div> </div>
</div> </div>
<el-scrollbar style=" height: calc(100vh - 200px);box-sizing: border-box;overflow: hidden;"> <el-scrollbar style=" height: calc(100vh - 200px);box-sizing: border-box;">
<draggable v-model="storageList" <draggable v-model="storageList"
ghostClass="drag-ghost" ghostClass="drag-ghost"
chosenClass="drag-chosen" chosenClass="drag-chosen"

View File

@ -1,6 +1,6 @@
<template> <template>
<div id="tags-view-container" class="tags-view-container"> <div id="tags-view-container" class="tags-view-container">
<div class="tags-view-inner" style="display:inline-flex"> <div class="tags-view-inner" >
<scroll-pane ref="scrollPane" class="tags-view-wrapper" @scroll="handleScroll"> <scroll-pane ref="scrollPane" class="tags-view-wrapper" @scroll="handleScroll">
<!-- v-model="quickLinkList" --> <!-- v-model="quickLinkList" -->
<!-- <draggable <!-- <draggable

View File

@ -57,13 +57,10 @@
</div> </div>
</div> </div>
<el-dialog :key="resetRefreshId+'.dlg'" class="printPreDialog" title="预览" :visible.sync="openPdfView" width="95%" height="100%" :close-on-click-modal="false" :destroy-on-close="true" v-dialogFullScreen v-dialogDrag append-to-body @close="handleClose"> <el-dialog :key="resetRefreshId+'.dlg'" class="printPreDialog" title="预览" :resizable="true" :visible.sync="openPdfView" width="90%" :close-on-click-modal="false" :destroy-on-close="true" v-dialogDrag append-to-body @close="handleClose">
<div style="height:100%;width:100%;overflow: auto;"> <div style="height:100%;width:100%;overflow: auto;">
<PdfViewer :key="resetRefreshId+'.pdf'" ref="pdfViewer" v-if="openPdfView&&!isInitA4" :pdfList="pdfList" :isLoadComplete="isLoadComplete" @onPrint="onPdfViewPrint" ></PdfViewer> <PdfViewer :key="resetRefreshId+'.pdf'" ref="pdfViewer" v-if="openPdfView&&!isInitA4" :pdfList="pdfList" :isLoadComplete="isLoadComplete" @onPrint="onPdfViewPrint" ></PdfViewer>
<A4Viewer :key="resetRefreshId+'.pdf'" ref="pdfViewer" v-if="openPdfView&&isInitA4" :pdfList="pdfList" :isLoadComplete="isLoadComplete" ></A4Viewer> <A4Viewer :key="resetRefreshId+'.pdf'" ref="pdfViewer" v-if="openPdfView&&isInitA4" :pdfList="pdfList" :isLoadComplete="isLoadComplete" ></A4Viewer>
</div> </div>
</el-dialog> </el-dialog>
@ -360,9 +357,7 @@
}); });
}, },
printPreview(orderList,isA4,tplCode){ printPreview(orderList,isA4,tplCode){
this.refreshKey(); this.refreshKey();
if(this.printerStatus !=1){ if(this.printerStatus !=1){
this.$modal.msgError("打印机未连接"); this.$modal.msgError("打印机未连接");
return; return;
@ -492,6 +487,8 @@
const loadingInstance = this.$loading({ const loadingInstance = this.$loading({
text: '正在下载...' text: '正在下载...'
}) })
// 清空以前的数据
this.pdfList=[];
this.tanexPrinter.batchGetPDF(this.selTplCode,this.selPrinterName,newOrderList,this.printManCode,function(code,msg,data){ this.tanexPrinter.batchGetPDF(this.selTplCode,this.selPrinterName,newOrderList,this.printManCode,function(code,msg,data){
loadingInstance.close(); loadingInstance.close();
@ -542,16 +539,57 @@
}, },
downSinglePDF(){ downSinglePDF(){
this.$prompt('请输入保存文件名', "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
closeOnClickModal: false,
inputValidator (value) {
if (value) {
return true;
}else{
return false;
}
},
inputErrorMessage: "文件名不能为空"
}).then(async ({ value }) => {
if(!value){
this.$modal.msgError("文件名不能为空" );
return
}
let needGenList=[]; let needGenList=[];
for(let j=0;j<this.pdfList.length;j++){ for(let j=0;j<this.pdfList.length;j++){
needGenList.push(this.pdfList[j].pdfBase64) needGenList.push(this.pdfList[j].pdfBase64)
} }
let fileName=new Date().getTime()+".pdf"; // let fileName=new Date().getTime()+".pdf";
let fileName=value+".pdf";
this.pdfUtils.mergePdf3(needGenList,fileName,true); this.pdfUtils.mergePdf3(needGenList,fileName,true);
}).catch(() => {});
}, },
downA4PDF(){ downA4PDF(){
this.$prompt('请输入保存文件名', "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
closeOnClickModal: false,
inputValidator (value) {
if (value) {
return true;
}else{
return false;
}
},
inputErrorMessage: "文件名不能为空"
}).then(async ({ value }) => {
if(!value){
this.$modal.msgError("文件名不能为空" );
return
}
let cacheA4FileList=[]; let cacheA4FileList=[];
const newList = Object.assign([], this.pdfList); const newList = Object.assign([], this.pdfList);
if(newList&&newList.length>4){ if(newList&&newList.length>4){
@ -582,15 +620,23 @@
} }
// 下载 // 下载
// let mergeA4List=[];
let needGenList=[];
for(let i=0;i<cacheA4FileList.length;i++){ for(let i=0;i<cacheA4FileList.length;i++){
let thisSubList=cacheA4FileList[i].childreen; let thisSubList=cacheA4FileList[i].childreen;
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)
} }
this.pdfUtils.mergePdfToA4(needGenList,"page-"+i+".pdf",true);
} }
// let pdfUrl=await this.pdfUtils.mergePdfToA4(needGenList);
// mergeA4List.push(pdfUrl);
// let fileName=new Date().getTime()+".pdf";
let fileName=value+".pdf";
this.pdfUtils.mergePdfToA4(needGenList,fileName,true);
}).catch(() => {});
}, },
// 响应PDF预览 // 响应PDF预览

View File

@ -197,12 +197,12 @@ export default {
inputErrorMessage: "数量介于 1 和 99 之间" inputErrorMessage: "数量介于 1 和 99 之间"
}).then(async ({ value }) => { }).then(async ({ value }) => {
if(!value){ if(!value){
this.$modal.msgSuccess("输入错误,数量介于 1 和 99 之间" ); this.$message.erro("输入错误,数量介于 1 和 99 之间" );
return return
} }
if(value<1 || value>99){ if(value<1 || value>99){
this.$modal.msgSuccess("输入错误,数量介于 1 和 99 之间" ); this.$message.erro("输入错误,数量介于 1 和 99 之间" );
return return
} }

View File

@ -25,7 +25,7 @@
<div> <div>
<el-input v-model="form.billCode" placeholder="" @blur="onBillCodeChange" style="font-weight:600;color:black" /> <el-input v-model="form.billCode" placeholder="" @blur="onBillCodeChange" style="font-weight:600;color:black" />
</div> </div>
<div style="padding-left:5px"> <el-checkbox style="font-size:400;margin-right:10px;font-size:10px" @change="checked=>handleBillCodeChange(checked)"><span style="font-size:10px">{{ $t('电子主单') }}</span></el-checkbox></div> <div style="padding-left:5px"> <el-checkbox v-model="form.blSelfBillCode" style="font-size:400;margin-right:10px;font-size:10px" @change="checked=>handleBillCodeChange(checked)" :true-label="'1'" :false-label="'0'"><span style="font-size:10px">{{ $t('电子主单') }}</span></el-checkbox></div>
</div> </div>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -1142,12 +1142,12 @@ methods: {
orderList.push(this.form.billCode); orderList.push(this.form.billCode);
// 客户联 // 客户联
let customerItem ={ // let customerItem ={
"tplCode":"TAN-CM-130", // "tplCode":"TAN-CM-130",
"printerName":this.$refs.tanexPrinter.getDefaultPrinter(), // "printerName":this.$refs.tanexPrinter.getDefaultPrinter(),
"orderList":orderList.toString() // "orderList":orderList.toString()
} // }
printDataList.push(customerItem); // printDataList.push(customerItem);
// 主单 // 主单
let mainBillItem ={ let mainBillItem ={
@ -1471,6 +1471,7 @@ methods: {
blSensitive:null, blSensitive:null,
lockFlag:null, lockFlag:null,
lockReason:null, lockReason:null,
blSelfBillCode:null,
}; };
this.resetForm("form"); this.resetForm("form");
}, },
@ -1991,7 +1992,9 @@ methods: {
}, },
// 实时获取运单号 // 实时获取运单号
handleBillCodeChange(checked,item){ handleBillCodeChange(checked,item){
if(checked){ // console.log("=handleBillCodeChange==>",checked);
if(checked==1){
let useSiteCode=this.form.sendSiteCode; let useSiteCode=this.form.sendSiteCode;
realMatchWaybill(useSiteCode).then(response => { realMatchWaybill(useSiteCode).then(response => {
this.form.billCode=response.data; this.form.billCode=response.data;

View File

@ -1003,7 +1003,7 @@ export default {
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
}).catch(() => {}); }).catch(() => {});
}, },
handleExport_new() { handleExport() {
var xlsxParam = { raw: true } var xlsxParam = { raw: true }
let wb = XLSX.utils.table_to_book(document.querySelector("#refTable"),xlsxParam); let wb = XLSX.utils.table_to_book(document.querySelector("#refTable"),xlsxParam);
let wbout = XLSX.write(wb, { let wbout = XLSX.write(wb, {

View File

@ -25,7 +25,7 @@
<div> <div>
<el-input v-model="form.billCode" placeholder="" @blur="onBillCodeChange" style="font-weight:600;color:black" /> <el-input v-model="form.billCode" placeholder="" @blur="onBillCodeChange" style="font-weight:600;color:black" />
</div> </div>
<div style="padding-left:5px"> <el-checkbox style="font-size:400;margin-right:10px;font-size:10px" @change="checked=>handleBillCodeChange(checked)"><span style="font-size:10px">{{ $t('电子主单') }}</span></el-checkbox></div> <div style="padding-left:5px"> <el-checkbox v-model="form.blSelfBillCode" style="font-size:400;margin-right:10px;font-size:10px" @change="checked=>handleBillCodeChange(checked)" :true-label="'1'" :false-label="'0'"><span style="font-size:10px">{{ $t('电子主单') }}</span></el-checkbox></div>
</div> </div>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -1142,12 +1142,12 @@ methods: {
orderList.push(this.form.billCode); orderList.push(this.form.billCode);
// 客户联 // 客户联
let customerItem ={ // let customerItem ={
"tplCode":"TAN-CM-130", // "tplCode":"TAN-CM-130",
"printerName":this.$refs.tanexPrinter.getDefaultPrinter(), // "printerName":this.$refs.tanexPrinter.getDefaultPrinter(),
"orderList":orderList.toString() // "orderList":orderList.toString()
} // }
printDataList.push(customerItem); // printDataList.push(customerItem);
// 主单 // 主单
let mainBillItem ={ let mainBillItem ={
@ -1471,6 +1471,7 @@ methods: {
blSensitive:null, blSensitive:null,
lockFlag:null, lockFlag:null,
lockReason:null, lockReason:null,
blSelfBillCode:null,
}; };
this.resetForm("form"); this.resetForm("form");
}, },
@ -1991,7 +1992,9 @@ methods: {
}, },
// 实时获取运单号 // 实时获取运单号
handleBillCodeChange(checked,item){ handleBillCodeChange(checked,item){
if(checked){ // console.log("=handleBillCodeChange==>",checked);
if(checked==1){
let useSiteCode=this.form.sendSiteCode; let useSiteCode=this.form.sendSiteCode;
realMatchWaybill(useSiteCode).then(response => { realMatchWaybill(useSiteCode).then(response => {
this.form.billCode=response.data; this.form.billCode=response.data;

View File

@ -115,9 +115,9 @@
type="text" type="text"
clearable clearable
maxlength="20" maxlength="20"
auto-complete="new-password"
:placeholder="$t('loginForm.username')" :placeholder="$t('loginForm.username')"
> >
<!-- auto-complete="new-password" -->
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" /> <svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
</el-input> </el-input>
</el-form-item> </el-form-item>
@ -126,12 +126,12 @@
v-model="loginForm.password" v-model="loginForm.password"
type="password" type="password"
maxlength="20" maxlength="20"
auto-complete="new-password"
show-password show-password
clearable clearable
:placeholder="$t('loginForm.password')" :placeholder="$t('loginForm.password')"
@keyup.enter.native="handleLogin" @keyup.enter.native="handleLogin"
> >
<!-- auto-complete="new-password" -->
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" /> <svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
</el-input> </el-input>
</el-form-item> </el-form-item>