|
@@ -3,7 +3,7 @@
|
|
|
:close-on-click-modal="false">
|
|
|
<div class="globalDiaMain" :class="!theme ? 'themeDa' : 'themeLi'">
|
|
|
<div class="main_top">
|
|
|
- <div class="main_top_left">
|
|
|
+ <div class="main_top_left" >
|
|
|
<div class="exceed">
|
|
|
<span style="margin-top: 3px">时间:</span>
|
|
|
<el-date-picker v-model="pickerTime" @change="changeTime" type="datetimerange"
|
|
@@ -32,7 +32,7 @@
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<div class="main_table warn-table" style="margin-top: 20px">
|
|
|
- <el-table :data="tableData" ref="report-table" border max-height="45vh" style="width: 100%"
|
|
|
+ <el-table :data="tableData" ref="report-table" border show-summary :summary-method="getSummaries" max-height="45vh" style="width: 100%"
|
|
|
:header-cell-style="{
|
|
|
padding: '4px',
|
|
|
fontSize: '16px',
|
|
@@ -144,6 +144,44 @@
|
|
|
this.getChartsData();
|
|
|
this.getTableData();
|
|
|
},
|
|
|
+ getSummaries(datas) {
|
|
|
+ const {columns, data} = datas
|
|
|
+ const sums = [];
|
|
|
+ columns.forEach((column, index) => {
|
|
|
+ if (index === 0) {
|
|
|
+ sums[index] = '合计';
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const values = data.map(item => Number(item[column.property]));
|
|
|
+ if (!values.every(value => isNaN(value))) {
|
|
|
+ if (index === 1 || index === 2) {
|
|
|
+ sums[index] = values.reduce((prev, curr) => {
|
|
|
+ const value = Number(curr);
|
|
|
+ if (!isNaN(value)) {
|
|
|
+ return prev + curr;
|
|
|
+ } else {
|
|
|
+ return prev;
|
|
|
+ }
|
|
|
+ }, 0) / values.length;
|
|
|
+ sums[index] = sums[index].toFixed(2) + ' (平均值)';
|
|
|
+ } else {
|
|
|
+ sums[index] = values.reduce((prev, curr) => {
|
|
|
+ const value = Number(curr);
|
|
|
+ if (!isNaN(value)) {
|
|
|
+ return prev + curr;
|
|
|
+ } else {
|
|
|
+ return prev;
|
|
|
+ }
|
|
|
+ }, 0);
|
|
|
+ sums[index] = sums[index].toFixed(2)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ sums[index] = '-';
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ return sums;
|
|
|
+ },
|
|
|
changeTime(val) {
|
|
|
if (val) {
|
|
|
let timeC = new Date(val[1]).getTime() - new Date(val[0]).getTime();
|
|
@@ -486,23 +524,145 @@
|
|
|
</script>
|
|
|
|
|
|
<style lang="less">
|
|
|
- .themeDa {
|
|
|
- .main_top {
|
|
|
- .main_top_left {
|
|
|
- .exceed {
|
|
|
- color: #fff;
|
|
|
+.el-overlay {
|
|
|
+ .el-overlay-dialog {
|
|
|
+ .windLifeDialog {
|
|
|
+ .el-dialog__header {
|
|
|
+ .el-dialog__title {
|
|
|
+ color: #fff !important;
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- .themeLi {
|
|
|
- .main_top {
|
|
|
- .main_top_left {
|
|
|
- .exceed {
|
|
|
- color: #000;
|
|
|
+ .el-dialog__body {
|
|
|
+ padding: 10px 20px;
|
|
|
+
|
|
|
+ .globalDiaMain {
|
|
|
+ .main_top {
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+
|
|
|
+ .main_top_left {
|
|
|
+ display: flex;
|
|
|
+
|
|
|
+ .exceed {
|
|
|
+ span {
|
|
|
+ font-size: 14px;
|
|
|
+ margin-left: 10px;
|
|
|
+ }
|
|
|
+
|
|
|
+ display: flex;
|
|
|
+ margin-right: 20px;
|
|
|
+
|
|
|
+ .el-select,
|
|
|
+ .el-select__wrapper {
|
|
|
+ height: 32px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .el-date-editor {
|
|
|
+ height: 32px;
|
|
|
+
|
|
|
+ .el-input__icon,
|
|
|
+ .el-range-separator {
|
|
|
+ line-height: 30px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .select-trigger {
|
|
|
+ .el-input {
|
|
|
+ .el-input__wrapper {
|
|
|
+ height: 30px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .el-input__suffix {
|
|
|
+ .el-input__icon {
|
|
|
+ line-height: 30px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .el-button {
|
|
|
+ height: 30px;
|
|
|
+ padding: 0 20px;
|
|
|
+ line-height: 5px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .main_charts {
|
|
|
+ margin-top: 20px;
|
|
|
+
|
|
|
+ .chartsStyle {
|
|
|
+ height: 300px;
|
|
|
+ width: 100%;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .main_table {
|
|
|
+ margin: 20px 0;
|
|
|
+
|
|
|
+ .el-table {
|
|
|
+ .el-table__body-wrapper {
|
|
|
+ height: 335px !important;
|
|
|
+ overflow-y: auto;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .themeDa {
|
|
|
+ .main_top {
|
|
|
+ .main_top_left {
|
|
|
+
|
|
|
+ .exceed {
|
|
|
+ .exceedName {
|
|
|
+ color: #fff;
|
|
|
+ margin: 3px 0 0 5px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .themeLi {
|
|
|
+ .main_top {
|
|
|
+ .main_top_left {
|
|
|
+
|
|
|
+ .exceed {
|
|
|
+ .exceedName {
|
|
|
+ color: #000;
|
|
|
+ margin: 3px 0 0 5px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ // .themeDa {
|
|
|
+ // .main_top {
|
|
|
+ // .main_top_left {
|
|
|
+ // display: flex;
|
|
|
+ // margin-bottom: 10px;
|
|
|
+ // .exceed {
|
|
|
+ // color: #fff;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+
|
|
|
+ // .themeLi {
|
|
|
+ // .main_top {
|
|
|
+ // .main_top_left {
|
|
|
+ // display: flex;
|
|
|
+ // margin-bottom: 10px;
|
|
|
+ // .exceed {
|
|
|
+ // color: #000;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
</style>
|