扫描记录查询页的导出功能完成
This commit is contained in:
parent
19cd003bbc
commit
d4484268d8
@ -93,17 +93,18 @@
|
||||
</el-form>
|
||||
|
||||
<xd-table v-loading="loading"
|
||||
border stripe
|
||||
size="small"
|
||||
:data="emisElectronicPagApplyList"
|
||||
:showSearch.sync="showSearch"
|
||||
:queryParams="queryParams"
|
||||
:total="total"
|
||||
@queryTable="getList"
|
||||
@selection-change="handleSelectionChange"
|
||||
@sort-change="handleSortChange"
|
||||
v-if="tableHeight" :max-height="tableHeight + 'px'"
|
||||
>
|
||||
ref="dataTable"
|
||||
border stripe
|
||||
size="small"
|
||||
:data="emisElectronicPagApplyList"
|
||||
:showSearch.sync="showSearch"
|
||||
:queryParams="queryParams"
|
||||
:total="total"
|
||||
@queryTable="getList"
|
||||
@selection-change="handleSelectionChange"
|
||||
@sort-change="handleSortChange"
|
||||
v-if="tableHeight" :max-height="tableHeight + 'px'"
|
||||
>
|
||||
<div slot="toolbar">
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
@ -138,7 +139,7 @@
|
||||
type="primary"
|
||||
plain
|
||||
size="mini"
|
||||
@click="getList"
|
||||
@click="handleExport"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
@ -154,7 +155,7 @@
|
||||
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
|
||||
<el-table-column :label="$t('单号')" align="center" prop="queryType" min-width="170">
|
||||
<el-table-column :label="$t('单号')" align="center" prop="billCode" min-width="170">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.queryType=="1"?scope.row.billCode:scope.row.orderSN}}</span>
|
||||
</template>
|
||||
@ -658,71 +659,72 @@ export default {
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
// this.download('emis/emisElectronicPagApply/export', {
|
||||
// ...this.queryParams
|
||||
// }, `emisElectronicPagApply_${new Date().getTime()}.xlsx`)
|
||||
const loadingInstance = this.$loading({
|
||||
text: '正在导出...'
|
||||
})
|
||||
var qParam = {...this.queryParams};
|
||||
qParam.pageNum=1;
|
||||
qParam.pageSize=5000;
|
||||
if (null != this.dateTimeRange && '' != this.dateTimeRange) {
|
||||
this.queryParams.params["beginScanDate"] = dateToStr(this.dateTimeRange[0]);
|
||||
this.queryParams.params["endScanDate"] = dateToStr(this.dateTimeRange[1]);
|
||||
let that = this;
|
||||
const loadingInstance = this.$loading({
|
||||
text: '正在导出...'
|
||||
})
|
||||
var qParam = {...this.queryParams};
|
||||
qParam.pageNum=1;
|
||||
qParam.pageSize=20;
|
||||
if (null != this.dateTimeRange && '' != this.dateTimeRange) {
|
||||
qParam.params.beginScanDate = dateToStr(new Date(this.dateTimeRange[0]));
|
||||
qParam.params.endScanDate = dateToStr(new Date(this.dateTimeRange[1]));
|
||||
}else{
|
||||
qParam.params.beginScanDate = null;
|
||||
qParam.params.endScanDate = null;
|
||||
}
|
||||
this.queryParams.params["queryType"] = this.queryParams.queryType;//1:yd;2:dd;
|
||||
this.queryParams.params["isSubBill"] = this.queryParams.isSubBill;//1:子单;0:主单
|
||||
qParam.params.queryType = this.queryParams.queryType;//1:yd;2:dd;
|
||||
qParam.params.isSubBill = this.queryParams.isSubBill;//1:子单;0:主单
|
||||
|
||||
listEmisTmsScanRecord(this.queryParams).then(response => {
|
||||
this.downloadLoading = false
|
||||
let queryType = this.queryParams.queryType;
|
||||
if(queryType == "1"){
|
||||
qParam.orderSN=null;
|
||||
}else if(queryType == "0"){
|
||||
qParam.orderSN=this.queryParams.billCode;
|
||||
qParam.billCode=null;
|
||||
}
|
||||
|
||||
listEmisTmsScanRecord(qParam).then(response => {
|
||||
this.loadingInstance = false
|
||||
if (response.code === 200) {
|
||||
const curList = []
|
||||
for (let index = 0; index < response.rows.length; index++) {
|
||||
let scanRstItem = response.rows[index];
|
||||
let record =Object.assign({}, scanRstItem)
|
||||
record.orderType = this.queryParams.orderType;
|
||||
record.scanSiteName = this.queryParams.scanSiteName || record.scanSiteName;
|
||||
record.preOrNextStation = this.queryParams.preOrNextStation || scanRstItem.preOrNextStation;
|
||||
curList.push(record);
|
||||
}
|
||||
import('@/vendor/Export2Excel').then(excel => {
|
||||
const tHeader = ['id','单号','单号类型','车牌号','扫描时间','扫描类型','扫描网点','上/下一网点','扫描员','录入时间','扫描重量'];
|
||||
const filterVal = ['id','billCode','orderType','carNo','scanDate','scanType','scanSite','preOrNextStation','scanMan','createTime','scanWeight'];
|
||||
const data = this.formatJson(filterVal, curList, curList)
|
||||
excel.export_json_to_excel({
|
||||
header: tHeader,
|
||||
data,
|
||||
filename: '网点电子面单申请',
|
||||
autoWidth: true
|
||||
})
|
||||
loadingInstance.close()
|
||||
})
|
||||
const curList = []
|
||||
for (let index = 0; index < response.rows.length; index++) {
|
||||
let scanRstItem = response.rows[index];
|
||||
let record =Object.assign({}, scanRstItem)
|
||||
if(this.queryParams.queryType!="1"){
|
||||
record.billCode = qParam.orderSN;
|
||||
}
|
||||
record.scanSiteName = this.queryParams.scanSiteName || record.scanSiteName;
|
||||
record.preOrNextStation = this.queryParams.preOrNextStation || scanRstItem.preOrNextStation;
|
||||
record.scanDate = parseTime(record.scanDate);
|
||||
record.createTime = parseTime(record.createTime);
|
||||
debugger
|
||||
console.log(that)
|
||||
record.scanType = that.dict.label.emis_scan_type[record.scanType];
|
||||
curList.push(record);
|
||||
}
|
||||
let tHeader = [];// ['id','单号','单号类型','车牌号','扫描时间','扫描类型','扫描网点','上/下一网点','扫描员','录入时间','扫描重量'];
|
||||
let filterVal = [];// ['id','billCode','orderType','carNo','scanDate','scanType','scanSite','preOrNextStation','scanMan','createTime','scanWeight'];
|
||||
|
||||
for(let sl = 0; sl < this.$refs.dataTable.storageList.length; sl++){
|
||||
if(this.$refs.dataTable.storageList[sl].show){
|
||||
tHeader.push(this.$refs.dataTable.storageList[sl].label);
|
||||
filterVal.push(this.$refs.dataTable.storageList[sl].prop);
|
||||
}
|
||||
}
|
||||
debugger
|
||||
import('@/vendor/Export2Excel').then(excel => {
|
||||
const data = this.formatJson(filterVal, curList, curList)
|
||||
excel.export_json_to_excel({
|
||||
header: tHeader,
|
||||
data,
|
||||
filename: '扫描记录查询',
|
||||
autoWidth: true
|
||||
})
|
||||
loadingInstance.close()
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
// listEmisTmsScanRecord(this.addDateRange(qParam, this.dateTimeRange)).then(response => {
|
||||
// this.emisElectronicPagApplyList = [];
|
||||
// this.loading = false;
|
||||
// let rows = response.rows;
|
||||
// this.total = response.total;
|
||||
// if(!rows || rows.length == 0){
|
||||
// this.$message.error("未查到单号");
|
||||
// return;
|
||||
// }
|
||||
// for (let index = 0; index < rows.length; index++) {
|
||||
// let scanRstItem = rows[index];
|
||||
// console.log(scanRstItem);
|
||||
|
||||
// let record =Object.assign({}, scanRstItem)
|
||||
// record.orderType = this.queryParams.orderType;
|
||||
// record.scanSiteName = this.queryParams.scanSiteName || record.scanSiteName;
|
||||
// record.preOrNextStation = this.queryParams.preOrNextStation || scanRstItem.preOrNextStation;
|
||||
// this.emisElectronicPagApplyList.push(record);
|
||||
// }
|
||||
// });
|
||||
|
||||
|
||||
},
|
||||
formatJson(filterVal, jsonData, resData) {
|
||||
let index = 0
|
||||
|
||||
Loading…
Reference in New Issue
Block a user