From d4484268d8dfb079da322fb533f343980cfeb94b Mon Sep 17 00:00:00 2001 From: liuyp Date: Wed, 19 Jun 2024 15:38:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=AB=E6=8F=8F=E8=AE=B0=E5=BD=95=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E9=A1=B5=E7=9A=84=E5=AF=BC=E5=87=BA=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../emisTmsScanRecord/scanRecordQuery.vue | 148 +++++++++--------- 1 file changed, 75 insertions(+), 73 deletions(-) diff --git a/src/views/emis/emisTmsScanRecord/scanRecordQuery.vue b/src/views/emis/emisTmsScanRecord/scanRecordQuery.vue index 7a70556d..05db6da7 100644 --- a/src/views/emis/emisTmsScanRecord/scanRecordQuery.vue +++ b/src/views/emis/emisTmsScanRecord/scanRecordQuery.vue @@ -93,17 +93,18 @@ + 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'" + >
@@ -138,7 +139,7 @@ type="primary" plain size="mini" - @click="getList" + @click="handleExport" >导出 @@ -154,7 +155,7 @@ - + @@ -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