fix: 修复报名详情页面文案和统计逻辑
- 修正错误文案: 单位型号人数 → 报名人数, 剩下显时(公共) → 预计时长(分钟) - 重新设计参赛人数统计表格: 单位/单人项目/集体项目/男/女/合计 - 修复统计逻辑按项目类型和性别正确统计 Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
This commit is contained in:
@@ -101,12 +101,10 @@
|
||||
<div v-if="scope.row.hint" class="row-hint">{{ scope.row.hint }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="category" label="类别" width="80"></el-table-column>
|
||||
<el-table-column prop="individual" label="2队" width="60" align="center"></el-table-column>
|
||||
<el-table-column prop="dual" label="2组" width="60" align="center"></el-table-column>
|
||||
<el-table-column prop="team1101" label="1101" width="60" align="center"></el-table-column>
|
||||
<el-table-column prop="workers" label="工作人员" width="90" align="center"></el-table-column>
|
||||
<el-table-column prop="female" label="女性组别" width="90" align="center"></el-table-column>
|
||||
<el-table-column prop="singleCount" label="单人项目" width="100" align="center"></el-table-column>
|
||||
<el-table-column prop="teamCount" label="集体项目" width="100" align="center"></el-table-column>
|
||||
<el-table-column prop="male" label="男" width="60" align="center"></el-table-column>
|
||||
<el-table-column prop="female" label="女" width="60" align="center"></el-table-column>
|
||||
<el-table-column prop="total" label="合计" width="60" align="center">
|
||||
<template #default="scope">
|
||||
<span class="total-num">+{{ scope.row.total }}</span>
|
||||
@@ -127,8 +125,8 @@
|
||||
</el-table-column>
|
||||
<el-table-column prop="participantCategory" label="参人/单位" width="100"></el-table-column>
|
||||
<el-table-column prop="teamCount" label="队伍" width="80" align="center"></el-table-column>
|
||||
<el-table-column prop="singleTeamPeople" label="单位型号人数" width="120" align="center"></el-table-column>
|
||||
<el-table-column prop="estimatedDuration" label="剩下显时(公共)" width="150" align="center"></el-table-column>
|
||||
<el-table-column prop="singleTeamPeople" label="报名人数" width="120" align="center"></el-table-column>
|
||||
<el-table-column prop="estimatedDuration" label="预计时长(分钟)" width="150" align="center"></el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
@@ -335,38 +333,55 @@ export default {
|
||||
const participants = await this.getParticipants()
|
||||
console.log('参赛人员列表返回:', participants)
|
||||
|
||||
// 预加载项目信息
|
||||
await this.preloadProjectInfo(participants)
|
||||
|
||||
// 按单位分组统计
|
||||
const unitMap = new Map()
|
||||
participants.forEach(p => {
|
||||
// 兼容驼峰和下划线命名
|
||||
const unit = p.organization || p.teamName || p.team_name || '未知单位'
|
||||
const projectId = p.projectId || p.project_id
|
||||
const project = this.projectCache.get(projectId)
|
||||
const projectType = project ? (project.type || 1) : 1 // 1=单人, 2=集体
|
||||
|
||||
if (!unitMap.has(unit)) {
|
||||
unitMap.set(unit, {
|
||||
schoolUnit: unit,
|
||||
category: '',
|
||||
individual: 0,
|
||||
dual: 0,
|
||||
team1101: 0,
|
||||
workers: 0,
|
||||
singleCount: 0,
|
||||
teamCount: 0,
|
||||
male: 0,
|
||||
female: 0,
|
||||
total: 0
|
||||
})
|
||||
}
|
||||
const stat = unitMap.get(unit)
|
||||
stat.total++
|
||||
if (p.gender === 2) stat.female++
|
||||
|
||||
// 按项目类型统计
|
||||
if (projectType === 1) {
|
||||
stat.singleCount++
|
||||
} else {
|
||||
stat.teamCount++
|
||||
}
|
||||
|
||||
// 按性别统计
|
||||
if (p.gender === 1) {
|
||||
stat.male++
|
||||
} else if (p.gender === 2) {
|
||||
stat.female++
|
||||
}
|
||||
})
|
||||
|
||||
this.participantsData = Array.from(unitMap.values())
|
||||
} catch (err) {
|
||||
console.error('加载参赛人员统计失败', err)
|
||||
this.$message.warning('加载参赛人员统计失败')
|
||||
// 使用空数组作为默认值
|
||||
this.participantsData = []
|
||||
}
|
||||
},
|
||||
|
||||
// 加载项目时间统计(该赛事的所有项目及参赛人数)
|
||||
// 加载项目时间统计(该赛事的所有项目及参赛人数)
|
||||
async loadProjectTimeStats() {
|
||||
try {
|
||||
// 使用缓存的参赛者列表
|
||||
|
||||
Reference in New Issue
Block a user