运单补打印新

This commit is contained in:
wuteng 2025-08-07 15:16:25 +08:00
parent eace7a4fd8
commit 936b058c28
2 changed files with 1601 additions and 0 deletions

View File

@ -0,0 +1,866 @@
<template>
<div>
<!-- 打印机状态 -->
<!-- style="padding:5px 0px;text-align: right;position: fixed;top: 150px;right: 10px; z-index: 9999;" -->
<div >
<div style="display: inline-flex;">
<div v-if="printerStatus==0" style="display: inline-flex;">
<el-tag type="danger" >{{ printerStatusMessage }}</el-tag>
</div>
<div v-if="printerStatus==1" style="display: inline-flex;">
<div v-if="isShowTpl==1" style="font-size: 12px; line-height: 28px;font-weight: 600;">模板:</div>
<div v-if="isShowTpl==1" style="width: 150px;">
<el-select v-model="selTplCode" multiple size="mini" placeholder="选择打印模板" clearable filterable>
<template slot="prefix">
<span style="padding: 5px;line-height: 28px;font-size: 16px;color: rgb(111 111 111);cursor: pointer;" @click="refreshPrintTpl()">
<i class="el-icon-refresh"></i>
</span>
</template>
<el-option
v-for="item in printTplList"
:key="item.tplCode"
:label="item.tplName"
:value="item.tplCode"
/>
</el-select>
</div>
<div v-if="(selTplCode=='TAN-GC-130' || selTplCode=='TAN-ENGC-130' || selTplCode=='VT-ENNOLOGO') && isShowSubBillRange" class="subBillRange" style="display: inline-flex;font-size: 12px; line-height: 28px; font-weight: 600;">
<span >子单范围:
<el-input size="mini" style="width:40px" v-model="subBillStart" type="text" maxlength="4" ></el-input>
-
<el-input size="mini" style="width:40px" v-model="subBillEnd" type="text" maxlength="4" ></el-input>
</span>
</div>
<div v-if="isShowPinters==1" style="font-size: 12px;line-height: 28px;font-weight: 600;">选择打印机:</div>
<div v-if="isShowPinters==1" style="width: 150px;">
<el-select v-model="selPrinterName" size="mini" placeholder="打印机" clearable filterable>
<el-option
v-for="item in printerList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</div>
</div>
<div v-if="printerStatus==1" style="display: inline-flex;">
<!-- <span style="color: green;font-weight: 600;font-size:13px;">【Printer Online】</span> -->
</div>
<div v-if="printerStatus==0" style="display: inline-flex;">
<a :href="printerDownUrl" style="color: blue;font-weight: 600;font-size:13px;text-decoration: underline">下载打印组件</a>
</div>
<div>
<span style="color: #b12e29;font-size:23px;cursor: pointer" class="icon iconfont icon-printer" title="" @click="configPrinter"></span>
<!-- <el-button type="text" size="mini" style="padding: 7px 5px;" icon="el-icon-setting" @click="configPrinter"></el-button> -->
</div>
</div>
</div>
<el-dialog v-if="openPdfView&&!isInitA4" :key="resetRefreshId+'.dlg'" class="printPreDialog" title="预览" :resizable="true" :visible.sync="openPdfView" width="50%" :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" :pdfList="pdfList" :isLoadComplete="isLoadComplete" @onPrint="onPdfViewPrint" @close="handleClose"></PdfViewer>
</div>
</el-dialog>
<el-dialog v-if="openPdfView&&isInitA4" :key="resetRefreshId+'.dlg'" class="printPreDialog" title="预览" :resizable="true" :visible.sync="openPdfView" width="70%" :close-on-click-modal="false" :destroy-on-close="true" v-dialogDrag append-to-body @close="handleClose">
<div style="height:100%;width:100%;overflow: auto;">
<A4Viewer :key="resetRefreshId+'.pdf'" ref="pdfViewer" :pdfList="pdfList" :isLoadComplete="isLoadComplete" @close="handleClose"></A4Viewer>
</div>
</el-dialog>
<el-dialog title="设置打印机" :visible.sync="openShowConfig" width="30%">
<el-form ref="form" :model="form" size="mini" :rules="rules" @submit.native.prevent>
<el-row :gutter="0" style="display: flex;flex-wrap: wrap;">
<el-col :span="24">
<el-alert
title="注意"
type="info"
description="配置打印机信息,不要轻易更改!"
show-icon
:closable="false"
style="margin-bottom: 10px;"
>
</el-alert>
<el-form-item label="打印机地址" prop="printerHost">
<el-input v-model="form.printerHost" type="text" placeholder="" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="打印模板" prop="selTplCode">
<el-select v-model="selTplCode" size="mini" style="width:100%" placeholder="选择打印模板" clearable filterable>
<template slot="prefix">
<span style="padding: 5px;line-height: 28px;font-size: 16px;color: rgb(111 111 111);cursor: pointer;" @click="refreshPrintTpl()">
<i class="el-icon-refresh"></i>
</span>
</template>
<el-option
v-for="item in printTplList"
:key="item.tplCode"
:label="item.tplName"
:value="item.tplCode"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="打印机" prop="selPrinterName">
<el-select v-model="selPrinterName" style="width:100%" size="mini" placeholder="打印机" clearable filterable>
<el-option
v-for="item in printerList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer" style="text-align: center;margin-bottom:20px">
<el-button type="primary" size="mini" @click="setupPrinter">设置</el-button>
<el-button size="mini" @click="openShowConfig = false">关 闭</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import emitter from 'element-ui/src/mixins/emitter';
import PdfViewer from '@/components/PdfViewer/viewer.vue';
import A4Viewer from '@/components/PdfViewer/A4Viewer.vue';
import PdfUtils from '@/utils/pdfUtils'
import { deepClone } from '@/utils/index'
export default {
name: "TanexPrinterPanel",
components: {
PdfViewer,A4Viewer
},
mixins: [emitter],
props: {
value: {
type: [Number],
required: false
},
placeholder:{
type: [String],
required: false
},
isShowPinters:{
type: [Boolean],
required: false,
default: false
},
isShowTpl:{
type: [Boolean],
required: false,
default: false
},
isShowSubBillRange:{
type: [Boolean],
required: false,
default: false
},
},
data() {
return {
resetRefreshId:null,
svalue: this.value,
subBillStart:1,
subBillEnd:null,
openPdfView:false,
orderDetailMap:new Map(),
isInitA4:false,
printManCode:this.$store.getters.empCode,
// 计数器
showCounter:0,
pdfList:[],
pdfBase64List:[],
isLoadComplete:0,
tanexPrinter:null,
printerDownUrl:null,
printerStatus:0,
printerStatusMessage:'打印组件未连接',
orderList:[],
printOrderList:[],
printerList:[],
printTplList:[],
selTplCode:[],
selPrinterName:null,
currentSelection:[],
openShowConfig:false,
pdfUtils:new PdfUtils({}),
form:{
printerHost:null,
},
rules:{
},
};
},
watch: {
value(newVal) {
this.svalue = newVal;
if(this.svalue!=null) {
}
},
},
created() {
this.initTanexPrinterSdk();
},
beforeDestroy(){
// this.tanexPrinter.close();
},
methods: {
configPrinter(){
this.form.printerHost=this.$tanexPrinter.getPrinterHost();
console.log("===>===>",this.form.printerHost);
this.openShowConfig=true;
},
setupPrinter(){
console.log("===>===>",this.form.printerHost);
if(this.form.printerHost){
this.$tanexPrinter.restPrinterHost(this.form.printerHost);
}
this.openShowConfig=false;
},
getUUID() {
return Math.random().toString(36).substring(3,10);
},
refreshKey(){
this.resetRefreshId="print-"+this.getUUID();
},
initTanexPrinterSdk(){
this.refreshKey();
this.tanexPrinter = this.$tanexPrinter;
this.getConfigKey("sys.printer.downurl").then(response => {
this.printerDownUrl = response.msg;
});
this.tanexPrinter.init();
this.tanexPrinter.setOnOpen(this.onPrinterOpen);
this.tanexPrinter.setOnClose(this.onPrinterClose);
this.tanexPrinter.setOnError(this.onPrinterError);
this.tanexPrinter.setOnGetPrinter(this.onGetPrinter);
this.tanexPrinter.setOnGetPrintTpl(this.onGetPrintTpl);
},
onPrinterOpen(evt){
// console.log("onPrinterOpen")
this.printerStatus = 1;
this.$emit("input",this.printerStatus);
this.printerStatusMessage="打印组件已连接,可以打印.";
},
onPrinterClose(evt){
// console.log("onPrinterClose")
this.printerStatus = 0;
this.$emit("input",this.printerStatus);
this.printerStatusMessage="打印组件已断开!";
},
onPrinterError(evt){
// console.log("onPrinterError")
this.printerStatus = 0;
this.$emit("input",this.printerStatus);
this.printerStatusMessage="打印组件已断开!";
},
onGetPrinter(msg){
// console.log("onGetPrinter")
this.printerList=this.tanexPrinter.getPrinterTplList();
this.selPrinterName=this.tanexPrinter.getDefaultPrinter();
},
onGetPrintTpl(msg){
console.log("onGetPrintTpl")
this.printTplList=[];
this.printTplList=this.tanexPrinter.getPrintTplList();
if(this.isInitA4){
const newList=this.printTplList.filter(item=>item.tplCode == 'A4-EP');
this.printTplList=newList;
}
// console.log("====onGetPrintTpl==>",this.printTplList);
if(this.printTplList&&this.printTplList.length>0){
this.selTplCode=[this.printTplList[0].tplCode];
}
},
getDefaultPrinter(){
return this.tanexPrinter.getDefaultPrinter();
},
getSelectPrinter(){
return this.selPrinterName;
},
refreshPrintTpl(){
this.printTplList=[];
this.selTplCode=[];
this.tanexPrinter.refreshPrintTpl()
},
lpadZero(val,len) {
return (new Array(len + 1).join('0') + val).slice(-len);
},
/*
高级批量打印
[
{
"tplCode":tplCode,
"printerName":printerName,
"orderList":orderList.toString()
}
]
*/
batchPrintAdv(printDataList){
if(this.printerStatus !=1){
this.$modal.msgError("打印机未连接");
return;
}
this.isInitA4=false;
this.tanexPrinter.batchPrintAdv(printDataList,this.printManCode);
},
batchPrint(orderList,tplCode,orderDetailList){
if(this.printerStatus !=1){
this.$modal.msgError("打印机未连接");
return;
}
this.isInitA4=false;
this.orderDetailMap=new Map();
if(orderDetailList){
orderDetailList.map(v=>{
this.orderDetailMap[v.billCode]=v;
});
}
let that = this;
let newOrderList=[];
if(orderList){
this.orderList=[...orderList]
}
if(tplCode){
this.selTplCode=tplCode
}
// 打印子单
// if(this.selTplCode=="TAN-GC-130" || this.selTplCode=="TAN-ENGC-130" || this.selTplCode=="VT-ENNOLOGO" ){
if(['TAN-GC-130','TAN-ENGC-130','VT-ENNOLOGO'].some(element=>this.selTplCode.includes(element))){
for(let i=0;i<this.orderList.length;i++){
let billCode=this.orderList[i];
let subBillStart=1;
if(this.subBillStart&&this.subBillStart>0){
subBillStart=this.subBillStart;
}
let billDetail = this.orderDetailMap[billCode];
let subBillEnd=parseInt(billDetail.parcelQty);
if(this.subBillEnd&&this.subBillEnd!=''){
subBillEnd = parseInt(this.subBillEnd)<=parseInt(billDetail.parcelQty)?parseInt(this.subBillEnd):parseInt(billDetail.parcelQty);
}
// 循环子单范围
for(let i=subBillStart;i<=subBillEnd;i++){
let subBillCode = billCode+""+this.lpadZero(i,4);
newOrderList.push(subBillCode);
}
}
}else{
newOrderList=[...orderList];
}
// console.log("tnprint===>",newOrderList);
// console.log("tnprint===>",that.selTplCode);
this.printOrderList=newOrderList;
that.tanexPrinter.batchPrint(that.selTplCode,that.selPrinterName,newOrderList,this.printManCode)
},
printPreviewAdv(printDataList,billCount){
if(this.printerStatus !=1){
this.$modal.msgError("打印机未连接");
return;
}
this.isInitA4=false;
let that = this;
const loadingInstance = this.$loading({
text: '正在生成预览...'
})
let orderSeqMap = new Map();
console.log("printPreviewAdv===>",printDataList);
let j=0;
printDataList.forEach(item=>{
let billArr = item.orderList.split(",");
billArr.forEach(objBillCodeStr=>{
if(!(objBillCodeStr in orderSeqMap)){
orderSeqMap[objBillCodeStr]=j+1;
console.log("orderSeqMap===>",objBillCodeStr,j+1);
j++;
}
});
});
that.pdfList=[];
that.showCounter=0;
this.tanexPrinter.batchGetPDFAdv(printDataList,billCount,this.printManCode,async function(code,msg,data){
loadingInstance.close();
if(code == 500){
that.$modal.msgError("打印出错:"+msg);
}
else if(code == 200){
const pdfData=deepClone(data);
let pdfInfo={
"billCode":pdfData.ydSn,
"pdfUrl":null,
"pdfBase64":pdfData.file,
"tplCode":pdfData.tplCode,
"seqNo":orderSeqMap[pdfData.ydSn]
}
that.pdfList.push(pdfInfo);
if(!that.openPdfView && that.showCounter==0){
that.openPdfView = true;
}
// if(that.pdfList.length == newOrderList.length){
// that.isLoadComplete=true;
// }
that.showCounter++;
}
else if(code == 800){
// 全部获取完成
console.log("===全部获取完成ADV====>");
that.pdfList.sort((one, two) => {
let v=one.seqNo-two.seqNo;
if(one.seqNo==two.seqNo){
return one.tplCode.localeCompare(two.tplCode)
}else{
return v;
}
});
that.refreshKey();
}
});
},
printPreview(orderList,isA4,tplCode,orderDetailList){
this.refreshKey();
if(this.printerStatus !=1){
this.$modal.msgError("打印机未连接");
return;
}
this.orderDetailMap=new Map();
if(orderDetailList){
orderDetailList.map(v=>{
this.orderDetailMap[v.billCode]=v;
});
}
// console.log("====>orderDetailMap==>",this.orderDetailMap);
if(tplCode){
this.selTplCode=tplCode;
}
if(isA4){
this.isInitA4=isA4;
}
let that = this;
let newOrderList=[];
if(orderList){
this.orderList=[...orderList]
}
// 打印子单
// if(this.selTplCode=="TAN-GC-130"|| this.selTplCode=='TAN-ENGC-130' || this.selTplCode=='VT-ENNOLOGO' ){
if(['TAN-GC-130','TAN-ENGC-130','VT-ENNOLOGO'].some(element=>this.selTplCode.includes(element))){ // 子单联无LOGO、英文子单无LOGO、越南英文子单无LOGO
for(let i=0;i<this.orderList.length;i++){
let billCode=this.orderList[i];
let subBillStart=1;
if(this.subBillStart&&this.subBillStart>0){
subBillStart=this.subBillStart;
}
let billDetail = this.orderDetailMap[billCode];
console.log("====>billDetail==>",billDetail);
let subBillEnd=parseInt(billDetail.parcelQty);
if(this.subBillEnd){
subBillEnd = parseInt(this.subBillEnd)<=parseInt(billDetail.parcelQty)?parseInt(this.subBillEnd):parseInt(billDetail.parcelQty);
}
// 循环子单范围
for(let i=subBillStart;i<=subBillEnd;i++){
let subBillCode = billCode+""+this.lpadZero(i,4);
newOrderList.push(subBillCode);
}
}
}else{
newOrderList=[...orderList];
}
const loadingInstance = this.$loading({
text: '正在生成预览...'
})
this.printOrderList=newOrderList;
let orderSeqMap = new Map();
for(let i=0; i<newOrderList.length; i++){
let billCodeItem=newOrderList[i];
orderSeqMap[billCodeItem]=i+1;
}
that.pdfList=[];
that.showCounter=0;
// that.openPdfView = true;
// if(!that.openPdfView && that.showCounter==0){
// that.openPdfView = true;
// }
// that.showCounter++;
// console.log('promise',this.tanexPrinter.batchGetPDF(this.selTplCode[0], this.selPrinterName, newOrderList, this.printManCode,async function(code,msg,data){}))
this.selTplCode.forEach(element => {
this.tanexPrinter.batchGetPDF(element,this.selPrinterName,newOrderList,this.printManCode,async function(code,msg,data){
loadingInstance.close();
if(code == 500){
that.$modal.msgError("打印出错:"+msg);
}
else if(code == 200){
const pdfData=deepClone(data);
let pdfInfo={
"billCode":pdfData.ydSn,
"pdfUrl":null,
"pdfBase64":pdfData.file,
"tplCode":pdfData.tplCode,
"seqNo":orderSeqMap[pdfData.ydSn]
}
that.pdfList.push(pdfInfo);
if(!that.openPdfView && that.showCounter==0){
that.openPdfView = true;
}
that.showCounter++;
}
else if(code == 800){
// 全部获取完成
console.log("===全部获取完成2====>");
that.pdfList.sort((one, two) => {
let v=one.seqNo-two.seqNo;
if(one.seqNo==two.seqNo){
return one.tplCode.localeCompare(two.tplCode)
}else{
return v;
}
});
console.log("===that.pdfList====>",that.pdfList);
that.refreshKey();
}
});
});
},
downPDF(orderList,isA4,tplCode,orderDetailList){
if(this.printerStatus !=1){
this.$modal.msgError("打印机未连接");
return;
}
this.orderDetailMap=new Map();
if(orderDetailList){
orderDetailList.map(v=>{
this.orderDetailMap[v.billCode]=v;
});
}
if(tplCode){
this.selTplCode=tplCode;
}
if(isA4){
this.isInitA4=isA4;
}
let that = this;
let newOrderList=[];
if(orderList){
this.orderList=[...orderList]
}
// 打印子单
// if(this.selTplCode=="TAN-GC-130" || this.selTplCode=='TAN-ENGC-130' || this.selTplCode=='VT-ENNOLOGO' ){
if(['TAN-GC-130','TAN-ENGC-130','VT-ENNOLOGO'].some(element=>this.selTplCode.includes(element))){ // 子单联无LOGO、英文子单无LOGO、越南英文子单无LOGO
for(let i=0;i<this.orderList.length;i++){
let billCode=this.orderList[i];
// 循环子单范围
let subBillStart=1;
if(this.subBillStart&&this.subBillStart>0){
subBillStart=this.subBillStart;
}
let billDetail = this.orderDetailMap[billCode];
// console.log("====>billDetail==>",billDetail);
let subBillEnd=parseInt(billDetail.parcelQty);
if(this.subBillEnd){
subBillEnd = parseInt(this.subBillEnd)<=parseInt(billDetail.parcelQty)?parseInt(this.subBillEnd):parseInt(billDetail.parcelQty);
}
for(let i=subBillStart;i<=subBillEnd;i++){
let subBillCode = billCode+""+this.lpadZero(i,4);
newOrderList.push(subBillCode);
}
}
}else{
newOrderList=[...orderList];
}
const loadingInstance = this.$loading({
text: '正在下载...'
})
let orderSeqMap = new Map();
for(let i=0; i<newOrderList.length; i++){
let billCodeItem=newOrderList[i];
orderSeqMap[billCodeItem]=i+1;
}
// 清空以前的数据
this.pdfList=[];
this.selTplCode.forEach(item=>{
this.tanexPrinter.batchGetPDF(this.selTplCode,this.selPrinterName,newOrderList,this.printManCode,function(code,msg,data){
if(code == 500){
loadingInstance.close();
that.$modal.msgError("下载出错:"+msg);
}
else if(code == 200){
const pdfData=deepClone(data);
let pdfInfo={
"billCode":pdfData.ydSn,
"pdfUrl":null,
"pdfBase64":pdfData.file,
"tplCode":pdfData.tplCode,
"seqNo":orderSeqMap[pdfData.ydSn]
}
that.pdfList.push(pdfInfo);
}
else if(code == 800){
loadingInstance.close();
// console.log("===全部获取完成====>");
// A4下载
if(that.isInitA4){
that.downA4PDF();
}else{
that.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 newTmpList=[...this.pdfList];
newTmpList.sort((one, two) => {
let v=one.seqNo-two.seqNo;
if(one.seqNo==two.seqNo){
return one.tplCode.localeCompare(two.tplCode)
}else{
return v;
}
});
for(let j=0;j<newTmpList.length;j++){
needGenList.push(newTmpList[j].pdfBase64)
}
// let fileName=new Date().getTime()+".pdf";
let fileName=value+".pdf";
this.pdfUtils.mergePdf3(needGenList,fileName,true);
}).catch(() => {});
},
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=[];
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-"+1,
"pdfUrl":null,
"childreen":newList
}
cacheA4FileList.push(fileItem);
}
// 下载
// 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";
console.log("==11111==>===> needGenList==>", needGenList);
let fileName=value+".pdf";
this.pdfUtils.mergePdfToA4(needGenList,fileName,true);
}).catch(() => {});
},
// 响应PDF预览
onPdfViewPrint(printCnt){
this.$emit("onPrint",printCnt);
},
handleClose(){
this.openPdfView=false;
this.$emit("onPrintComplete");
}
}
};
</script>
<style lang="scss">
.printPreDialog .el-dialog__body {
margin: 0px!important;
}
// .printPreDialog .el-dialog__header {
// display: none;
// }
.subBillRange .el-input__inner {
padding:0px;
text-align: center;
}
</style>

