Browse Source

定制报表开发

master
Rui_Li 4 years ago
parent
commit
f947462ac9
  1. 2
      src/views/modules/report/com_edit_customer_report_search_column.vue
  2. 45
      src/views/modules/report/com_run_customer_report.vue

2
src/views/modules/report/com_edit_customer_report_search_column.vue

@ -347,7 +347,7 @@ export default {
margin-top: -10px; margin-top: -10px;
} }
/*fieldset下table的样式*/ /*fieldset下table的样式*/
.customer-fieldset /deep/ .el-table__header th.is-leaf{
.customer-css .el-table__header /deep/ th.is-leaf{
line-height: 16px; line-height: 16px;
} }

45
src/views/modules/report/com_run_customer_report.vue

@ -38,6 +38,18 @@
<span slot="footer" class="dialog-footer" style="margin-top: 0px;"> <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="runCustomerReportData">刷新</el-button>
<el-button type="primary" class="customer-bun-min" @click="closeDialog">关闭</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> </span>
</el-dialog> </el-dialog>
</div> </div>
@ -59,6 +71,13 @@ export default {
customerReportList: [], customerReportList: [],
customerColumnlArray: [], customerColumnlArray: [],
searchColumnData: [], searchColumnData: [],
customerReport: [],
// start
exportData: [],
exportName: "定制报表导出",
exportFooter: [],
exportDefaultValue: "这一行这一列没有数据",
// end
dataListLoading: false, dataListLoading: false,
} }
}, },
@ -89,12 +108,36 @@ export default {
if(data.code === 200){ if(data.code === 200){
this.customerReportList = data.resultMap.resultRows; this.customerReportList = data.resultMap.resultRows;
this.customerColumnlArray = data.resultMap.columnRows; this.customerColumnlArray = data.resultMap.columnRows;
this.customerReport = data.resultMap.customerReport;
}else{ }else{
this.$message.error(data.msg); 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() { created() {
// //
@ -114,7 +157,7 @@ export default {
margin-top: -10px; margin-top: -10px;
} }
/*fieldset下table的样式*/ /*fieldset下table的样式*/
.customer-fieldset /deep/ .el-table__header th.is-leaf{
.customer-css /deep/ .el-table__header th.is-leaf{
line-height: 16px; line-height: 16px;
} }

Loading…
Cancel
Save