Просмотр исходного кода

feat(system): 添加默认赛事功能并优化赛事相关页面

- 新增获取默认赛事和修改赛事为默认的功能
- 更新赛事列表页面,增加切换默认赛事的开关
- 调整赛事配置页面,自动加载默认赛事信息
- 优化赛事配置类型页面,添加排序功能
zhou 2 недель назад
Родитель
Сommit
042b862bf3

+ 27 - 0
src/api/system/gameEvent/index.ts

@@ -74,3 +74,30 @@ export const getEventIdNameMap = () => {
     method: 'get'
   });
 };
+
+/**
+ * 获取默认赛事信息
+ */
+export function getDefaultEvent() {
+  return request({
+    url: '/system/gameEvent/default',
+    method: 'get'
+  });
+}
+
+/**
+ * 修改赛事为默认赛事
+ * @param eventId
+ */
+export function changeEventDefault(eventId: string | number, isDefault: string) {
+  const data = {
+    eventId,
+    isDefault,
+    // eventName
+  };
+  return request({
+    url: '/system/gameEvent/changeEventDefault',
+    method: 'put',
+    data: data
+  });
+}

+ 19 - 0
src/api/system/gameEventConfigType/types.ts

@@ -4,6 +4,11 @@ export interface GameEventConfigTypeVO {
    */
   typeId: string | number;
 
+  /**
+   * 赛事id
+   */
+  eventId: string | number;
+
   /**
    * 类型编码
    */
@@ -47,6 +52,11 @@ export interface GameEventConfigTypeForm extends BaseEntity {
    */
   typeId?: string | number;
 
+  /**
+   * 赛事id
+   */
+  eventId?: string | number;
+
   /**
    * 类型编码
    */
@@ -85,6 +95,15 @@ export interface GameEventConfigTypeForm extends BaseEntity {
 }
 
 export interface GameEventConfigTypeQuery extends PageQuery {
+  /**
+   * 主键
+   */
+  typeId?: string | number;
+
+  /**
+   * 赛事id
+   */
+  eventId?: string | number;
 
   /**
    * 类型编码

+ 14 - 14
src/components/ImageOrUrlInput/index.vue

@@ -152,6 +152,20 @@ const handleTabClick = () => {
   }
 };
 
+// 加载OSS数据
+const loadOssData = async (ossId: string) => {
+  try {
+    const res = await listByIds(ossId);
+    if (res.data && res.data.length > 0) {
+      const item = res.data[0];
+      fileList.value = [{ name: item.ossId, url: item.url, ossId: item.ossId }];
+    }
+  } catch (error) {
+    console.warn('Invalid ossId:', ossId);
+    fileList.value = [];
+  }
+};
+
 // 监听 modelValue 变化
 watch(
   () => props.modelValue,
@@ -178,20 +192,6 @@ watch(
   { immediate: true }
 );
 
-// 加载OSS数据
-const loadOssData = async (ossId: string) => {
-  try {
-    const res = await listByIds(ossId);
-    if (res.data && res.data.length > 0) {
-      const item = res.data[0];
-      fileList.value = [{ name: item.ossId, url: item.url, ossId: item.ossId }];
-    }
-  } catch (error) {
-    console.warn('Invalid ossId:', ossId);
-    fileList.value = [];
-  }
-};
-
 /** 上传前loading加载 */
 const handleBeforeUpload = (file: any) => {
   let isImg = false;

+ 52 - 63
src/views/system/gameAthlete/index.vue

@@ -4,12 +4,9 @@
       <div v-show="showSearch" class="mb-[10px]">
         <el-card shadow="hover">
           <el-form ref="queryFormRef" :model="queryParams" :inline="true">
-            <el-form-item label="赛事ID" prop="eventId">
-              <el-input v-model="queryParams.eventId" placeholder="请输入赛事ID" clearable @keyup.enter="handleQuery" />
-            </el-form-item>
-            <el-form-item label="赛事名称" prop="eventName">
+            <!-- <el-form-item label="赛事名称" prop="eventName">
               <el-input v-model="queryParams.eventName" placeholder="请输入赛事名称" clearable @keyup.enter="handleQuery" />
-            </el-form-item>
+            </el-form-item> -->
             <el-form-item label="队伍名称" prop="teamName">
               <el-input v-model="queryParams.teamName" placeholder="请输入队伍名称" clearable @keyup.enter="handleQuery" />
             </el-form-item>
@@ -61,14 +58,12 @@
         <el-table-column type="selection" width="55" align="center" />
         <el-table-column label="主键" align="center" prop="athleteId" v-if="false" />
         <!-- <el-table-column label="用户ID" align="center" prop="userId" /> -->
-        <el-table-column label="赛事ID" align="center" prop="eventId" />
         <el-table-column label="赛事名称" align="center" prop="eventName" width="120px" />
         <el-table-column label="运动员编号" align="center" prop="athleteCode" width="100px" />
         <el-table-column label="姓名" align="center" prop="name" />
         <el-table-column label="性别" align="center" prop="gender">
           <template #default="scope">
-            <el-tag v-if="scope.row.gender === '0'">男</el-tag>
-            <el-tag v-if="scope.row.gender === '1'">女</el-tag>
+            <dict-tag :options="sys_user_sex" :value="scope.row.gender" />
           </template>
         </el-table-column>
         <el-table-column label="年龄" align="center" prop="age" />
@@ -111,9 +106,6 @@
         <!-- <el-form-item label="用户ID" prop="userId">
           <el-input v-model="form.userId" placeholder="请输入用户ID" />
         </el-form-item> -->
-        <el-form-item label="赛事ID" prop="eventId">
-          <el-input v-model="form.eventId" placeholder="请输入赛事ID" />
-        </el-form-item>
         <el-form-item label="队伍" prop="teamId">
           <el-select v-model="form.teamId" placeholder="请选择队伍">
             <el-option v-for="team in gameTeamList" :key="team.teamId" :label="team.teamName" :value="team.teamId" />
@@ -126,29 +118,17 @@
           <el-input v-model="form.name" placeholder="请输入姓名" />
         </el-form-item>
         <el-form-item label="性别" prop="gender">
-          <el-input v-model="form.gender" placeholder="请输入性别" />
+          <el-radio-group v-model="form.gender">
+            <el-radio 
+            v-for="dict in sys_user_sex"
+            :key="dict.value"
+            :value="dict.value"
+            >{{dict.label}}</el-radio>
+          </el-radio-group>
         </el-form-item>
         <el-form-item label="年龄" prop="age">
           <el-input v-model="form.age" placeholder="请输入年龄" />
         </el-form-item>
-        <!-- <el-form-item label="证件号" prop="idCard">
-          <el-input v-model="form.idCard" placeholder="请输入证件号" />
-        </el-form-item>
-        <el-form-item label="芯片号" prop="chipCode">
-          <el-input v-model="form.chipCode" placeholder="请输入芯片号" />
-        </el-form-item>
-        <el-form-item label="手机号" prop="phone">
-          <el-input v-model="form.phone" placeholder="请输入手机号" />
-        </el-form-item>
-        <el-form-item label="居住地址" prop="location">
-          <el-input v-model="form.location" placeholder="请输入居住地址" />
-        </el-form-item>
-        <el-form-item label="T恤尺码" prop="tshirtSize">
-          <el-input v-model="form.tshirtSize" placeholder="请输入T恤尺码" />
-        </el-form-item>
-        <el-form-item label="号码" prop="number">
-          <el-input v-model="form.number" placeholder="请输入号码" />
-        </el-form-item> -->
         <el-form-item label="参与项目" prop="projectValue">
           <el-transfer
             v-model="form.selectedProjects"
@@ -174,15 +154,20 @@
 </template>
 
 <script setup name="GameAthlete" lang="ts">
-import { nextTick, ref } from 'vue';
+import { nextTick, ref, onMounted } from 'vue';
 import { listGameAthlete, getGameAthlete, delGameAthlete, addGameAthlete, updateGameAthlete } from '@/api/system/gameAthlete';
 import { listGameTeam } from '@/api/system/gameTeam';
 import { listGameEventProject } from '@/api/system/gameEventProject';
+import { getDefaultEvent } from '@/api/system/gameEvent';
 import { GameAthleteVO, GameAthleteQuery, GameAthleteForm } from '@/api/system/gameAthlete/types';
 import { GameTeamVO } from '@/api/system/gameTeam/types';
+import { GameEventVO } from '@/api/system/gameEvent/types';
 import { GameEventProjectVO } from '@/api/system/gameEventProject/types';
 
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
+const { sys_user_sex } = toRefs<any>(proxy?.useDict('sys_user_sex'));
+const defaultEvent = ref<GameEventVO | null>(null); // 默认赛事信息
+
 
 const gameTeamList = ref<GameTeamVO[]>([]); // 队伍列表
 const gameAthleteList = ref<GameAthleteVO[]>([]);
@@ -225,11 +210,11 @@ const initFormData: GameAthleteForm = {
   remark: undefined
 };
 const data = reactive<PageData<GameAthleteForm, GameAthleteQuery>>({
-  form: { ...initFormData },
+  form: { ...initFormData, eventId: undefined },
   queryParams: {
     pageNum: 1,
     pageSize: 10,
-    eventId: undefined,
+    eventId: undefined,  // 会自动设置为默认赛事ID
     eventName: undefined,
     teamId: undefined,
     teamName: undefined,
@@ -247,38 +232,32 @@ const data = reactive<PageData<GameAthleteForm, GameAthleteQuery>>({
     athleteCode: [{ required: true, message: '运动员编号不能为空', trigger: 'blur' }],
     gender: [{ required: true, message: '性别不能为空', trigger: 'blur' }],
     age: [{ required: true, message: '年龄不能为空', trigger: 'blur' }]
-    // idCard: [
-    //   { required: true, message: "证件号不能为空", trigger: "blur" }
-    // ],
-    // chipCode: [
-    //   { required: true, message: "芯片号不能为空", trigger: "blur" }
-    // ],
-    // phone: [
-    //   { required: true, message: "手机号不能为空", trigger: "blur" }
-    // ],
-    // location: [
-    //   { required: true, message: "居住地址不能为空", trigger: "blur" }
-    // ],
-    // tshirtSize: [
-    //   { required: true, message: "T恤尺码不能为空", trigger: "blur" }
-    // ],
-    // groupType: [
-    //   { required: true, message: "组别不能为空", trigger: "change" }
-    // ],
-    // number: [
-    //   { required: true, message: "号码不能为空", trigger: "blur" }
-    // ],
-    // projectValue: [
-    //   { required: true, message: "参与项目列表不能为空", trigger: "blur" }
-    // ],
-    // status: [
-    //   { required: true, message: "状态不能为空", trigger: "change" }
-    // ],
+  }
+});
+
+// 添加额外的ref用于处理默认事件ID
+const defaultEventId = computed(() => defaultEvent.value?.eventId);
+
+// 监听默认事件变化
+watchEffect(() => {
+  if (defaultEventId.value) {
+    form.value.eventId = defaultEventId.value;
+    queryParams.value.eventId = defaultEventId.value;
   }
 });
 
 const { queryParams, form, rules } = toRefs(data);
 
+/** 获取默认赛事 */
+const getDefaultEventInfo = async () => {
+  try {
+    const res = await getDefaultEvent();
+    defaultEvent.value = res.data;
+  } catch (error) {
+    proxy?.$modal.msgError('获取默认赛事信息失败');
+  }
+};
+
 /** 获取队伍名称 */
 const getTeamNameById = (teamId: string | number) => {
   const team = gameTeamList.value.find((team) => team.teamId === teamId);
@@ -313,6 +292,12 @@ const formatProjectList = (projectValue: string) => {
 
 /** 查询参赛队员列表 */
 const getList = async () => {
+  if (!queryParams.value.eventId) {
+    proxy?.$modal.msgWarning('未获取到默认赛事信息');
+    loading.value = false;
+    return;
+  }
+  
   loading.value = true;
   const res = await listGameAthlete(queryParams.value);
   gameAthleteList.value = res.rows;
@@ -337,7 +322,7 @@ const cancel = () => {
 
 /** 表单重置 */
 const reset = () => {
-  form.value = { ...initFormData };
+  form.value = { ...initFormData, eventId: defaultEvent.value?.eventId };
   gameAthleteFormRef.value?.resetFields();
 };
 
@@ -350,6 +335,8 @@ const handleQuery = () => {
 /** 重置按钮操作 */
 const resetQuery = () => {
   queryFormRef.value?.resetFields();
+  // 保留默认赛事ID
+  queryParams.value.eventId = defaultEvent.value?.eventId;
   handleQuery();
 };
 
@@ -445,7 +432,9 @@ const handleExport = () => {
 };
 
 onMounted(() => {
-  getList();
-  getTeamList();
+  getDefaultEventInfo().then(() => {
+    getList();
+    getTeamList();
+  });
 });
 </script>

+ 103 - 58
src/views/system/gameEvent/edit.vue

@@ -93,7 +93,7 @@
             <el-row :gutter="20">
               <el-col :span="12">
                 <el-form-item label="是否默认赛事" prop="isDefault">
-                  <el-radio-group v-model="basicForm.isDefault">
+                  <el-radio-group v-model="basicForm.isDefault" >
                     <el-radio
                       v-for="dict in sys_yes_no"
                       :key="dict.value"
@@ -282,6 +282,18 @@
             </div>
             
             <el-table :data="configItems" border style="width: 100%">
+              <el-table-column label="配置类型" prop="configType" width="150">
+                <template #default="scope">
+                  <el-select v-model="scope.row.configType" placeholder="请选择配置类型" style="width: 100%">
+                    <el-option
+                      v-for="type in configTypes"
+                      :key="type.typeCode"
+                      :label="type.typeName"
+                      :value="type.typeCode"
+                    />
+                  </el-select>
+                </template>
+              </el-table-column>
               <el-table-column label="配置键" prop="configKey" width="200">
                 <template #default="scope">
                   <el-input v-model="scope.row.configKey" placeholder="请输入配置键" />
@@ -387,10 +399,12 @@
 </template>
 
 <script setup name="GameEventEdit" lang="ts">
-import { getGameEvent, addGameEvent, updateGameEvent } from '@/api/system/gameEvent';
+import { getGameEvent, addGameEvent, updateGameEvent,changeEventDefault } from '@/api/system/gameEvent';
 import { GameEventVO, GameEventForm } from '@/api/system/gameEvent/types';
 import { listGameEventConfig, addGameEventConfig, updateGameEventConfig, delGameEventConfig } from '@/api/system/gameEventConfig';
 import { GameEventConfigVO, GameEventConfigForm } from '@/api/system/gameEventConfig/types';
+import { listGameEventConfigType } from '@/api/system/gameEventConfigType'; // 添加导入
+import { GameEventConfigTypeVO } from '@/api/system/gameEventConfigType/types'; // 添加导入
 import { useRoute, useRouter } from 'vue-router';
 import { listGameEventMenu, addGameEventMenu, updateGameEventMenu, delGameEventMenu } from '@/api/system/gameEventMenu';
 import { GameEventMenuVO, GameEventMenuForm } from '@/api/system/gameEventMenu/types';
@@ -458,18 +472,20 @@ const basicRules = {
 // 初始化页面
 onMounted(async () => {
   const eventId = route.params.id as string;
-  if (eventId && eventId !== 'add') {
+  if (eventId) {
     isEdit.value = true;
     await loadEventData(eventId);
   } else {
     // 新增模式,加载图片配置模板
-    await loadImageConfigTemplates();
+    // await loadImageConfigTemplates();
   }
+  // 加载配置类型选项
+  await loadConfigTypes();
   // console.log('Initial image configs:', imageConfigItems.value); // 添加调试信息
 });
 
 // 加载赛事数据
-const loadEventData = async (eventId: string) => {
+const loadEventData = async (eventId: string | number) => {
   try {
     const res = await getGameEvent(eventId);
     const data = res.data;
@@ -498,11 +514,25 @@ const loadEventData = async (eventId: string) => {
   }
 };
 
+/** 状态修改  */
+const handleStatusChange = async (row: GameEventVO) => {
+  const text = row.isDefault === '0' ? '启用' : '停用';
+  try {
+    await proxy?.$modal.confirm('确认要"' + text + '""' + row.eventName + '"为默认赛事吗?');
+    await changeEventDefault(row.eventId, row.isDefault);
+    await loadEventData(row.eventId);
+    proxy?.$modal.msgSuccess(text + '成功');
+  } catch {
+    return;
+  } finally {
+    row.isDefault = row.isDefault === '0' ? '1' : '0';
+  }
+};
 
 // 赛事分组数据
 const groupItems = ref<GameEventGroupForm[]>([]);
 // 加载项目分组数据
-const loadGroupData = async (eventId: string) => {
+const loadGroupData = async (eventId: string | number) => {
   try {
     const res = await listGameEventGroup({
       eventId,
@@ -558,14 +588,13 @@ const saveGroupData = async (eventId: string) => {
 // 菜单列表数据
 const menuItems = ref<GameEventMenuForm[]>([]);
 // 加载菜单数据
-const loadMenuData = async (eventId: string) => {
+const loadMenuData = async (eventId: string | number) => {
   try {
     const res = await listGameEventMenu({
       eventId,
       pageNum: 1,
       pageSize: 1000
     });
-    // console.log('Menu response:', res);
     menuItems.value = Array.isArray(res.rows) ? res.rows : [];
   } catch (error) {
     proxy?.$modal.msgError('加载菜单数据失败');
@@ -603,12 +632,7 @@ const saveMenuData = async (eventId: string) => {
     for (const item of menuItems.value) {
       // 确保eventId被正确设置
       const menuData = { ...item, eventId };
-      // 如果是编辑模式且item中没有eventId,则手动添加
-      // if (!menuData.eventId) {
-      //   menuData.eventId = eventId;
-      // }
-      
-      // console.log('Menu data:', item);
+
       if (item.menuId) {
         // 更新现有菜单
         await updateGameEventMenu(menuData);
@@ -626,7 +650,7 @@ const saveMenuData = async (eventId: string) => {
 // 图片配置数据
 const imageConfigItems = ref<GameEventConfigForm[]>([]);
 // 加载图片配置数据(用于编辑模式)
-const loadImageConfigData = async (eventId: string) => {
+const loadImageConfigData = async (eventId: string | number) => {
   try {
     // 先查询所有image类型的配置模板(不限制eventId,获取所有可用的图片配置项)
     const templateRes = await listGameEventConfig({
@@ -635,11 +659,8 @@ const loadImageConfigData = async (eventId: string) => {
       pageSize: 100
     });
     
-    // console.log('Template response:', templateRes);
-    
     // 获取所有图片配置模板
     const allImageConfigs = Array.isArray(templateRes.rows) ? templateRes.rows : [];
-    // console.log('All image configs:', allImageConfigs);
     
     // 查询当前赛事的图片配置数据
     const eventRes = await listGameEventConfig({
@@ -650,8 +671,6 @@ const loadImageConfigData = async (eventId: string) => {
     });
     
     const eventImageConfigs = Array.isArray(eventRes.rows) ? eventRes.rows : [];
-    // console.log('Event image configs:', eventImageConfigs);
-    //console.log('Event image configs:', eventRes);
     
     // 合并配置:以模板为基础,用当前赛事的数据覆盖
     imageConfigItems.value = allImageConfigs.map(template => {
@@ -666,7 +685,6 @@ const loadImageConfigData = async (eventId: string) => {
       };
     });
     
-    // console.log('Final image config items:', imageConfigItems.value);
   } catch (error) {
     console.error('加载图片配置数据失败:', error);
     proxy?.$modal.msgError('加载图片配置数据失败: ' + (error as Error).message);
@@ -680,39 +698,40 @@ const refreshImageConfigs = async () => {
     await loadImageConfigData(eventId);
   } else {
     // 新增模式,只加载配置模板
-    await loadImageConfigTemplates();
+    // await loadImageConfigTemplates();
   }
 };
 // 加载图片配置模板(用于新增模式)
-const loadImageConfigTemplates = async () => {
-  try {
-    const res = await listGameEventConfig({
-      configType: 'IMAGE',
-      pageNum: 1,
-      pageSize: 100
-    });
-
-    // console.log('Template response (new mode):', res);
-
-    const imageData = Array.isArray(res.rows) ? res.rows : []; // 修改此处,确保正确访问数组数据
-    // console.log('Image data (new mode):', imageData);
-
-    imageConfigItems.value = imageData.map(item => ({
-      ...item,
-      configValue: item.configValue || '', // 确保 configValue 初始化正确
-      isEnabled: item.isEnabled || '0', // 确保 isEnabled 初始化正确
-      status: item.status || '0' // 确保 status 初始化正确
-    }));
-
-    // console.log('Image config items (new mode):', imageConfigItems.value);
-  } catch (error) {
-    console.error('加载图片配置模板失败:', error);
-    proxy?.$modal.msgError('加载图片配置模板失败: ' + (error as Error).message);
-    imageConfigItems.value = [];
-  }
-};
+// const loadImageConfigTemplates = async () => {
+//   try {
+//     const res = await listGameEventConfig({
+//       eventId: '',
+//       configType: 'IMAGE',
+//       pageNum: 1,
+//       pageSize: 100
+//     });
+
+//     // console.log('Template response (new mode):', res);
+
+//     const imageData = Array.isArray(res.rows) ? res.rows : []; // 修改此处,确保正确访问数组数据
+//     // console.log('Image data (new mode):', imageData);
+
+//     imageConfigItems.value = imageData.map(item => ({
+//       ...item,
+//       configValue: item.configValue || '', // 确保 configValue 初始化正确
+//       isEnabled: item.isEnabled || '0', // 确保 isEnabled 初始化正确
+//       status: item.status || '0' // 确保 status 初始化正确
+//     }));
+
+//     // console.log('Image config items (new mode):', imageConfigItems.value);
+//   } catch (error) {
+//     console.error('加载图片配置模板失败:', error);
+//     proxy?.$modal.msgError('加载图片配置模板失败: ' + (error as Error).message);
+//     imageConfigItems.value = [];
+//   }
+// };
 // 保存图片配置数据
-const saveImageConfigData = async (eventId?: string) => {
+const saveImageConfigData = async (eventId?: string | number) => {
   try {
     const targetEventId = eventId || route.params.id as string;
     const updates: GameEventConfigForm[] = [];
@@ -758,7 +777,7 @@ const handleTabClick = () => {
 // 项目数据
 const projectItems = ref<GameEventProjectForm[]>([]);
 // 加载项目数据
-const loadProjectData = async (eventId: string) => {
+const loadProjectData = async (eventId: string | number) => {
   try {
     const res = await listGameEventProject({
       eventId,
@@ -795,7 +814,7 @@ const removeProjectItem = (index: number) => {
   }
 };
 //保存项目数据
-const saveProjectData = async (eventId: string) => {
+const saveProjectData = async (eventId: string | number) => {
   try {
     for (const item of projectItems.value) {
       // 确保eventId被正确设置
@@ -818,8 +837,24 @@ const saveProjectData = async (eventId: string) => {
 
 // 配置信息数据
 const configItems = ref<GameEventConfigForm[]>([]);
+// 配置类型选项
+const configTypes = ref<GameEventConfigTypeVO[]>([]);
+
+// 加载配置类型数据
+const loadConfigTypes = async () => {
+  try {
+    const res = await listGameEventConfigType({
+      pageNum: 1,
+      pageSize: 1000
+    });
+    configTypes.value = Array.isArray(res.rows) ? res.rows : [];
+  } catch (error) {
+    proxy?.$modal.msgError('加载配置类型数据失败');
+  }
+};
+
 // 加载赛事配置数据
-const loadConfigData = async (eventId: string) => {
+const loadConfigData = async (eventId: string | number) => {
   try {
     const res = await listGameEventConfig({
       eventId,
@@ -828,17 +863,21 @@ const loadConfigData = async (eventId: string) => {
     });
     configItems.value = Array.isArray(res.rows) ? res.rows : [];
   } catch (error) {
-    proxy?.$modal.msgError('加载赛事配置数据失败');
+    console.error('加载赛事配置数据失败:', error);
+    proxy?.$modal.msgError('加载赛事配置数据失败: ' + (error as Error).message);
   }
 };
+
 // 添加配置项
 const addConfigItem = () => {
   configItems.value.push({
     configKey: '',
     configValue: '',
     configDesc: '',
+    configType: '', // 添加配置类型字段
   });
 };
+
 // 删除配置项
 const removeConfigItem = (index: number) => {
   const configItem = configItems.value[index];
@@ -850,8 +889,9 @@ const removeConfigItem = (index: number) => {
     configItems.value.splice(index, 1);
   }
 };
+
 // 保存赛事配置数据
-const saveconfigData = async (eventId: string) => {
+const saveconfigData = async (eventId: string | number) => {
   try {
     for (const item of configItems.value) {
       // 确保eventId被正确设置
@@ -875,7 +915,7 @@ const saveconfigData = async (eventId: string) => {
 // 参赛队伍数据
 const teamItems = ref<GameTeamForm[]>([]);
 // 加载队伍数据
-const loadTeamData = async (eventId: string) => {
+const loadTeamData = async (eventId: string | number) => {
   try {
     const res = await listGameTeam({
       eventId,
@@ -909,7 +949,7 @@ const removeTeamItem = (index: number) => {
   }
 };
 // 保存参赛队伍数据
-const saveTeamData = async (eventId: string) => {
+const saveTeamData = async (eventId: string | number) => {
   try {
     for (const item of teamItems.value) {
       // 确保eventId被正确设置
@@ -943,6 +983,10 @@ const saveEvent = async () => {
     };
 
     let savedEventId: string;
+    // 如果设置为默认赛事,则取消其他赛事的默认状态
+    if(basicForm.value.isDefault === '0'){
+      handleStatusChange({ eventId: basicForm.value.eventId, isDefault: basicForm.value.isDefault } as GameEventVO);
+    }
 
     // 保存基本信息
     if (isEdit.value) {
@@ -951,7 +995,8 @@ const saveEvent = async () => {
     } else {
       const addRes = await addGameEvent(formData);
       // 假设返回的数据中包含新创建的赛事ID
-      savedEventId = addRes.data?.eventId || route.params.id as string;
+      console.log('addRes', addRes);
+      savedEventId = addRes?.data as string;
     }
 
     // 保存图片配置数据

+ 19 - 24
src/views/system/gameEvent/index.vue

@@ -100,7 +100,8 @@
         <el-table-column label="举办单位" align="center" prop="unit" />
         <el-table-column label="是否默认赛事" align="center" prop="isDefault">
           <template #default="scope">
-            <dict-tag :options="sys_yes_no" :value="scope.row.isDefault"/>
+            <!-- <dict-tag :options="sys_yes_no" :value="scope.row.isDefault"/> -->
+             <el-switch v-model="scope.row.isDefault" active-value="0" inactive-value="1" @change="handleStatusChange(scope.row)"></el-switch>
           </template>
         </el-table-column>
         <el-table-column label="创建时间" align="center" prop="createTime" width="180">
@@ -170,7 +171,7 @@
 </template>
 
 <script setup name="GameEvent" lang="ts">
-import { listGameEvent, getGameEvent, delGameEvent, addGameEvent, updateGameEvent } from '@/api/system/gameEvent';
+import { listGameEvent, changeEventDefault, delGameEvent, addGameEvent, updateGameEvent } from '@/api/system/gameEvent';
 import { GameEventVO, GameEventQuery, GameEventForm } from '@/api/system/gameEvent/types';
 import { useRouter } from 'vue-router';
 import { ref } from 'vue';
@@ -247,27 +248,6 @@ const data = reactive<PageData<GameEventForm, GameEventQuery>>({
     eventType: [
       { required: true, message: "赛事类型不能为空", trigger: "change" }
     ],
-    // purpose: [
-    //   { required: true, message: "用途不能为空", trigger: "change" }
-    // ],
-    // startTime: [
-    //   { required: true, message: "开始时间不能为空", trigger: "blur" }
-    // ],
-    // endTime: [
-    //   { required: true, message: "结束时间不能为空", trigger: "blur" }
-    // ],
-    // eventUrl: [
-    //   { required: true, message: "赛事链接不能为空", trigger: "blur" }
-    // ],
-    // refereeUrl: [
-    //   { required: true, message: "裁判码不能为空", trigger: "blur" }
-    // ],
-    // isDefault: [
-    //   { required: true, message: "是否默认赛事不能为空", trigger: "change" }
-    // ],
-    // status: [
-    //   { required: true, message: "状态不能为空", trigger: "change" }
-    // ],
   }
 });
 
@@ -431,7 +411,7 @@ const handleAddParticipant = (row: GameEventVO) => {
   });
 };
 
-// 添加裁判按钮操作
+// 添加裁判按钮操作                                                                                                         1
 const handleAddReferee = async (row: GameEventVO) => {
   // 打开裁判表单对话框并传递 eventId
   refereeFormRef.value?.openDialog(String(row.eventId));
@@ -463,6 +443,21 @@ const openRankingBoard = (eventId: string) => {
   rankingBoardVisible.value = true;
 };
 
+/** 状态修改  */
+const handleStatusChange = async (row: GameEventVO) => {
+  const text = row.isDefault === '0' ? '启用' : '停用';
+  try {
+    await proxy?.$modal.confirm('确认要"' + text + '""' + row.eventName + '"为默认赛事吗?');
+    await changeEventDefault(row.eventId, row.isDefault);
+    await getList();
+    proxy?.$modal.msgSuccess(text + '成功');
+  } catch {
+    return;
+  } finally {
+    row.isDefault = row.isDefault === '0' ? '1' : '0';
+  }
+};
+
 onMounted(() => {
   getList();
 });

+ 30 - 12
src/views/system/gameEventConfig/index.vue

@@ -4,9 +4,6 @@
       <div v-show="showSearch" class="mb-[10px]">
         <el-card shadow="hover">
           <el-form ref="queryFormRef" :model="queryParams" :inline="true">
-            <el-form-item label="赛事ID" prop="eventId">
-              <el-input v-model="queryParams.eventId" placeholder="请输入赛事ID" clearable @keyup.enter="handleQuery" />
-            </el-form-item>
             <el-form-item label="配置描述" prop="configDesc">
               <el-input v-model="queryParams.configDesc" placeholder="请输入配置描述" clearable @keyup.enter="handleQuery" />
             </el-form-item>
@@ -54,7 +51,7 @@
       <el-table v-loading="loading" border :data="gameEventConfigList" @selection-change="handleSelectionChange">
         <el-table-column type="selection" width="55" align="center" />
         <el-table-column label="主键" align="center" prop="configId" v-if="true" />
-        <el-table-column label="赛事ID" align="center" prop="eventId" />
+        <!-- <el-table-column label="赛事ID" align="center" prop="eventId" /> -->
         <el-table-column label="配置类型" align="center" prop="configType" />
         <el-table-column label="配置键" align="center" prop="configKey" />
         <el-table-column label="配置值" align="center" prop="configValue" />
@@ -87,9 +84,6 @@
     <!-- 添加或修改赛事配置对话框 -->
     <el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
       <el-form ref="gameEventConfigFormRef" :model="form" :rules="rules" label-width="80px">
-        <el-form-item label="赛事ID" prop="eventId">
-          <el-input v-model="form.eventId" placeholder="请输入赛事ID" />
-        </el-form-item>
         <el-form-item label="配置键" prop="configKey">
           <el-input v-model="form.configKey" placeholder="请输入配置键" />
         </el-form-item>
@@ -133,10 +127,13 @@
 
 <script setup name="GameEventConfig" lang="ts">
 import { listGameEventConfig, getGameEventConfig, delGameEventConfig, addGameEventConfig, updateGameEventConfig } from '@/api/system/gameEventConfig';
+import { getDefaultEvent } from '@/api/system/gameEvent';
 import { GameEventConfigVO, GameEventConfigQuery, GameEventConfigForm } from '@/api/system/gameEventConfig/types';
+import { GameEventVO } from '@/api/system/gameEvent/types';
 
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
 const { game_event_status, game_yes_no } = toRefs<any>(proxy?.useDict('game_event_status', 'game_yes_no'));
+const defaultEvent = ref<GameEventVO | null>(null); // 默认赛事信息
 
 const gameEventConfigList = ref<GameEventConfigVO[]>([]);
 const buttonLoading = ref(false);
@@ -180,9 +177,6 @@ const data = reactive<PageData<GameEventConfigForm, GameEventConfigQuery>>({
     }
   },
   rules: {
-    eventId: [
-      { required: true, message: "赛事ID不能为空", trigger: "blur" }
-    ],
     configKey: [
       { required: true, message: "配置键不能为空", trigger: "blur" }
     ],
@@ -205,6 +199,12 @@ const { queryParams, form, rules } = toRefs(data);
 
 /** 查询赛事配置列表 */
 const getList = async () => {
+  if (!queryParams.value.eventId) {
+    proxy?.$modal.msgWarning('未获取到默认赛事信息');
+    loading.value = false;
+    return;
+  }
+  
   loading.value = true;
   const res = await listGameEventConfig(queryParams.value);
   gameEventConfigList.value = res.rows;
@@ -212,6 +212,20 @@ const getList = async () => {
   loading.value = false;
 }
 
+/** 获取默认赛事 */
+const getDefaultEventInfo = async () => {
+  try {
+    const res = await getDefaultEvent();
+    defaultEvent.value = res.data;
+    // 设置查询条件为默认赛事ID
+    queryParams.value.eventId = res.data.eventId;
+    // 设置表单的默认赛事ID
+    form.value.eventId = res.data.eventId;
+  } catch (error) {
+    proxy?.$modal.msgError('获取默认赛事信息失败');
+  }
+};
+
 /** 取消按钮 */
 const cancel = () => {
   reset();
@@ -220,7 +234,7 @@ const cancel = () => {
 
 /** 表单重置 */
 const reset = () => {
-  form.value = {...initFormData};
+  form.value = {...initFormData, eventId: defaultEvent.value?.eventId};
   gameEventConfigFormRef.value?.resetFields();
 }
 
@@ -233,6 +247,8 @@ const handleQuery = () => {
 /** 重置按钮操作 */
 const resetQuery = () => {
   queryFormRef.value?.resetFields();
+  // 保留默认赛事ID
+  queryParams.value.eventId = defaultEvent.value?.eventId;
   handleQuery();
 }
 
@@ -294,6 +310,8 @@ const handleExport = () => {
 }
 
 onMounted(() => {
-  getList();
+  getDefaultEventInfo().then(() => {
+    getList();
+  });
 });
 </script>

+ 38 - 3
src/views/system/gameEventConfigType/index.vue

@@ -55,7 +55,18 @@
         <el-table-column label="类型编码" align="center" prop="typeCode" />
         <el-table-column label="类型名称" align="center" prop="typeName" />
         <el-table-column label="类型描述" align="center" prop="typeDesc" />
-        <el-table-column label="排序字段" align="center" prop="sortField" />
+        <el-table-column label="排序" align="center" prop="sortField">
+          <template #default="scope">
+            <el-input-number 
+              v-model="scope.row.sortField" 
+              :min="0" 
+              :max="9999" 
+              controls-position="right" 
+              size="small"
+              @change="handleSortChange(scope.row)"
+            />
+          </template>
+        </el-table-column>
         <el-table-column label="是否启用" align="center" prop="isEnabled">
           <template #default="scope">
             <dict-tag :options="game_yes_no" :value="scope.row.isEnabled"/>
@@ -153,6 +164,7 @@ const data = reactive<PageData<GameEventConfigTypeForm, GameEventConfigTypeQuery
   queryParams: {
     pageNum: 1,
     pageSize: 10,
+    typeId: undefined,
     typeCode: undefined,
     typeName: undefined,
     typeDesc: undefined,
@@ -184,7 +196,12 @@ const { queryParams, form, rules } = toRefs(data);
 const getList = async () => {
   loading.value = true;
   const res = await listGameEventConfigType(queryParams.value);
-  gameEventConfigTypeList.value = res.rows;
+  // 根据sortField字段对数据进行排序
+  gameEventConfigTypeList.value = res.rows.sort((a, b) => {
+    const aSort = a.sortField !== undefined && a.sortField !== null ? Number(a.sortField) : 0;
+    const bSort = b.sortField !== undefined && b.sortField !== null ? Number(b.sortField) : 0;
+    return aSort - bSort;
+  });
   total.value = res.total;
   loading.value = false;
 }
@@ -229,7 +246,7 @@ const handleAdd = () => {
 
 /** 修改按钮操作 */
 const handleUpdate = async (row?: GameEventConfigTypeVO) => {
-  reset();
+  // reset();
   const _typeId = row?.typeId || ids.value[0]
   const res = await getGameEventConfigType(_typeId);
   Object.assign(form.value, res.data);
@@ -254,6 +271,24 @@ const submitForm = () => {
   });
 }
 
+/** 处理排序字段变更 */
+const handleSortChange = async (row: GameEventConfigTypeVO) => {
+  // 创建更新数据对象
+  const updateData = {
+    typeId: row.typeId,
+    sortField: row.sortField
+  };
+  
+  try {
+    await updateGameEventConfigType(updateData);
+    proxy?.$modal.msgSuccess("排序更新成功");
+    // 重新获取列表以确保排序正确
+    await getList();
+  } catch (error) {
+    proxy?.$modal.msgError("排序更新失败");
+  }
+}
+
 /** 删除按钮操作 */
 const handleDelete = async (row?: GameEventConfigTypeVO) => {
   const _typeIds = row?.typeId || ids.value;

+ 45 - 30
src/views/system/gameEventGroup/index.vue

@@ -4,9 +4,6 @@
       <div v-show="showSearch" class="mb-[10px]">
         <el-card shadow="hover">
           <el-form ref="queryFormRef" :model="queryParams" :inline="true">
-            <el-form-item label="赛事ID" prop="eventId">
-              <el-input v-model="queryParams.eventId" placeholder="请输入赛事ID" clearable @keyup.enter="handleQuery" />
-            </el-form-item>
             <el-form-item label="赛事组别" prop="groupName">
               <el-input v-model="queryParams.groupName" placeholder="请输入项目组名称" clearable @keyup.enter="handleQuery" />
             </el-form-item>
@@ -54,7 +51,7 @@
       <el-table v-loading="loading" border :data="gameEventGroupList" @selection-change="handleSelectionChange">
         <el-table-column type="selection" width="55" align="center" />
         <el-table-column label="主键" align="center" prop="groupId" v-if="false" />
-        <el-table-column label="赛事ID" align="center" prop="eventId" />
+        <!-- <el-table-column label="赛事ID" align="center" prop="eventId" /> -->
         <el-table-column label="赛事组别" align="center" prop="groupName" />
         <el-table-column label="包含项目" align="center" prop="projectList" />
         <el-table-column label="成员性别" align="center" prop="memberGender">
@@ -62,10 +59,6 @@
             {{ genderMap[scope.row.memberGender] || '未知' }}
           </template>
         </el-table-column>
-        <!-- <el-table-column label="排序字段" align="center" prop="sortOrder" /> -->
-        <!-- <el-table-column label="排序规则(0升序1降序)" align="center" prop="sortRule" /> -->
-        <!-- <el-table-column label="状态" align="center" prop="status" /> -->
-        <!-- <el-table-column label="备注" align="center" prop="remark" /> -->
         <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
           <template #default="scope">
             <el-tooltip content="修改" placement="top">
@@ -83,9 +76,6 @@
     <!-- 添加或修改赛事分组对话框 -->
     <el-dialog :title="dialog.title" v-model="dialog.visible" width="800px" append-to-body>
       <el-form ref="gameEventGroupFormRef" :model="form" :rules="rules" label-width="80px">
-        <el-form-item label="赛事ID" prop="eventId">
-          <el-input v-model="form.eventId" placeholder="请输入赛事ID" />
-        </el-form-item>
         <el-form-item label="项目组名称" prop="groupName">
           <el-input v-model="form.groupName" placeholder="请输入项目组名称" />
         </el-form-item>
@@ -106,12 +96,6 @@
             <el-option label="女" value="2"></el-option>
           </el-select>
         </el-form-item>
-        <!-- <el-form-item label="排序字段" prop="sortOrder">
-          <el-input v-model="form.sortOrder" placeholder="请输入排序字段" />
-        </el-form-item>
-        <el-form-item label="排序规则(0升序1降序)" prop="sortRule">
-          <el-input v-model="form.sortRule" placeholder="请输入排序规则(0升序1降序)" />
-        </el-form-item> -->
         <el-form-item label="备注" prop="remark">
           <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
         </el-form-item>
@@ -130,8 +114,10 @@
 import { nextTick, ref } from 'vue';
 import { listGameEventGroup, getGameEventGroup, delGameEventGroup, addGameEventGroup, updateGameEventGroup } from '@/api/system/gameEventGroup';
 import { listGameEventProject } from '@/api/system/gameEventProject';
+import { getDefaultEvent } from '@/api/system/gameEvent';
 import { GameEventGroupVO, GameEventGroupQuery, GameEventGroupForm } from '@/api/system/gameEventGroup/types';
 import { GameEventProjectVO } from '@/api/system/gameEventProject/types';
+import { GameEventVO } from '@/api/system/gameEvent/types';
 
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
 
@@ -144,6 +130,7 @@ const genderMap = {
 
 const gameEventGroupList = ref<GameEventGroupVO[]>([]);
 const gameEventProjectList = ref<Array<{ key: string; label: string }>>([]); // 赛事项目列表(用于穿梭框)
+const defaultEvent = ref<GameEventVO | null>(null); // 默认赛事信息
 const buttonLoading = ref(false);
 const loading = ref(true);
 const showSearch = ref(true);
@@ -178,28 +165,52 @@ const data = reactive<PageData<GameEventGroupForm, GameEventGroupQuery>>({
     pageNum: 1,
     pageSize: 10,
     eventId: undefined,
-    groupName: undefined,
-    projectList: undefined,
-    memberGender: undefined,
-    sortOrder: undefined,
-    sortRule: undefined,
-    status: undefined,
-    params: {}
+    // groupName: undefined,
+    // projectList: undefined,
+    // memberGender: undefined,
+    // sortOrder: undefined,
+    // sortRule: undefined,
+    // status: undefined,
+    // params: {}
   },
   rules: {
-    eventId: [{ required: true, message: '赛事ID不能为空', trigger: 'blur' }],
     groupName: [{ required: true, message: '项目组名称不能为空', trigger: 'blur' }],
     memberGender: [{ required: true, message: '成员性别不能为空', trigger: 'change' }]
-    // status: [
-    //   { required: true, message: "状态不能为空", trigger: "change" }
-    // ],
+  }
+});
+
+// 添加额外的ref用于处理默认事件ID
+const defaultEventId = computed(() => defaultEvent.value?.eventId);
+
+// 监听默认事件变化
+watchEffect(() => {
+  if (defaultEventId.value) {
+    form.value.eventId = defaultEventId.value;
+    queryParams.value.eventId = defaultEventId.value;
   }
 });
 
 const { queryParams, form, rules } = toRefs(data);
 
+
+/** 获取默认赛事 */
+const getDefaultEventInfo = async () => {
+  try {
+    const res = await getDefaultEvent();
+    defaultEvent.value = res.data;
+  } catch (error) {
+    proxy?.$modal.msgError('获取默认赛事信息失败');
+  }
+};
+
 /** 查询赛事分组列表 */
 const getList = async () => {
+  if (!queryParams.value.eventId) {
+    proxy?.$modal.msgWarning('未获取到默认赛事信息');
+    loading.value = false;
+    return;
+  }
+  
   loading.value = true;
   const res = await listGameEventGroup(queryParams.value);
   gameEventGroupList.value = res.rows;
@@ -228,7 +239,7 @@ const cancel = () => {
 
 /** 表单重置 */
 const reset = () => {
-  form.value = { ...initFormData };
+  form.value = { ...initFormData, eventId: defaultEvent.value?.eventId };
   gameEventGroupFormRef.value?.resetFields();
 };
 
@@ -241,6 +252,8 @@ const handleQuery = () => {
 /** 重置按钮操作 */
 const resetQuery = () => {
   queryFormRef.value?.resetFields();
+  // 保留默认赛事ID
+  queryParams.value.eventId = defaultEvent.value?.eventId;
   handleQuery();
 };
 
@@ -336,6 +349,8 @@ const handleExport = () => {
 };
 
 onMounted(() => {
-  getList();
+  getDefaultEventInfo().then(() => {
+    getList();
+  });
 });
 </script>

+ 36 - 26
src/views/system/gameEventProject/index.vue

@@ -4,9 +4,6 @@
       <div v-show="showSearch" class="mb-[10px]">
         <el-card shadow="hover">
           <el-form ref="queryFormRef" :model="queryParams" :inline="true">
-            <el-form-item label="赛事ID" prop="eventId">
-              <el-input v-model="queryParams.eventId" placeholder="请输入赛事ID" clearable @keyup.enter="handleQuery" />
-            </el-form-item>
             <el-form-item label="项目名称" prop="projectName">
               <el-input v-model="queryParams.projectName" placeholder="请输入项目名称" clearable @keyup.enter="handleQuery" />
             </el-form-item>
@@ -51,7 +48,6 @@
       <el-table v-loading="loading" border :data="gameEventProjectList" @selection-change="handleSelectionChange">
         <el-table-column type="selection" width="55" align="center" />
         <el-table-column label="主键" align="center" prop="projectId" v-if="false" />
-        <el-table-column label="赛事ID" align="center" prop="eventId" />
         <el-table-column label="项目名称" align="center" prop="projectName" />
         <el-table-column label="项目类型" align="center" prop="projectType">
           <template #default="scope">
@@ -107,9 +103,6 @@
     <!-- 添加或修改赛事项目对话框 -->
     <el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
       <el-form ref="gameEventProjectFormRef" :model="form" :rules="rules" label-width="80px">
-        <el-form-item label="赛事ID" prop="eventId">
-          <el-input v-model="form.eventId" placeholder="请输入赛事ID" />
-        </el-form-item>
         <el-form-item label="项目名称" prop="projectName">
           <el-input v-model="form.projectName" placeholder="请输入项目名称" />
         </el-form-item>
@@ -201,10 +194,12 @@
 <script setup name="GameEventProject" lang="ts">
 import { listGameEventProject, getGameEventProject, delGameEventProject, addGameEventProject, updateGameEventProject } from '@/api/system/gameEventProject';
 import { listGameEventGroup } from '@/api/system/gameEventGroup';
+import { getDefaultEvent } from '@/api/system/gameEvent';
 import { GameEventProjectVO, GameEventProjectQuery, GameEventProjectForm } from '@/api/system/gameEventProject/types';
 
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
 const { game_score_type, game_project_type } = toRefs<any>(proxy?.useDict('game_score_type', 'game_project_type'));
+const defaultEvent = ref<any | null>(null); // 默认赛事信息
 
 const gameEventGroupList = ref<any[]>([]); // 赛事分组列表
 
@@ -252,7 +247,7 @@ const data = reactive<PageData<GameEventProjectForm, GameEventProjectQuery>>({
   queryParams: {
     pageNum: 1,
     pageSize: 10,
-    eventId: undefined,
+    eventId: undefined
     // projectName: undefined,
     // projectType: undefined,
     // groupType: undefined,
@@ -275,31 +270,42 @@ const data = reactive<PageData<GameEventProjectForm, GameEventProjectQuery>>({
     groupType: [
       { required: true, message: "项目组别不能为空", trigger: "change" }
     ],
-    // refereeId: [
-    //   { required: true, message: "裁判员ID不能为空", trigger: "blur" }
-    // ],
     location: [
       { required: true, message: "比赛场地不能为空", trigger: "blur" }
     ],
-    // startTime: [
-    //   { required: true, message: "开始时间不能为空", trigger: "blur" }
-    // ],
-    // endTime: [
-    //   { required: true, message: "结束时间不能为空", trigger: "blur" }
-    // ],
-    // scoreValue: [
-    //   { required: true, message: "积分分值不能为空", trigger: "blur" }
-    // ],
-    // status: [
-    //   { required: true, message: "状态不能为空", trigger: "change" }
-    // ],
   }
 });
 
 const { queryParams, form, rules } = toRefs(data);
+  
+// 添加额外的ref用于处理默认事件ID
+const defaultEventId = computed(() => defaultEvent.value?.eventId);
+
+// 监听默认事件变化
+watchEffect(() => {
+  if (defaultEventId.value) {
+    form.value.eventId = defaultEventId.value;
+    queryParams.value.eventId = defaultEventId.value;
+  }
+});
+/** 获取默认赛事 */
+const getDefaultEventInfo = async () => {
+  try {
+    const res = await getDefaultEvent();
+    defaultEvent.value = res.data;
+  } catch (error) {
+    proxy?.$modal.msgError('获取默认赛事信息失败');
+  }
+};
 
 /** 查询赛事项目列表 */
 const getList = async () => {
+  if (!queryParams.value.eventId) {
+    proxy?.$modal.msgWarning('未获取到默认赛事信息');
+    loading.value = false;
+    return;
+  }
+    
   loading.value = true;
   const res = await listGameEventProject(queryParams.value);
   gameEventProjectList.value = res.rows;
@@ -324,7 +330,7 @@ const cancel = () => {
 
 /** 表单重置 */
 const reset = () => {
-  form.value = {...initFormData};
+  form.value = {...initFormData, eventId: defaultEvent.value?.eventId};
   gameEventProjectFormRef.value?.resetFields();
 }
 
@@ -337,6 +343,8 @@ const handleQuery = () => {
 /** 重置按钮操作 */
 const resetQuery = () => {
   queryFormRef.value?.resetFields();
+  // 保留默认赛事ID
+  queryParams.value.eventId = defaultEvent.value?.eventId;
   handleQuery();
 }
 
@@ -398,7 +406,9 @@ const handleExport = () => {
 }
 
 onMounted(() => {
-  getList();
-  getGroupList();
+  getDefaultEventInfo().then(() => {
+    getList();
+    getGroupList();
+  });
 });
 </script>

+ 32 - 53
src/views/system/gameEventSchedule/index.vue

@@ -4,20 +4,13 @@
       <template #header>
         <div class="flex items-center justify-between">
           <div class="flex items-center gap-4">
-            <el-select v-model="selectedEventId" placeholder="请选择赛事" @change="loadEventData">
-              <el-option
-                v-for="event in eventList"
-                :key="event.eventId"
-                :label="event.eventName"
-                :value="event.eventId"
-              />
-            </el-select>
-            <el-button type="primary" @click="loadEventData(selectedEventId)" :disabled="!selectedEventId">
-              加载赛事数据
+            <h3 class="text-lg font-bold">赛事日程安排</h3>
+            <el-button type="primary" @click="loadEventData()" :disabled="!defaultEvent.eventId">
+              加载默认赛事数据
             </el-button>
           </div>
           <div>
-            <el-button type="success" @click="exportSchedule" :disabled="!selectedEventId || scheduleData.length === 0">
+            <el-button type="success" @click="exportSchedule" :disabled="!defaultEvent.eventId || scheduleData.length === 0">
               导出日程表
             </el-button>
           </div>
@@ -25,22 +18,22 @@
       </template>
 
       <!-- 赛事信息展示 -->
-      <el-card v-if="currentEvent.eventId" class="mb-4" shadow="hover">
+      <el-card v-if="defaultEvent.eventId" class="mb-4" shadow="hover">
         <div class="flex items-center justify-between">
           <div>
-            <h3 class="text-lg font-bold">{{ currentEvent.eventName }}</h3>
+            <h3 class="text-lg font-bold">{{ defaultEvent.eventName }}</h3>
             <p class="text-gray-600">
-              比赛时间: {{ parseTime(currentEvent.startTime) }} 至 {{ parseTime(currentEvent.endTime) }}
+              比赛时间: {{ parseTime(defaultEvent.startTime) }} 至 {{ parseTime(defaultEvent.endTime) }}
             </p>
           </div>
           <div>
-            <p>赛事地点: {{ currentEvent.location }}</p>
+            <p>赛事地点: {{ defaultEvent.location }}</p>
           </div>
         </div>
       </el-card>
 
       <!-- 日程安排表单 -->
-      <el-card v-if="selectedEventId && projectGroups.length > 0" class="mb-4" shadow="hover">
+      <el-card v-if="defaultEvent.eventId && projectGroups.length > 0" class="mb-4" shadow="hover">
         <template #header>
           <span class="font-bold">项目分组与时间安排</span>
         </template>
@@ -173,8 +166,8 @@
 
 <script setup name="GameEventSchedule" lang="ts">
 import { ref, reactive, computed, onMounted } from 'vue'
-import { listGameEvent } from '@/api/system/gameEvent'
 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'
@@ -184,12 +177,8 @@ 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[]>([])
-// 选中的赛事ID
-const selectedEventId = ref<string | number>('')
-// 当前赛事信息
-const currentEvent = ref<GameEventVO>({} as GameEventVO)
+// 默认赛事信息
+const defaultEvent = ref<GameEventVO>({} as GameEventVO)
 // 项目分组(按项目类型分组)
 const projectGroups = ref<{type: string, projects: GameEventProjectVO[]}[]>([])
 // 活动的项目分组标签页
@@ -197,42 +186,27 @@ const activeGroupTab = ref('个人')
 // 日程数据(用于预览和导出)
 const scheduleData = ref<GameEventProjectVO[]>([])
 
-// 获取赛事列表
-const loadEventList = async () => {
+// 获取默认赛事
+const loadDefaultEvent = async () => {
   try {
-    const res = await listGameEvent({
-      pageNum: 1,
-      pageSize: 1000
-    })
-    eventList.value = res.rows
-    
-    // 如果赛事列表不为空,默认选择第一条赛事
-    if (eventList.value.length > 0 && !selectedEventId.value) {
-      selectedEventId.value = eventList.value[0].eventId
-      // 自动加载第一条赛事的数据
-      await loadEventData(selectedEventId.value)
-    }
+    const res = await getDefaultEvent()
+    defaultEvent.value = res.data
   } catch (error) {
-    ElMessage.error('加载赛事列表失败')
+    ElMessage.error('获取默认赛事失败')
   }
 }
 
 // 加载赛事数据
-const loadEventData = async (eventId: string | number) => {
-  if (!eventId) return
+const loadEventData = async () => {
+  if (!defaultEvent.value.eventId) {
+    ElMessage.warning('请先指定默认赛事')
+    return
+  }
   
   try {
-    // 获取赛事基本信息
-    const eventRes = await listGameEvent({
-      eventId: eventId,
-      pageNum: 1,
-      pageSize: 1000
-    })
-    currentEvent.value = eventRes.rows[0] || ({} as GameEventVO)
-    
     // 获取赛事项目
     const projectRes = await listGameEventProject({
-      eventId: eventId,
+      eventId: defaultEvent.value.eventId,
       pageNum: 1,
       pageSize: 1000
     })
@@ -332,7 +306,7 @@ const saveSchedule = async () => {
         groupNum: project.groupNum,
         participateNum: project.participateNum,
         //其他字段
-        eventId: selectedEventId.value,
+        eventId: defaultEvent.value.eventId,
         projectName: project.projectName,
         projectType: project.projectType,
         groupType: project.groupType,
@@ -368,7 +342,7 @@ const deleteSchedule = async (project: GameEventProjectVO) => {
       groupNum: project.groupNum,
       participateNum: project.participateNum,
       //其他字段
-      eventId: selectedEventId.value,
+      eventId: defaultEvent.value.eventId,
       projectName: project.projectName,
       projectType: project.projectType,
       groupType: project.groupType,
@@ -428,7 +402,7 @@ const exportSchedule = () => {
   const link = document.createElement('a')
   const url = URL.createObjectURL(blob)
   link.setAttribute('href', url)
-  link.setAttribute('download', `赛事日程安排_${currentEvent.value.eventName}_${parseTime(new Date(), '{y}{m}{d}')}.csv`)
+  link.setAttribute('download', `赛事日程安排_${defaultEvent.value.eventName}_${parseTime(new Date(), '{y}{m}{d}')}.csv`)
   link.style.visibility = 'hidden'
   document.body.appendChild(link)
   link.click()
@@ -436,7 +410,12 @@ const exportSchedule = () => {
 }
 
 onMounted(() => {
-  loadEventList()
+  loadDefaultEvent().then(() => {
+    // 自动加载默认赛事数据
+    if (defaultEvent.value.eventId) {
+      loadEventData()
+    }
+  })
 })
 </script>
 

+ 36 - 11
src/views/system/gameReferee/index.vue

@@ -4,9 +4,6 @@
       <div v-show="showSearch" class="mb-[10px]">
         <el-card shadow="hover">
           <el-form ref="queryFormRef" :model="queryParams" :inline="true">
-            <el-form-item label="赛事ID" prop="eventId">
-              <el-input v-model="queryParams.eventId" placeholder="请输入赛事ID" clearable @keyup.enter="handleQuery" />
-            </el-form-item>
             <el-form-item label="裁判姓名" prop="name">
               <el-input v-model="queryParams.name" placeholder="请输入裁判姓名" clearable @keyup.enter="handleQuery" />
             </el-form-item>
@@ -40,7 +37,7 @@
 
       <el-table v-loading="loading" border :data="gameRefereeList" @selection-change="handleSelectionChange">
         <el-table-column type="selection" width="55" align="center" />
-        <el-table-column label="赛事ID" align="center" prop="eventId" />
+        <!-- <el-table-column label="赛事ID" align="center" prop="eventId" /> -->
         <el-table-column label="裁判ID" align="center" prop="refereeId" v-if="true" />
         <el-table-column label="裁判姓名" align="center" prop="name" />
         <el-table-column label="账号" align="center" prop="account" />
@@ -74,9 +71,6 @@
     <!-- 添加或修改裁判对话框 -->
     <el-dialog :title="dialog.title" v-model="dialog.visible" width="800px" append-to-body>
       <el-form ref="gameRefereeFormRef" :model="form" :rules="rules" label-width="80px">
-        <el-form-item label="赛事ID" prop="eventId">
-          <el-input v-model="form.eventId" placeholder="请输入赛事ID" />
-        </el-form-item>
         <el-form-item label="裁判姓名" prop="name">
           <el-input v-model="form.name" placeholder="请输入裁判姓名" />
         </el-form-item>
@@ -127,8 +121,11 @@ import { listGameReferee, getGameReferee, delGameReferee, addGameReferee, update
 import { listGameEventProject } from '@/api/system/gameEventProject';
 import { GameRefereeVO, GameRefereeQuery, GameRefereeForm } from '@/api/system/gameReferee/types';
 import { toDataURL } from 'qrcode';
+import { getDefaultEvent } from '@/api/system/gameEvent';
+import { GameEventVO } from '@/api/system/gameEvent/types';
 
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
+const defaultEvent = ref<GameEventVO | null>(null); // 默认赛事信息
 
 const gameRefereeList = ref<GameRefereeVOExt[]>([]);
 const buttonLoading = ref(false);
@@ -196,13 +193,37 @@ const rules = {
   password: [
     { required: true, message: "密码不能为空", trigger: "blur" }
   ],
-  // status: [
-  //   { required: true, message: "状态不能为空", trigger: "change" }
-  // ],
 }
 
+// 添加额外的ref用于处理默认事件ID
+const defaultEventId = computed(() => defaultEvent.value?.eventId);
+
+// 监听默认事件变化
+watchEffect(() => {
+  if (defaultEventId.value) {
+    form.eventId = defaultEventId.value;
+    queryParams.eventId = defaultEventId.value;
+  }
+});
+
+/** 获取默认赛事 */
+const getDefaultEventInfo = async () => {
+  try {
+    const res = await getDefaultEvent();
+    defaultEvent.value = res.data;
+  } catch (error) {
+    proxy?.$modal.msgError('获取默认赛事信息失败');
+  }
+};
+
 /** 查询裁判列表 */
 const getList = async () => {
+  if (!queryParams.eventId) {
+    proxy?.$modal.msgWarning('未获取到默认赛事信息');
+    loading.value = false;
+    return;
+  }
+
   loading.value = true;
   const res = await listGameReferee(queryParams);
   
@@ -266,6 +287,8 @@ const handleQuery = () => {
 /** 重置按钮操作 */
 const resetQuery = () => {
   queryFormRef.value?.resetFields();
+  // 保留默认赛事ID
+  queryParams.eventId = defaultEvent.value?.eventId;
   handleQuery();
 }
 
@@ -404,6 +427,8 @@ const handleExport = () => {
 }
 
 onMounted(() => {
-  getList();
+  getDefaultEventInfo().then(() => {
+    getList();
+  });
 });
 </script>

+ 85 - 63
src/views/system/gameScore/index.vue

@@ -4,7 +4,7 @@
       <div v-show="showSearch" class="mb-[10px]">
         <el-card shadow="hover">
           <el-form ref="queryFormRef" :model="queryParams" :inline="true">
-            <el-form-item label="赛事" prop="eventId">
+            <!-- <el-form-item label="赛事" prop="eventId">
               <el-select v-model="queryParams.eventId" placeholder="请选择赛事" clearable filterable @change="handleEventChange">
                 <el-option
                   v-for="event in eventList"
@@ -13,7 +13,7 @@
                   :value="event.eventId">
                 </el-option>
               </el-select>
-            </el-form-item>
+            </el-form-item> -->
             <el-form-item label="项目" prop="projectId">
               <el-select v-model="queryParams.projectId" placeholder="请选择项目" clearable filterable>
                 <el-option
@@ -96,7 +96,7 @@
 
 <script setup name="GameScore" lang="ts">
 import { listGameScore, getGameScore, delGameScore, addGameScore, updateGameScore } from '@/api/system/gameScore';
-import { listGameEvent } from '@/api/system/gameEvent';
+import { getDefaultEvent } from '@/api/system/gameEvent'
 import { listGameEventProject } from '@/api/system/gameEventProject';
 import { GameScoreVO, GameScoreQuery, GameScoreForm } from '@/api/system/gameScore/types';
 import { GameEventVO, GameEventQuery } from '@/api/system/gameEvent/types';
@@ -105,7 +105,8 @@ import { GameEventProjectVO, GameEventProjectQuery } from '@/api/system/gameEven
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
 const router = useRouter();
 
-
+// 默认赛事信息
+const defaultEvent = ref<GameEventVO>({} as GameEventVO)
 const gameScoreList = ref<GameScoreVO[]>([]);
 
 const buttonLoading = ref(false);
@@ -117,7 +118,7 @@ const multiple = ref(true);
 const total = ref(0);
 
 // 下拉框数据
-const eventList = ref<GameEventVO[]>([]);
+// const eventList = ref<GameEventVO[]>([]);
 const projectList = ref<GameEventProjectVO[]>([]);
 
 const queryFormRef = ref<ElFormInstance>();
@@ -144,29 +145,44 @@ const data = reactive<PageData<GameScoreForm, GameScoreQuery>>({
     pageNum: 1,
     pageSize: 10,
     eventId: undefined,
-    projectId: undefined,
-    athleteId: undefined,
-    teamId: undefined,
-    statusFlag: undefined,
-    params: {
-    }
+    // projectId: undefined,
+    // athleteId: undefined,
+    // teamId: undefined,
+    // statusFlag: undefined,
+    // params: {}
   },
   rules: {}
 });
 
 const { queryParams, form, rules } = toRefs(data);
+// 添加额外的ref用于处理默认事件ID
+const defaultEventId = computed(() => defaultEvent.value?.eventId);
 
-// const projectListWithStatus = computed(() => {
-//   return projectList.value.map(project => ({
-//     ...project,
-//     status: getScoreStatus(project.projectId)
-//   }));
-// });
-
+// 监听默认事件变化
+watchEffect(() => {
+  if (defaultEventId.value) {
+    form.value.eventId = defaultEventId.value;
+    queryParams.value.eventId = defaultEventId.value;
+  }
+});
 
+// 获取默认赛事
+const getDefaultEventInfo = async () => {
+  try {
+    const res = await getDefaultEvent()
+    defaultEvent.value = res.data
+  } catch (error) {
+    ElMessage.error('获取默认赛事失败')
+  }
+}
 
 /** 查询成绩列表 */
 const getList = async () => {
+  if (!queryParams.value.eventId) {
+    proxy?.$modal.msgWarning('未指定默认赛事');
+    loading.value = false;
+    return;
+  }
   // loading.value = true;
   const res = await listGameScore(queryParams.value);
   gameScoreList.value = res.rows;
@@ -175,22 +191,22 @@ const getList = async () => {
 }
 
 /** 查询所有赛事列表 */
-const getEventList = async () => {
-  const res = await listGameEvent({
-    // status: '0', // 只查询正常状态的赛事
-    pageNum: 1,
-    pageSize: 1000
-  } as GameEventQuery);
-  eventList.value = res.rows;
+// const getEventList = async () => {
+//   const res = await listGameEvent({
+//     // status: '0', // 只查询正常状态的赛事
+//     pageNum: 1,
+//     pageSize: 1000
+//   } as GameEventQuery);
+//   eventList.value = res.rows;
   
-  // 如果有赛事数据,默认选择第一个
-  if (res.rows && res.rows.length > 0) {
-    queryParams.value.eventId = res.rows[0].eventId;
-    // 触发赛事变更事件,加载相关项目、队伍、运动员数据
-    handleEventChange(queryParams.value.eventId);
-    await getScoreStatus(queryParams.value.projectId);
-  }
-}
+//   // 如果有赛事数据,默认选择第一个
+//   if (res.rows && res.rows.length > 0) {
+//     queryParams.value.eventId = res.rows[0].eventId;
+//     // 触发赛事变更事件,加载相关项目、队伍、运动员数据
+//     handleEventChange(queryParams.value.eventId);
+//     await getScoreStatus(queryParams.value.projectId);
+//   }
+// }
 
 /** 根据赛事ID查询项目列表 */
 const getProjectList = async (eventId?: string | number) => {
@@ -206,31 +222,33 @@ const getProjectList = async (eventId?: string | number) => {
 
 
 /** 赛事变更事件 */
-const handleEventChange = async (eventId: string | number | undefined) => {
-  if (!eventId) {
-    // 清空相关下拉框数据
-    projectList.value = [];
-    return;
-  }
+// const handleEventChange = async (eventId: string | number | undefined) => {
+//   if (!eventId) {
+//     // 清空相关下拉框数据
+//     projectList.value = [];
+//     return;
+//   }
   
-  // 加载相关数据
-  await Promise.all([
-    getProjectList(eventId),
-  ]);
-}
-
-const getScoreStatus = async (projectId: string | number) => {
-  const score = await listGameScore({
-    projectId: projectId,
-    pageNum: 1,
-    pageSize: 100
-  });
-  if (!score || !score.rows.length) {
-    return '0';
-  }
-  return '1';
-};
+//   // 加载相关数据
+//   await Promise.all([
+//     getProjectList(eventId),
+//   ]);
+// }
 
+// const getScoreStatus = async (projectId: string | number) => {
+//   const score = await listGameScore({
+//     projectId: projectId,
+//     pageNum: 1,
+//     pageSize: 100
+//   });
+//   if (!score || !score.rows.length) {
+//     return '0';
+//   }
+//   return '1';
+// };
+/**
+ * 刷新数据
+ */
 const refreshData = async () => {
   await loadProjects();
 };
@@ -245,8 +263,13 @@ const exportNumberMapping = async () => {
 const exportScoresNames = async () => { 
   console.log('导出成绩逻辑待实现');
 };
+
+/**
+ * 加载项目列表
+ */
 const loadProjects = async () => {
   loading.value = true;
+  console.log('加载项目列表: ',queryParams.value);
   const res = await listGameEventProject(queryParams.value);
   projectList.value = res.rows;
   total.value = res.total;
@@ -260,12 +283,14 @@ const handleQuery = () => {
 /** 重置按钮操作 */
 const resetQuery = () => {
   queryFormRef.value?.resetFields();
+  // 保留默认赛事ID
+  queryParams.value.eventId = defaultEvent.value?.eventId;
   handleQuery();
 };
 
 /** 多选框选中数据 */
 const handleSelectionChange = (selection: GameScoreVO[]) => {
-  ids.value = selection.map(item => item.eventId); // 使用eventId作为标识
+  ids.value = selection.map(item => item.projectId); // 使用eventId作为标识
   single.value = selection.length != 1;
   multiple.value = !selection.length;
 }
@@ -282,12 +307,9 @@ const navigateToEditPage = (row: GameEventProjectVO) => {
 };
 
 onMounted(() => {
-  // 默认加载第一个赛事的数据
-  getEventList().then(() => {
-    if (eventList.value.length > 0) {
-      getList();
-    }
+  getDefaultEventInfo().then(() => {
+    getList();
+    refreshData();
   });
-  refreshData();
 });
 </script>

+ 49 - 59
src/views/system/gameTeam/index.vue

@@ -4,9 +4,6 @@
       <div v-show="showSearch" class="mb-[10px]">
         <el-card shadow="hover">
           <el-form ref="queryFormRef" :model="queryParams" :inline="true">
-            <el-form-item label="赛事ID" prop="eventId">
-              <el-input v-model="queryParams.eventId" placeholder="请输入赛事ID" clearable @keyup.enter="handleQuery" />
-            </el-form-item>
             <el-form-item label="队伍名称" prop="teamName">
               <el-input v-model="queryParams.teamName" placeholder="请输入队伍名称" clearable @keyup.enter="handleQuery" />
             </el-form-item>
@@ -47,14 +44,7 @@
         <el-table-column label="赛事ID" align="center" prop="eventId" />
         <el-table-column label="队伍名称" align="center" prop="teamName" />
         <el-table-column label="队伍编号" align="center" prop="teamCode" />
-        <!-- <el-table-column label="领队" align="center" prop="leader" />
-        <el-table-column label="队员列表" align="center" prop="athleteValue" />
-        <el-table-column label="参与项目列表" align="center" prop="projectValue" />
-        <el-table-column label="人数" align="center" prop="athleteNum" />
-        <el-table-column label="号码段" align="center" prop="numberRange" /> -->
         <el-table-column label="团队描述" align="center" prop="teamDescribe" />
-        <!-- <el-table-column label="状态" align="center" prop="status" /> -->
-        <!-- <el-table-column label="备注" align="center" prop="remark" /> -->
         <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
           <template #default="scope">
             <el-tooltip content="修改" placement="top">
@@ -81,27 +71,9 @@
         <el-form-item label="队伍编号" prop="teamCode">
           <el-input v-model="form.teamCode" placeholder="请输入队伍编号" />
         </el-form-item>
-        <!-- <el-form-item label="领队" prop="leader">
-          <el-input v-model="form.leader" placeholder="请输入领队" />
-        </el-form-item>
-        <el-form-item label="队员列表" prop="athleteValue">
-          <el-input v-model="form.athleteValue" placeholder="请输入队员列表" />
-        </el-form-item>
-        <el-form-item label="参与项目列表" prop="projectValue">
-          <el-input v-model="form.projectValue" placeholder="请输入参与项目列表" />
-        </el-form-item>
-        <el-form-item label="人数" prop="athleteNum">
-          <el-input v-model="form.athleteNum" placeholder="请输入人数" />
-        </el-form-item>
-        <el-form-item label="号码段" prop="numberRange">
-          <el-input v-model="form.numberRange" placeholder="请输入号码段" />
-        </el-form-item> -->
         <el-form-item label="团队描述" prop="teamDescribe">
           <el-input v-model="form.teamDescribe" placeholder="请输入团队描述" />
         </el-form-item>
-        <!-- <el-form-item label="备注" prop="remark">
-            <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
-        </el-form-item> -->
       </el-form>
       <template #footer>
         <div class="dialog-footer">
@@ -115,9 +87,12 @@
 
 <script setup name="GameTeam" lang="ts">
 import { listGameTeam, getGameTeam, delGameTeam, addGameTeam, updateGameTeam } from '@/api/system/gameTeam';
+import { getDefaultEvent } from '@/api/system/gameEvent';
 import { GameTeamVO, GameTeamQuery, GameTeamForm } from '@/api/system/gameTeam/types';
+import { GameEventVO } from '@/api/system/gameEvent/types';
 
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
+const defaultEvent = ref<GameEventVO | null>(null); // 默认赛事信息
 
 const gameTeamList = ref<GameTeamVO[]>([]);
 const buttonLoading = ref(false);
@@ -155,50 +130,61 @@ const data = reactive<PageData<GameTeamForm, GameTeamQuery>>({
     pageNum: 1,
     pageSize: 10,
     eventId: undefined,
-    teamName: undefined,
-    teamCode: undefined,
-    leader: undefined,
-    athleteValue: undefined,
-    projectValue: undefined,
-    athleteNum: undefined,
-    numberRange: undefined,
-    teamDescribe: undefined,
-    status: undefined,
-    params: {
-    }
+    // teamName: undefined,
+    // teamCode: undefined,
+    // leader: undefined,
+    // athleteValue: undefined,
+    // projectValue: undefined,
+    // athleteNum: undefined,
+    // numberRange: undefined,
+    // teamDescribe: undefined,
+    // status: undefined,
+    // params: {
+    // }
   },
   rules: {
+    teamName: [
+      { required: true, message: "队伍名称不能为空", trigger: "blur" }
+    ],
     teamCode: [
       { required: true, message: "队伍编号不能为空", trigger: "blur" }
     ],
-    // leader: [
-    //   { required: true, message: "领队不能为空", trigger: "blur" }
-    // ],
-    // athleteValue: [
-    //   { required: true, message: "队员列表不能为空", trigger: "blur" }
-    // ],
-    // projectValue: [
-    //   { required: true, message: "参与项目列表不能为空", trigger: "blur" }
-    // ],
-    // athleteNum: [
-    //   { required: true, message: "人数不能为空", trigger: "blur" }
-    // ],
-    // numberRange: [
-    //   { required: true, message: "号码段不能为空", trigger: "blur" }
-    // ],
     teamDescribe: [
       { required: true, message: "团队描述不能为空", trigger: "blur" }
     ],
-    // status: [
-    //   { required: true, message: "状态不能为空", trigger: "change" }
-    // ],
   }
 });
 
 const { queryParams, form, rules } = toRefs(data);
 
+// 添加额外的ref用于处理默认事件ID
+const defaultEventId = computed(() => defaultEvent.value?.eventId);
+// 监听默认事件变化
+watchEffect(() => {
+  if (defaultEventId.value) {
+    form.value.eventId = defaultEventId.value;
+    queryParams.value.eventId = defaultEventId.value;
+  }
+});
+
+/** 获取默认赛事 */
+const getDefaultEventInfo = async () => {
+  try {
+    const res = await getDefaultEvent();
+    defaultEvent.value = res.data;
+  } catch (error) {
+    proxy?.$modal.msgError('获取默认赛事信息失败');
+  }
+};
+
 /** 查询参赛队伍列表 */
 const getList = async () => {
+  if (!queryParams.value.eventId) {
+    proxy?.$modal.msgWarning('未获取到默认赛事信息');
+    loading.value = false;
+    return;
+  }
+
   loading.value = true;
   const res = await listGameTeam(queryParams.value);
   gameTeamList.value = res.rows;
@@ -214,7 +200,7 @@ const cancel = () => {
 
 /** 表单重置 */
 const reset = () => {
-  form.value = {...initFormData};
+  form.value = {...initFormData, eventId: defaultEvent.value?.eventId};
   gameTeamFormRef.value?.resetFields();
 }
 
@@ -227,6 +213,8 @@ const handleQuery = () => {
 /** 重置按钮操作 */
 const resetQuery = () => {
   queryFormRef.value?.resetFields();
+  // 保留默认赛事ID
+  queryParams.value.eventId = defaultEvent.value?.eventId;
   handleQuery();
 }
 
@@ -288,6 +276,8 @@ const handleExport = () => {
 }
 
 onMounted(() => {
-  getList();
+  getDefaultEventInfo().then(() => {
+    getList();
+  });
 });
 </script>