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:
co-authored by
factory-droid[bot]
parent
bb3122a843
commit
e1f13dae0d
@@ -135,7 +135,10 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="category" label="分组类别" width="100" align="center">
|
<el-table-column prop="category" label="分组类别" width="100" align="center">
|
||||||
<template #default="{ row }">
|
<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>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="eventType" label="项目类型" width="100" align="center">
|
<el-table-column prop="eventType" label="项目类型" width="100" align="center">
|
||||||
|
|||||||
@@ -84,8 +84,8 @@
|
|||||||
<span class="project-index">{{ groupIndex + 1 }}、</span>
|
<span class="project-index">{{ groupIndex + 1 }}、</span>
|
||||||
<span class="project-title">{{ group.title }}</span>
|
<span class="project-title">{{ group.title }}</span>
|
||||||
<span class="project-meta">{{ group.type }}</span>
|
<span class="project-meta">{{ group.type }}</span>
|
||||||
<span class="project-meta">{{ getTeamCount(group) }}队</span>
|
<span class="project-meta">{{ group.type === '集体' ? getTeamCount(group) + '队' : '1组' }}</span>
|
||||||
<span class="project-meta">{{ group.items?.length || 0 }}组</span>
|
<span class="project-meta">{{ group.type === '集体' ? getTeamCount(group) + '组' : '' }}</span>
|
||||||
<span class="project-meta">{{ group.code }}</span>
|
<span class="project-meta">{{ group.code }}</span>
|
||||||
<span class="project-table-no">表号: {{ generateTableNo(group) }}</span>
|
<span class="project-table-no">表号: {{ generateTableNo(group) }}</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -883,6 +883,49 @@ export default {
|
|||||||
console.log('生成的时间段:', this.timeSlots)
|
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() {
|
async loadVenues() {
|
||||||
try {
|
try {
|
||||||
@@ -972,6 +1015,7 @@ export default {
|
|||||||
console.log('解析后的competitionGroups:', this.competitionGroups)
|
console.log('解析后的competitionGroups:', this.competitionGroups)
|
||||||
console.log('当前selectedVenueId:', this.selectedVenueId)
|
console.log('当前selectedVenueId:', this.selectedVenueId)
|
||||||
console.log('当前selectedTime:', this.selectedTime)
|
console.log('当前selectedTime:', this.selectedTime)
|
||||||
|
this.updateTimeSlotsFromGroups()
|
||||||
this.$message.success(data.isDraft ? '已加载草稿数据' : '已加载编排数据')
|
this.$message.success(data.isDraft ? '已加载草稿数据' : '已加载编排数据')
|
||||||
} else {
|
} else {
|
||||||
// 后端还没有数据,使用默认数据进行展示
|
// 后端还没有数据,使用默认数据进行展示
|
||||||
|
|||||||
Reference in New Issue
Block a user