|
@@ -238,7 +238,7 @@
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
import { ref, computed, onMounted, onUnmounted, getCurrentInstance, toRefs } from 'vue';
|
|
import { ref, computed, onMounted, onUnmounted, getCurrentInstance, toRefs } from 'vue';
|
|
|
import { getProjectScoreData, getRankingBoardData, updateBonusData, exportBonusExcel } from '@/api/system/gameScore';
|
|
import { getProjectScoreData, getRankingBoardData, updateBonusData, exportBonusExcel } from '@/api/system/gameScore';
|
|
|
-import { listGameEventProject } from '@/api/system/gameEventProject';
|
|
|
|
|
|
|
+import { listGameEventProject, getProjectOptionList } from '@/api/system/gameEventProject';
|
|
|
import { getProjectProgress } from '@/api/system/gameEvent/projectProgress';
|
|
import { getProjectProgress } from '@/api/system/gameEvent/projectProgress';
|
|
|
import { ProjectProgressVo, GroupProgressVo } from '@/api/system/gameEvent/types';
|
|
import { ProjectProgressVo, GroupProgressVo } from '@/api/system/gameEvent/types';
|
|
|
import { useGameEventStore } from '@/store/modules/gameEvent';
|
|
import { useGameEventStore } from '@/store/modules/gameEvent';
|
|
@@ -443,14 +443,10 @@ const loadRankGroupOptions = async () => {
|
|
|
// 获取项目选项(个人和团队)
|
|
// 获取项目选项(个人和团队)
|
|
|
const loadProjectOptions = async () => {
|
|
const loadProjectOptions = async () => {
|
|
|
try {
|
|
try {
|
|
|
- const res = await listGameEventProject({
|
|
|
|
|
- eventId: defaultEventInfo.value.eventId,
|
|
|
|
|
- orderByColumn: 'createTime',
|
|
|
|
|
- isAsc: 'desc',
|
|
|
|
|
- pageNum: 1,
|
|
|
|
|
- pageSize: 1000
|
|
|
|
|
|
|
+ const res = await getProjectOptionList({
|
|
|
|
|
+ eventId: defaultEventInfo.value.eventId
|
|
|
});
|
|
});
|
|
|
- const allProjects = res.rows || [];
|
|
|
|
|
|
|
+ const allProjects = res.data || [];
|
|
|
|
|
|
|
|
// 个人项目过滤
|
|
// 个人项目过滤
|
|
|
personalProjectOptions.value = allProjects.filter(p => p.classification === '0');
|
|
personalProjectOptions.value = allProjects.filter(p => p.classification === '0');
|
|
@@ -480,65 +476,6 @@ const handleTeamProjectChange = (projectId: string | number) => {
|
|
|
refreshTeamRanking();
|
|
refreshTeamRanking();
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-// 加载项目进度信息
|
|
|
|
|
-const loadProjectProgress = async () => {
|
|
|
|
|
- try {
|
|
|
|
|
- const res = await getProjectProgress(defaultEventInfo.value.eventId);
|
|
|
|
|
- projectProgress.value = res.data || [];
|
|
|
|
|
-
|
|
|
|
|
- // 计算已完成和总任务数
|
|
|
|
|
- let completed = 0;
|
|
|
|
|
- let total = 0;
|
|
|
|
|
-
|
|
|
|
|
- projectProgress.value.forEach(project => {
|
|
|
|
|
- if (project.groups && project.groups.length > 0) {
|
|
|
|
|
- // 有组别的项目,统计组别
|
|
|
|
|
- project.groups.forEach(group => {
|
|
|
|
|
- total++;
|
|
|
|
|
- if (group.status === '2') { // 已完成
|
|
|
|
|
- completed++;
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- } else {
|
|
|
|
|
- // 没有组别的项目,直接统计项目
|
|
|
|
|
- total++;
|
|
|
|
|
- if (project.status === '2') { // 已完成
|
|
|
|
|
- completed++;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- completedTasks.value = completed;
|
|
|
|
|
- totalTasks.value = total;
|
|
|
|
|
-
|
|
|
|
|
- // 前端也可以做一次排序确保,虽然后端已经排序了
|
|
|
|
|
- // 按完整时间排序(项目时间或最早组别时间)
|
|
|
|
|
- projectProgress.value.sort((a, b) => {
|
|
|
|
|
- const getEarliestTime = (project: ProjectProgressVo) => {
|
|
|
|
|
- if (project.groups && project.groups.length > 0) {
|
|
|
|
|
- // 有组别,找到最早的组别时间
|
|
|
|
|
- const groupTimes = project.groups
|
|
|
|
|
- .map(g => g.beginTime ? new Date(g.beginTime).getTime() : 0)
|
|
|
|
|
- .filter(time => time > 0);
|
|
|
|
|
- if (groupTimes.length > 0) {
|
|
|
|
|
- return Math.min(...groupTimes);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- // 没有组别或组别时间无效,使用项目时间
|
|
|
|
|
- return project.startTime ? new Date(project.startTime).getTime() : 0;
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
- const aTime = getEarliestTime(a);
|
|
|
|
|
- const bTime = getEarliestTime(b);
|
|
|
|
|
-
|
|
|
|
|
- return aTime - bTime;
|
|
|
|
|
- });
|
|
|
|
|
- } catch (error) {
|
|
|
|
|
- console.error('加载项目进度失败:', error);
|
|
|
|
|
- }
|
|
|
|
|
-};
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
// 获取排名显示文本
|
|
// 获取排名显示文本
|
|
|
const getRankDisplay = (item: any, index: number, list: any[]) => {
|
|
const getRankDisplay = (item: any, index: number, list: any[]) => {
|
|
|
if (item.rank === '-' || item.rank === undefined || item.rank === null || item.rank === 0 || item.rank === '0') {
|
|
if (item.rank === '-' || item.rank === undefined || item.rank === null || item.rank === 0 || item.rank === '0') {
|