|
|
@@ -317,87 +317,6 @@ const handleBonusSelectionChange = (selection: any[]) => {
|
|
|
selectedBonusRows.value = selection;
|
|
|
};
|
|
|
|
|
|
-// 保存加分修改
|
|
|
-// const saveBonusChanges = async () => {
|
|
|
-// try {
|
|
|
-// saveLoading.value = true;
|
|
|
-
|
|
|
-// const event = gameEventStore.defaultEventInfo;
|
|
|
-// const eventId = event?.eventId;
|
|
|
-
|
|
|
-// if (!eventId) {
|
|
|
-// proxy?.$modal.msgWarning('未指定赛事,无法保存');
|
|
|
-// return;
|
|
|
-// }
|
|
|
-
|
|
|
-// const updateData = bonusDataList.value.map(row => ({
|
|
|
-// teamId: row.teamId,
|
|
|
-// leaderPoint: Number(row.leaderPoint) || 0,
|
|
|
-// extraPoint: Number(row.extraPoint) || 0,
|
|
|
-// totalScore: row.totalScore,
|
|
|
-// rank: row.rank
|
|
|
-// }));
|
|
|
-
|
|
|
-// await updateBonusData({
|
|
|
-// eventId: eventId,
|
|
|
-// data: updateData
|
|
|
-// });
|
|
|
-
|
|
|
-// proxy?.$modal.msgSuccess("保存成功");
|
|
|
-
|
|
|
-// // 刷新主页面数据
|
|
|
-// // await refreshData();
|
|
|
-// } catch (error) {
|
|
|
-// console.error("保存失败:", error);
|
|
|
-// proxy?.$modal.msgError("保存失败,请稍后再试");
|
|
|
-// } finally {
|
|
|
-// saveLoading.value = false;
|
|
|
-// }
|
|
|
-// };
|
|
|
-
|
|
|
-// 导出加分数据方法
|
|
|
-// const exportBonusData = async () => {
|
|
|
-// try {
|
|
|
-// exportLoading.value = true;
|
|
|
-
|
|
|
-// const event = gameEventStore.defaultEventInfo;
|
|
|
-// const eventId = event?.eventId;
|
|
|
-
|
|
|
-// if (!eventId) {
|
|
|
-// proxy?.$modal.msgWarning('未指定默认赛事,无法导出');
|
|
|
-// return;
|
|
|
-// }
|
|
|
-
|
|
|
-// // 使用 proxy?.download 方法,传递JSON字符串参数
|
|
|
-// proxy?.download(
|
|
|
-// '/system/gameScore/exportBonusExcel',
|
|
|
-// {
|
|
|
-// eventId: eventId,
|
|
|
-// data: JSON.stringify(bonusDataList.value),
|
|
|
-// projects: JSON.stringify(bonusProjectList.value)
|
|
|
-// },
|
|
|
-// `总成绩排名表_${new Date().toLocaleDateString()}.xlsx`
|
|
|
-// );
|
|
|
-
|
|
|
-// proxy?.$modal.msgSuccess("导出成功");
|
|
|
-// } catch (error) {
|
|
|
-// console.error("导出失败:", error);
|
|
|
-// proxy?.$modal.msgError("导出失败,请稍后再试");
|
|
|
-// } finally {
|
|
|
-// exportLoading.value = false;
|
|
|
-// }
|
|
|
-// };
|
|
|
-
|
|
|
-// 刷新加分数据
|
|
|
-// const refreshBonusData = async () => {
|
|
|
-// const event = gameEventStore.defaultEventInfo;
|
|
|
-// const eventId = event?.eventId;
|
|
|
-
|
|
|
-// if (eventId) {
|
|
|
-// await loadBonusData(eventId);
|
|
|
-// }
|
|
|
-// };
|
|
|
-
|
|
|
/** 查询成绩列表 */
|
|
|
const getList = async () => {
|
|
|
loading.value = true;
|
|
|
@@ -911,15 +830,12 @@ const exportScoresNames = () => {
|
|
|
const loadProjects = async () => {
|
|
|
loading.value = true;
|
|
|
try {
|
|
|
- console.log('加载项目列表: ', queryParams.value);
|
|
|
+ // console.log('加载项目列表: ', queryParams.value);
|
|
|
const res = await listGameEventProject(queryParams.value);
|
|
|
projectList.value = res.rows;
|
|
|
total.value = res.total;
|
|
|
-
|
|
|
- // 为每个项目计算参赛人数
|
|
|
- await calculateParticipantCounts();
|
|
|
} catch (error) {
|
|
|
- console.error('加载项目列表失败:', error);
|
|
|
+ // console.error('加载项目列表失败:', error);
|
|
|
proxy?.$modal.msgError('加载项目列表失败');
|
|
|
} finally {
|
|
|
loading.value = false;
|
|
|
@@ -935,71 +851,6 @@ const handlePagination = (paginationData: { page: number, limit: number }) => {
|
|
|
loadProjects();
|
|
|
};
|
|
|
|
|
|
-/**
|
|
|
- * 计算每个项目的参赛人数
|
|
|
- */
|
|
|
-const calculateParticipantCounts = async () => {
|
|
|
- for (const project of projectList.value) {
|
|
|
- try {
|
|
|
- // 获取该项目的成绩数据
|
|
|
- const scoreRes = await getProjectScoreData({
|
|
|
- eventId: project.eventId,
|
|
|
- projectId: project.projectId,
|
|
|
- classification: project.classification,
|
|
|
- pageNum: 1,
|
|
|
- pageSize: 1000
|
|
|
- });
|
|
|
-
|
|
|
- const scores = scoreRes.rows || [];
|
|
|
-
|
|
|
- // 计算参赛总人数(去重后的队伍或运动员数量)
|
|
|
- const uniqueParticipants = new Set();
|
|
|
- scores.forEach(score => {
|
|
|
- if (project.classification === '0') {
|
|
|
- // 个人项目:按运动员ID去重
|
|
|
- if (score.athleteId) {
|
|
|
- uniqueParticipants.add(score.athleteId);
|
|
|
- }
|
|
|
- } else {
|
|
|
- // 团体项目:按队伍ID去重
|
|
|
- if (score.teamId) {
|
|
|
- uniqueParticipants.add(score.teamId);
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- // 使用类型断言添加新属性
|
|
|
- (project as any).totalParticipants = uniqueParticipants.size;
|
|
|
-
|
|
|
- // 计算完赛人数(有成绩记录的)
|
|
|
- const completedScores = scores.filter(score => {
|
|
|
- // 成绩必须存在且大于0
|
|
|
- const sc = score.classification === '0' ? score.individualPerformance : score.teamPerformance;
|
|
|
- if (sc === null || sc === undefined || sc === '' || sc === '00:00:00.000') {
|
|
|
- return false;
|
|
|
- }
|
|
|
- if (typeof sc === 'number') {
|
|
|
- return !isNaN(sc) && sc > 0;
|
|
|
- }else if(typeof sc === 'string'){
|
|
|
- return sc !== '0';
|
|
|
- }
|
|
|
- });
|
|
|
- console.log('completedScores: ', completedScores);
|
|
|
- (project as any).completedParticipants = completedScores.length;
|
|
|
-
|
|
|
- // 计算未完赛人数
|
|
|
- (project as any).incompleteParticipants = (project as any).totalParticipants - (project as any).completedParticipants;
|
|
|
-
|
|
|
- } catch (error) {
|
|
|
- console.error(`计算项目 ${project.projectName} 参赛人数失败:`, error);
|
|
|
- // 设置默认值
|
|
|
- (project as any).totalParticipants = 0;
|
|
|
- (project as any).completedParticipants = 0;
|
|
|
- (project as any).incompleteParticipants = 0;
|
|
|
- }
|
|
|
- }
|
|
|
-};
|
|
|
-
|
|
|
/** 搜索按钮操作 */
|
|
|
const handleQuery = () => {
|
|
|
queryParams.value.pageNum = 1;
|