学习进度统计
This commit is contained in:
@@ -6,12 +6,12 @@
|
||||
<div class="summary-content">
|
||||
<div class="summary-item">
|
||||
<div class="summary-label">总学习人数</div>
|
||||
<div class="summary-value">{{ taskInfo.totalTaskNum || 0 }}</div>
|
||||
<div class="summary-value">{{ totalPerson }}</div>
|
||||
</div>
|
||||
<div class="summary-divider"></div>
|
||||
<div class="summary-item">
|
||||
<div class="summary-label">已完成人数</div>
|
||||
<div class="summary-value completed">{{ taskInfo.completedTaskNum || 0 }}</div>
|
||||
<div class="summary-value completed">{{ completedPerson }}</div>
|
||||
</div>
|
||||
<div class="summary-divider"></div>
|
||||
<div class="summary-item">
|
||||
@@ -138,6 +138,7 @@ import * as echarts from 'echarts';
|
||||
import type { ECharts } from 'echarts';
|
||||
import { learningTaskApi } from '@/apis/study/learning-task';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { TaskVO } from '@/types';
|
||||
|
||||
// Props
|
||||
const props = defineProps<{
|
||||
@@ -146,7 +147,7 @@ const props = defineProps<{
|
||||
|
||||
// 响应式数据
|
||||
const loading = ref(false);
|
||||
const taskInfo = ref<any>({});
|
||||
const taskInfo = ref<TaskVO>();
|
||||
const durationDistribution = ref<any[]>([]);
|
||||
const progressDistribution = ref<any[]>([]);
|
||||
const completionRanking = ref<any[]>([]);
|
||||
@@ -158,12 +159,12 @@ const progressChartRef = ref<HTMLElement>();
|
||||
let durationChart: ECharts | null = null;
|
||||
let progressChart: ECharts | null = null;
|
||||
|
||||
const totalPerson = computed(() => taskInfo.value?.taskUsers?.length || 0);
|
||||
const completedPerson = computed(() => taskInfo.value?.taskUsers?.filter((user: any) => user.status === 2).length || 0);
|
||||
// 计算完成率
|
||||
const completionRate = computed(() => {
|
||||
const total = taskInfo.value.totalTaskNum || 0;
|
||||
const completed = taskInfo.value.completedTaskNum || 0;
|
||||
if (total === 0) return 0;
|
||||
return ((completed / total) * 100).toFixed(1);
|
||||
if (totalPerson.value === 0) return 0;
|
||||
return ((completedPerson.value / totalPerson.value) * 100).toFixed(1);
|
||||
});
|
||||
|
||||
// 获取排名样式类
|
||||
|
||||
Reference in New Issue
Block a user