作者 xudada

优化运单查询

import html2canvas from 'html2canvas'
/*import jsPDF from 'jspdf'*/
export default{
install (Vue, options) {
Vue.prototype.getPdf = function (htmlTitle,currentTime) {
var element = document.getElementById("file");
html2canvas(element, {
logging:false
}).then(function(canvas) {
var pdf = new jsPDF('p', 'mm', 'a4'); //A4纸,纵向
var ctx = canvas.getContext('2d'),
a4w = 190, a4h = 277, //A4大小,210mm x 297mm,四边各保留10mm的边距,显示区域190x277
imgHeight = Math.floor(a4h * canvas.width / a4w), //按A4显示比例换算一页图像的像素高度
renderedHeight = 0;
while(renderedHeight < canvas.height) {
var page = document.createElement("canvas");
page.width = canvas.width;
page.height = Math.min(imgHeight, canvas.height - renderedHeight);//可能内容不足一页
//用getImageData剪裁指定区域,并画到前面创建的canvas对象中
page.getContext('2d').putImageData(ctx.getImageData(0, renderedHeight, canvas.width, Math.min(imgHeight, canvas.height - renderedHeight)), 0, 0);
pdf.addImage(page.toDataURL('image/jpeg', 1.0), 'JPEG', 10, 10, a4w, Math.min(a4h, a4w * page.height / page.width)); //添加图像到页面,保留10mm边距
renderedHeight += imgHeight;
if(renderedHeight < canvas.height)
pdf.addPage();//如果后面还有内容,添加一个空页
}
pdf.save(htmlTitle);
});
}
}
}
... ...
... ... @@ -75,7 +75,7 @@
export default {
data() {
return {
sysName:'易通快速通关申报管理系统',
sysName:'河南烩捞大盘鸡',
collapsed:false,
sysUserName: '',
sysUserAvatar: '',
... ...
... ... @@ -74,6 +74,7 @@
<el-col :span="24">
<template>
<el-table
v-loading="listLoading"
ref="multipleTable"
:data="tableData"
tooltip-effect="dark"
... ... @@ -718,7 +719,8 @@
rows:{},
loading:false,
dialogTableVisible:false,
gridData:[]
gridData:[],
listLoading:false
}
},
methods:{
... ...
... ... @@ -52,7 +52,7 @@
</el-col>
<el-col :span="12">
<el-button type="primary" @click="submitForm('ruleForm')">保存</el-button>
<el-button type="primary" @click="submitForm('ruleForm')">保存发送</el-button>
<el-button type="primary" @click="back">返回</el-button>
</el-col>
</el-row>
<!--对话提示框-->
... ... @@ -179,7 +179,10 @@
DialogVisible(){
this.centerDialogVisible=false;
this.$router.push({name:'运单分拨申报',params:{awba:this.ruleForm.awba}});
}
},
back(){
this.$router.go(-1);//返回上一层
},
},
mounted(){
this.getDefaultData();
... ...
... ... @@ -138,15 +138,13 @@
this.options = [];
this.options2=[];
}
//this.options=res.data.data;
//this.options2=res.data.data;
});
},
/*按钮点击请求方法*/
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.$router.push({name:'进港原始舱单',params:{flightno:this.ruleForm.flightno,flightdate:this.dateConversion(this.ruleForm.flightdate),originstation:this.ruleForm.originstation,destinationstation:this.ruleForm.destinationstation}});
this.$router.push({path:'/origmaster',query:{flightno:JSON.stringify(this.ruleForm.flightno),flightdate:JSON.stringify(this.dateConversion(this.ruleForm.flightdate)),originstation:JSON.stringify(this.ruleForm.originstation),destinationstation:JSON.stringify(this.ruleForm.destinationstation),awba:JSON.stringify("")}});
} else {
console.log('error submit!!');
return false;
... ... @@ -161,11 +159,11 @@
},
/*加载默认参数*/
getDefaultData(){
if(this.$route.params.row!=null){
this.ruleForm.flightno=this.$route.params.row.flightno;
this.ruleForm.flightdate=this.$route.params.row.flightdate;
this.ruleForm.originstation=this.$route.params.row.originstation;
this.ruleForm.destinationstation=this.$route.params.row.destinationstation;
if(this.$route.query!=null){
this.ruleForm.flightno=JSON.parse(this.$route.query.flightno);
this.ruleForm.flightdate=JSON.parse(this.$route.query.flightdate);
this.ruleForm.originstation=JSON.parse(this.$route.query.originstation);
this.ruleForm.destinationstation=JSON.parse(this.$route.query.destinationstation);
}
}
},
... ...
... ... @@ -174,7 +174,7 @@
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.$router.push({name:'进港理货舱单',params:{flightno:this.ruleForm.flightno,flightdate:this.dateConversion(this.ruleForm.flightdate),originstation:this.ruleForm.originstation,destinationstation:this.ruleForm.destinationstation}})
this.$router.push({path:'/tallymaster',query:{flightno:JSON.stringify(this.ruleForm.flightno),flightdate:JSON.stringify(this.dateConversion(this.ruleForm.flightdate)),originstation:JSON.stringify(this.ruleForm.originstation),destinationstation:JSON.stringify(this.ruleForm.destinationstation),awba:JSON.stringify("")}})
} else {
//console.log('error submit!!');
return false;
... ... @@ -189,11 +189,11 @@
},
/*获取默认值方法*/
getDefaultData(){
if(this.$route.params.row!=null){
this.ruleForm.flightno=this.$route.params.row.flightno;
this.ruleForm.flightdate=this.$route.params.row.flightdate;
this.ruleForm.originstation=this.$route.params.row.originstation;
this.ruleForm.destinationstation=this.$route.params.row.destinationstation;
if(this.$route.query!=null){
this.ruleForm.flightno=JSON.parse(this.$route.query.flightno);
this.ruleForm.flightdate=JSON.parse(this.$route.query.flightdate);
this.ruleForm.originstation=JSON.parse(this.$route.query.originstation);
this.ruleForm.destinationstation=JSON.parse(this.$route.query.destinationstation);
}
}
},
... ...
... ... @@ -58,7 +58,7 @@
</el-col>
<el-col :span="12">
<el-button type="primary" @click="submitForm('ruleForm')">保存</el-button>
<el-button type="primary" @click="submitSend('ruleForm')">保存发送</el-button>
<el-button type="primary" @click="back">返回</el-button>
</el-col>
</el-row>
<!--对话提示框-->
... ... @@ -190,7 +190,10 @@
DialogVisible(){
this.centerDialogVisible=false;
this.$router.push({name:'运单分拨申报',params:{awba:this.ruleForm.awba}});
}
},
back(){
this.$router.go(-1);//返回上一层
},
},
mounted(){
this.getDefaultData();
... ...
... ... @@ -30,6 +30,7 @@
<el-row>
<template>
<el-table
v-loading="tableloading"
:data="tableData"
style="width: 100%"
:default-sort = "{prop: 'date', order: 'descending'}"
... ... @@ -107,7 +108,8 @@
flighttime: undefined,
currentPage:1,
pageSize:10,
total:0
total:0,
tableloading:true
}
},
methods: {
... ... @@ -130,19 +132,19 @@
this.listLoading = true;
selectFlightLists(params).then(res=>{
let response=res.data.data;
console.log(response)
this.tableData=response.list;
this.tableloading=false;
this.total=response.total;
this.listLoading = false;
});
},
/*原始舱单跳转*/
handleEdit(index, row) {
this.$router.push({name:'原始舱单',params:{index,row}})
this.$router.push({path:'/enter',query:{flightno:JSON.stringify(row.flightno),flightdate:JSON.stringify(row.flightdate),originstation:JSON.stringify(row.originstation),destinationstation:JSON.stringify(row.destinationstation)}})
},
/*进港理货跳转*/
handleDelete(index, row) {
this.$router.push({name:'进港理货',params:{index,row}})
this.$router.push({path:'entertall',query:{flightno:JSON.stringify(row.flightno),flightdate:JSON.stringify(row.flightdate),originstation:JSON.stringify(row.originstation),destinationstation:JSON.stringify(row.destinationstation)}})
}
},
computed:{
... ...
... ... @@ -42,7 +42,15 @@
</el-col>
<el-col :span="4" class="pub">
<div class="grid-content">
<el-button type="primary" size="mini">导出PDF</el-button>
<el-dropdown @command="handleCommand">
<el-button size="mini" type="primary">
导出文件<i class="el-icon-arrow-down el-icon--right"></i>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="PDF">导出PDF</el-dropdown-item>
<el-dropdown-item command="EXCEL">导出EXCEL</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
</el-col>
</div>
... ... @@ -58,6 +66,9 @@
<el-col :span="24">
<template>
<el-table
class="table"
id="pdfDom"
v-loading="tableloading"
ref="multipleTable"
:data="tableData"
tooltip-effect="dark"
... ... @@ -74,7 +85,7 @@
<el-table-column
label="运单号"
width="185"
show-overflow-tooltip>
>
<template slot-scope="scope">
<span v-if="scope.row.awbh==''||scope.row.awbh==null">
{{scope.row.awba}}
... ... @@ -569,7 +580,7 @@
</el-col>
<el-col :span="2" class="pub">
<div class="grid-content">
<el-button type="primary" size="mini">返回</el-button>
<el-button type="primary" @click="back" size="mini">返回</el-button>
</div>
</el-col>
<el-col :span="2.5" class="pub">
... ... @@ -681,12 +692,23 @@
.pub {
margin-right: 10px;
}
.el-dropdown {
vertical-align: top;
}
.el-dropdown + .el-dropdown {
margin-left: 15px;
}
.el-icon-arrow-down {
font-size: 12px;
}
</style>
<script>
import { getMt1201List,addMt1201,ediMt1201,getFenList,getCountryCode,selectCustomcode,sendCreateMt1201,sendEditeMt1201,sendRemoveMt1201 } from '../../api/mt1201'
import{addResponse,selectResponseList} from "../../api/InResponse";
import FileSaver from "file-saver";
import XLSX from "xlsx";
/*import htmlToPdf from "../../api/htmlToPdf"*/
export default {
data() {
/*初始数据*/
... ... @@ -845,14 +867,42 @@
},
udStatus:'',
loading:false,
temprows:{
},
temprows:{},
dialogTableVisible:false,
gridData:[]
gridData:[],
tableloading:true,
htmlTitle:''
}
},
methods: {
//导出PDF,EXCEL文件
handleCommand(command) {
if(command='EXCEL'){
this.$message('正在为您下载' + command+'文件');
this.downLoad();
}else if(command='PDF'){
this.htmlTitle=this.defaultQuery.flightno+this.defaultQuery.flightdate;
this.$message('正在为您下载' + command+'文件');
//this.getPdf();
}
},
downLoad(){
var wb = XLSX.utils.table_to_book(document.querySelector(".table"));
var wbout = XLSX.write(wb, {
bookType: "xlsx",
bookSST: true,
type: "array"
});
try {
FileSaver.saveAs(
new Blob([wbout], { type: "application/octet-stream" }),
this.defaultQuery.flightno+this.defaultQuery.flightdate+ ".xlsx" // name+'.xlsx'表示导出的excel表格名字
);
} catch (e) {
if (typeof console !== "undefined") console.log(e, wbout);
}
return wbout;
},
//回执收发明细
handleDetail(index,row){
if(row.flightno.length>4){
... ... @@ -914,6 +964,7 @@
/*多选框功能*/
handleSelectionChange(val) {
this.multipleSelection = val;
console.log(val)
},
/*编辑主单信息*/
handleEdit(index, row){
... ... @@ -1087,21 +1138,21 @@
},
/*获取默认值*/
getDefaultData(){
this.defaultQuery.flightno = this.$route.params.flightno;
this.defaultQuery.flightdate = this.$route.params.flightdate;
this.defaultQuery.originstation = this.$route.params.originstation;
this.defaultQuery.destinationstation = this.$route.params.destinationstation;
this.defaultQuery.awba=this.$route.params.awba;
this.defaultQuery.flightno = JSON.parse(this.$route.query.flightno);
this.defaultQuery.flightdate = JSON.parse(this.$route.query.flightdate);
this.defaultQuery.originstation = JSON.parse(this.$route.query.originstation);
this.defaultQuery.destinationstation = JSON.parse(this.$route.query.destinationstation);
this.defaultQuery.awba=JSON.parse(this.$route.query.awba);
},
/*获取默认数据列表*/
getList(){
getMt1201List(this.defaultQuery).then(res =>{
console.log(res);
this.sumNmmsCount=0;
this.sumNmmsPrice=0;
this.sumNmmsWeight=0;
let response=res.data.data;
this.tableData=response;
this.tableloading=false;
response.forEach((item,i) => {
if(item.awba!=null&&item.awbh=="");
this.sumNmmsCount=Number(this.sumNmmsCount)+1;
... ... @@ -1152,9 +1203,9 @@
this.dialogStatus="create";
this.outerVisible = true;
this.FenStatus='ediAwbh';
this.ruleForm.flightno=this.$route.params.flightno;
this.ruleForm.flightdate=this.$route.params.flightdate;
this.ruleForm.originstation=this.$route.params.originstation+"-"+this.$route.params.destinationstation;
this.ruleForm.flightno=JSON.parse(this.$route.query.flightno);
this.ruleForm.flightdate=JSON.parse(this.$route.query.flightdate);
this.ruleForm.originstation=JSON.parse(this.$route.query.originstation)+"-"+JSON.parse(this.$route.query.destinationstation);
},
//新增原始分单
addFen(formName){
... ... @@ -1234,7 +1285,10 @@
Allocatearrive(index,row){
this.$router.push({name:'分拨运抵',params:{carrier:row.carrier,flightno:row.flightno.substr(2),awba:row.awba,flightdate:row.flightdate,
turnpiece:row.awbinfo.pcs,turnweight:row.awbinfo.weight,customcode:row.customcode,goodsname:row.goodsname}});
}
},
back(){
this.$router.go(-1);//返回上一层
},
},
/*渲染方法*/
... ...
... ... @@ -42,6 +42,7 @@
ref="multipleTable"
:data="tableData"
tooltip-effect="dark"
v-loading="tableLoading"
style="width: 100%"
@selection-change="handleSelectionChange"
row-key="uuid"
... ... @@ -336,7 +337,7 @@
<el-row>
<el-col :span="2.5"><div class="grid-content"><el-button type="primary" v-on:click="addTally" size="mini">新增进港理货</el-button></div></el-col>
<el-col :span="2.5"><div class="grid-content"><el-button type="primary" size="mini">批量发送删除报</el-button></div></el-col>
<el-col :span="2"><div class="grid-content"><el-button type="primary" size="mini">返回</el-button></div></el-col>
<el-col :span="2"><div class="grid-content"><el-button type="primary" @click="back" size="mini">返回</el-button></div></el-col>
<el-col :span="2.5"><div class="grid-content"><span>主单数:{{sumNmmsCount}}</span></div></el-col>
<el-col :span="3.5"><div class="grid-content"><span>理货总件数:{{sumNmmsPrice}}</span></div></el-col>
<el-col :span="4"><div class="grid-content"><span>理货总重量:{{sumNmmsWeight}}</span></div></el-col>
... ... @@ -517,6 +518,7 @@
loading:false,
dialogTableVisible:false,
gridData:[],
tableLoading:false
}
},
methods: {
... ... @@ -705,20 +707,22 @@
},
//获取默认值
getDefaultData(){
this.defaultQuery.flightno=this.$route.params.flightno;
this.defaultQuery.flightdate=this.$route.params.flightdate;
this.defaultQuery.originstation=this.$route.params.originstation;
this.defaultQuery.destinationstation=this.$route.params.destinationstation;
this.defaultQuery.flightno = JSON.parse(this.$route.query.flightno);
this.defaultQuery.flightdate = JSON.parse(this.$route.query.flightdate);
this.defaultQuery.originstation = JSON.parse(this.$route.query.originstation);
this.defaultQuery.destinationstation = JSON.parse(this.$route.query.destinationstation);
this.defaultQuery.awba=JSON.parse(this.$route.query.awba);
},
//获取进港理货列表
getMt5201List(){
this.tableLoading=true;
getMt5201List(this.defaultQuery).then(res =>{
this.sumNmmsCount=0;
this.sumNmmsPrice=0;
this.sumNmmsWeight=0;
let response=res.data.data;
console.log(res)
this.tableData=response;
this.tableLoading=false;
response.forEach((item,i) => {
if(item.awba!=null&&item.awbh=="");
this.sumNmmsCount=Number(this.sumNmmsCount)+1;
... ... @@ -732,10 +736,10 @@
this.outerVisible = true;
this.dialogStatus="create";
this.FenStatus='ediAwbh';
this.ruleForm.flightno=this.$route.params.flightno;
this.ruleForm.flightdate=this.$route.params.flightdate;
this.ruleForm.originstation=this.$route.params.originstation;
this.ruleForm.destinationstation=this.$route.params.destinationstation;
this.ruleForm.flightno=JSON.parse(this.$route.query.flightno);
this.ruleForm.flightdate=JSON.parse(this.$route.query.flightdate);
this.ruleForm.originstation=JSON.parse(this.$route.query.originstation);
this.ruleForm.destinationstation=JSON.parse(this.$route.query.destinationstation);
},
//新增原始舱单数据
createData(formName){
... ... @@ -789,6 +793,9 @@
}
});
},
back(){
this.$router.go(-1);//返回上一层
},
},
//渲染方法
mounted(){
... ...
... ... @@ -85,6 +85,7 @@
<el-col :span="24">
<template>
<el-table
v-loading="tableloading"
ref="multipleTable"
:data="tableData"
tooltip-effect="dark"
... ... @@ -253,7 +254,8 @@
multipleSelection: [],
currentPage:1,
pageSize:100,
total:0
total:0,
tableloading:false
}
},
methods:{
... ... @@ -282,22 +284,21 @@
QueryData(){
let params={currentPage:this.currentPage,pageSize:this.pageSize,awba:this.defaultQuery.awba,carrier:this.defaultQuery.carrier,
flightno:this.defaultQuery.flightno,flightdate:this.defaultQuery.flightdate,status:this.defaultQuery.status,messageType:this.defaultQuery.messageType};
this.listLoading = true;
this.tableloading=true;
QueryData(params).then(res =>{
console.log(res)
let response=res.data.data;
this.tableData=response.list;
this.total=response.total;
this.listLoading = false;
this.tableloading = false;
});
},
//点击进入原始页面
handleClick(row){
this.$router.push({name:'进港原始舱单',params:{flightno:row.carrier+row.flightno,destinationstation:row.destinationstation,awba:row.awba,flightdate:row.flightdate,originstation:row.originstation}});
this.$router.push({path:'/origmaster',query:{flightno:JSON.stringify(row.carrier+row.flightno),destinationstation:JSON.stringify(row.destinationstation),awba:JSON.stringify(row.awba),flightdate:JSON.stringify(row.flightdate),originstation:JSON.stringify(row.originstation)}});
},
//点击进入理货页面
handleTally(row){
this.$router.push({name:'进港理货舱单',params:{flightno:row.carrier+row.flightno,destinationstation:row.destinationstation,awba:row.awba,flightdate:row.flightdate,originstation:row.originstation}});
this.$router.push({path:'/tallymaster',query:{flightno:JSON.stringify(row.carrier+row.flightno),destinationstation:JSON.stringify(row.destinationstation),awba:JSON.stringify(row.awba),flightdate:JSON.stringify(row.flightdate),originstation:JSON.stringify(row.originstation)}});
},
//table显示时间转换
timestampToTime(timestamp) {
... ...