jinhui.wang

货物查询修改

......@@ -6,7 +6,7 @@ const mimeMap = {
zip: 'application/zip'
}
const baseUrl = process.env.VUE_APP_BASE_API
const baseUrl = 'http://192.168.1.134:18080'
export function downLoadZip(str, filename) {
var url = baseUrl + str
axios({
......@@ -18,6 +18,20 @@ export function downLoadZip(str, filename) {
resolveBlob(res, mimeMap.zip)
})
}
export function cargoXlsx(str,data) {
var url = baseUrl + str
axios({
method: 'post',
url: url,
data:data,
responseType: 'blob',
headers: { 'Authorization': getToken() }
}).then(res => {
if(res.status === 200){
cargoTableXlsx(res)
}
})
}
/**
* 解析blob响应内容并下载
* @param {*} res blob响应内容
......@@ -25,7 +39,7 @@ export function downLoadZip(str, filename) {
*/
export function resolveBlob(res, mimeType) {
const aLink = document.createElement('a')
var blob = new Blob([res.data], { type: mimeType })
var blob = new Blob([res], { type: mimeType })
// //从response的headers中获取filename, 后端response.setHeader("Content-disposition", "attachment; filename=xxxx.docx") 设置的文件名;
var patt = new RegExp('filename=([^;]+\\.[^\\.;]+);*')
var contentDisposition = decodeURI(res.headers['content-disposition'])
......@@ -38,3 +52,14 @@ export function resolveBlob(res, mimeType) {
aLink.click()
document.body.removeChild(aLink);
}
//货物查询表导出
export function cargoTableXlsx(res){
const aLink = document.createElement('a')
const fileName = "货物查询表.xlsx"
aLink.href = URL.createObjectURL(res.data)
aLink.setAttribute('download', fileName) // 设置下载文件名称
document.body.appendChild(aLink)
aLink.click()
document.body.removeChild(aLink);
}
......
<template>
<div>
<div class="cargoPage" v-loading="downloading">
<el-form
ref="cargoForm"
size="mini"
inline
size="small"
:model="formData"
label-position="right"
label-width="105px"
style="margin: 15px"
label-position="left"
label-width="auto"
style="margin: 10px; width: 100%"
>
<el-row>
<el-row type="flex" style="flexWrap: wrap!important">
<el-col :span="6">
<el-form-item label="航班日期:">
<el-form-item label="航班日期:">
<el-date-picker
class="formItem"
v-model="flightTime"
type="daterange"
range-separator="至"
......@@ -23,9 +23,10 @@
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="6">
<!-- <el-col :span="6">
<el-form-item label="预配航班日期:">
<el-date-picker
class="formItem"
v-model="prepalyFlightTime"
type="daterange"
range-separator="至"
......@@ -35,10 +36,11 @@
>
</el-date-picker>
</el-form-item>
</el-col>
</el-col> -->
<el-col :span="6">
<el-form-item label="创建日期:">
<el-date-picker
class="formItem"
v-model="createDate"
type="daterange"
range-separator="至"
......@@ -50,58 +52,34 @@
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="取件日期:">
<el-date-picker
v-model="formData.pickUpDate"
type="date"
placeholder="选择日期"
:value-format="valueFormat"
>
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="运单号:">
<el-input
size="small"
type="text"
v-model="formData.waybillNo"
></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="站点:">
<el-input
size="small"
type="text"
v-model="formData.siteName"
class="formItem"
></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="航班号:">
<el-input
size="small"
type="text"
v-model="upCase"
></el-input>
<el-form-item label="原航班号:">
<el-input type="text" v-model="upCase" class="formItem"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<!-- <el-col :span="6">
<el-form-item label="航班序列单号:">
<el-input
size="small"
type="text"
v-model="formData.mawbCode"
class="formItem"
></el-input>
</el-form-item>
</el-col>
</el-col> -->
<el-col :span="6">
<el-form-item label="URSA:">
<el-input
size="small"
type="text"
v-model="formData.ursa"
class="formItem"
></el-input>
</el-form-item>
</el-col>
......@@ -110,6 +88,7 @@
<el-select
placeholder="不限"
v-model="formData.typeId"
class="formItem"
clearable
>
<el-option
......@@ -127,6 +106,7 @@
<el-select
placeholder="不限"
v-model="formData.statusId"
class="formItem"
clearable
>
<el-option
......@@ -139,11 +119,12 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<!-- <el-col :span="6">
<el-form-item label="配置航班类型:">
<el-select
placeholder="不限"
v-model="formData.kindToAllocFlightId"
class="formItem"
clearable
>
<el-option
......@@ -155,12 +136,13 @@
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
</el-col> -->
<!-- <el-col :span="6">
<el-form-item label="历史货物状态:">
<el-select
placeholder="不限"
v-model="formData.historyAllocaCargoTypeId"
class="formItem"
clearable
>
<el-option
......@@ -172,12 +154,13 @@
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-col> -->
<el-col :span="6">
<el-form-item label="海关回执状态:">
<el-select
placeholder="不限"
v-model="formData.customsReceiptStatusId"
class="formItem"
clearable
>
<el-option
......@@ -195,6 +178,7 @@
<el-select
placeholder="不限"
v-model="formData.serviceTypeId"
class="formItem"
clearable
>
<el-option
......@@ -207,47 +191,73 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<!-- <el-col :span="6">
<el-form-item label="数据源:">
<el-select
placeholder="不限"
v-model="formData.dataSources"
class="formItem"
clearable
>
<el-option label="人工导入" value="1"> </el-option>
<el-option label="系统导入" value="2"> </el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
</el-col> -->
<!-- <el-col :span="6">
<el-form-item label="是否大货:">
<el-select
placeholder="不限"
v-model="formData.big"
class="formItem"
clearable
>
<el-option label="是" value="1"> </el-option>
<el-option label="否" value="0"> </el-option>
</el-select>
</el-form-item>
</el-col>
</el-col> -->
<el-col :span="6">
<el-form-item label="是否自动:">
<el-select
placeholder="不限"
v-model="formData.allocationTypeId"
class="formItem"
clearable
>
<el-option
v-for="item in findConditionData.cargoAllocationType"
:label="item.chineseName"
:value="item.id"
:key="item.id"
label="手动"
value="1"
>
</el-option>
<el-option
label="自动"
value="2"
>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="运单号:">
<el-input
type="textarea"
v-model="formData.waybillNo"
class="formItem"
></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="取件日期:">
<el-date-picker
v-model="formData.pickUpDate"
type="date"
placeholder="选择日期"
:value-format="valueFormat"
>
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<div style="paddingleft: 10px">
<el-button
......@@ -257,34 +267,35 @@
@click="select"
>查询</el-button
>
<el-button type="primary" size="small" @click="checks(tableDate)"
<el-button type="primary" size="small" @click="checks(tableData)"
>全选/全否</el-button
>
<el-button type="primary" size="small" @click="xlse(limitStart)"
<el-button type="primary" size="small" @click="xlse(0)" v-dbClick :disabled="tableData.length==0"
>导出本页查询结果</el-button
>
<el-button type="primary" size="small" @click="xlse(0)"
<el-button type="primary" size="small" @click="xlse(1)" v-dbClick :disabled="tableData.length==0"
>导出全部查询结果</el-button
>
<div class="tips">
<span style="paddingright: 50px">总重量:{{ allWeight }}</span
> <span>总件数:{{ allQty }}</span>
<span style="paddingright: 50px">总重量:{{ allWeight }}</span>
<span>总件数:{{ allQty }}</span>
</div>
</div>
</el-form>
<el-table
ref="cargoTable"
:data="tableDate"
:data="tableData"
style="width: 100%"
size="small"
height="500"
height="450"
v-loading="tableLoading"
fit
@select="cheacked"
@select-all="selectAll"
>
<el-table-column type="selection" width="55" fixed> </el-table-column>
<el-table-column type="index" label="序号">
<template slot-scope="scope">{{scope.$index+1}}</template>
<template slot-scope="scope">{{ scope.$index + 1 }}</template>
</el-table-column>
<el-table-column
v-for="item in tableHeader"
......@@ -294,6 +305,7 @@
width="100%"
header-align="center"
align="center"
:formatter="formatter"
>
</el-table-column>
</el-table>
......@@ -313,7 +325,7 @@
<script>
import { findConditionData, findCargoData } from "@/api/cargoSelect";
import { downLoadZip } from "@/utils/zipdownload";
import { cargoXlsx } from "@/utils/zipdownload";
export default {
data() {
......@@ -342,66 +354,67 @@ export default {
big: null,
}, //表单数据
tableHeader: [
{ name: "配置航班类型", value: "kindIdToAllocFlightName" },
{ name: "取件日期", value: "pickUpDate" },
{ name: "取件扫描号", value: "pickUpScanNo" },
{ name: "服务类型", value: "serviceTypeName" },
{ name: "运单号", value: "waybillNo" },
{ name: "状态", value: "statusName" },
{ name: "航班号", value: "fltNo" },
{ name: "航班日期", value: "fltDate" },
{ name: "原航班", value: "sourceFlt" },
{ name: "已选目的航班", value: "fltSet" },
{ name: "货物状态", value: "statusName" },
{ name: "原航班号", value: "fltNoAccs" },
{ name: "原航班日期", value: "fltDateAccs" },
{ name: "ACCS航线", value: "accsFlightRoute" },
{ name: "预配航班日期", value: "preplanFlightTime" },
{ name: "预配航班号", value: "preplanFlightNo" },
{ name: "二配航班日期", value: "twoMatchFlightTime" },
{ name: "二配航班号", value: "twoMatchFlightNo" },
{ name: "终配航班日期", value: "finalFlightTime" },
{ name: "终配航班号", value: "finalFlightNo" },
{ name: "件数", value: "qty" },
{ name: "实际重量", value: "actualWeight" },
{ name: "航班序号单", value: "mawbCode" },
{ name: "申报类型", value: "typeName" },
{ name: "历史货物状态", value: "historyAllocaCargoTypeName" },
{ name: "预配航班日期", value: "prematchFltDate" },
{ name: "口岸代码", value: "portName" },
{ name: "subcategory", value: "subCategory" },
{ name: "发件人账号", value: "shipperAccount" },
{ name: "发件公司中文名称", value: "shipperCompany" },
{ name: "是否RDE手工录入", value: "manualRde" },
{ name: "HandlingCode", value: "handingCode" },
{ name: "品名描述", value: "nameDescription" },
{ name: "站点", value: "siteName" },
{ name: "始发地城市名称", value: "originCity" },
{ name: "收件地", value: "destinationSiteName" },
{ name: "目的国家", value: "countryName" },
{ name: "Bagging ID", value: "baggingId" },
{ name: "收件人国家代码", value: "consigneeCountry" },
{ name: "URSA", value: "ursa" },
{ name: "selection Code", value: "selectionCode" },
{ name: "尺寸", value: "sizeStr" },
{ name: "体积", value: "volume" },
{ name: "是否大货", value: "big" },
{ name: "历史航班号", value: "historyFltNo" },
{ name: "海关回执状态", value: "customsReceiptStatusName" },
{ name: "海关回执时间", value: "customsReceiptTime" },
{ name: "预审状态", value: "preQualificationStatus" },
{ name: "CA预审意见", value: "caPretrialOpinion" },
{ name: "CA回执时间", value: "caPretrialTime" },
{ name: "CA预审时间", value: "caPretrialTime" },
{
name: "大货预审意见(是否可以配置CA航班)",
value: "bigPretrialOpinion",
},
{ name: "大货预审时间", value: "bigPretrialTime" },
{ name: "是否已经传送到图像系统", value: "transmitFlg" },
{ name: "传送时间", value: "transmitUploadTime" },
{ name: "图像系统反馈结果", value: "transmitFeedbackTime" },
{ name: "图像系统反馈时间", value: "transmitFeedbackResult" },
{ name: "创建人", value: "createUserId" },
{ name: "创建时间", value: "createTime" },
{ name: "数据源", value: "dataSources" },
{ name: "是否自动", value: "allocationTypeName" },
{ name: "是否自动", value: "cargoRulesStatus" },
], //表头数据
findConditionData: {}, //货物查询条件
tableDate: [], //表格数据
tableData: [], //表格数据
allWeight: 0,
allQty: 0,
shiftKey: false,
start: -1,
valueFormat:'yyyy-MM-dd',
tableLoading:false,
totalCount:0,
valueFormat: "yyyy-MM-dd",
tableLoading: false,
downloading:false,
totalCount: 0,
selectTable: [],
flightTime: [],
prepalyFlightTime: [],
createDate: [],
limitStart: 0,
limitSize: 100,//无限制-1
limitSize: 100, //无限制-1
selecetALL:false,
};
},
......@@ -410,11 +423,11 @@ export default {
findConditionData().then((res) => {
if (res.code == 200) {
this.findConditionData = res.data;
}else{
} else {
this.$message({
message: '查询条件不存在',
type: 'warning',
});
message: "查询条件不存在",
type: "warning",
});
}
});
},
......@@ -433,84 +446,120 @@ export default {
},
methods: {
clear(){
this.$refs.cargoForm.resetFields()
clear() {
this.$refs.cargoForm.resetFields();
},
//查询
select() {
this.tableData = [];
this.allWeight = 0;
this.allQty = 0;
this.tableLoading = true;
if(this.createDate.length > 0){
if (this.createDate != null && this.createDate.length > 0) {
this.formData.createTimeStart = this.createDate[0];
this.formData.createTimeEnd = this.createDate[1];
this.formData.createTimeEnd = this.createDate[1];
}else{
this.formData.createTimeStart = null;
this.formData.createTimeEnd = null;
}
if(this.prepalyFlightTime.length > 0){
if (this.prepalyFlightTime != null && this.prepalyFlightTime.length > 0) {
this.formData.prematchFltDateStart = this.prepalyFlightTime[0];
this.formData.prematchFltDateEnd = this.prepalyFlightTime[1];
}else{
this.formData.prematchFltDateStart ="";
this.formData.prematchFltDateEnd = "";
}
if(this.flightTime.length > 0){
if (this.flightTime != null && this.flightTime.length > 0) {
this.formData.fltDateStart = this.flightTime[0];
this.formData.fltDateEnd = this.flightTime[1];
}else{
this.formData.fltDateStart = "";
this.formData.fltDateEnd = "";
}
this.formData.limitStart = this.limitStart;
this.formData.limitSize = this.limitSize;
findCargoData(this.formData).then((res) => {
if (res.code == 200) {
if(res.data.list.length > 0 ){
this.tableDate = res.data.list;
this.totalCount = res.data.totalCount;
for (let i = 0; i < this.tableDate.length; i++) {
this.tableDate[i].index = i;
if (res.code == 200) {
if (res.data.list.length > 0) {
this.tableData = res.data.list;
this.totalCount = res.data.totalCount;
for (let i = 0; i < this.tableData.length; i++) {
this.tableData[i].index = i;
}
}else{
} else {
this.$message({
message: "未查询到数据",
type: "warning",
});
}
} else {
this.$message({
message: '未查询到数据',
type: 'warning',
});
}
}else{
this.$message({
message: res.msg,
type: 'warning',
type: "warning",
});
}
this.tableLoading = false;
});
}
this.tableLoading = false;
}).catch(()=>{
this.tableLoading = false;
});
},
//全选反选
checks(rows) {
if (rows) {
if (rows && !this.selecetALL) {
rows.forEach((row) => {
this.$refs.cargoTable.toggleRowSelection(row);
this.allQty = row.qty + this.allQty;
this.allWeight = row.actualWeight + this.allWeight;
});
this.selecetALL = true;
this.allWeight = this.allWeight.toFixed(1);
this.allQty = this.allQty.toFixed(0);
} else {
this.$refs.cargoTable.clearSelection();
this.allWeight = 0;
this.allQty = 0;
this.selecetALL = false;
}
},
selectAll(selection){
if(selection.length > 0){
selection.forEach(item => {
this.allWeight = item.actualWeight + this.allWeight;
this.allQty = item.qty + this.allQty;
})
this.allWeight = this.allWeight.toFixed(1);
this.allQty = this.allQty.toFixed(0);
}else{
this.allWeight = 0;
this.allQty = 0;
}
},
//下一页
nextClick(){
nextClick() {
this.limitStart = this.limitStart + 100;
},
//上一页
prevClick(){
prevClick() {
this.limitStart = this.limitStart - 100;
},
//指定页数
currentChange(page){
this.limitStart = (page-1)*100;
this.select()
currentChange(page) {
this.limitStart = (page - 1) * 100;
this.select();
// this.$el.getElementsByClassName("el-table__body")[0].scrollTop=0
},
//表单项选中操作
cheacked(sl, row) {
if (this.shiftKey) {
if (this.start == -1) {
for (let i = 0; i <= row.index; i++) {
this.$refs.cargoTable.toggleRowSelection(this.tableDate[i], true);
this.selectTable.push(this.tableDate[i]);
this.$refs.cargoTable.toggleRowSelection(this.tableData[i], true);
this.selectTable.push(this.tableData[i]);
}
} else {
for (let i = this.start + 1; i <= row.index; i++) {
this.$refs.cargoTable.toggleRowSelection(this.tableDate[i], true);
this.$refs.cargoTable.toggleRowSelection(this.tableData[i], true);
}
}
} else {
......@@ -522,12 +571,12 @@ export default {
newselect.push(row);
for (let i = 0; i < this.selectTable.length; i++) {
if (this.selectTable[i].id != row.id) {
newselect.push(this.selectTable[i])
}else{
newselect.push(this.selectTable[i]);
} else {
newselect.splice(0, 1);
}
}
this.selectTable = newselect
this.selectTable = newselect;
}
}
this.allWeight = 0;
......@@ -539,34 +588,76 @@ export default {
this.allQty = this.allQty.toFixed(0);
this.allWeight = this.allWeight.toFixed(1);
},
// 全部、当前页面
// 导出表格
xlse(page) {
if(page > 0 ){
let cargoXlse = {title:"货物导出表",cargoConditionDto:{}};
if (this.createDate != null && this.createDate.length > 0) {
this.formData.createTimeStart = this.createDate[0];
this.formData.createTimeEnd = this.createDate[1];
}else{
this.formData.createTimeStart = null;
this.formData.createTimeEnd = null;
}
if (this.prepalyFlightTime != null && this.prepalyFlightTime.length > 0) {
this.formData.prematchFltDateStart = this.prepalyFlightTime[0];
this.formData.prematchFltDateEnd = this.prepalyFlightTime[1];
}else{
this.formData.prematchFltDateStart ="";
this.formData.prematchFltDateEnd = "";
}
if (this.flightTime != null && this.flightTime.length > 0) {
this.formData.fltDateStart = this.flightTime[0];
this.formData.fltDateEnd = this.flightTime[1];
}else{
this.formData.fltDateStart = "";
this.formData.fltDateEnd = "";
}
cargoXlse.cargoConditionDto = this.formData;
cargoXlse.cargoConditionDto.limitSize = this.limitSize;
if (page == 0) {
cargoXlse.cargoConditionDto.limitStart = this.limitStart;
} else {
cargoXlse.cargoConditionDto.limitStart = 0;
cargoXlse.cargoConditionDto.limitSize = -1;
}
console.log(page);
cargoXlsx("/cargo/excel",cargoXlse)
},
//表格格式化
formatter(row,column,cellValue,index){
if(column.property=="cargoRulesStatus"){
console.log()
if(cellValue == 1){
return cellValue = "手动"
}else if(cellValue == 2){
return cellValue = "自动"
}
}
return cellValue
}
},
computed:{
upCase:{
get: function(){
computed: {
upCase: {
get: function () {
return this.formData.fltNo;
},
set: function(val){
set: function (val) {
this.formData.fltNo = val.toUpperCase();
}
}
}
},
},
},
};
</script>
<style>
<style scoped>
.tips {
float: right;
color: #606266;
font-size: 14px;
margin-right: 20px;
margin-right: 40px;
}
.formItem {
width:100%;
max-width: 300px;
}
</style>
\ No newline at end of file
......