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; }