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,
titleView:"",
openView: false,
selectionList:[],
// 备注时间范围
daterangeApplyDate: [],
// 备注时间范围
@ -485,6 +487,7 @@ export default {
},
// 多选框选中数据
handleSelectionChange(selection) {
this.selectionList=selection;
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
@ -590,89 +593,120 @@ export default {
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
let that = this;
/** 导出按钮操作 */
handleExport() {
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;
if(this.selectionList&&this.selectionList.length>0){
this.exportData(this.selectionList,loadingInstance);
}
qParam.params.queryType = this.queryParams.queryType;//1:yd;2:dd;
qParam.params.isSubBill = this.queryParams.isSubBill;//1:子单;0:主单
else{
let qExportParam=this.initQueryParams();
qExportParam.pageNum=1;
qExportParam.pageSize=20000;
let queryType = this.queryParams.queryType;
if(queryType == "1"){
qParam.orderSN=null;
}else if(queryType == "0"){
qParam.orderSN=this.queryParams.billCode;
qParam.billCode=null;
listEmisTmsScanRecord(qExportParam).then(response => {
if (response.code === 200) {
this.exportData(response.rows,loadingInstance);
}
});
}
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)
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);
}
}
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()
})
}
});
},
exportData(selData,loadingInstance){
const curList =selData
import('@/vendor/Export2Excel').then(excel => {
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({
header: tHeader,
data,
filename: '扫描记录导出',
autoWidth: true
})
loadingInstance.close()
})
},
formatJson(filterVal, jsonData, resData) {
let index = 0
return jsonData.map(v => filterVal.map(j => {
if (j === 'index') {
return ++index
}
if (j === 'status') {
var statusStr='xxx'
if(v[j] == 10){
statusStr='xxx'
if (j === 'kjlx') {
return v['sendSiteName']+'--'+v['dispatchUnderlingSiteName'];
}
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]
}))
},
/** 列索引函数 */
getIndex($index) {
return (this.queryParams.pageNum - 1) * this.queryParams.pageSize + $index + 1