|
@@ -73,7 +73,7 @@
|
|
|
</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="companyName" v-if="activeTab === 'all' || activeTab === 'company'" />
|
|
<el-table-column label="公司" align="center" prop="companyName" v-if="activeTab === 'all' || activeTab === 'company'" />
|
|
@@ -177,6 +177,31 @@ export default {
|
|
|
this.getList();
|
|
this.getList();
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
+ getSummaries(param) {
|
|
|
|
|
+ const { columns, data } = param;
|
|
|
|
|
+ const sums = [];
|
|
|
|
|
+ columns.forEach((column, index) => {
|
|
|
|
|
+ if (index === 0) {
|
|
|
|
|
+ sums[index] = '合计';
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ // 根据列的位置判断,假设流量列是最后一个列(第5列,索引为4)
|
|
|
|
|
+ // 或者根据列的数量判断,这里假设流量列始终是倒数第一列
|
|
|
|
|
+ if (index === columns.length - 1) {
|
|
|
|
|
+ if (data && data.length > 0) {
|
|
|
|
|
+ const values = data.map(item => Number(item.totalInternetTraffic) || 0);
|
|
|
|
|
+ const total = values.reduce((prev, curr) => prev + curr, 0);
|
|
|
|
|
+ sums[index] = this.formatTrafficData(total);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ sums[index] = '0.0000 GB';
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ sums[index] = '';
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ return sums;
|
|
|
|
|
+ },
|
|
|
handleTabClick(tab) {
|
|
handleTabClick(tab) {
|
|
|
this.queryParams.tabType = tab.name;
|
|
this.queryParams.tabType = tab.name;
|
|
|
this.queryParams.pageNum = 1;
|
|
this.queryParams.pageNum = 1;
|
|
@@ -205,6 +230,7 @@ export default {
|
|
|
this.loading = true;
|
|
this.loading = true;
|
|
|
listCourseTrafficLog(this.queryParams).then(res => {
|
|
listCourseTrafficLog(this.queryParams).then(res => {
|
|
|
this.courseTrafficLogList = res.rows;
|
|
this.courseTrafficLogList = res.rows;
|
|
|
|
|
+ console.log('列表',this.courseTrafficLogList)
|
|
|
this.total = res.total;
|
|
this.total = res.total;
|
|
|
}).finally(() => {
|
|
}).finally(() => {
|
|
|
this.loading = false;
|
|
this.loading = false;
|