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,8 +291,7 @@ export default {
this.showA4Page(this.currentPage)
}
},
// 下载
downPDF() {
downPDF() {
// 下载所有预览的PDF文件
if(this.isA4){
if(this.cacheA4FileList&&this.cacheA4FileList.length>0){
@ -304,35 +303,79 @@ export default {
needGenList.push(thisSubList[j].pdfBase64)
}
item.pdfUrl=await this.pdfUtils.mergePdfToA4(needGenList);
this.downPdfFile(item.billCode,item.pdfUrl);
this.downPdfFile(item.pdfUrl);
}else{
this.downPdfFile(item.billCode,item.pdfUrl);
this.downPdfFile(item.pdfUrl);
}
});
}
}else{
if(this.cacheFileList&&this.cacheFileList.length>0){
this.cacheFileList.forEach( item=>{
if(!item.pdfUrl){
item.pdfUrl = this.pdfUtils.getBlobUrl(item.pdfBase64);
// this.cacheFileList.forEach( item=>{
// if(!item.pdfUrl){
// 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){
var tempLink = document.createElement('a')
tempLink.style.display = 'none'
tempLink.href = pdfUrl
tempLink.setAttribute('download', fileName+'.pdf')
if (typeof tempLink.download === 'undefined') {
tempLink.setAttribute('target', '_blank')
}
document.body.appendChild(tempLink)
tempLink.click()
document.body.removeChild(tempLink)
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')
tempLink.style.display = 'none'
tempLink.href = pdfUrl
tempLink.setAttribute('download', fileName+'.pdf')
if (typeof tempLink.download === 'undefined') {
tempLink.setAttribute('target', '_blank')
}
document.body.appendChild(tempLink)
tempLink.click()
document.body.removeChild(tempLink)
}).catch(() => {});
},
// 打印
printPDF() {

View File

@ -33,13 +33,15 @@
<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" 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-download" size="mini" style="padding: 5px 10px;" @click="downPDF">下载</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 style="min-height:1600px;margin: 0 auto;overflow: auto;">
<div class="pdf-wrapper">
<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">
<pdf
:src="currentPdfUrl"
:page="page"
@ -47,14 +49,9 @@
@page-loaded="onPageLoaded($event)"
ref="pdf"
></pdf>
</div>
<!-- <div>
<XdPdf :pdfUrl="loadPdfUrl"></XdPdf>
</div> -->
</div>
<!-- </div> -->
<!-- </el-scrollbar> -->
</div>
</div>
</div>
@ -302,9 +299,9 @@ export default {
needGenList.push(thisSubList[j].pdfBase64)
}
item.pdfUrl=await this.pdfUtils.mergePdfToA4(needGenList);
this.downPdfFile(item.billCode,item.pdfUrl);
this.downPdfFile(item.pdfUrl);
}else{
this.downPdfFile(item.billCode,item.pdfUrl);
this.downPdfFile(item.pdfUrl);
}
});
@ -319,27 +316,63 @@ export default {
// });
let needGenList=[];
for(let j=0;j<this.cacheFileList.length;j++){
needGenList.push(this.cacheFileList[j].pdfBase64)
}
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=[];
for(let j=0;j<this.cacheFileList.length;j++){
needGenList.push(this.cacheFileList[j].pdfBase64)
}
this.pdfUtils.mergePdf3(needGenList,fileName,true);
}).catch(() => {});
let fileName=new Date().getTime()+".pdf";
this.pdfUtils.mergePdf3(needGenList,fileName,true);
}
}
},
downPdfFile(fileName,pdfUrl){
var tempLink = document.createElement('a')
tempLink.style.display = 'none'
tempLink.href = pdfUrl
tempLink.setAttribute('download', fileName+'.pdf')
if (typeof tempLink.download === 'undefined') {
tempLink.setAttribute('target', '_blank')
}
document.body.appendChild(tempLink)
tempLink.click()
document.body.removeChild(tempLink)
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')
tempLink.style.display = 'none'
tempLink.href = pdfUrl
tempLink.setAttribute('download', fileName+'.pdf')
if (typeof tempLink.download === 'undefined') {
tempLink.setAttribute('target', '_blank')
}
document.body.appendChild(tempLink)
tempLink.click()
document.body.removeChild(tempLink)
}).catch(() => {});
},
// 打印
printPDF() {
@ -460,7 +493,7 @@ export default {
display: flex;
z-index: 9999;
position: absolute;
top: 5px;
top: 0px;
right: 30px;
}
.pdf-bar {
@ -471,7 +504,7 @@ export default {
z-index: 1;
width: 100%;
height: 50px;
height: 36px;
border: 1px solid #ddd;
box-sizing: border-box;
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>
</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"
ghostClass="drag-ghost"
chosenClass="drag-chosen"

View File

@ -1,6 +1,6 @@
<template>
<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">
<!-- v-model="quickLinkList" -->
<!-- <draggable

View File

@ -57,13 +57,10 @@
</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;">
<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>
</div>
</el-dialog>
@ -360,9 +357,7 @@
});
},
printPreview(orderList,isA4,tplCode){
this.refreshKey();
if(this.printerStatus !=1){
this.$modal.msgError("打印机未连接");
return;
@ -492,6 +487,8 @@
const loadingInstance = this.$loading({
text: '正在下载...'
})
// 清空以前的数据
this.pdfList=[];
this.tanexPrinter.batchGetPDF(this.selTplCode,this.selPrinterName,newOrderList,this.printManCode,function(code,msg,data){
loadingInstance.close();
@ -542,54 +539,103 @@
},
downSinglePDF(){
let needGenList=[];
for(let j=0;j<this.pdfList.length;j++){
needGenList.push(this.pdfList[j].pdfBase64)
}
let fileName=new Date().getTime()+".pdf";
this.pdfUtils.mergePdf3(needGenList,fileName,true);
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=[];
for(let j=0;j<this.pdfList.length;j++){
needGenList.push(this.pdfList[j].pdfBase64)
}
// let fileName=new Date().getTime()+".pdf";
let fileName=value+".pdf";
this.pdfUtils.mergePdf3(needGenList,fileName,true);
}).catch(() => {});
},
downA4PDF(){
let cacheA4FileList=[];
const newList = Object.assign([], this.pdfList);
if(newList&&newList.length>4){
let spliteArr = (array = [], subGroupLength = 0) => {
let index = 0;
const newArray = [];
while (index < array.length) {
newArray.push(array.slice(index, index += subGroupLength));
this.$prompt('请输入保存文件名', "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
closeOnClickModal: false,
inputValidator (value) {
if (value) {
return true;
}else{
return false;
}
return newArray;
}
const subPdfList=spliteArr(newList, 4);
for (let i=0; i < subPdfList.length;i++){
},
inputErrorMessage: "文件名不能为空"
}).then(async ({ value }) => {
if(!value){
this.$modal.msgError("文件名不能为空" );
return
}
let cacheA4FileList=[];
const newList = Object.assign([], this.pdfList);
if(newList&&newList.length>4){
let spliteArr = (array = [], subGroupLength = 0) => {
let index = 0;
const newArray = [];
while (index < array.length) {
newArray.push(array.slice(index, index += subGroupLength));
}
return newArray;
}
const subPdfList=spliteArr(newList, 4);
for (let i=0; i < subPdfList.length;i++){
let fileItem={
"billCode":"page-"+(i+1),
"pdfUrl":null,
"childreen":subPdfList[i]
}
cacheA4FileList.push(fileItem);
}
}else{
let fileItem={
"billCode":"page-"+(i+1),
"pdfUrl":null,
"childreen":subPdfList[i]
"billCode":"page-"+1,
"pdfUrl":null,
"childreen":newList
}
cacheA4FileList.push(fileItem);
}
}else{
let fileItem={
"billCode":"page-"+1,
"pdfUrl":null,
"childreen":newList
}
cacheA4FileList.push(fileItem);
}
}
// 下载
for(let i=0;i<cacheA4FileList.length;i++){
let thisSubList=cacheA4FileList[i].childreen;
let needGenList=[];
for(let j=0;j<thisSubList.length;j++){
needGenList.push(thisSubList[j].pdfBase64)
}
this.pdfUtils.mergePdfToA4(needGenList,"page-"+i+".pdf",true);
}
// 下载
// let mergeA4List=[];
let needGenList=[];
for(let i=0;i<cacheA4FileList.length;i++){
let thisSubList=cacheA4FileList[i].childreen;
for(let j=0;j<thisSubList.length;j++){
needGenList.push(thisSubList[j].pdfBase64)
}
}
// 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(() => {});
},

View File

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

View File

@ -25,7 +25,7 @@
<div>
<el-input v-model="form.billCode" placeholder="" @blur="onBillCodeChange" style="font-weight:600;color:black" />
</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>
</el-form-item>
</el-col>
@ -388,7 +388,7 @@
</el-table-column>
<el-table-column prop="length" :label="$t('长(cm)')" align="center" width="60">
<template slot-scope="scope">
<el-input v-model="scope.row.length" @input="(val)=>handleCalcVolumeDebounce(scope.row)" size="mini" placeholder=""></el-input>
<el-input v-model="scope.row.length" @input="(val)=>handleCalcVolumeDebounce(scope.row)" size="mini" placeholder=""></el-input>
</template>
</el-table-column>
<el-table-column prop="width" :label="$t('宽(cm)')" align="center" width="60">
@ -398,7 +398,7 @@
</el-table-column>
<el-table-column prop="height" :label="$t('高(cm)')" align="center" width="60">
<template slot-scope="scope">
<el-input v-model="scope.row.height" @input="(val)=>handleCalcVolumeDebounce(scope.row)" size="mini" placeholder=""></el-input>
<el-input v-model="scope.row.height" @input="(val)=>handleCalcVolumeDebounce(scope.row)" size="mini" placeholder=""></el-input>
</template>
</el-table-column>
<el-table-column prop="cargoQty" :label="$t('件数')" align="center" width="60">
@ -1142,12 +1142,12 @@ methods: {
orderList.push(this.form.billCode);
// 客户联
let customerItem ={
"tplCode":"TAN-CM-130",
"printerName":this.$refs.tanexPrinter.getDefaultPrinter(),
"orderList":orderList.toString()
}
printDataList.push(customerItem);
// let customerItem ={
// "tplCode":"TAN-CM-130",
// "printerName":this.$refs.tanexPrinter.getDefaultPrinter(),
// "orderList":orderList.toString()
// }
// printDataList.push(customerItem);
// 主单
let mainBillItem ={
@ -1471,6 +1471,7 @@ methods: {
blSensitive:null,
lockFlag:null,
lockReason:null,
blSelfBillCode:null,
};
this.resetForm("form");
},
@ -1991,7 +1992,9 @@ methods: {
},
// 实时获取运单号
handleBillCodeChange(checked,item){
if(checked){
// console.log("=handleBillCodeChange==>",checked);
if(checked==1){
let useSiteCode=this.form.sendSiteCode;
realMatchWaybill(useSiteCode).then(response => {
this.form.billCode=response.data;

View File

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

View File

@ -25,7 +25,7 @@
<div>
<el-input v-model="form.billCode" placeholder="" @blur="onBillCodeChange" style="font-weight:600;color:black" />
</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>
</el-form-item>
</el-col>
@ -388,7 +388,7 @@
</el-table-column>
<el-table-column prop="length" :label="$t('长(cm)')" align="center" width="60">
<template slot-scope="scope">
<el-input v-model="scope.row.length" @input="(val)=>handleCalcVolumeDebounce(scope.row)" size="mini" placeholder=""></el-input>
<el-input v-model="scope.row.length" @input="(val)=>handleCalcVolumeDebounce(scope.row)" size="mini" placeholder=""></el-input>
</template>
</el-table-column>
<el-table-column prop="width" :label="$t('宽(cm)')" align="center" width="60">
@ -398,7 +398,7 @@
</el-table-column>
<el-table-column prop="height" :label="$t('高(cm)')" align="center" width="60">
<template slot-scope="scope">
<el-input v-model="scope.row.height" @input="(val)=>handleCalcVolumeDebounce(scope.row)" size="mini" placeholder=""></el-input>
<el-input v-model="scope.row.height" @input="(val)=>handleCalcVolumeDebounce(scope.row)" size="mini" placeholder=""></el-input>
</template>
</el-table-column>
<el-table-column prop="cargoQty" :label="$t('件数')" align="center" width="60">
@ -1142,12 +1142,12 @@ methods: {
orderList.push(this.form.billCode);
// 客户联
let customerItem ={
"tplCode":"TAN-CM-130",
"printerName":this.$refs.tanexPrinter.getDefaultPrinter(),
"orderList":orderList.toString()
}
printDataList.push(customerItem);
// let customerItem ={
// "tplCode":"TAN-CM-130",
// "printerName":this.$refs.tanexPrinter.getDefaultPrinter(),
// "orderList":orderList.toString()
// }
// printDataList.push(customerItem);
// 主单
let mainBillItem ={
@ -1471,6 +1471,7 @@ methods: {
blSensitive:null,
lockFlag:null,
lockReason:null,
blSelfBillCode:null,
};
this.resetForm("form");
},
@ -1991,7 +1992,9 @@ methods: {
},
// 实时获取运单号
handleBillCodeChange(checked,item){
if(checked){
// console.log("=handleBillCodeChange==>",checked);
if(checked==1){
let useSiteCode=this.form.sendSiteCode;
realMatchWaybill(useSiteCode).then(response => {
this.form.billCode=response.data;

View File

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