diff --git a/src/views/emis/emisSmsSendRecord/index.vue b/src/views/emis/emisSmsSendRecord/index.vue index 39debfb1..937c95f2 100644 --- a/src/views/emis/emisSmsSendRecord/index.vue +++ b/src/views/emis/emisSmsSendRecord/index.vue @@ -29,18 +29,26 @@ - + + + + + + + + - { this.emisSmsSendRecordList = response.rows; this.total = response.total; @@ -278,6 +282,7 @@ export default { }, // 多选框选中数据 handleSelectionChange(selection) { + this.selectionList=selection; this.ids = selection.map(item => item.id) this.single = selection.length!==1 this.multiple = !selection.length @@ -327,35 +332,41 @@ export default { }).catch(() => {}); }, /** 导出按钮操作 */ - handleExport() { - // this.download('emis/emisSmsSendRecord/export', { - // ...this.queryParams - // }, `emisSmsSendRecord_${new Date().getTime()}.xlsx`) - const loadingInstance = this.$loading({ + handleExport() { + const loadingInstance = this.$loading({ text: '正在导出...' - }) - var qParam = {...this.queryParams}; - qParam.pageNum=1; - qParam.pageSize=5000; + }) - listEmisSmsSendRecord(this.addDateRange(qParam, this.dateTimeRange)).then(response => { - this.downloadLoading = false - if (response.code === 200) { - const curList = response.rows - import('@/vendor/Export2Excel').then(excel => { - const tHeader = ['id','运单号','发送站点编码','站点名称','发件人名称','发送人编码','短信类型','目标号码','短信内容','单条发送费用','发送渠道','发送时间','渠道发送状态','渠道错误代码','渠道错误信息','任务处理时间','备注','租户ID','删除标志(0代表存在','创建者','创建时间','更新者','更新时间','创建网点','更新网点',]; - const filterVal = ['id','billCode','sendSiteCode','sendSiteName','sendManName','sendManCode','smsType','phone','content','fee','smsChannel','sendDate','sendStatus','errCode','errMsg','taskDate','remark','tenantId','delFlag','createBy','createTime','updateBy','updateTime','createSite','updateSite',]; - const data = this.formatJson(filterVal, curList, response.rows) - excel.export_json_to_excel({ - header: tHeader, - data, - filename: '短信发送记录表', - autoWidth: true - }) - loadingInstance.close() - }) - } - }); + if(this.selectionList&&this.selectionList.length>0){ + this.exportData(this.selectionList,loadingInstance); + } + else{ + let qExportParam=this.addDateRange(this.queryParams, this.dateTimeRange,"createTime"); + qExportParam.pageNum=1; + qExportParam.pageSize=50000; + + listEmisSmsSendRecord(qExportParam).then(response => { + if (response.code === 200) { + this.exportData(response.rows,loadingInstance); + } + }); + } + }, + exportData(selData,loadingInstance){ + const curList =selData + import('@/vendor/Export2Excel').then(excel => { + const exportParam=this.$refs.refTable.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 @@ -363,16 +374,33 @@ export default { if (j === 'index') { return ++index } - if (j === 'status') { - var statusStr='xxx' - if(v[j] == 10){ - statusStr='xxx' + if (j === 'smsType') { + if(v['smsType'] == 1){ + return '寄件'; + } + else if(v['smsType'] == 2){ + return '签收'; + } + else if(v['smsType'] == 3){ + return '问题件'; + } + } + if (j === 'sendStatus') { + if(v['sendStatus'] == 1){ + return '已发送'; + } + else if(v['sendStatus'] == 0){ + return '未发送'; + } + else if(v['sendStatus'] == -1){ + return '发送异常'; } - return statusStr; } return v[j] })) }, + + /** 列索引函数 */ getIndex($index) { return (this.queryParams.pageNum - 1) * this.queryParams.pageSize + $index + 1