From f947462ac9918e8a86654f8f22cff0ac72ece6fd Mon Sep 17 00:00:00 2001 From: Rui_Li <877258667@qq.com> Date: Wed, 20 Apr 2022 09:12:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9A=E5=88=B6=E6=8A=A5=E8=A1=A8=E5=BC=80?= =?UTF-8?q?=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...com_edit_customer_report_search_column.vue | 2 +- .../report/com_run_customer_report.vue | 45 ++++++++++++++++++- 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/src/views/modules/report/com_edit_customer_report_search_column.vue b/src/views/modules/report/com_edit_customer_report_search_column.vue index d11ec97..0c2d29e 100644 --- a/src/views/modules/report/com_edit_customer_report_search_column.vue +++ b/src/views/modules/report/com_edit_customer_report_search_column.vue @@ -347,7 +347,7 @@ export default { margin-top: -10px; } /*fieldset下table的样式*/ -.customer-fieldset /deep/ .el-table__header th.is-leaf{ +.customer-css .el-table__header /deep/ th.is-leaf{ line-height: 16px; } diff --git a/src/views/modules/report/com_run_customer_report.vue b/src/views/modules/report/com_run_customer_report.vue index 6833d02..aabcb6d 100644 --- a/src/views/modules/report/com_run_customer_report.vue +++ b/src/views/modules/report/com_run_customer_report.vue @@ -38,6 +38,18 @@ 刷新 关闭 + + 导出 + @@ -59,6 +71,13 @@ export default { customerReportList: [], customerColumnlArray: [], searchColumnData: [], + customerReport: [], + // 导出 start + exportData: [], + exportName: "定制报表导出", + exportFooter: [], + exportDefaultValue: "这一行这一列没有数据", + // 导出 end dataListLoading: false, } }, @@ -89,12 +108,36 @@ export default { if(data.code === 200){ this.customerReportList = data.resultMap.resultRows; this.customerColumnlArray = data.resultMap.columnRows; + this.customerReport = data.resultMap.customerReport; }else{ this.$message.error(data.msg); } }); }, + // 导出excel的方法 + fields() { + //实时修改导出文件的名称 + this.exportName = this.customerReport.reportName +"-"+ this.dayjs().format('YYYYMMDDHHmmss'); + //导出方法 + let json = "{" + this.customerColumnlArray.forEach((item, index) => { + if (index == this.customerColumnlArray.length - 1) { + json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + } else { + json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + "," + } + }) + json += "}" + let s = eval("(" + json + ")") + return s + }, + createExportData() { + // 点击导出按钮之后,开始导出数据之前的执行函数,返回值为需要下载的数据 + return this.customerReportList; + }, + + }, created() { // @@ -114,7 +157,7 @@ export default { margin-top: -10px; } /*fieldset下table的样式*/ -.customer-fieldset /deep/ .el-table__header th.is-leaf{ +.customer-css /deep/ .el-table__header th.is-leaf{ line-height: 16px; }