Merge branch 'master' of http://git.xdadan.com/tanex/emis-frontend
This commit is contained in:
commit
3ae1a20ec2
@ -9,7 +9,7 @@
|
||||
<i
|
||||
v-show="clearable && svalue"
|
||||
class="clearButton el-input__icon el-icon-circle-close el-input__clear"
|
||||
@click.prevent="svalue=''"
|
||||
@click.prevent="onClear"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
@ -45,6 +45,11 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onClear(){
|
||||
this.svalue='';
|
||||
this.$emit("input", this.svalue);
|
||||
this.dispatch('ElFormItem', 'el.form.blur');
|
||||
},
|
||||
onBlur(val){
|
||||
this.$emit("input", this.svalue);
|
||||
this.dispatch('ElFormItem', 'el.form.blur');
|
||||
|
||||
@ -6,6 +6,7 @@ import { download } from '@/utils/request'
|
||||
getPrinterList: 获取打印机列表
|
||||
getPrintTplList: 获取打印模版列表
|
||||
batchPrint:发送打印
|
||||
batchGetPDF:PDF预览和下载
|
||||
getPrinterVer:获取打印组件版本信息
|
||||
|
||||
printerIsRead:打印机已经OK的信号
|
||||
@ -44,6 +45,7 @@ class TanexPrinterSdk {
|
||||
|
||||
onGetPrinterCallback =[];
|
||||
onGetPrintTplCallback =[];
|
||||
onBatchGetPDFCallback = [];
|
||||
|
||||
// 自定义 回调函数
|
||||
callbacks ={}
|
||||
@ -53,6 +55,11 @@ class TanexPrinterSdk {
|
||||
// 打印模版列表
|
||||
printTplList = []
|
||||
|
||||
// PDF文件缓存
|
||||
recievePdfFileList = []
|
||||
sendPdfFileListCount = 0
|
||||
pdfFileReceiveMap = new Map();
|
||||
|
||||
// 默认打印机
|
||||
defaultPrinter = null;
|
||||
|
||||
@ -100,6 +107,10 @@ class TanexPrinterSdk {
|
||||
this.onGetPrintTplCallback.push(callback);
|
||||
}
|
||||
|
||||
setOnBatchGetPDF(callback){
|
||||
this.onBatchGetPDFCallback.push(callback);
|
||||
}
|
||||
|
||||
// 获取打印机列表
|
||||
getPrinterTplList(){
|
||||
return this.printerList;
|
||||
@ -121,15 +132,24 @@ class TanexPrinterSdk {
|
||||
}
|
||||
|
||||
// 下载PDF文件
|
||||
downPdfFile(ydSn,tplName,printerName){
|
||||
let link = document.createElement('a');
|
||||
link.style.display = 'none';
|
||||
link.href = this.HTTP_GET_PDF + '?ydSn=' + ydSn+"&tplName="+tplName+"&printerName="+printerName;
|
||||
// window.open(link.href, '_blank');
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
// downPdfFile(ydSn,tplName,printerName){
|
||||
// let link = document.createElement('a');
|
||||
// link.style.display = 'none';
|
||||
// link.href = this.HTTP_GET_PDF + '?ydSn=' + ydSn+"&tplName="+tplName+"&printerName="+printerName;
|
||||
// // window.open(link.href, '_blank');
|
||||
// document.body.appendChild(link);
|
||||
// link.click();
|
||||
// }
|
||||
|
||||
|
||||
// 批量获取PDF文件
|
||||
batchGetPDF(tplName,printerName,orderList){
|
||||
if(tplName&&printerName&&orderList&&orderList.length>0){
|
||||
this.sendBatchGetPDFCMD(tplName,printerName,orderList);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 批量打印
|
||||
batchPrint(tplName,printerName,orderList){
|
||||
if(tplName&&printerName&&orderList&&orderList.length>0){
|
||||
@ -166,6 +186,27 @@ class TanexPrinterSdk {
|
||||
}
|
||||
}
|
||||
|
||||
sendBatchGetPDFCMD(tplName,printerName,orderList){
|
||||
// {"CMD":"batchGetPDF","status":"1","Data":["DT20210901001","DT20210901002"]}
|
||||
var printCmd={};
|
||||
printCmd['CMD']="batchGetPDF";
|
||||
printCmd['Status']="1";
|
||||
if(orderList!=null && orderList.length>0){
|
||||
let printData={
|
||||
"tplName":tplName,
|
||||
"printerName":printerName,
|
||||
"orderList":orderList.toString()
|
||||
}
|
||||
|
||||
this.recievePdfFileList = []
|
||||
this.sendPdfFileListCount = orderList.length;
|
||||
|
||||
printCmd['Data']=printData
|
||||
console.log(JSON.stringify(printCmd));
|
||||
this.send(JSON.stringify(printCmd),null);
|
||||
}
|
||||
}
|
||||
|
||||
sendGetPrinterListCMD(){
|
||||
// {"CMD":"getPrinterList","status":"1","Data":""}
|
||||
var printCmd={};
|
||||
@ -272,7 +313,7 @@ class TanexPrinterSdk {
|
||||
}
|
||||
|
||||
}
|
||||
if(msg["CMD"]=='getPrintTplList'){
|
||||
else if(msg["CMD"]=='getPrintTplList'){
|
||||
this.innerGetPrintTplList(msg)
|
||||
if(this.onGetPrintTplCallback.length>0){
|
||||
this.onGetPrintTplCallback.forEach(callback=>{
|
||||
@ -282,6 +323,10 @@ class TanexPrinterSdk {
|
||||
})
|
||||
}
|
||||
}
|
||||
else if(msg["CMD"]=='batchGetPDF'){
|
||||
this.innerBatchGetPDF(msg)
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 通知其他客户端
|
||||
@ -339,6 +384,50 @@ class TanexPrinterSdk {
|
||||
}
|
||||
}
|
||||
|
||||
innerBatchGetPDF(msg){
|
||||
console.log("innerBatchGetPDF")
|
||||
|
||||
console.log(msg)
|
||||
if(this.recievePdfFileList.length<this.sendPdfFileListCount){
|
||||
if(msg){
|
||||
let ydSn=msg.Data.ydSn;
|
||||
if(ydSn in this.pdfFileReceiveMap){
|
||||
// 文件已存在则返回
|
||||
console.log(ydSn+"-PDF文件已存在");
|
||||
return;
|
||||
}
|
||||
|
||||
this.recievePdfFileList.push(msg.Data);
|
||||
this.pdfFileReceiveMap[ydSn]=1;
|
||||
}
|
||||
}
|
||||
|
||||
// 如果已相等则表示文件已接收完成
|
||||
if(this.recievePdfFileList.length >= this.sendPdfFileListCount){
|
||||
|
||||
if(this.onBatchGetPDFCallback.length>0){
|
||||
this.onBatchGetPDFCallback.forEach(callback=>{
|
||||
if(callback!=null){
|
||||
// 把PDF文件传给终端处理
|
||||
callback(this.recievePdfFileList);
|
||||
|
||||
// 发送完成后数据清空
|
||||
this.recievePdfFileList=[];
|
||||
this.pdfFileReceiveMap=new Map();
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
console.log("文件已接收完成");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
jsonToObj(json){
|
||||
return JSON.parse(json)
|
||||
@ -367,7 +456,7 @@ class TanexPrinterSdk {
|
||||
this.ws.send(data)
|
||||
return 1;
|
||||
} else {
|
||||
// console.log("Ws is abnormal,send faild!!")
|
||||
console.log("Ws is abnormal,send faild!!")
|
||||
return -1
|
||||
}
|
||||
}
|
||||
|
||||
@ -172,7 +172,7 @@ export default {
|
||||
destCountryName: null,
|
||||
blUnpack: null,
|
||||
sendStiteCode: null,
|
||||
nextStiteCode: null,
|
||||
nextSiteCode: null,
|
||||
nextStation: null,
|
||||
totalParcelQty: null,
|
||||
totalWaybillQty: null,
|
||||
|
||||
@ -265,7 +265,7 @@
|
||||
|
||||
|
||||
<!--
|
||||
<el-dialog :title="titleView" :visible.sync="openView" width="60%" :close-on-click-modal="false" v-dialogDrag append-to-body>
|
||||
<el-dialog :title="titleView" :visible.sync="openView" width="60%" :close-on-click-modal="false" v-dialogDrag append-to-body>
|
||||
<emisTmsPackView :id="id" ></EmisTmsPackView>
|
||||
</el-dialog>
|
||||
-->
|
||||
@ -438,7 +438,7 @@ export default {
|
||||
const curList = response.rows
|
||||
import('@/vendor/Export2Excel').then(excel => {
|
||||
const tHeader = ['id','合包号','合包名称','合包时间','目的国家','目的国家名称','是否可拆','发出网点','下一网点','下一站','总件数','总运单数','总体积','总重量','合包状态','扩展数据','操作员','ext1','ext2','ext3','ext4','备注','租户ID','删除标志(0代表存在','创建者','创建时间','更新者','更新时间','创建网点','更新网点',];
|
||||
const filterVal = ['id','packNo','packName','packDate','destCountry','destCountryName','blUnpack','sendStiteCode','nextStiteCode','nextStation','totalParcelQty','totalWaybillQty','totalVolume','totalWeight','packStatus','extData','opMan','ext1','ext2','ext3','ext4','remark','tenantId','delFlag','createBy','createTime','updateBy','updateTime','createSite','updateSite',];
|
||||
const filterVal = ['id','packNo','packName','packDate','destCountry','destCountryName','blUnpack','sendStiteCode','nextSiteCode','nextStation','totalParcelQty','totalWaybillQty','totalVolume','totalWeight','packStatus','extData','opMan','ext1','ext2','ext3','ext4','remark','tenantId','delFlag','createBy','createTime','updateBy','updateTime','createSite','updateSite',];
|
||||
const data = this.formatJson(filterVal, curList, response.rows)
|
||||
excel.export_json_to_excel({
|
||||
header: tHeader,
|
||||
|
||||
@ -245,26 +245,6 @@
|
||||
</div>
|
||||
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<!--
|
||||
<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" align="center" />
|
||||
<!--
|
||||
<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 :label="$t('订单状态')" align="center" prop="orderStatus" min-width="100" /> -->
|
||||
<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"/>
|
||||
|
||||
@ -736,6 +716,11 @@ export default {
|
||||
this.tanexPrinter.setOnError(this.onPrinterError);
|
||||
this.tanexPrinter.setOnGetPrinter(this.onGetPrinter);
|
||||
this.tanexPrinter.setOnGetPrintTpl(this.onGetPrintTpl);
|
||||
this.tanexPrinter.setOnBatchGetPDF(this.onBatchGetPDF);
|
||||
|
||||
},
|
||||
onBatchGetPDF(list){
|
||||
console.log(list);
|
||||
},
|
||||
onPrinterOpen(evt){
|
||||
console.log("onPrinterOpen")
|
||||
@ -783,6 +768,13 @@ export default {
|
||||
|
||||
},
|
||||
async handlePrintPreview(){
|
||||
let orderList=[];
|
||||
this.currentSelection.forEach(item=>{
|
||||
orderList.push(item.billCode);
|
||||
});
|
||||
this.tanexPrinter.batchGetPDF(this.selTplName,this.selPrinterName,orderList)
|
||||
},
|
||||
async handlePrintPreview_old(){
|
||||
let pdfUrlList=[];
|
||||
this.currentSelection.forEach(item=>{
|
||||
let url=this.tanexPrinter.getPdfUrl(item.billCode,this.selTplName,this.selPrinterName);
|
||||
@ -813,6 +805,7 @@ export default {
|
||||
pdfUtils.mergePdf2(pdfUrlList, (new Date()).getTime()+".pdf" ,true);
|
||||
},
|
||||
|
||||
|
||||
/** 查询运单列表列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user