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
@ -590,89 +593,120 @@ export default {
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
}).catch(() => {}); }).catch(() => {});
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
let that = this;
const loadingInstance = this.$loading({ const loadingInstance = this.$loading({
text: '正在导出...' text: '正在导出...'
}) })
var qParam = {...this.queryParams};
qParam.pageNum=1; if(this.selectionList&&this.selectionList.length>0){
qParam.pageSize=500; this.exportData(this.selectionList,loadingInstance);
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; else{
qParam.params.isSubBill = this.queryParams.isSubBill;//1:子单;0:主单 let qExportParam=this.initQueryParams();
qExportParam.pageNum=1;
qExportParam.pageSize=20000;
let queryType = this.queryParams.queryType; listEmisTmsScanRecord(qExportParam).then(response => {
if(queryType == "1"){ if (response.code === 200) {
qParam.orderSN=null; this.exportData(response.rows,loadingInstance);
}else if(queryType == "0"){ }
qParam.orderSN=this.queryParams.billCode; });
qParam.billCode=null;
} }
},
listEmisTmsScanRecord(qParam).then(response => { exportData(selData,loadingInstance){
this.loadingInstance = false const curList =selData
if (response.code === 200) { import('@/vendor/Export2Excel').then(excel => {
const curList = [] const exportParam=this.$refs.dataTable.getExportParam();
for (let index = 0; index < response.rows.length; index++) { const tHeader = exportParam.header;
let scanRstItem = response.rows[index]; const filterVal = exportParam.filter;
let record =Object.assign({}, scanRstItem) const data = this.formatJson(filterVal, curList, selData)
if(this.queryParams.queryType!="1"){ excel.export_json_to_excel({
record.billCode = qParam.orderSN; header: tHeader,
} data,
record.scanSiteName = this.queryParams.scanSiteName || record.scanSiteName; filename: '扫描记录导出',
record.preOrNextStation = this.queryParams.preOrNextStation || scanRstItem.preOrNextStation; autoWidth: true
record.scanDate = parseTime(record.scanDate); })
record.createTime = parseTime(record.createTime); loadingInstance.close()
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);
}
}
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()
})
}
});
}, },
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' 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 "";
} }
return statusStr; }
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