View File

@ -0,0 +1,735 @@
<template>
<XdPageContainer class="app-container">
<!-- label-width="100px" -->
<SearchForm slot="pageHeader" :model="queryParams" ref="queryForm"
size="mini" :maxShow="8"
v-show="showSearch"
@search="handleQuery"
@reset="resetQuery"
:isShowSearchBtn="false"
>
<el-row :gutter="0" style="display: flex;flex-wrap: wrap;">
<el-col :span="6">
<el-form-item label="" prop="billCode">
<div slot="label">
<el-radio-group class="query-label" v-model="queryOrderType">
<el-radio :key="1" label="1">运单号</el-radio>
<!-- <el-radio :key="0" label="0">订单号</el-radio> -->
</el-radio-group>
</div>
<XdTextareaInput
v-model="queryParams.billCode"
:placeholder="$t('多个流水号逗号或换行隔开')"
clearable
:rows="2"
/>
<!-- @keyup.enter.native="handleQuery" -->
</el-form-item>
<el-form-item label="发货时间" prop="dateTimeRange">
<elDateAdvPicker clearable v-model="dateTimeRange" @dateTimeChange="onDateSelect" ></elDateAdvPicker>
</el-form-item>
</el-col>
<el-col :span="18">
<el-form-item label="寄件客户" prop="custNo">
<EmisMonthpayAccountPicker v-model="queryParams.custNo" @onChange="handleQuery"></EmisMonthpayAccountPicker>
</el-form-item>
<el-form-item label="寄件网点" prop="sendSiteCode">
<EmisSiteSimplePicker1 v-model="queryParams.sendSiteCode" ></EmisSiteSimplePicker1>
</el-form-item>
<el-form-item label="寄件公司" prop="sendCompany">
<el-input
v-model="queryParams.sendCompany"
:placeholder="$t('寄件公司')"
clearable
/>
</el-form-item>
<el-form-item :label="$t('取件业务员')" prop="takePieceEmployeeCode">
<EmisUserSimplePicker1 :placeholder="$t('取件员')" v-model="queryParams.takePieceEmployeeCode"></EmisUserSimplePicker1>
</el-form-item>
<el-form-item label="线路" prop="transLineType">
<TransLinePicker v-model="queryParams.transLineType" isInitiated="true" ></TransLinePicker>
</el-form-item>
<el-form-item label="产品类型" prop="productType">
<TransProductPicker placeholder="产品类型" v-model="queryParams.productType" :transLineCode="queryParams.transLineType"></TransProductPicker>
</el-form-item>
<el-form-item label="目的网点" prop="dispatchUnderlingSiteCode">
<EmisSiteSimplePicker2 v-model="queryParams.dispatchUnderlingSiteCode" ></EmisSiteSimplePicker2>
</el-form-item>
<el-form-item :label="$t('操作员')" prop="operateEmployeeCode">
<EmisUserSimplePicker0 :placeholder="$t('操作员')" v-model="queryParams.operateEmployeeCode"></EmisUserSimplePicker0>
</el-form-item>
</el-col>
</el-row>
</SearchForm>
<XdTable
slot="pageContent"
slot-scope="slotProps"
:height="(slotProps.contentHeight)+'px'"
ref="refQueryTable"
:row-key="rowKey"
storageName="waybillIsPrinted_main"
v-loading="loading"
border
size="small"
:data="emisWaybillList"
:showSearch.sync="showSearch"
:queryParams="queryParams"
:total="total"
@queryTable="getList"
@selection-change="handleSelectionChange"
@sort-change="handleSortChange"
>
<div slot="toolbar">
<el-row :gutter="10" class="mb8" style="display: flex;flex-wrap: wrap;">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-search"
size="mini"
@click="handleQuery"
>查询</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-print"
size="mini"
:disabled="multiple"
@click="handleBatchPrint(1)"
>打印</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="primary"
plain
size="mini"
:disabled="multiple"
@click="handlePrintPreview"
>预览面单</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="primary"
plain
size="mini"
:disabled="multiple"
@click="handleDownPDF"
>下载pdf</el-button>
</el-col>
<!-- v-hasPermi="['emis:emisWaybill:downCustBill']" -->
<el-col :span="1.5">
<el-button
type="primary"
plain
size="mini"
:disabled="multiple"
@click="handleDownCustBillPDF"
v-hasPermi="['emis:emisWaybill:downCustBill']"
>下载客户账单(PDF)</el-button>
</el-col>
<!-- v-hasPermi="['emis:emisWaybill:downCustTaxBill']" -->
<el-col :span="1.5">
<el-button
type="primary"
plain
size="mini"
:disabled="multiple"
@click="handleDownCustTaxBillPDF"
v-hasPermi="['emis:emisWaybill:downCustTaxBill']"
>下载税金账单(PDF)</el-button>
</el-col>
<el-col :span="1.5">
<TanexPrinterBatchPanel ref="tanexPrinter" :isShowPinters="true" :isShowTpl="true" :isShowSubBillRange="true" @onPrint="handleBatchPrint"></TanexPrinterBatchPanel>
</el-col>
</el-row>
</div>
<el-table-column label="序号" align="center" min-width="60">
<template slot-scope="scope">
<span v-text="getIndex(scope.$index)"> </span>
</template>
</el-table-column>
<el-table-column type="selection" width="55" :reserve-selection="true" align="center" />
<el-table-column :label="$t('运单编号')" align="center" prop="billCode" min-width="120" :show-overflow-tooltip="true" />
<!-- <el-table-column :label="$t('订单号')" align="center" prop="orderSn" width="100" :show-overflow-tooltip="true"/> -->
<el-table-column :label="$t('是否打印')" align="center" prop="blPrint" min-width="80" >
<template slot-scope="scope">
<el-tag v-if="scope.row.blPrint==1" type="success">已打印</el-tag>
<el-tag v-else type="danger">未打印</el-tag>
</template>
</el-table-column>
<el-table-column :label="$t('打印次数')" align="center" prop="printCount" min-width="80" />
<el-table-column :label="$t('打印时间')" align="center" prop="printDate" min-width="80" :show-overflow-tooltip="true"/>
<el-table-column :label="$t('打印人')" align="center" prop="printManName" min-width="80" :show-overflow-tooltip="true"/>
<el-table-column :label="$t('打印站点')" align="center" prop="printSiteName" min-width="80" :show-overflow-tooltip="true"/>
<el-table-column :label="$t('进仓单号')" align="center" prop="warehouseInNo" width="80" :show-overflow-tooltip="true"/>
<el-table-column :label="$t('发货日期')" align="center" prop="sendDate" min-width="100" :show-overflow-tooltip="true"/>
<el-table-column :label="$t('取件方式')" align="center" prop="pickupMethod" width="100" >
<template slot-scope="scope">
<dict-tag :options="dict.type.emis_qujian_fangshi" :value="scope.row.pickupMethod"/>
</template>
</el-table-column>
<el-table-column :label="$t('客户名称')" align="center" prop="custName" min-width="80" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span v-if="scope.row.paymentType==2 || scope.row.paymentType==4 || scope.row.paymentType==5">{{scope.row.custName}}</span>
<span v-else></span>
</template>
</el-table-column>
<el-table-column :label="$t('销售回款人')" align="center" prop="payee" min-width="100" />
<el-table-column :label="$t('销售联系人')" align="center" prop="salesmen" min-width="100" />
<el-table-column :label="$t('起始国')" align="center" prop="sendCountryName" width="80" :show-overflow-tooltip="true"/>
<el-table-column :label="$t('目的国')" align="center" prop="receiveCountryName" width="80" :show-overflow-tooltip="true"/>
<el-table-column :label="$t('线路')" align="center" prop="transLineTypeName" min-width="80" :show-overflow-tooltip="true"/>
<el-table-column :label="$t('产品类型')" align="center" prop="productTypeName" min-width="80" :show-overflow-tooltip="true"/>
<el-table-column :label="$t('清关方式')" align="center" prop="customsClear" min-width="80" >
<template slot-scope="scope">
<dict-tag :options="dict.type.emis_customs_clear" :value="scope.row.customsClear"/>
</template>
</el-table-column>
<el-table-column :label="$t('报关方式')" align="center" prop="customsEclaration" min-width="80" >
<template slot-scope="scope">
<dict-tag :options="dict.type.emis_declare_mode" :value="scope.row.customsEclaration"/>
</template>
</el-table-column>
<el-table-column :label="$t('寄件网点')" align="center" prop="sendSiteName" min-width="80" :show-overflow-tooltip="true"/>
<el-table-column :label="$t('寄件人')" align="center" prop="sendName" min-width="80" :show-overflow-tooltip="true"/>
<el-table-column :label="$t('寄件公司')" align="center" prop="sendCompany" min-width="80" :show-overflow-tooltip="true"/>
<el-table-column :label="$t('目的地')" align="center" prop="destinationName" min-width="80" :show-overflow-tooltip="true"/>
<el-table-column :label="$t('目的网点')" align="center" prop="dispatchUnderlingSiteName" min-width="80" :show-overflow-tooltip="true"/>
<el-table-column :label="$t('收件人')" align="center" prop="receiveName" min-width="80" :show-overflow-tooltip="true"/>
<el-table-column :label="$t('收件电话')" align="center" prop="receiveMobile" min-width="80" :show-overflow-tooltip="true"/>
<el-table-column :label="$t('收件公司')" align="center" prop="receiveCompany" min-width="80" :show-overflow-tooltip="true"/>
<el-table-column :label="$t('收件国家')" align="center" prop="receiveCountryName" min-width="80" :show-overflow-tooltip="true"/>
<el-table-column :label="$t('收件省')" align="center" prop="receiveProvinceName" min-width="80" :show-overflow-tooltip="true"/>
<!-- <el-table-column :label="$t('收件市')" align="center" prop="receiveCityName" min-width="80" :show-overflow-tooltip="true"/> -->
<!-- <el-table-column :label="$t('收件区')" align="center" prop="receiveCountyName" min-width="80" :show-overflow-tooltip="true"/> -->
<el-table-column :label="$t('货物名称')" align="center" prop="goodsInfo" min-width="80" :show-overflow-tooltip="true"/>
<el-table-column :label="$t('包装类型')" align="center" prop="packType" min-width="80" >
<template slot-scope="scope">
<dict-tag :options="dict.type.emis_tab_packing_type" :value="scope.row.packType"/>
</template>
</el-table-column>
<el-table-column :label="$t('件数')" align="center" prop="parcelQty" min-width="80" />
<el-table-column :label="$t('实际重量')" align="center" prop="billWeight" min-width="80" />
<el-table-column :label="$t('体积')" align="center" prop="totalVolume" min-width="80" />
<el-table-column :label="$t('体积重量')" align="center" prop="volumeWeight" min-width="80" />
<el-table-column :label="$t('结算重量')" align="center" prop="settlementWeight" min-width="80" />
<el-table-column :label="$t('支付方式')" align="center" prop="paymentType" min-width="80" :show-overflow-tooltip="true" >
<template slot-scope="scope">
<dict-tag :options="dict.type.emis_payment_type" :value="scope.row.paymentType"/>
</template>
</el-table-column>
<el-table-column :label="$t('运费')" align="center" prop="freight" min-width="80" />
<el-table-column :label="$t('录单人')" align="center" prop="registerManName" min-width="80" :show-overflow-tooltip="true" />
<el-table-column :label="$t('录单备注')" align="center" prop="remark" min-width="80" :show-overflow-tooltip="true" />
</XdTable>
</XdPageContainer>
</template>
<script>
import { listEmisWaybill, getEmisWaybill, delEmisWaybill, addEmisWaybill, updateEmisWaybill,queryPrintListSimple } from "@/api/emis/emisWaybill";
import emisWaybillForm from '@/views/emis/emisWaybill/emisWaybillForm';
import elDateAdvPicker from '@/components/DatePickerAdv/elDateAdvPicker';
import CountryPicker0 from '@/views/emis/EmisBaseTools/CountryPicker.vue';
import CountryPicker1 from '@/views/emis/EmisBaseTools/CountryPicker.vue';
import CountryPicker2 from '@/views/emis/EmisBaseTools/CountryPicker.vue';
import ProvincePicker2 from '@/views/emis/EmisBaseTools/ProvincePicker.vue';
import TransLinePicker from '@/views/emis/EmisBaseTools/TransLinePicker.vue';
import TransProductPicker from '@/views/emis/EmisBaseTools/TransProductPicker.vue';
import EmisMonthpayAccountPicker from '@/views/emis/EmisBaseTools/EmisMonthpayAccountPicker.vue';
import EmisUserSimplePicker0 from '@/views/emis/EmisBaseTools/EmisUserSimplePicker.vue';
import EmisUserSimplePicker1 from '@/views/emis/EmisBaseTools/EmisUserSimplePicker.vue';
import EmisSiteSimplePicker1 from '@/views/emis/EmisBaseTools/EmisSiteSimplePicker.vue';
import EmisSiteSimplePicker2 from '@/views/emis/EmisBaseTools/EmisSiteSimplePicker.vue';
import ProblemTypePicker from '@/views/emis/EmisBaseTools/ProblemTypePicker.vue';
import TanexPrinterPanel from '@/views/emis/EmisBaseTools/TanexPrinterPanel.vue';
import TanexPrinterBatchPanel from "@/views/emis/EmisBaseTools/TanexPrinterBatchPanel.vue";
import { formatSearchStr,deepClone } from '@/utils/index'
import {timeDiffTime,timeFormat} from '@/utils/dateUtils'
export default {
name: "WaybillIsPrinted",
components: {
TanexPrinterPanel,
TanexPrinterBatchPanel,
elDateAdvPicker,
emisWaybillForm,
CountryPicker1,
CountryPicker2,
ProvincePicker2,
TransLinePicker,
TransProductPicker,
EmisUserSimplePicker0,
EmisUserSimplePicker1,
EmisSiteSimplePicker1,
EmisSiteSimplePicker2,
ProblemTypePicker,
EmisMonthpayAccountPicker
},
dicts: ['emis_qujian_fangshi','emis_declare_mode','emis_customs_clear',
'emis_tab_packing_type','emis_tab_dispatch_mode','emis_payment_type',
'emis_calc_fee_type','emis_print_type','emis_payment_status','emis_waybill_status'
],
data() {
return {
tableHeight: 200,
// 遮罩层
loading: false,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 创建时间搜索
dateTimeRange:[],
// 总条数
total: 0,
// 运单列表表格数据
emisWaybillList: [],
currentId:null,
openForm: false,
titleForm: "",
queryOrderType:null,
currentSelection:[],
// 弹出展示层
id:null,
titleView:"",
openView: false,
// 更新网点时间范围
daterangeOrderDate: [],
// 更新网点时间范围
daterangeEstimateDate: [],
// 更新网点时间范围
daterangePickStartDate: [],
// 更新网点时间范围
daterangePickFinishDate: [],
// 更新网点时间范围
daterangeDispFdDate: [],
// 更新网点时间范围
daterangeRegisterDate: [],
// 更新网点时间范围
daterangeSendDate: [],
// 更新网点时间范围
daterangeProduceBillDate: [],
// 更新网点时间范围
daterangeCreateTime: [],
// 更新网点时间范围
daterangeUpdateTime: [],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 100,
orderSn: null,
billCode: null,
billCodeSub: null,
orderStatus: null,
waybillStatus: null,
orderType: null,
orderDate: null,
customerCode: null,
customerName: null,
receiveCustomerCode: null,
receiveCustomerName: null,
thirdCustomerCode: null,
thirdCustomerName: null,
receiveName: null,
receiveCompany: null,
receiveMobile: null,
receiveTel: null,
receiveCountry: null,
receiveProvince: null,
receiveCity: null,
receiveCounty: null,
receiveTown: null,
receiveAddress: null,
receivePostcode: null,
receivePcd: null,
sendName: null,
sendCompany: null,
sendMobile: null,
sendTel: null,
sendCountry: null,
sendProvince: null,
sendCity: null,
sendCounty: null,
sendTown: null,
sendAddress: null,
sendPostcode: null,
sendPcd: null,
paymentType: null,
calcFeeType: null,
custNo: null,
transLineType: null,
productType: null,
timeType: null,
meterType: null,
customsClear: null,
customsEclaration: null,
estimateDate: null,
packType: null,
dispatchMethod: null,
pickupMethod: null,
pickStartDate: null,
pickFinishDate: null,
pickFailReason: null,
intoWarehouseCode: null,
intoWarehouseName: null,
intoWarehouseAddress: null,
intoWarehouseContact: null,
intoWarehousePhone: null,
intoWarehouseBillCode: null,
warehouseInNo: null,
customerDeliveryBeginTime: null,
customerDeliveryEndTime: null,
goodsType: null,
goodsInfo: null,
goodsPics: null,
blPrepareInFreight: null,
prepareInEstFee: null,
prepareInRealFee: null,
prepareInExpress: null,
prepareInBillCode: null,
prepareInRemark: null,
prepareInSupplier: null,
totalWeight: null,
totalVolume: null,
parcelQty: null,
billWeight: null,
volumeWeight: null,
currency: null,
settlementWeight: null,
feeWeight: null,
freight: null,
blOverLong: null,
blBill: null,
blOverWeight: null,
overWeightNumber: null,
feeRemark: null,
thirdCode: null,
realValue: null,
blInsure: null,
insureValue: null,
insureValueCurrency: null,
insureFeeCurrency: null,
insureFee: null,
insureRemark: null,
insureSiteCode: null,
insureDate: null,
blPrint: null,
printManCode: null,
printSite: null,
printDate: null,
printCount: null,
blDispFd: null,
transferCode: null,
transferBillcode: null,
dispFdDate: null,
dispFdReason: null,
currentSiteCode: null,
lastSiteCode: null,
registerSiteCode: null,
registerDate: null,
registerManCode: null,
takePieceEmployeeCode: null,
sendSiteCode: null,
sendDate: null,
dispatchManCode: null,
dispatchDate: null,
dispatchSiteCode: null,
produceBillDate: null,
produceBillSiteCode: null,
produceBillManCode: null,
destinationCode: null,
destinationProvince: null,
destinationCity: null,
destinationCounty: null,
dispatchUnderlingSiteCode: null,
destinationCenterCode: null,
marketManCode: null,
payee: null,
salesmen: null,
operateEmployeeCode: null,
blIsQuestion: null,
problemType: null,
problemCause: null,
problemDelayDays: null,
blMessage: null,
blAcceptMessage: null,
blGenSubbill: null,
signMan: null,
signManCode: null,
signSiteCode: null,
signDate: null,
billPicSendRmk: null,
billPicDispatchRmk: null,
timezoneOffset: null,
delFlag: null,
remark: null,
params:{
queryOrderType:1,
queryOrderDateType:1,
isQueryPrintOrder:null,
}
},
};
},
created() {
// this.getList();
this.queryOrderType="1";
const end = new Date()
const start = new Date()
start.setHours(0,0,0,0)
end.setHours(23,59,59,0)
this.dateTimeRange=[timeFormat(start), timeFormat(end)]
if(this.$store.getters.ownerSiteCode!='88888'){
this.queryParams.sendSiteCode=this.$store.getters.ownerSiteCode;
}
},
methods: {
rowKey (row) {
return row.id;
},
handleDownCustBillPDF() {
if(this.currentSelection&&this.currentSelection.length>0){
this.currentSelection.forEach(item=>{
this.download('emis/emisWaybill/exportCustBillTpl', {
billCode:item.billCode,
fileType:'pdf'
}, `${item.billCode}-custbill.pdf`)
});
}
},
handleDownCustTaxBillPDF() {
if(this.currentSelection&&this.currentSelection.length>0){
this.currentSelection.forEach(item=>{
this.download('emis/emisWaybill/exportCustTaxBillTpl', {
billCode:item.billCode,
fileType:'pdf'
}, `${item.billCode}-custTaxBill.pdf`)
});
}
},
handleBatchPrint(printCnt){
this.$confirm("确定打印?", "提示", {
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){
console.log("====printCnt==>",printCnt)
for(let i=0; i<printCnt; i++){
this.$refs.tanexPrinter.batchPrint(orderList,null,this.currentSelection);
}
}else{
this.$refs.tanexPrinter.batchPrint(orderList,null,this.currentSelection);
}
}).catch(() => {});
},
handlePrintPreview(){
let orderList=[];
this.currentSelection.forEach(item=>{
orderList.push(item.billCode);
});
// printPreview(orderList,isA4,tplCode,orderDetailList)
this.$refs.tanexPrinter.printPreview(orderList,false,null,this.currentSelection);
},
handleDownPDF(){
let orderList=[];
this.currentSelection.forEach(item=>{
orderList.push(item.billCode);
});
this.$refs.tanexPrinter.downPDF(orderList,false,null,this.currentSelection);
},
initQueryParams(){
this.queryParams=this.addDateRange(this.queryParams, this.dateTimeRange,"sendDate");
let qParam=null;
if(this.queryParams.billCode){
qParam={
pageNum:this.queryParams.pageNum,
pageSize:this.queryParams.pageSize,
billCode:this.queryParams.billCode,
}
}else{
qParam={...this.queryParams}
qParam.params.isQueryPrintOrder=1;
}
return qParam;
},
/** 查询运单列表列表 */
getList() {
this.loading = true;
let qParam=this.initQueryParams();
queryPrintListSimple(qParam).then(response => {
this.emisWaybillList = response.rows;
this.total = response.total;
this.loading = false;
});
},
onDateSelect(value){
// console.log("date picker---->", value)
this.dateTimeRange=value;
// scanDate
},
/** 搜索按钮操作 */
handleQuery() {
// 清除已选择
if(this.ids&&this.ids.length>0){
this.$refs.refQueryTable.clearSelection();
}
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.currentSelection=selection;
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
// 排序 查询字段是表格中字段名字 动态取值排序顺序
handleSortChange(column) {
this.queryParams.orderByColumn = column.prop;
this.queryParams.isAsc = column.order;
this.getList();
},
/** 新增按钮操作 */
handleAdd(row) {
this.currentId=null;
this.openForm= true;
this.titleForm = "新增";
},
handleShowMoreInput(){
this.moreInputVisible = !this.moreInputVisible;
},
/** 修改按钮操作 */
handleUpdate(row) {
this.currentId= row.id;
this.openForm = true;
this.titleForm = "修改";
},
handleView(row) {
this.id=row.id;
this.titleView="查看";
this.openView=true;
// this.router.push({ path: '/emis/emisWaybill/viewDetail', query: { id: row.id }})
},
handleFormChanged(){
this.openForm = false;
this.getList();
},
cancelForm(){
this.openForm = false;
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除').then(function() {
return delEmisWaybill(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 列索引函数 */
getIndex($index) {
return (this.queryParams.pageNum - 1) * this.queryParams.pageSize + $index + 1
},
/** 时间搜索响应函数 */
dateTimeChange(value){
this.dateTimeRange=value;
},
}
};
</script>
<style lang="scss">
.query-label {
.el-radio{
display: block;
line-height: 23px;
white-space: normal;
margin-right: 0;
}
}
.printPreDialog .el-dialog__body {
margin: 0px!important;
}
</style>