|
@@ -5,14 +5,10 @@
|
|
<div class="flex items-center justify-between">
|
|
<div class="flex items-center justify-between">
|
|
<div class="flex items-center gap-4">
|
|
<div class="flex items-center gap-4">
|
|
<h3 class="text-lg font-bold">赛事日程安排</h3>
|
|
<h3 class="text-lg font-bold">赛事日程安排</h3>
|
|
- <el-button type="primary" @click="loadEventData()" :disabled="!defaultEvent.eventId">
|
|
|
|
- 加载赛事数据
|
|
|
|
- </el-button>
|
|
|
|
|
|
+ <el-button type="primary" @click="loadEventData()" :disabled="!defaultEvent.eventId"> 加载赛事数据 </el-button>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div>
|
|
- <el-button type="success" @click="exportSchedule" :disabled="!defaultEvent.eventId || scheduleData.length === 0">
|
|
|
|
- 导出日程表
|
|
|
|
- </el-button>
|
|
|
|
|
|
+ <el-button type="success" @click="exportSchedule" :disabled="!defaultEvent.eventId || scheduleData.length === 0"> 导出日程表 </el-button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
@@ -22,9 +18,7 @@
|
|
<div class="flex items-center justify-between">
|
|
<div class="flex items-center justify-between">
|
|
<div>
|
|
<div>
|
|
<h3 class="text-lg font-bold">{{ defaultEvent.eventName }}</h3>
|
|
<h3 class="text-lg font-bold">{{ defaultEvent.eventName }}</h3>
|
|
- <p class="text-gray-600">
|
|
|
|
- 比赛时间: {{ parseTime(defaultEvent.startTime) }} 至 {{ parseTime(defaultEvent.endTime) }}
|
|
|
|
- </p>
|
|
|
|
|
|
+ <p class="text-gray-600">比赛时间: {{ parseTime(defaultEvent.startTime) }} 至 {{ parseTime(defaultEvent.endTime) }}</p>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div>
|
|
<p>赛事地点: {{ defaultEvent.location }}</p>
|
|
<p>赛事地点: {{ defaultEvent.location }}</p>
|
|
@@ -37,23 +31,18 @@
|
|
<template #header>
|
|
<template #header>
|
|
<span class="font-bold">项目分组与时间安排</span>
|
|
<span class="font-bold">项目分组与时间安排</span>
|
|
</template>
|
|
</template>
|
|
-
|
|
|
|
|
|
+
|
|
<el-tabs v-model="activeGroupTab">
|
|
<el-tabs v-model="activeGroupTab">
|
|
- <el-tab-pane
|
|
|
|
- v-for="group in projectGroups"
|
|
|
|
- :key="group.type"
|
|
|
|
- :label="`${group.type} (${group.projects.length})`"
|
|
|
|
- :name="group.type"
|
|
|
|
- >
|
|
|
|
|
|
+ <el-tab-pane v-for="group in projectGroups" :key="group.type" :label="`${group.type} (${group.projects.length})`" :name="group.type">
|
|
<el-table :data="group.projects" border class="mb-4">
|
|
<el-table :data="group.projects" border class="mb-4">
|
|
- <el-table-column label="项目名称" prop="projectName" width="150" />
|
|
|
|
|
|
+ <el-table-column label="项目名称" prop="projectName" />
|
|
<!-- <el-table-column label="项目组别" prop="groupType" width="120" /> -->
|
|
<!-- <el-table-column label="项目组别" prop="groupType" width="120" /> -->
|
|
- <el-table-column label="项目类型" width="100">
|
|
|
|
|
|
+ <el-table-column label="项目类型">
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
<dict-tag :options="game_project_type" :value="scope.row.projectType || ''" />
|
|
<dict-tag :options="game_project_type" :value="scope.row.projectType || ''" />
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
- <el-table-column label="比赛日期" width="180">
|
|
|
|
|
|
+ <el-table-column label="比赛日期">
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
<el-date-picker
|
|
<el-date-picker
|
|
v-model="scope.row.scheduleDate"
|
|
v-model="scope.row.scheduleDate"
|
|
@@ -65,59 +54,35 @@
|
|
/>
|
|
/>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
- <el-table-column label="开始时间" width="180">
|
|
|
|
|
|
+ <el-table-column label="开始时间">
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
- <el-time-picker
|
|
|
|
- v-model="scope.row.startTime"
|
|
|
|
- placeholder="开始时间"
|
|
|
|
- format="HH:mm"
|
|
|
|
- value-format="HH:mm"
|
|
|
|
- style="width: 100%"
|
|
|
|
- />
|
|
|
|
|
|
+ <el-time-picker v-model="scope.row.startTime" placeholder="开始时间" format="HH:mm" value-format="HH:mm" style="width: 100%" />
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
- <el-table-column label="结束时间" width="180">
|
|
|
|
|
|
+ <el-table-column label="结束时间">
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
- <el-time-picker
|
|
|
|
- v-model="scope.row.endTime"
|
|
|
|
- placeholder="结束时间"
|
|
|
|
- format="HH:mm"
|
|
|
|
- value-format="HH:mm"
|
|
|
|
- style="width: 100%"
|
|
|
|
- />
|
|
|
|
|
|
+ <el-time-picker v-model="scope.row.endTime" placeholder="结束时间" format="HH:mm" value-format="HH:mm" style="width: 100%" />
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
- <el-table-column label="比赛场地" width="150">
|
|
|
|
|
|
+ <el-table-column label="比赛场地">
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
<el-input v-model="scope.row.location" placeholder="输入比赛场地" />
|
|
<el-input v-model="scope.row.location" placeholder="输入比赛场地" />
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
- <el-table-column label="分组数" width="150">
|
|
|
|
|
|
+ <el-table-column label="分组数">
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
- <el-input-number
|
|
|
|
- v-model="scope.row.groupNum"
|
|
|
|
- :min="1"
|
|
|
|
- :max="20"
|
|
|
|
- controls-position="right"
|
|
|
|
- size="small"
|
|
|
|
- />
|
|
|
|
|
|
+ <el-input-number v-model="scope.row.groupNum" :min="1" :max="20" controls-position="right" size="small" />
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
- <el-table-column label="每组人数" width="150">
|
|
|
|
|
|
+ <el-table-column label="每组人数">
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
- <el-input-number
|
|
|
|
- v-model="scope.row.participateNum"
|
|
|
|
- :min="1"
|
|
|
|
- :max="100"
|
|
|
|
- controls-position="right"
|
|
|
|
- size="small"
|
|
|
|
- />
|
|
|
|
|
|
+ <el-input-number v-model="scope.row.participateNum" :min="1" :max="100" controls-position="right" size="small" />
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-table>
|
|
</el-tab-pane>
|
|
</el-tab-pane>
|
|
</el-tabs>
|
|
</el-tabs>
|
|
-
|
|
|
|
|
|
+
|
|
<div class="flex justify-end">
|
|
<div class="flex justify-end">
|
|
<el-button type="primary" @click="saveSchedule">保存日程安排</el-button>
|
|
<el-button type="primary" @click="saveSchedule">保存日程安排</el-button>
|
|
</div>
|
|
</div>
|
|
@@ -128,32 +93,25 @@
|
|
<template #header>
|
|
<template #header>
|
|
<span class="font-bold">日程预览</span>
|
|
<span class="font-bold">日程预览</span>
|
|
</template>
|
|
</template>
|
|
-
|
|
|
|
|
|
+
|
|
<el-table :data="scheduleData" border stripe>
|
|
<el-table :data="scheduleData" border stripe>
|
|
- <el-table-column label="日期" prop="scheduleDate" width="120" />
|
|
|
|
- <el-table-column label="时间" width="200">
|
|
|
|
- <template #default="scope">
|
|
|
|
- {{ scope.row.startTime }} - {{ scope.row.endTime }}
|
|
|
|
- </template>
|
|
|
|
|
|
+ <el-table-column label="日期" prop="scheduleDate" />
|
|
|
|
+ <el-table-column label="时间">
|
|
|
|
+ <template #default="scope"> {{ scope.row.startTime }} - {{ scope.row.endTime }}</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
- <el-table-column label="项目名称" prop="projectName" width="150" />
|
|
|
|
- <el-table-column label="项目类型" width="100">
|
|
|
|
|
|
+ <el-table-column label="项目名称" prop="projectName" />
|
|
|
|
+ <el-table-column label="项目类型">
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
<dict-tag :options="game_project_type" :value="scope.row.projectType || ''" />
|
|
<dict-tag :options="game_project_type" :value="scope.row.projectType || ''" />
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</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">
|
|
|
|
|
|
+ <el-table-column label="比赛场地" prop="location" />
|
|
|
|
+ <el-table-column label="分组数" prop="groupNum" />
|
|
|
|
+ <el-table-column label="每组人数" prop="participateNum" />
|
|
|
|
+ <el-table-column label="操作">
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
- <el-button
|
|
|
|
- type="danger"
|
|
|
|
- size="small"
|
|
|
|
- @click="deleteSchedule(scope.row)"
|
|
|
|
- v-hasPermi="['system:gameeventproject:remove']"
|
|
|
|
- >
|
|
|
|
|
|
+ <el-button type="danger" size="small" @click="deleteSchedule(scope.row)" v-hasPermi="['system:gameeventproject:remove']">
|
|
删除
|
|
删除
|
|
</el-button>
|
|
</el-button>
|
|
</template>
|
|
</template>
|
|
@@ -165,44 +123,44 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup name="GameEventSchedule" lang="ts">
|
|
<script setup name="GameEventSchedule" lang="ts">
|
|
-import { ref, reactive, computed, onMounted } from 'vue'
|
|
|
|
-import { listGameEventProject, updateGameEventProject } from '@/api/system/gameEventProject'
|
|
|
|
-import { getDefaultEvent } from '@/api/system/gameEvent'
|
|
|
|
-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
|
|
|
|
|
|
+import { ref, reactive, computed, onMounted } from 'vue';
|
|
|
|
+import { listGameEventProject, updateGameEventProject } from '@/api/system/gameEventProject';
|
|
|
|
+import { getDefaultEvent } from '@/api/system/gameEvent';
|
|
|
|
+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 { game_project_type } = toRefs<any>(proxy?.useDict('game_project_type'));
|
|
|
|
|
|
// 默认赛事信息
|
|
// 默认赛事信息
|
|
-const defaultEvent = ref<GameEventVO>({} as GameEventVO)
|
|
|
|
|
|
+const defaultEvent = ref<GameEventVO>({} as GameEventVO);
|
|
// 项目分组(按项目类型分组)
|
|
// 项目分组(按项目类型分组)
|
|
-const projectGroups = ref<{type: string, projects: GameEventProjectVO[]}[]>([])
|
|
|
|
|
|
+const projectGroups = ref<{ type: string; projects: GameEventProjectVO[] }[]>([]);
|
|
// 活动的项目分组标签页
|
|
// 活动的项目分组标签页
|
|
-const activeGroupTab = ref('个人')
|
|
|
|
|
|
+const activeGroupTab = ref('个人');
|
|
// 日程数据(用于预览和导出)
|
|
// 日程数据(用于预览和导出)
|
|
-const scheduleData = ref<GameEventProjectVO[]>([])
|
|
|
|
|
|
+const scheduleData = ref<GameEventProjectVO[]>([]);
|
|
|
|
|
|
// 获取默认赛事
|
|
// 获取默认赛事
|
|
const loadDefaultEvent = async () => {
|
|
const loadDefaultEvent = async () => {
|
|
try {
|
|
try {
|
|
- const res = await getDefaultEvent()
|
|
|
|
- defaultEvent.value = res.data
|
|
|
|
|
|
+ const res = await getDefaultEvent();
|
|
|
|
+ defaultEvent.value = res.data;
|
|
} catch (error) {
|
|
} catch (error) {
|
|
- ElMessage.error('获取默认赛事失败')
|
|
|
|
|
|
+ ElMessage.error('获取默认赛事失败');
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
+};
|
|
|
|
|
|
// 加载赛事数据
|
|
// 加载赛事数据
|
|
const loadEventData = async () => {
|
|
const loadEventData = async () => {
|
|
if (!defaultEvent.value.eventId) {
|
|
if (!defaultEvent.value.eventId) {
|
|
- ElMessage.warning('请先指定默认赛事')
|
|
|
|
- return
|
|
|
|
|
|
+ ElMessage.warning('请先指定默认赛事');
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
try {
|
|
try {
|
|
// 获取赛事项目
|
|
// 获取赛事项目
|
|
const projectRes = await listGameEventProject({
|
|
const projectRes = await listGameEventProject({
|
|
@@ -211,95 +169,91 @@ const loadEventData = async () => {
|
|
pageSize: 1000,
|
|
pageSize: 1000,
|
|
orderByColumn: '',
|
|
orderByColumn: '',
|
|
isAsc: ''
|
|
isAsc: ''
|
|
- })
|
|
|
|
-
|
|
|
|
|
|
+ });
|
|
|
|
+
|
|
// 按项目类型分组
|
|
// 按项目类型分组
|
|
- const groups: { [key: string]: GameEventProjectVO[] } = {}
|
|
|
|
- projectRes.rows.forEach(project => {
|
|
|
|
|
|
+ const groups: { [key: string]: GameEventProjectVO[] } = {};
|
|
|
|
+ projectRes.rows.forEach((project) => {
|
|
// 使用字典标签作为分组键
|
|
// 使用字典标签作为分组键
|
|
- const projectTypeDict = game_project_type.value.find((dict: any) => dict.value === project.projectType)
|
|
|
|
- const type = projectTypeDict ? projectTypeDict.label : '未知类型'
|
|
|
|
|
|
+ const projectTypeDict = game_project_type.value.find((dict: any) => dict.value === project.projectType);
|
|
|
|
+ const type = projectTypeDict ? projectTypeDict.label : '未知类型';
|
|
if (!groups[type]) {
|
|
if (!groups[type]) {
|
|
- groups[type] = []
|
|
|
|
|
|
+ groups[type] = [];
|
|
}
|
|
}
|
|
// 初始化时间字段
|
|
// 初始化时间字段
|
|
// 从数据库加载时,将开始时间和结束时间拆分为日期和时间部分
|
|
// 从数据库加载时,将开始时间和结束时间拆分为日期和时间部分
|
|
if (project.startTime) {
|
|
if (project.startTime) {
|
|
// 提取日期部分
|
|
// 提取日期部分
|
|
- project.scheduleDate = project.startTime.split(' ')[0]
|
|
|
|
|
|
+ project.scheduleDate = project.startTime.split(' ')[0];
|
|
// 只保留时间部分
|
|
// 只保留时间部分
|
|
- project.startTime = project.startTime.split(' ')[1]?.substring(0, 5) || ''
|
|
|
|
|
|
+ project.startTime = project.startTime.split(' ')[1]?.substring(0, 5) || '';
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
if (project.endTime) {
|
|
if (project.endTime) {
|
|
// 只保留时间部分(日期部分应该与startTime相同)
|
|
// 只保留时间部分(日期部分应该与startTime相同)
|
|
- project.endTime = project.endTime.split(' ')[1]?.substring(0, 5) || ''
|
|
|
|
|
|
+ project.endTime = project.endTime.split(' ')[1]?.substring(0, 5) || '';
|
|
}
|
|
}
|
|
-
|
|
|
|
- if (!project.groupNum) project.groupNum = 1
|
|
|
|
- if (!project.participateNum) project.participateNum = 1
|
|
|
|
- groups[type].push(project)
|
|
|
|
- })
|
|
|
|
-
|
|
|
|
- projectGroups.value = Object.keys(groups).map(type => ({
|
|
|
|
|
|
+
|
|
|
|
+ if (!project.groupNum) project.groupNum = 1;
|
|
|
|
+ if (!project.participateNum) project.participateNum = 1;
|
|
|
|
+ groups[type].push(project);
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ projectGroups.value = Object.keys(groups).map((type) => ({
|
|
type,
|
|
type,
|
|
projects: groups[type]
|
|
projects: groups[type]
|
|
- }))
|
|
|
|
-
|
|
|
|
|
|
+ }));
|
|
|
|
+
|
|
// 设置默认活动标签页
|
|
// 设置默认活动标签页
|
|
if (projectGroups.value.length > 0) {
|
|
if (projectGroups.value.length > 0) {
|
|
- activeGroupTab.value = projectGroups.value[0].type
|
|
|
|
|
|
+ activeGroupTab.value = projectGroups.value[0].type;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
// 更新日程预览数据
|
|
// 更新日程预览数据
|
|
- updateScheduleData()
|
|
|
|
-
|
|
|
|
- ElMessage.success('赛事数据加载成功')
|
|
|
|
|
|
+ updateScheduleData();
|
|
|
|
+
|
|
|
|
+ ElMessage.success('赛事数据加载成功');
|
|
} catch (error) {
|
|
} catch (error) {
|
|
- ElMessage.error('加载赛事数据失败')
|
|
|
|
|
|
+ ElMessage.error('加载赛事数据失败');
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
+};
|
|
|
|
|
|
// 更新日程预览数据
|
|
// 更新日程预览数据
|
|
const updateScheduleData = () => {
|
|
const updateScheduleData = () => {
|
|
- const allProjects: GameEventProjectVO[] = []
|
|
|
|
- projectGroups.value.forEach(group => {
|
|
|
|
- group.projects.forEach(project => {
|
|
|
|
|
|
+ const allProjects: GameEventProjectVO[] = [];
|
|
|
|
+ projectGroups.value.forEach((group) => {
|
|
|
|
+ group.projects.forEach((project) => {
|
|
// 只添加已安排时间的项目
|
|
// 只添加已安排时间的项目
|
|
if (project.scheduleDate && project.startTime && project.endTime) {
|
|
if (project.scheduleDate && project.startTime && project.endTime) {
|
|
- allProjects.push(project)
|
|
|
|
|
|
+ allProjects.push(project);
|
|
}
|
|
}
|
|
- })
|
|
|
|
- })
|
|
|
|
-
|
|
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+
|
|
// 按日期和时间排序
|
|
// 按日期和时间排序
|
|
scheduleData.value = allProjects.sort((a, b) => {
|
|
scheduleData.value = allProjects.sort((a, b) => {
|
|
if (a.scheduleDate !== b.scheduleDate) {
|
|
if (a.scheduleDate !== b.scheduleDate) {
|
|
- return a.scheduleDate.localeCompare(b.scheduleDate)
|
|
|
|
|
|
+ return a.scheduleDate.localeCompare(b.scheduleDate);
|
|
}
|
|
}
|
|
- return a.startTime.localeCompare(b.startTime)
|
|
|
|
- })
|
|
|
|
-}
|
|
|
|
|
|
+ return a.startTime.localeCompare(b.startTime);
|
|
|
|
+ });
|
|
|
|
+};
|
|
|
|
|
|
// 保存日程安排
|
|
// 保存日程安排
|
|
const saveSchedule = async () => {
|
|
const saveSchedule = async () => {
|
|
try {
|
|
try {
|
|
- const allProjects: GameEventProjectVO[] = []
|
|
|
|
- projectGroups.value.forEach(group => {
|
|
|
|
- allProjects.push(...group.projects)
|
|
|
|
- })
|
|
|
|
-
|
|
|
|
|
|
+ const allProjects: GameEventProjectVO[] = [];
|
|
|
|
+ projectGroups.value.forEach((group) => {
|
|
|
|
+ allProjects.push(...group.projects);
|
|
|
|
+ });
|
|
|
|
+
|
|
// 保存每个项目的时间安排
|
|
// 保存每个项目的时间安排
|
|
for (const project of allProjects) {
|
|
for (const project of allProjects) {
|
|
// 组合日期和时间部分为完整的日期时间格式
|
|
// 组合日期和时间部分为完整的日期时间格式
|
|
- const startDateTime = project.scheduleDate && project.startTime
|
|
|
|
- ? `${project.scheduleDate} ${project.startTime}:00`
|
|
|
|
- : null;
|
|
|
|
-
|
|
|
|
- const endDateTime = project.scheduleDate && project.endTime
|
|
|
|
- ? `${project.scheduleDate} ${project.endTime}:00`
|
|
|
|
- : null;
|
|
|
|
-
|
|
|
|
|
|
+ const startDateTime = project.scheduleDate && project.startTime ? `${project.scheduleDate} ${project.startTime}:00` : null;
|
|
|
|
+
|
|
|
|
+ const endDateTime = project.scheduleDate && project.endTime ? `${project.scheduleDate} ${project.endTime}:00` : null;
|
|
|
|
+
|
|
await updateGameEventProject({
|
|
await updateGameEventProject({
|
|
projectId: project.projectId,
|
|
projectId: project.projectId,
|
|
startTime: startDateTime,
|
|
startTime: startDateTime,
|
|
@@ -311,30 +265,26 @@ const saveSchedule = async () => {
|
|
eventId: defaultEvent.value.eventId,
|
|
eventId: defaultEvent.value.eventId,
|
|
projectName: project.projectName,
|
|
projectName: project.projectName,
|
|
projectType: project.projectType,
|
|
projectType: project.projectType,
|
|
- groupType: project.groupType,
|
|
|
|
- } as any)
|
|
|
|
|
|
+ groupType: project.groupType
|
|
|
|
+ } as any);
|
|
}
|
|
}
|
|
-
|
|
|
|
- ElMessage.success('日程安排保存成功')
|
|
|
|
- updateScheduleData()
|
|
|
|
|
|
+
|
|
|
|
+ ElMessage.success('日程安排保存成功');
|
|
|
|
+ updateScheduleData();
|
|
} catch (error) {
|
|
} catch (error) {
|
|
- ElMessage.error('保存日程安排失败')
|
|
|
|
|
|
+ ElMessage.error('保存日程安排失败');
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
+};
|
|
|
|
|
|
// 删除日程安排
|
|
// 删除日程安排
|
|
const deleteSchedule = async (project: GameEventProjectVO) => {
|
|
const deleteSchedule = async (project: GameEventProjectVO) => {
|
|
try {
|
|
try {
|
|
- await ElMessageBox.confirm(
|
|
|
|
- `确定要删除项目 "${project.projectName}" 的日程安排吗?`,
|
|
|
|
- '删除确认',
|
|
|
|
- {
|
|
|
|
- confirmButtonText: '确定',
|
|
|
|
- cancelButtonText: '取消',
|
|
|
|
- type: 'warning'
|
|
|
|
- }
|
|
|
|
- )
|
|
|
|
-
|
|
|
|
|
|
+ await ElMessageBox.confirm(`确定要删除项目 "${project.projectName}" 的日程安排吗?`, '删除确认', {
|
|
|
|
+ confirmButtonText: '确定',
|
|
|
|
+ cancelButtonText: '取消',
|
|
|
|
+ type: 'warning'
|
|
|
|
+ });
|
|
|
|
+
|
|
// 清除该项目的时间安排
|
|
// 清除该项目的时间安排
|
|
await updateGameEventProject({
|
|
await updateGameEventProject({
|
|
projectId: project.projectId,
|
|
projectId: project.projectId,
|
|
@@ -347,45 +297,45 @@ const deleteSchedule = async (project: GameEventProjectVO) => {
|
|
eventId: defaultEvent.value.eventId,
|
|
eventId: defaultEvent.value.eventId,
|
|
projectName: project.projectName,
|
|
projectName: project.projectName,
|
|
projectType: project.projectType,
|
|
projectType: project.projectType,
|
|
- groupType: project.groupType,
|
|
|
|
- } as any)
|
|
|
|
-
|
|
|
|
|
|
+ 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
|
|
|
|
- })
|
|
|
|
|
|
+ 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) {
|
|
if (group) {
|
|
- const projectItem = group.projects.find(p => p.projectId === project.projectId)
|
|
|
|
|
|
+ const projectItem = group.projects.find((p) => p.projectId === project.projectId);
|
|
if (projectItem) {
|
|
if (projectItem) {
|
|
- projectItem.scheduleDate = ''
|
|
|
|
- projectItem.startTime = ''
|
|
|
|
- projectItem.endTime = ''
|
|
|
|
|
|
+ projectItem.scheduleDate = '';
|
|
|
|
+ projectItem.startTime = '';
|
|
|
|
+ projectItem.endTime = '';
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
- ElMessage.success('日程安排删除成功')
|
|
|
|
- updateScheduleData()
|
|
|
|
|
|
+
|
|
|
|
+ ElMessage.success('日程安排删除成功');
|
|
|
|
+ updateScheduleData();
|
|
} catch (error) {
|
|
} catch (error) {
|
|
if (error !== 'cancel') {
|
|
if (error !== 'cancel') {
|
|
- ElMessage.error('删除日程安排失败')
|
|
|
|
|
|
+ ElMessage.error('删除日程安排失败');
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
+};
|
|
|
|
|
|
// 导出日程表
|
|
// 导出日程表
|
|
const exportSchedule = () => {
|
|
const exportSchedule = () => {
|
|
if (scheduleData.value.length === 0) {
|
|
if (scheduleData.value.length === 0) {
|
|
- ElMessage.warning('暂无日程安排数据可导出')
|
|
|
|
- return
|
|
|
|
|
|
+ ElMessage.warning('暂无日程安排数据可导出');
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
// 创建表格数据
|
|
// 创建表格数据
|
|
- const headers = ['日期', '时间', '项目名称', '项目类型', '项目组别', '比赛场地', '分组数', '每组人数']
|
|
|
|
- let csvContent = headers.join(',') + '\n'
|
|
|
|
-
|
|
|
|
- scheduleData.value.forEach(item => {
|
|
|
|
|
|
+ const headers = ['日期', '时间', '项目名称', '项目类型', '项目组别', '比赛场地', '分组数', '每组人数'];
|
|
|
|
+ let csvContent = headers.join(',') + '\n';
|
|
|
|
+
|
|
|
|
+ scheduleData.value.forEach((item) => {
|
|
const row = [
|
|
const row = [
|
|
item.scheduleDate,
|
|
item.scheduleDate,
|
|
`${item.startTime}-${item.endTime}`,
|
|
`${item.startTime}-${item.endTime}`,
|
|
@@ -395,30 +345,30 @@ const exportSchedule = () => {
|
|
item.location,
|
|
item.location,
|
|
item.groupNum,
|
|
item.groupNum,
|
|
item.participateNum
|
|
item.participateNum
|
|
- ].join(',')
|
|
|
|
- csvContent += row + '\n'
|
|
|
|
- })
|
|
|
|
-
|
|
|
|
|
|
+ ].join(',');
|
|
|
|
+ csvContent += row + '\n';
|
|
|
|
+ });
|
|
|
|
+
|
|
// 创建下载链接
|
|
// 创建下载链接
|
|
- const blob = new Blob(['\uFEFF' + csvContent], { type: 'text/csv;charset=utf-8;' })
|
|
|
|
- const link = document.createElement('a')
|
|
|
|
- const url = URL.createObjectURL(blob)
|
|
|
|
- link.setAttribute('href', url)
|
|
|
|
- link.setAttribute('download', `赛事日程安排_${defaultEvent.value.eventName}_${parseTime(new Date(), '{y}{m}{d}')}.csv`)
|
|
|
|
- link.style.visibility = 'hidden'
|
|
|
|
- document.body.appendChild(link)
|
|
|
|
- link.click()
|
|
|
|
- document.body.removeChild(link)
|
|
|
|
-}
|
|
|
|
|
|
+ const blob = new Blob(['\uFEFF' + csvContent], { type: 'text/csv;charset=utf-8;' });
|
|
|
|
+ const link = document.createElement('a');
|
|
|
|
+ const url = URL.createObjectURL(blob);
|
|
|
|
+ link.setAttribute('href', url);
|
|
|
|
+ link.setAttribute('download', `赛事日程安排_${defaultEvent.value.eventName}_${parseTime(new Date(), '{y}{m}{d}')}.csv`);
|
|
|
|
+ link.style.visibility = 'hidden';
|
|
|
|
+ document.body.appendChild(link);
|
|
|
|
+ link.click();
|
|
|
|
+ document.body.removeChild(link);
|
|
|
|
+};
|
|
|
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
loadDefaultEvent().then(() => {
|
|
loadDefaultEvent().then(() => {
|
|
// 自动加载默认赛事数据
|
|
// 自动加载默认赛事数据
|
|
if (defaultEvent.value.eventId) {
|
|
if (defaultEvent.value.eventId) {
|
|
- loadEventData()
|
|
|
|
|
|
+ loadEventData();
|
|
}
|
|
}
|
|
- })
|
|
|
|
-})
|
|
|
|
|
|
+ });
|
|
|
|
+});
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style scoped>
|
|
<style scoped>
|
|
@@ -457,4 +407,4 @@ onMounted(() => {
|
|
.text-gray-600 {
|
|
.text-gray-600 {
|
|
color: #6b7280;
|
|
color: #6b7280;
|
|
}
|
|
}
|
|
-</style>
|
|
|
|
|
|
+</style>
|