|
@@ -57,11 +57,11 @@
|
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
</el-row>
|
|
</el-row>
|
|
|
|
|
|
|
|
- <el-table border v-loading="loading" :data="courseTrafficLogList" @selection-change="handleSelectionChange">
|
|
|
|
|
|
|
+ <el-table border v-loading="loading" :data="courseTrafficLogList" @selection-change="handleSelectionChange" show-summary :summary-method="getSummaries">
|
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
|
<el-table-column label="项目" align="center" prop="projectName" />
|
|
<el-table-column label="项目" align="center" prop="projectName" />
|
|
|
<el-table-column label="日期" align="center" prop="month" />
|
|
<el-table-column label="日期" align="center" prop="month" />
|
|
|
- <el-table-column label="使用流量" align="center">
|
|
|
|
|
|
|
+ <el-table-column label="使用流量" align="center" prop="totalInternetTraffic">
|
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
|
<span>{{ formatTrafficData(scope.row.totalInternetTraffic) }}</span>
|
|
<span>{{ formatTrafficData(scope.row.totalInternetTraffic) }}</span>
|
|
|
</template>
|
|
</template>
|
|
@@ -161,6 +161,24 @@ export default {
|
|
|
|
|
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
+ getSummaries(param) {
|
|
|
|
|
+ const { columns, data } = param;
|
|
|
|
|
+ const sums = [];
|
|
|
|
|
+ columns.forEach((column, index) => {
|
|
|
|
|
+ if (index === 0) {
|
|
|
|
|
+ sums[index] = '合计';
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (column.property === 'totalInternetTraffic') {
|
|
|
|
|
+ const values = data.map(item => Number(item.totalInternetTraffic));
|
|
|
|
|
+ const total = values.reduce((acc, curr) => acc + curr, 0);
|
|
|
|
|
+ sums[index] = this.formatTrafficData(total);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ sums[index] = '';
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ return sums;
|
|
|
|
|
+ },
|
|
|
handleDateData(){
|
|
handleDateData(){
|
|
|
if (this.time) {
|
|
if (this.time) {
|
|
|
this.queryParams.startDate = this.time[0];
|
|
this.queryParams.startDate = this.time[0];
|