|
@@ -189,18 +189,14 @@
|
|
|
<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 { listScoreRanking, listPersonalRanking, listTeamRanking } from '@/api/system/gameEvent/eventRank';
|
|
import { listScoreRanking, listPersonalRanking, listTeamRanking } from '@/api/system/gameEvent/eventRank';
|
|
|
-import { listGameScore } from '@/api/system/gameScore';
|
|
|
|
|
-import { listGameTeam } from '@/api/system/gameTeam';
|
|
|
|
|
|
|
+import { listGameScore, getBonusData } from '@/api/system/gameScore';
|
|
|
import { getProjectProgress } from '@/api/system/gameEvent/projectProgress';
|
|
import { getProjectProgress } from '@/api/system/gameEvent/projectProgress';
|
|
|
-import { useRouter,useRoute } from 'vue-router';
|
|
|
|
|
-import { GameTeamVO } from '@/api/system/gameTeam/types';
|
|
|
|
|
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';
|
|
|
import { storeToRefs } from 'pinia';
|
|
import { storeToRefs } from 'pinia';
|
|
|
import { listRankGroup } from '@/api/system/rankGroup';
|
|
import { listRankGroup } from '@/api/system/rankGroup';
|
|
|
import { RankGroupVO } from '@/api/system/rankGroup/types';
|
|
import { RankGroupVO } from '@/api/system/rankGroup/types';
|
|
|
import { Refresh } from '@element-plus/icons-vue';
|
|
import { Refresh } from '@element-plus/icons-vue';
|
|
|
-import { Timer, Close } from '@element-plus/icons-vue';
|
|
|
|
|
|
|
|
|
|
// 定义队伍积分排行榜的数据结构
|
|
// 定义队伍积分排行榜的数据结构
|
|
|
interface TeamScore {
|
|
interface TeamScore {
|
|
@@ -297,30 +293,9 @@ const handleTeamCountChange = (value: number) => {
|
|
|
|
|
|
|
|
// 获取队伍积分排行榜
|
|
// 获取队伍积分排行榜
|
|
|
const loadTeamScores = async () => {
|
|
const loadTeamScores = async () => {
|
|
|
- // 获取所有成绩数据
|
|
|
|
|
- const scoreRes = await listGameScore({
|
|
|
|
|
|
|
+ const teamScoreRes = await getBonusData({
|
|
|
eventId: defaultEventInfo.value.eventId,
|
|
eventId: defaultEventInfo.value.eventId,
|
|
|
- pageNum: 1,
|
|
|
|
|
- pageSize: 1000,
|
|
|
|
|
- orderByColumn: '',
|
|
|
|
|
- isAsc: ''
|
|
|
|
|
});
|
|
});
|
|
|
- const scores = scoreRes.rows;
|
|
|
|
|
-
|
|
|
|
|
- // 获取所有队伍信息
|
|
|
|
|
- const teamRes = await listGameTeam({
|
|
|
|
|
- eventId: defaultEventInfo.value.eventId,
|
|
|
|
|
- pageNum: 1,
|
|
|
|
|
- pageSize: 1000,
|
|
|
|
|
- orderByColumn: '',
|
|
|
|
|
- isAsc: ''
|
|
|
|
|
- });
|
|
|
|
|
- const teams = teamRes.rows;
|
|
|
|
|
-
|
|
|
|
|
- // 获取分组信息(如果还没有加载的话)
|
|
|
|
|
- if (rankGroupOptions.value.length === 0) {
|
|
|
|
|
- await loadRankGroupOptions();
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
// 创建分组ID到分组名称的映射
|
|
// 创建分组ID到分组名称的映射
|
|
|
const groupMap = new Map();
|
|
const groupMap = new Map();
|
|
@@ -328,59 +303,25 @@ const loadTeamScores = async () => {
|
|
|
groupMap.set(group.rgId, group.rgName);
|
|
groupMap.set(group.rgId, group.rgName);
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- // 计算每个队伍的总积分
|
|
|
|
|
- const teamScoreMap = new Map();
|
|
|
|
|
- scores.forEach(score => {
|
|
|
|
|
- const teamId = score.teamId;
|
|
|
|
|
- if (teamId) {
|
|
|
|
|
- if (teamScoreMap.has(teamId)) {
|
|
|
|
|
- teamScoreMap.set(teamId, teamScoreMap.get(teamId) + score.scorePoint);
|
|
|
|
|
- } else {
|
|
|
|
|
- teamScoreMap.set(teamId, score.scorePoint);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- // 将队伍信息和积分结合
|
|
|
|
|
- const teamScoreList = teams.map(team => {
|
|
|
|
|
|
|
+ // // 将队伍信息和积分结合
|
|
|
|
|
+ const teamScoreList = teamScoreRes.data.rows.map(teamScore => {
|
|
|
return {
|
|
return {
|
|
|
- teamId: team.teamId,
|
|
|
|
|
- teamName: team.teamName,
|
|
|
|
|
- score: teamScoreMap.get(team.teamId) || 0,
|
|
|
|
|
- rank: 0, // 占位符,稍后设置
|
|
|
|
|
- rgId: team.rgId, // 添加分组ID
|
|
|
|
|
- rgName: groupMap.get(team.rgId) || '-' // 添加分组名称
|
|
|
|
|
- };
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- // 按积分从高到低排序
|
|
|
|
|
- teamScoreList.sort((a, b) => b.score - a.score);
|
|
|
|
|
-
|
|
|
|
|
- // 添加排名(支持并列排名)
|
|
|
|
|
- let currentRank = 1;
|
|
|
|
|
- for (let i = 0; i < teamScoreList.length; i++) {
|
|
|
|
|
- const team = teamScoreList[i];
|
|
|
|
|
- const currentScore = team.score || 0;
|
|
|
|
|
-
|
|
|
|
|
- // 如果不是第一个,检查是否与前一个积分相同
|
|
|
|
|
- if (i > 0) {
|
|
|
|
|
- const previousScore = teamScoreList[i - 1].score || 0;
|
|
|
|
|
- if (currentScore !== previousScore) {
|
|
|
|
|
- currentRank = i + 1;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ teamId: teamScore.teamId,
|
|
|
|
|
+ teamName: teamScore.teamName,
|
|
|
|
|
+ score: teamScore.totalScore,
|
|
|
|
|
+ rank: teamScore.rank,
|
|
|
|
|
+ rgId: teamScore.rgId,
|
|
|
|
|
+ rgName: groupMap.get(teamScore.rgId) || '-' // 添加分组名称
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- team.rank = currentRank;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- teamScores.value = teamScoreList;
|
|
|
|
|
- // 默认显示所有队伍
|
|
|
|
|
|
|
+ })
|
|
|
|
|
+ // // 默认显示所有队伍
|
|
|
filteredTeamScores.value = teamScoreList;
|
|
filteredTeamScores.value = teamScoreList;
|
|
|
|
|
+ teamScores.value = teamScoreList;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
// 处理分组筛选变化
|
|
// 处理分组筛选变化
|
|
|
-const handleRankGroupChange = (rgId: string | number | null) => {
|
|
|
|
|
- if (rgId === null || rgId === ALL_GROUPS_VALUE) {
|
|
|
|
|
|
|
+const handleRankGroupChange = (rgId: string | number | null | undefined) => {
|
|
|
|
|
+ if (rgId === null || rgId === undefined || rgId === '' || rgId === ALL_GROUPS_VALUE) {
|
|
|
// 显示所有队伍
|
|
// 显示所有队伍
|
|
|
filteredTeamScores.value = teamScores.value;
|
|
filteredTeamScores.value = teamScores.value;
|
|
|
} else {
|
|
} else {
|