feat: 优化编排页面显示

1. 项目列表分组类别显示男子/女子/混合标签
2. 编排页时间段只显示有比赛的时段
3. 集体项目显示队数和组数
4. 单人项目显示1组

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
This commit is contained in:
Z-WICK
2026-01-09 17:42:48 +08:00
co-authored by factory-droid[bot]
parent bb3122a843
commit e1f13dae0d
2 changed files with 50 additions and 3 deletions
+4 -1
View File
@@ -135,7 +135,10 @@
</el-table-column>
<el-table-column prop="category" label="分组类别" width="100" align="center">
<template #default="{ row }">
<span>{{ row.category || '-' }}</span>
<el-tag v-if="row.category == 1" type="primary" size="small">男子</el-tag>
<el-tag v-else-if="row.category == 2" type="danger" size="small">女子</el-tag>
<el-tag v-else-if="row.category == 3" type="success" size="small">混合</el-tag>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column prop="eventType" label="项目类型" width="100" align="center">
+46 -2
View File
@@ -84,8 +84,8 @@
<span class="project-index">{{ groupIndex + 1 }}</span>
<span class="project-title">{{ group.title }}</span>
<span class="project-meta">{{ group.type }}</span>
<span class="project-meta">{{ getTeamCount(group) }}</span>
<span class="project-meta">{{ group.items?.length || 0 }}</span>
<span class="project-meta">{{ group.type === '集体' ? getTeamCount(group) + '队' : '1组' }}</span>
<span class="project-meta">{{ group.type === '集体' ? getTeamCount(group) + '组' : '' }}</span>
<span class="project-meta">{{ group.code }}</span>
<span class="project-table-no">表号: {{ generateTableNo(group) }}</span>
</div>
@@ -883,6 +883,49 @@ export default {
console.log('生成的时间段:', this.timeSlots)
},
// 根据实际编排数据更新显示的时间段(只显示有比赛的时段)
updateTimeSlotsFromGroups() {
if (!this.competitionGroups || this.competitionGroups.length === 0) {
return
}
// 从分组数据中提取实际使用的时段索引
const usedTimeSlotIndexes = new Set()
this.competitionGroups.forEach(group => {
if (group.timeSlotIndex !== null && group.timeSlotIndex !== undefined) {
usedTimeSlotIndexes.add(group.timeSlotIndex)
}
})
if (usedTimeSlotIndexes.size === 0) {
return
}
// 保存原始时段用于映射
const allSlots = [...this.timeSlots]
const filteredSlots = []
const indexMapping = {}
let newIndex = 0
allSlots.forEach((slot, oldIndex) => {
if (usedTimeSlotIndexes.has(oldIndex)) {
filteredSlots.push(slot)
indexMapping[oldIndex] = newIndex
newIndex++
}
})
// 更新分组的时段索引
this.competitionGroups.forEach(group => {
if (group.timeSlotIndex !== null && group.timeSlotIndex !== undefined) {
const newIdx = indexMapping[group.timeSlotIndex]
if (newIdx !== undefined) {
group.timeSlotIndex = newIdx
}
}
})
this.timeSlots = filteredSlots
console.log("过滤后的时间段:", this.timeSlots)
if (this.selectedTime >= this.timeSlots.length) {
this.selectedTime = 0
}
},
// 加载场地列表
async loadVenues() {
try {
@@ -972,6 +1015,7 @@ export default {
console.log('解析后的competitionGroups:', this.competitionGroups)
console.log('当前selectedVenueId:', this.selectedVenueId)
console.log('当前selectedTime:', this.selectedTime)
this.updateTimeSlotsFromGroups()
this.$message.success(data.isDraft ? '已加载草稿数据' : '已加载编排数据')
} else {
// 后端还没有数据,使用默认数据进行展示