diff --git a/src/views/martial/project/index.vue b/src/views/martial/project/index.vue index 3c433d9..973d1ed 100644 --- a/src/views/martial/project/index.vue +++ b/src/views/martial/project/index.vue @@ -135,7 +135,10 @@ diff --git a/src/views/martial/schedule/index.vue b/src/views/martial/schedule/index.vue index 1e8dcbc..6680411 100644 --- a/src/views/martial/schedule/index.vue +++ b/src/views/martial/schedule/index.vue @@ -84,8 +84,8 @@ {{ groupIndex + 1 }}、 {{ group.title }} {{ group.type }} - {{ getTeamCount(group) }}队 - {{ group.items?.length || 0 }}组 + {{ group.type === '集体' ? getTeamCount(group) + '队' : '1组' }} + {{ group.type === '集体' ? getTeamCount(group) + '组' : '' }} {{ group.code }} 表号: {{ generateTableNo(group) }} @@ -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 { // 后端还没有数据,使用默认数据进行展示