This commit is contained in:
linfso 2024-11-05 11:43:02 +08:00
parent ee58a9585f
commit abd162dde0

View File

@ -256,6 +256,8 @@ export default {
id:null, id:null,
titleView:"", titleView:"",
openView: false, openView: false,
selectionList:[],
// 备注时间范围 // 备注时间范围
daterangeApplyDate: [], daterangeApplyDate: [],
// 备注时间范围 // 备注时间范围
@ -485,6 +487,7 @@ export default {
}, },
// 多选框选中数据 // 多选框选中数据
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.selectionList=selection;
this.ids = selection.map(item => item.id) this.ids = selection.map(item => item.id)
this.single = selection.length!==1 this.single = selection.length!==1
this.multiple = !selection.length this.multiple = !selection.length
@ -592,87 +595,118 @@ export default {
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
let that = this;
const loadingInstance = this.$loading({ const loadingInstance = this.$loading({
text: '正在导出...' text: '正在导出...'
}) })
var qParam = {...this.queryParams};
qParam.pageNum=1;
qParam.pageSize=500;
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;
}
qParam.params.queryType = this.queryParams.queryType;//1:yd;2:dd;
qParam.params.isSubBill = this.queryParams.isSubBill;//1:子单;0:主单
let queryType = this.queryParams.queryType; if(this.selectionList&&this.selectionList.length>0){
if(queryType == "1"){ this.exportData(this.selectionList,loadingInstance);
qParam.orderSN=null;
}else if(queryType == "0"){
qParam.orderSN=this.queryParams.billCode;
qParam.billCode=null;
} }
else{
let qExportParam=this.initQueryParams();
qExportParam.pageNum=1;
qExportParam.pageSize=20000;
listEmisTmsScanRecord(qParam).then(response => { listEmisTmsScanRecord(qExportParam).then(response => {
this.loadingInstance = false
if (response.code === 200) { if (response.code === 200) {
const curList = [] this.exportData(response.rows,loadingInstance);
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);
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);
} }
});
} }
},
exportData(selData,loadingInstance){
const curList =selData
import('@/vendor/Export2Excel').then(excel => { import('@/vendor/Export2Excel').then(excel => {
const data = this.formatJson(filterVal, curList, curList) const exportParam=this.$refs.dataTable.getExportParam();
const tHeader = exportParam.header;
const filterVal = exportParam.filter;
const data = this.formatJson(filterVal, curList, selData)
excel.export_json_to_excel({ excel.export_json_to_excel({
header: tHeader, header: tHeader,
data, data,
filename: '扫描记录查询', filename: '扫描记录导出',
autoWidth: true autoWidth: true
}) })
loadingInstance.close() loadingInstance.close()
}) })
}
});
}, },
formatJson(filterVal, jsonData, resData) { formatJson(filterVal, jsonData, resData) {
let index = 0 let index = 0
return jsonData.map(v => filterVal.map(j => { return jsonData.map(v => filterVal.map(j => {
if (j === 'index') { if (j === 'index') {
return ++index return ++index
} }
if (j === 'status') { if (j === 'kjlx') {
var statusStr='xxx' return v['sendSiteName']+'--'+v['dispatchUnderlingSiteName'];
if(v[j] == 10){
statusStr='xxx'
} }
return statusStr; if (j === 'fjr') {
return v['sendName']+'--'+v['receiveName'];
}
if (j === 'custName') {
let paymentType=v['paymentType'];
if(paymentType==2 || paymentType==4 || paymentType==5 ){
return v['custName'];
}else{
return "";
}
}
if (j === 'sendMobile') {
return "";
}
if (j === 'scanType') {
return this.selectDictLabel(this.dict.type.emis_scan_type,v[j]);
}
if (j === 'pickupMethod') {
return this.selectDictLabel(this.dict.type.emis_qujian_fangshi,v[j]);
}
if (j === 'customsEclaration') {
return this.selectDictLabel(this.dict.type.emis_declare_mode,v[j]);
}
if (j === 'customsClear') {
return this.selectDictLabel(this.dict.type.emis_customs_clear,v[j]);
}
if (j === 'packType') {
return this.selectDictLabels(this.dict.type.emis_tab_packing_type,v[j]);
}
if (j === 'dispatchMethod') {
if(v[j] == 1){
return '派送';
}else{
return '自提';
}
}
if (j === 'blMessage') {
if(v[j] == 1){
return '发送';
}else{
return '不发送';
}
}
if (j === 'blAcceptMessage') {
if(v[j] == 1){
return '发送';
}else{
return '不发送';
}
}
if (j === 'blSign') {
if(v[j] == 1){
return '已签收';
}else{
return '未签收';
}
}
if (j === 'paymentType') {
return this.selectDictLabel(this.dict.type.emis_payment_type,v[j]);
} }
return v[j] return v[j]
})) }))
}, },
/** 列索引函数 */ /** 列索引函数 */
getIndex($index) { getIndex($index) {
return (this.queryParams.pageNum - 1) * this.queryParams.pageSize + $index + 1 return (this.queryParams.pageNum - 1) * this.queryParams.pageSize + $index + 1