|
|
|
@ -38,6 +38,18 @@ |
|
|
|
<span slot="footer" class="dialog-footer" style="margin-top: 0px;"> |
|
|
|
<el-button type="primary" class="customer-bun-min" @click="runCustomerReportData">刷新</el-button> |
|
|
|
<el-button type="primary" class="customer-bun-min" @click="closeDialog">关闭</el-button> |
|
|
|
<download-excel style="width: 50px; padding: 5px; margin-bottom: 10px;" |
|
|
|
:fields="fields()" |
|
|
|
:data="exportData" |
|
|
|
type="xls" |
|
|
|
:name="exportName" |
|
|
|
:footer="exportFooter" |
|
|
|
:defaultValue="exportDefaultValue" |
|
|
|
:fetch="createExportData" |
|
|
|
worksheet="导出信息" |
|
|
|
class="el-button el-button--primary el-button--medium"> |
|
|
|
导出 |
|
|
|
</download-excel> |
|
|
|
</span> |
|
|
|
</el-dialog> |
|
|
|
</div> |
|
|
|
@ -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; |
|
|
|
} |
|
|
|
|
|
|
|
|