From db905ecd14f63dba9337b4f4715584ef2d7e8c7e Mon Sep 17 00:00:00 2001
From: 马宇豪 <978517621@qq.com>
Date: Fri, 07 Mar 2025 14:45:00 +0800
Subject: [PATCH] 修改
---
src/views/onlineEducation/count/index.vue | 42 +++++++++++++++++++++++++++++++++++++-----
1 files changed, 37 insertions(+), 5 deletions(-)
diff --git a/src/views/onlineEducation/count/index.vue b/src/views/onlineEducation/count/index.vue
index 9a1d718..ba55738 100644
--- a/src/views/onlineEducation/count/index.vue
+++ b/src/views/onlineEducation/count/index.vue
@@ -51,11 +51,13 @@
@click="resetQuery()"
>重置</el-button>
</div>
- <el-table v-loading="loading" :data="expertList">
+ <el-table v-loading="loading" :data="expertList" show-summary :summary-method="getSummaries">
<el-table-column label="平台" align="center" prop="institutionName" />
<el-table-column label="培训总人数" align="center" prop="studentCount" />
<el-table-column label="培训学时达标人数" align="center" prop="finishCount" />
- <el-table-column label="考试合格人数" align="center" prop="passCount" />
+ <el-table-column label="学时合格率" align="center" prop="classHourRate" />
+ <el-table-column label="自测考试总人数" align="center" prop="eaxmStudentCount" />
+ <el-table-column label="自测考试合格人数" align="center" prop="passCount" />
<el-table-column label="考试合格率" align="center" prop="passRate">
<template #default="scope">
<span>{{scope.row.passRate}}%</span>
@@ -134,7 +136,12 @@
this.loading = true;
getCount(this.queryParams).then(res => {
if (res.code == 200) {
- this.expertList = res.data
+ this.expertList = res.data.map(item => {
+ return {
+ ...item,
+ classHourRate: item.finishCount != 0 && item.studentCount != 0 ? (item.finishCount / item.studentCount).toFixed(2) *100 + '%': '0%'
+ }
+ })
this.loading = false;
}
})
@@ -188,8 +195,33 @@
this.time = []
this.getList()
},
- handleAdd(){
-
+ getSummaries(param) {
+ const { columns, data } = param
+ const sums = [];
+ columns.forEach((column, index) => {
+ if (index === 0) {
+ sums[index] = '总计';
+ return
+ }
+ if (index === columns.length - 1) {
+ sums[index] = '--';
+ return
+ }
+ const values = data.map(item => Number(item[column.property]))
+ if (!values.every(value => isNaN(value))) {
+ sums[index] = values.reduce((prev, curr) => {
+ const value = Number(curr);
+ if (!isNaN(value)) {
+ return prev + curr;
+ } else {
+ return prev;
+ }
+ }, 0)
+ } else {
+ sums[index] = '--';
+ }
+ })
+ return sums;
}
}
};
--
Gitblit v1.9.2