|
@@ -49,15 +49,15 @@
|
|
|
<el-tab-pane
|
|
|
v-for="group in projectGroups"
|
|
|
:key="group.type"
|
|
|
- :label="`${group.type}项目 (${group.projects.length})`"
|
|
|
+ :label="`${group.type} (${group.projects.length})`"
|
|
|
:name="group.type"
|
|
|
>
|
|
|
<el-table :data="group.projects" border class="mb-4">
|
|
|
<el-table-column label="项目名称" prop="projectName" width="150" />
|
|
|
- <el-table-column label="项目组别" prop="groupType" width="120" />
|
|
|
+ <!-- <el-table-column label="项目组别" prop="groupType" width="120" /> -->
|
|
|
<el-table-column label="项目类型" width="100">
|
|
|
<template #default="scope">
|
|
|
- {{ scope.row.projectType === '0' ? '个人' : '团体' }}
|
|
|
+ <dict-tag :options="game_project_type" :value="scope.row.projectType || ''" />
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="比赛日期" width="180">
|
|
@@ -99,7 +99,7 @@
|
|
|
<el-input v-model="scope.row.location" placeholder="输入比赛场地" />
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="分组数" width="100">
|
|
|
+ <el-table-column label="分组数" width="150">
|
|
|
<template #default="scope">
|
|
|
<el-input-number
|
|
|
v-model="scope.row.groupNum"
|
|
@@ -110,7 +110,7 @@
|
|
|
/>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="每组人数" width="100">
|
|
|
+ <el-table-column label="每组人数" width="150">
|
|
|
<template #default="scope">
|
|
|
<el-input-number
|
|
|
v-model="scope.row.participateNum"
|
|
@@ -146,13 +146,25 @@
|
|
|
<el-table-column label="项目名称" prop="projectName" width="150" />
|
|
|
<el-table-column label="项目类型" width="100">
|
|
|
<template #default="scope">
|
|
|
- {{ scope.row.projectType === '0' ? '个人' : '团体' }}
|
|
|
+ <dict-tag :options="game_project_type" :value="scope.row.projectType || ''" />
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="项目组别" prop="groupType" width="120" />
|
|
|
+ <!-- <el-table-column label="项目组别" prop="groupType" width="120" /> -->
|
|
|
<el-table-column label="比赛场地" prop="location" width="120" />
|
|
|
<el-table-column label="分组数" prop="groupNum" width="80" />
|
|
|
<el-table-column label="每组人数" prop="participateNum" width="100" />
|
|
|
+ <el-table-column label="操作" width="100">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-button
|
|
|
+ type="danger"
|
|
|
+ size="small"
|
|
|
+ @click="deleteSchedule(scope.row)"
|
|
|
+ v-hasPermi="['system:gameeventproject:remove']"
|
|
|
+ >
|
|
|
+ 删除
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
</el-table>
|
|
|
</el-card>
|
|
|
</el-card>
|
|
@@ -167,6 +179,10 @@ import { GameEventVO } from '@/api/system/gameEvent/types'
|
|
|
import { GameEventProjectVO } from '@/api/system/gameEventProject/types'
|
|
|
import { parseTime } from '@/utils/ruoyi'
|
|
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
|
+import DictTag from '@/components/DictTag/index.vue'
|
|
|
+
|
|
|
+const { proxy } = getCurrentInstance() as any
|
|
|
+const { game_project_type } = toRefs<any>(proxy?.useDict('game_project_type'));
|
|
|
|
|
|
// 赛事列表
|
|
|
const eventList = ref<GameEventVO[]>([])
|
|
@@ -189,6 +205,13 @@ const loadEventList = async () => {
|
|
|
pageSize: 1000
|
|
|
})
|
|
|
eventList.value = res.rows
|
|
|
+
|
|
|
+ // 如果赛事列表不为空,默认选择第一条赛事
|
|
|
+ if (eventList.value.length > 0 && !selectedEventId.value) {
|
|
|
+ selectedEventId.value = eventList.value[0].eventId
|
|
|
+ // 自动加载第一条赛事的数据
|
|
|
+ await loadEventData(selectedEventId.value)
|
|
|
+ }
|
|
|
} catch (error) {
|
|
|
ElMessage.error('加载赛事列表失败')
|
|
|
}
|
|
@@ -202,8 +225,8 @@ const loadEventData = async (eventId: string | number) => {
|
|
|
// 获取赛事基本信息
|
|
|
const eventRes = await listGameEvent({
|
|
|
eventId: eventId,
|
|
|
- pageNum: 0,
|
|
|
- pageSize: 0
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 1000
|
|
|
})
|
|
|
currentEvent.value = eventRes.rows[0] || ({} as GameEventVO)
|
|
|
|
|
@@ -217,7 +240,9 @@ const loadEventData = async (eventId: string | number) => {
|
|
|
// 按项目类型分组
|
|
|
const groups: { [key: string]: GameEventProjectVO[] } = {}
|
|
|
projectRes.rows.forEach(project => {
|
|
|
- const type = project.projectType === '0' ? '个人' : '团体'
|
|
|
+ // 使用字典标签作为分组键
|
|
|
+ const projectTypeDict = game_project_type.value.find((dict: any) => dict.value === project.projectType)
|
|
|
+ const type = projectTypeDict ? projectTypeDict.label : '未知类型'
|
|
|
if (!groups[type]) {
|
|
|
groups[type] = []
|
|
|
}
|
|
@@ -321,6 +346,58 @@ const saveSchedule = async () => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// 删除日程安排
|
|
|
+const deleteSchedule = async (project: GameEventProjectVO) => {
|
|
|
+ try {
|
|
|
+ await ElMessageBox.confirm(
|
|
|
+ `确定要删除项目 "${project.projectName}" 的日程安排吗?`,
|
|
|
+ '删除确认',
|
|
|
+ {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }
|
|
|
+ )
|
|
|
+
|
|
|
+ // 清除该项目的时间安排
|
|
|
+ await updateGameEventProject({
|
|
|
+ projectId: project.projectId,
|
|
|
+ startTime: null,
|
|
|
+ endTime: null,
|
|
|
+ location: project.location,
|
|
|
+ groupNum: project.groupNum,
|
|
|
+ participateNum: project.participateNum,
|
|
|
+ //其他字段
|
|
|
+ eventId: selectedEventId.value,
|
|
|
+ projectName: project.projectName,
|
|
|
+ projectType: project.projectType,
|
|
|
+ groupType: project.groupType,
|
|
|
+ } as any)
|
|
|
+
|
|
|
+ // 更新本地数据
|
|
|
+ const group = projectGroups.value.find(g => {
|
|
|
+ const projectTypeDict = game_project_type.value.find((dict: any) => dict.value === project.projectType)
|
|
|
+ const type = projectTypeDict ? projectTypeDict.label : '未知类型'
|
|
|
+ return g.type === type
|
|
|
+ })
|
|
|
+ if (group) {
|
|
|
+ const projectItem = group.projects.find(p => p.projectId === project.projectId)
|
|
|
+ if (projectItem) {
|
|
|
+ projectItem.scheduleDate = ''
|
|
|
+ projectItem.startTime = ''
|
|
|
+ projectItem.endTime = ''
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ElMessage.success('日程安排删除成功')
|
|
|
+ updateScheduleData()
|
|
|
+ } catch (error) {
|
|
|
+ if (error !== 'cancel') {
|
|
|
+ ElMessage.error('删除日程安排失败')
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
// 导出日程表
|
|
|
const exportSchedule = () => {
|
|
|
if (scheduleData.value.length === 0) {
|