Browse Source

feat(system): 为游戏事件相关页面添加列显隐功能

- 在 gameAthlete、gameEvent、gameEventConfig、gameEventConfigType 和 gameEventGroup 页面中添加列显隐功能
- 通过 columns 数组控制每列的显示状态
- 在模板中根据 columns 数组的 visible 属性动态显示列
- 优化部分页面的查询逻辑,移除不必要的默认赛事获取操作
zhou 2 weeks ago
parent
commit
df14c27d4f

+ 59 - 42
src/views/system/gameAthlete/index.vue

@@ -53,42 +53,41 @@
           <el-col :span="1.5">
             <el-button type="info" plain icon="Upload" @click="handleImport" v-hasPermi="['system:gameAthlete:import']"> 导入 </el-button>
           </el-col>
-          <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
+          <right-toolbar v-model:showSearch="showSearch" :columns="columns" @queryTable="getList"></right-toolbar>
         </el-row>
       </template>
 
       <el-table v-loading="loading" border :data="gameAthleteList" @selection-change="handleSelectionChange">
         <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="赛事名称" 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">
+        <el-table-column label="主键" align="center" prop="athleteId" v-if="columns[0].visible" />
+        <el-table-column label="赛事名称" align="center" prop="eventName" width="120px" v-if="columns[1].visible" />
+        <el-table-column label="运动员编号" align="center" prop="athleteCode" width="100px" v-if="columns[2].visible" />
+        <el-table-column label="姓名" align="center" prop="name" v-if="columns[3].visible" />
+        <el-table-column label="性别" align="center" prop="gender" v-if="columns[4].visible">
           <template #default="scope">
             <dict-tag :options="sys_user_sex" :value="scope.row.gender" />
           </template>
         </el-table-column>
-        <el-table-column label="年龄" align="center" prop="age" />
-        <el-table-column label="参与项目" align="center" prop="projectValue" width="200px">
+        <el-table-column label="年龄" align="center" prop="age" v-if="columns[5].visible" />
+        <el-table-column label="参与项目" align="center" prop="projectValue" width="200px" v-if="columns[6].visible">
           <template #default="scope">
             {{ formatProjectList(scope.row.projectValue) }}
           </template>
         </el-table-column>
-        <el-table-column label="证件号" align="center" prop="idCard" />
-        <el-table-column label="队伍" align="center" prop="teamId">
+        <el-table-column label="证件号" align="center" prop="idCard" v-if="columns[7].visible" />
+        <el-table-column label="队伍" align="center" prop="teamId" v-if="columns[8].visible">
           <template #default="scope">
             {{ getTeamNameById(scope.row.teamId) }}
           </template>
         </el-table-column>
-        <el-table-column label="芯片号" align="center" prop="chipCode" />
-        <el-table-column label="手机号" align="center" prop="phone" />
-        <el-table-column label="居住地址" align="center" prop="location" />
-        <el-table-column label="T恤尺码" align="center" prop="tshirtSize" />
-        <el-table-column label="组别" align="center" prop="groupType" />
-        <el-table-column label="号码" align="center" prop="number" />
-        <el-table-column label="状态" align="center" prop="status" />
-        <el-table-column label="备注" align="center" prop="remark" />
+        <el-table-column label="芯片号" align="center" prop="chipCode" v-if="columns[9].visible" />
+        <el-table-column label="手机号" align="center" prop="phone" v-if="columns[10].visible" />
+        <el-table-column label="居住地址" align="center" prop="location" v-if="columns[11].visible" />
+        <el-table-column label="T恤尺码" align="center" prop="tshirtSize" v-if="columns[12].visible" />
+        <el-table-column label="组别" align="center" prop="groupType" v-if="columns[13].visible" />
+        <el-table-column label="号码" align="center" prop="number" v-if="columns[14].visible" />
+        <el-table-column label="状态" align="center" prop="status" v-if="columns[15].visible" />
+        <el-table-column label="备注" align="center" prop="remark" v-if="columns[16].visible" />
         <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right">
           <template #default="scope">
             <el-tooltip content="修改" placement="top">
@@ -193,7 +192,7 @@ 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 { 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';
@@ -214,6 +213,27 @@ const single = ref(true);
 const multiple = ref(true);
 const total = ref(0);
 
+// 列显隐数据
+const columns = ref<FieldOption[]>([
+  { key: 0, label: '主键', visible: false },
+  { key: 1, label: '赛事名称', visible: true },
+  { key: 2, label: '运动员编号', visible: true },
+  { key: 3, label: '姓名', visible: true },
+  { key: 4, label: '性别', visible: true },
+  { key: 5, label: '年龄', visible: true },
+  { key: 6, label: '参与项目', visible: true },
+  { key: 7, label: '证件号', visible: true },
+  { key: 8, label: '队伍', visible: true },
+  { key: 9, label: '芯片号', visible: true },
+  { key: 10, label: '手机号', visible: true },
+  { key: 11, label: '居住地址', visible: true },
+  { key: 12, label: 'T恤尺码', visible: true },
+  { key: 13, label: '组别', visible: true },
+  { key: 14, label: '号码', visible: true },
+  { key: 15, label: '状态', visible: true },
+  { key: 16, label: '备注', visible: true },
+]);
+
 const queryFormRef = ref<ElFormInstance>();
 const gameAthleteFormRef = ref<ElFormInstance>();
 const uploadRef = ref<ElUploadInstance>();
@@ -280,7 +300,6 @@ const data = reactive<PageData<GameAthleteForm, GameAthleteQuery>>({
     isAsc: ''
   },
   rules: {
-    userId: [{ required: true, message: '用户ID不能为空', trigger: 'blur' }],
     teamId: [{ required: true, message: '队伍ID不能为空', trigger: 'blur' }],
     athleteCode: [{ required: true, message: '运动员编号不能为空', trigger: 'blur' }],
     gender: [{ required: true, message: '性别不能为空', trigger: 'blur' }],
@@ -302,14 +321,14 @@ watchEffect(() => {
 const { queryParams, form, rules } = toRefs(data);
 
 /** 获取默认赛事 */
-const getDefaultEventInfo = async () => {
-  try {
-    const res = await getDefaultEvent();
-    defaultEvent.value = res.data;
-  } catch (error) {
-    proxy?.$modal.msgError('获取默认赛事信息失败');
-  }
-};
+// const getDefaultEventInfo = async () => {
+//   try {
+//     const res = await getDefaultEvent();
+//     defaultEvent.value = res.data;
+//   } catch (error) {
+//     proxy?.$modal.msgError('获取默认赛事信息失败');
+//   }
+// };
 
 /** 获取队伍名称 */
 const getTeamNameById = (teamId: string | number) => {
@@ -320,7 +339,7 @@ const getTeamNameById = (teamId: string | number) => {
 // 获取赛事项目列表
 const getProjectList = async (eventId?: string) => {
   const res = await listGameEventProject({
-    eventId: eventId || String(form.value.eventId),
+    // eventId: eventId || String(form.value.eventId),
     pageNum: 1,
     pageSize: 1000,
     orderByColumn: '',
@@ -347,11 +366,11 @@ const formatProjectList = (projectValue: string) => {
 
 /** 查询参赛队员列表 */
 const getList = async () => {
-  if (!queryParams.value.eventId) {
-    proxy?.$modal.msgWarning('未获取到默认赛事信息');
-    loading.value = false;
-    return;
-  }
+  // if (!queryParams.value.eventId) {
+  //   proxy?.$modal.msgWarning('未获取到默认赛事信息');
+  //   loading.value = false;
+  //   return;
+  // }
 
   loading.value = true;
   const res = await listGameAthlete(queryParams.value);
@@ -379,7 +398,7 @@ const cancel = () => {
 
 /** 表单重置 */
 const reset = () => {
-  form.value = { ...initFormData, eventId: defaultEvent.value?.eventId };
+  form.value = { ...initFormData };
   gameAthleteFormRef.value?.resetFields();
 };
 
@@ -392,8 +411,8 @@ const handleQuery = () => {
 /** 重置按钮操作 */
 const resetQuery = () => {
   queryFormRef.value?.resetFields();
-  // 保留默认赛事ID
-  queryParams.value.eventId = defaultEvent.value?.eventId;
+  // // 保留默认赛事ID
+  // queryParams.value.eventId = defaultEvent.value?.eventId;
   handleQuery();
 };
 
@@ -521,9 +540,7 @@ const importTemplate = () => {
 };
 
 onMounted(() => {
-  getDefaultEventInfo().then(() => {
-    getList();
-    getTeamList();
-  });
+  getList();
+  getTeamList();
 });
 </script>

+ 37 - 18
src/views/system/gameEvent/index.vue

@@ -56,68 +56,68 @@
           <el-col :span="1.5">
             <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['system:gameEvent:export']">导出 </el-button>
           </el-col>
-          <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
+          <right-toolbar v-model:showSearch="showSearch" :columns="columns" @queryTable="getList"></right-toolbar>
         </el-row>
       </template>
 
       <el-table v-loading="loading" border :data="gameEventList" @selection-change="handleSelectionChange">
         <el-table-column type="selection" width="55" align="center" />
-        <el-table-column label="主键" align="center" prop="eventId" v-if="false" />
-        <el-table-column label="赛事编号" align="center" prop="eventCode" />
-        <el-table-column label="赛事名称" align="center" prop="eventName" />
-        <el-table-column label="赛事类型" align="center" prop="eventType">
+        <el-table-column label="主键" align="center" prop="eventId" v-if="columns[0].visible" />
+        <el-table-column label="赛事编号" align="center" prop="eventCode" v-if="columns[1].visible" />
+        <el-table-column label="赛事名称" align="center" prop="eventName" v-if="columns[2].visible" />
+        <el-table-column label="赛事类型" align="center" prop="eventType" v-if="columns[3].visible">
           <template #default="scope">
             <dict-tag :options="game_event_type" :value="scope.row.eventType" />
           </template>
         </el-table-column>
-        <el-table-column label="举办地点" align="center" prop="location" />
-        <el-table-column label="用途" align="center" prop="purpose">
+        <el-table-column label="举办地点" align="center" prop="location" v-if="columns[4].visible" />
+        <el-table-column label="用途" align="center" prop="purpose" v-if="columns[5].visible">
           <template #default="scope">
             <dict-tag :options="game_event_purpose" :value="scope.row.purpose" />
           </template>
         </el-table-column>
-        <el-table-column label="开始时间" align="center" prop="startTime" width="180">
+        <el-table-column label="开始时间" align="center" prop="startTime" width="180" v-if="columns[6].visible">
           <template #default="scope">
             <span>{{ parseTime(scope.row.startTime, '{y}-{m}-{d}') }}</span>
           </template>
         </el-table-column>
-        <el-table-column label="结束时间" align="center" prop="endTime" width="180">
+        <el-table-column label="结束时间" align="center" prop="endTime" width="180" v-if="columns[7].visible">
           <template #default="scope">
             <span>{{ parseTime(scope.row.endTime, '{y}-{m}-{d}') }}</span>
           </template>
         </el-table-column>
-        <el-table-column label="赛事链接" align="center" prop="eventUrlUrl" width="100">
+        <el-table-column label="赛事链接" align="center" prop="eventUrlUrl" width="100" v-if="columns[8].visible">
           <template #default="scope">
             <image-preview :src="scope.row.eventUrlUrl" :width="50" :height="50" />
           </template>
         </el-table-column>
-        <el-table-column label="裁判码" align="center" prop="refereeUrlUrl" width="100">
+        <el-table-column label="裁判码" align="center" prop="refereeUrlUrl" width="100" v-if="columns[9].visible">
           <template #default="scope">
             <image-preview :src="scope.row.refereeUrlUrl" :width="50" :height="50" />
           </template>
         </el-table-column>
-        <el-table-column label="举办单位" align="center" prop="unit" />
-        <el-table-column label="是否默认赛事" align="center" prop="isDefault">
+        <el-table-column label="举办单位" align="center" prop="unit" v-if="columns[10].visible" />
+        <el-table-column label="是否默认赛事" align="center" prop="isDefault" v-if="columns[11].visible">
           <template #default="scope">
             <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">
+        <el-table-column label="创建时间" align="center" prop="createTime" width="180" v-if="columns[12].visible">
           <template #default="scope">
             <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
           </template>
         </el-table-column>
-        <el-table-column label="更新时间" align="center" prop="updateTime" width="180">
+        <el-table-column label="更新时间" align="center" prop="updateTime" width="180" v-if="columns[13].visible">
           <template #default="scope">
             <span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d}') }}</span>
           </template>
         </el-table-column>
-        <el-table-column label="状态" align="center" prop="status">
+        <el-table-column label="状态" align="center" prop="status" v-if="columns[14].visible">
           <template #default="scope">
             <dict-tag :options="game_event_status" :value="scope.row.status" />
           </template>
         </el-table-column>
-        <el-table-column label="备注" align="center" prop="remark" />
+        <el-table-column label="备注" align="center" prop="remark" v-if="columns[15].visible" />
         <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right">
           <template #default="scope">
             <el-tooltip content="修改" placement="top">
@@ -199,7 +199,6 @@ import { ref } from 'vue';
 import RefereeForm from '@/views/system/gameEvent/RefereeForm.vue';
 import RankingBoard from './RankingBoard.vue';
 import { useTagsViewStore } from '@/store/modules/tagsView';
-import { useTagsViewStore } from '@/store/modules/tagsView';
 
 const router = useRouter();
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
@@ -223,6 +222,26 @@ const single = ref(true);
 const multiple = ref(true);
 const total = ref(0);
 
+// 列显隐数据
+const columns = ref<FieldOption[]>([
+  { key: 0, label: '主键', visible: false },
+  { key: 1, label: '赛事编号', visible: true },
+  { key: 2, label: '赛事名称', visible: true },
+  { key: 3, label: '赛事类型', visible: true },
+  { key: 4, label: '举办地点', visible: true },
+  { key: 5, label: '用途', visible: true },
+  { key: 6, label: '开始时间', visible: true },
+  { key: 7, label: '结束时间', visible: true },
+  { key: 8, label: '赛事链接', visible: true },
+  { key: 9, label: '裁判码', visible: true },
+  { key: 10, label: '举办单位', visible: true },
+  { key: 11, label: '是否默认赛事', visible: true },
+  { key: 12, label: '创建时间', visible: true },
+  { key: 13, label: '更新时间', visible: true },
+  { key: 14, label: '状态', visible: true },
+  { key: 15, label: '备注', visible: true }
+]);
+
 const queryFormRef = ref<ElFormInstance>();
 const gameEventFormRef = ref<ElFormInstance>();
 

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

@@ -44,29 +44,29 @@
           <el-col :span="1.5">
             <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['system:gameEventConfig:export']">导出</el-button>
           </el-col>
-          <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
+          <right-toolbar v-model:showSearch="showSearch" :columns="columns" @queryTable="getList"></right-toolbar>
         </el-row>
       </template>
 
       <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="主键" align="center" prop="configId" v-if="columns[0].visible" />
         <!-- <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" />
-        <el-table-column label="配置描述" align="center" prop="configDesc" />
-        <el-table-column label="是否启用" align="center" prop="isEnabled">
+        <el-table-column label="配置类型" align="center" prop="configType" v-if="columns[1].visible" />
+        <el-table-column label="配置键" align="center" prop="configKey" v-if="columns[2].visible" />
+        <el-table-column label="配置值" align="center" prop="configValue" v-if="columns[3].visible" />
+        <el-table-column label="配置描述" align="center" prop="configDesc" v-if="columns[4].visible" />
+        <el-table-column label="是否启用" align="center" prop="isEnabled" v-if="columns[5].visible">
           <template #default="scope">
             <dict-tag :options="game_yes_no" :value="scope.row.isEnabled"/>
           </template>
         </el-table-column>
-        <el-table-column label="状态" align="center" prop="status">
+        <el-table-column label="状态" align="center" prop="status" v-if="columns[6].visible">
           <template #default="scope">
             <dict-tag :options="game_event_status" :value="scope.row.status"/>
           </template>
         </el-table-column>
-        <el-table-column label="备注" align="center" prop="remark" />
+        <el-table-column label="备注" align="center" prop="remark" v-if="columns[7].visible" />
         <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
           <template #default="scope">
             <el-tooltip content="修改" placement="top">
@@ -144,6 +144,18 @@ const single = ref(true);
 const multiple = ref(true);
 const total = ref(0);
 
+// 列显隐数据
+const columns = ref<FieldOption[]>([
+  { key: 0, label: '主键', visible: true },
+  { key: 1, label: '配置类型', visible: true },
+  { key: 2, label: '配置键', visible: true },
+  { key: 3, label: '配置值', visible: true },
+  { key: 4, label: '配置描述', visible: true },
+  { key: 5, label: '是否启用', visible: true },
+  { key: 6, label: '状态', visible: true },
+  { key: 7, label: '备注', visible: true }
+]);
+
 const queryFormRef = ref<ElFormInstance>();
 const gameEventConfigFormRef = ref<ElFormInstance>();
 
@@ -173,8 +185,9 @@ const data = reactive<PageData<GameEventConfigForm, GameEventConfigQuery>>({
     configDesc: undefined,
     isEnabled: undefined,
     status: undefined,
-    params: {
-    }
+    params: {},
+    orderByColumn: '',
+    isAsc: ''
   },
   rules: {
     configKey: [
@@ -192,7 +205,7 @@ const data = reactive<PageData<GameEventConfigForm, GameEventConfigQuery>>({
     status: [
       { required: true, message: "状态不能为空", trigger: "change" }
     ],
-  }
+  },
 });
 
 const { queryParams, form, rules } = toRefs(data);

+ 21 - 9
src/views/system/gameEventConfigType/index.vue

@@ -45,34 +45,35 @@
           <el-col :span="1.5">
             <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['system:gameEventConfigType:export']">导出</el-button>
           </el-col>
-          <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
+          <right-toolbar v-model:showSearch="showSearch" :columns="columns" @queryTable="getList"></right-toolbar>
         </el-row>
       </template>
 
       <el-table v-loading="loading" border :data="gameEventConfigTypeList" @selection-change="handleSelectionChange">
         <el-table-column type="selection" width="55" align="center" />
-        <el-table-column label="主键" align="center" prop="typeId" v-if="false" />
-        <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="typeId" v-if="columns[0].visible" />
+        <el-table-column label="类型编码" align="center" prop="typeCode" v-if="columns[1].visible" />
+        <el-table-column label="类型名称" align="center" prop="typeName" v-if="columns[2].visible" />
+        <el-table-column label="类型描述" align="center" prop="typeDesc" v-if="columns[3].visible" />
+        <el-table-column label="排序" align="center" prop="sortField" v-if="columns[4].visible">
           <template #default="scope">
             <el-input-number 
-              v-model="scope.row.sortField" 
+              :model-value="Number(scope.row.sortField)" 
               :min="0" 
               :max="9999" 
               controls-position="right" 
               size="small"
               @change="handleSortChange(scope.row)"
+              @update:model-value="(value) => scope.row.sortField = String(value)"
             />
           </template>
         </el-table-column>
-        <el-table-column label="是否启用" align="center" prop="isEnabled">
+        <el-table-column label="是否启用" align="center" prop="isEnabled" v-if="columns[5].visible">
           <template #default="scope">
             <dict-tag :options="game_yes_no" :value="scope.row.isEnabled"/>
           </template>
         </el-table-column>
-        <el-table-column label="备注" align="center" prop="remark" />
+        <el-table-column label="备注" align="center" prop="remark" v-if="columns[6].visible" />
         <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
           <template #default="scope">
             <el-tooltip content="修改" placement="top">
@@ -141,6 +142,17 @@ const single = ref(true);
 const multiple = ref(true);
 const total = ref(0);
 
+// 列显隐数据
+const columns = ref<FieldOption[]>([
+  { key: 0, label: '主键', visible: false },
+  { key: 1, label: '类型编码', visible: true },
+  { key: 2, label: '类型名称', visible: true },
+  { key: 3, label: '类型描述', visible: true },
+  { key: 4, label: '排序', visible: true },
+  { key: 5, label: '是否启用', visible: true },
+  { key: 6, label: '备注', visible: true }
+]);
+
 const queryFormRef = ref<ElFormInstance>();
 const gameEventConfigTypeFormRef = ref<ElFormInstance>();
 

+ 19 - 41
src/views/system/gameEventGroup/index.vue

@@ -44,17 +44,17 @@
           <el-col :span="1.5">
             <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['system:gameEventGroup:export']">导出 </el-button>
           </el-col>
-          <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
+          <right-toolbar v-model:showSearch="showSearch" :columns="columns" @queryTable="getList"></right-toolbar>
         </el-row>
       </template>
 
       <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="主键" align="center" prop="groupId" v-if="columns[0].visible" />
         <!-- <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">
+        <el-table-column label="赛事组别" align="center" prop="groupName" v-if="columns[1].visible" />
+        <el-table-column label="包含项目" align="center" prop="projectList" v-if="columns[2].visible" />
+        <el-table-column label="成员性别" align="center" prop="memberGender" v-if="columns[3].visible">
           <template #default="scope">
             {{ genderMap[scope.row.memberGender] || '未知' }}
           </template>
@@ -111,13 +111,10 @@
 </template>
 
 <script setup name="GameEventGroup" lang="ts">
-import { nextTick, ref } from 'vue';
+import { nextTick, ref, onMounted } 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;
 
@@ -130,7 +127,6 @@ 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);
@@ -139,6 +135,14 @@ const single = ref(true);
 const multiple = ref(true);
 const total = ref(0);
 
+// 列显隐数据
+const columns = ref<FieldOption[]>([
+  { key: 0, label: '主键', visible: false },
+  { key: 1, label: '赛事组别', visible: true },
+  { key: 2, label: '包含项目', visible: true },
+  { key: 3, label: '成员性别', visible: true },
+]);
+
 const queryFormRef = ref<ElFormInstance>();
 const gameEventGroupFormRef = ref<ElFormInstance>();
 
@@ -164,7 +168,6 @@ const data = reactive<PageData<GameEventGroupForm, GameEventGroupQuery>>({
   queryParams: {
     pageNum: 1,
     pageSize: 10,
-    eventId: undefined,
     orderByColumn: '',
     isAsc: ''
   },
@@ -176,24 +179,8 @@ const data = reactive<PageData<GameEventGroupForm, GameEventGroupQuery>>({
 
 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;
@@ -202,9 +189,8 @@ const getList = async () => {
 };
 
 // 获取赛事项目列表
-const getProjectList = async (eventId?: string) => {
+const getProjectList = async () => {
   const res = await listGameEventProject({
-    eventId: eventId || String(form.value.eventId),
     pageNum: 1,
     pageSize: 1000,
     orderByColumn: '',
@@ -224,7 +210,7 @@ const cancel = () => {
 
 /** 表单重置 */
 const reset = () => {
-  form.value = { ...initFormData, eventId: defaultEvent.value?.eventId };
+  form.value = { ...initFormData };
   gameEventGroupFormRef.value?.resetFields();
 };
 
@@ -237,8 +223,6 @@ const handleQuery = () => {
 /** 重置按钮操作 */
 const resetQuery = () => {
   queryFormRef.value?.resetFields();
-  // 保留默认赛事ID
-  queryParams.value.eventId = defaultEvent.value?.eventId;
   handleQuery();
 };
 
@@ -256,9 +240,7 @@ const handleAdd = () => {
   dialog.title = '添加赛事分组';
   // 获取项目列表
   nextTick(() => {
-    if (form.value.eventId) {
-      getProjectList(String(form.value.eventId));
-    }
+    getProjectList();
   });
 };
 
@@ -280,9 +262,7 @@ const handleUpdate = async (row?: GameEventGroupVO) => {
   dialog.title = '修改赛事分组';
   // 获取项目列表
   nextTick(() => {
-    if (form.value.eventId) {
-      getProjectList(String(form.value.eventId));
-    }
+    getProjectList();
   });
 };
 
@@ -334,8 +314,6 @@ const handleExport = () => {
 };
 
 onMounted(() => {
-  getDefaultEventInfo().then(() => {
-    getList();
-  });
+  getList();
 });
 </script>

+ 76 - 85
src/views/system/gameEventProject/index.vue

@@ -40,46 +40,46 @@
           <el-col :span="1.5">
             <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['system:gameEventProject:export']">导出 </el-button>
           </el-col>
-          <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
+          <right-toolbar v-model:showSearch="showSearch" :columns="columns" @queryTable="getList"></right-toolbar>
         </el-row>
       </template>
 
       <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="项目名称" align="center" prop="projectName" />
-        <el-table-column label="项目类型" align="center" prop="projectType">
+        <el-table-column label="主键" align="center" prop="projectId" v-if="columns[0].visible" />
+        <el-table-column label="项目名称" align="center" prop="projectName" v-if="columns[1].visible" />
+        <el-table-column label="项目类型" align="center" prop="projectType" v-if="columns[2].visible">
           <template #default="scope">
             <dict-tag :options="game_project_type" :value="scope.row.projectType || ''" />
           </template>
         </el-table-column>
-        <el-table-column label="项目组别" align="center" prop="groupType" />
-        <el-table-column label="比赛场地" align="center" prop="location" />
-        <el-table-column label="计算规则" align="center" prop="scoreRule">
+        <el-table-column label="项目组别" align="center" prop="groupType" v-if="columns[3].visible" />
+        <el-table-column label="比赛场地" align="center" prop="location" v-if="columns[4].visible" />
+        <el-table-column label="计算规则" align="center" prop="scoreRule" v-if="columns[5].visible">
           <template #default="scope">
             <dict-tag :options="game_score_type" :value="scope.row.scoreRule || ''" />
           </template>
         </el-table-column>
-        <el-table-column label="开始时间" align="center" prop="startTime" width="180">
+        <el-table-column label="开始时间" align="center" prop="startTime" width="180" v-if="columns[6].visible">
           <template #default="scope">
             <span>{{ parseTime(scope.row.startTime, '{y}-{m}-{d}') }}</span>
           </template>
         </el-table-column>
-        <el-table-column label="结束时间" align="center" prop="endTime" width="180">
+        <el-table-column label="结束时间" align="center" prop="endTime" width="180" v-if="columns[7].visible">
           <template #default="scope">
             <span>{{ parseTime(scope.row.endTime, '{y}-{m}-{d}') }}</span>
           </template>
         </el-table-column>
-        <el-table-column label="裁判员ID" align="center" prop="refereeId" />
+        <el-table-column label="裁判员ID" align="center" prop="refereeId" v-if="columns[8].visible" />
         <!-- <el-table-column label="参赛组数" align="center" prop="groupNum" />
         <el-table-column label="参赛人数" align="center" prop="participateNum" /> -->
-        <el-table-column label="轮次" align="center" prop="roundType" />
-        <el-table-column label="排序方式" align="center" prop="orderType">
+        <el-table-column label="轮次" align="center" prop="roundType" v-if="columns[9].visible" />
+        <el-table-column label="排序方式" align="center" prop="orderType" v-if="columns[10].visible">
           <template #default="scope">
             {{ scope.row.orderType === '0' ? '升序' : '降序' }}
           </template>
         </el-table-column>
-        <el-table-column label="积分分值" align="center" prop="scoreValue" />
+        <el-table-column label="积分分值" align="center" prop="scoreValue" v-if="columns[11].visible" />
         <!-- <el-table-column label="奖项" align="center" prop="award" />
         <el-table-column label="计时点名称" align="center" prop="timePoint" />
         <el-table-column label="控制盒编号" align="center" prop="boxCode" />
@@ -187,12 +187,10 @@ import {
   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[]>([]); // 赛事分组列表
 
@@ -213,6 +211,22 @@ const dialog = reactive<DialogOption>({
   title: ''
 });
 
+// 列显隐数据
+const columns = ref<FieldOption[]>([
+  { key: 0, label: '主键', visible: false },
+  { key: 1, label: '项目名称', visible: true },
+  { key: 2, label: '项目类型', visible: true },
+  { key: 3, label: '项目组别', visible: true },
+  { key: 4, label: '比赛场地', visible: true },
+  { key: 5, label: '计算规则', visible: true },
+  { key: 6, label: '开始时间', visible: true },
+  { key: 7, label: '结束时间', visible: true },
+  { key: 8, label: '裁判员ID', visible: true },
+  { key: 9, label: '轮次', visible: true },
+  { key: 10, label: '排序方式', visible: true },
+  { key: 11, label: '积分分值', visible: true },
+]);
+
 const initFormData: GameEventProjectForm = {
   projectId: undefined,
   eventId: undefined,
@@ -240,18 +254,11 @@ const data = reactive<PageData<GameEventProjectForm, GameEventProjectQuery>>({
   queryParams: {
     pageNum: 1,
     pageSize: 10,
-    eventId: undefined
-    // projectName: undefined,
-    // projectType: undefined,
-    // groupType: undefined,
-    // startTime: undefined,
-    // orderType: undefined,
-    // status: undefined,
-    // params: {
-    // }
+    eventId: undefined,
+    orderByColumn: '',
+    isAsc: ''
   },
   rules: {
-    eventId: [{ required: true, message: '赛事ID不能为空', trigger: 'blur' }],
     projectName: [{ required: true, message: '项目名称不能为空', trigger: 'blur' }],
     projectType: [{ required: true, message: '项目类型不能为空', trigger: 'change' }],
     groupType: [{ required: true, message: '项目组别不能为空', trigger: 'change' }],
@@ -261,35 +268,8 @@ const data = reactive<PageData<GameEventProjectForm, GameEventProjectQuery>>({
 
 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;
@@ -297,13 +277,15 @@ const getList = async () => {
   loading.value = false;
 };
 
-// 获取赛事分组列表
-const getGroupList = async () => {
+/** 查询赛事分组列表 */
+const getGameEventGroupList = async () => {
   const res = await listGameEventGroup({
     pageNum: 1,
-    pageSize: 1000
+    pageSize: 1000,
+    orderByColumn: '',
+    isAsc: ''
   });
-  gameEventGroupList.value = res.rows || [];
+  gameEventGroupList.value = res.data;
 };
 
 /** 取消按钮 */
@@ -314,7 +296,7 @@ const cancel = () => {
 
 /** 表单重置 */
 const reset = () => {
-  form.value = { ...initFormData, eventId: defaultEvent.value?.eventId };
+  form.value = { ...initFormData };
   gameEventProjectFormRef.value?.resetFields();
 };
 
@@ -327,15 +309,13 @@ const handleQuery = () => {
 /** 重置按钮操作 */
 const resetQuery = () => {
   queryFormRef.value?.resetFields();
-  // 保留默认赛事ID
-  queryParams.value.eventId = defaultEvent.value?.eventId;
   handleQuery();
 };
 
 /** 多选框选中数据 */
-const handleSelectionChange = (selection: GameEventProjectVO[]) => {
-  ids.value = selection.map((item) => item.projectId);
-  single.value = selection.length != 1;
+const handleSelectionChange = (selection: any[]) => {
+  ids.value = selection.map(item => item.projectId);
+  single.value = selection.length !== 1;
   multiple.value = !selection.length;
 };
 
@@ -347,39 +327,51 @@ const handleAdd = () => {
 };
 
 /** 修改按钮操作 */
-const handleUpdate = async (row?: GameEventProjectVO) => {
+const handleUpdate = (row?: GameEventProjectVO) => {
   reset();
-  const _projectId = row?.projectId || ids.value[0];
-  const res = await getGameEventProject(_projectId);
-  Object.assign(form.value, res.data);
-  dialog.visible = true;
-  dialog.title = '修改赛事项目';
+  const projectId = row?.projectId || ids.value.at(0);
+  getGameEventProject(projectId).then(response => {
+    Object.assign(form.value, response.data);
+    dialog.visible = true;
+    dialog.title = '修改赛事项目';
+  });
 };
 
 /** 提交按钮 */
 const submitForm = () => {
-  gameEventProjectFormRef.value?.validate(async (valid: boolean) => {
+  gameEventProjectFormRef.value?.validate(valid => {
     if (valid) {
       buttonLoading.value = true;
-      if (form.value.projectId) {
-        await updateGameEventProject(form.value).finally(() => (buttonLoading.value = false));
+      if (form.value.projectId !== undefined) {
+        updateGameEventProject(form.value).then(response => {
+          proxy?.$modal.msgSuccess('修改成功');
+          dialog.visible = false;
+          getList();
+        }).finally(() => {
+          buttonLoading.value = false;
+        });
       } else {
-        await addGameEventProject(form.value).finally(() => (buttonLoading.value = false));
+        addGameEventProject(form.value).then(response => {
+          proxy?.$modal.msgSuccess('新增成功');
+          dialog.visible = false;
+          getList();
+        }).finally(() => {
+          buttonLoading.value = false;
+        });
       }
-      proxy?.$modal.msgSuccess('操作成功');
-      dialog.visible = false;
-      await getList();
     }
   });
 };
 
 /** 删除按钮操作 */
-const handleDelete = async (row?: GameEventProjectVO) => {
-  const _projectIds = row?.projectId || ids.value;
-  await proxy?.$modal.confirm('是否确认删除赛事项目编号为"' + _projectIds + '"的数据项?').finally(() => (loading.value = false));
-  await delGameEventProject(_projectIds);
-  proxy?.$modal.msgSuccess('删除成功');
-  await getList();
+const handleDelete = (row?: GameEventProjectVO) => {
+  const projectIds = row?.projectId || ids.value;
+  proxy?.$modal.confirm('是否确认删除赛事项目编号为"' + projectIds + '"的数据项?').then(function () {
+    return delGameEventProject(projectIds);
+  }).then(() => {
+    getList();
+    proxy?.$modal.msgSuccess('删除成功');
+  }).catch(() => {proxy?.$modal.msgSuccess('删除失败');});
 };
 
 /** 导出按钮操作 */
@@ -394,9 +386,8 @@ const handleExport = () => {
 };
 
 onMounted(() => {
-  getDefaultEventInfo().then(() => {
-    getList();
-    getGroupList();
-  });
+  getList();
+  getGameEventGroupList();
 });
+
 </script>

+ 4 - 2
src/views/system/gameEventSchedule/index.vue

@@ -6,7 +6,7 @@
           <div class="flex items-center gap-4">
             <h3 class="text-lg font-bold">赛事日程安排</h3>
             <el-button type="primary" @click="loadEventData()" :disabled="!defaultEvent.eventId">
-              加载默认赛事数据
+              加载赛事数据
             </el-button>
           </div>
           <div>
@@ -208,7 +208,9 @@ const loadEventData = async () => {
     const projectRes = await listGameEventProject({
       eventId: defaultEvent.value.eventId,
       pageNum: 1,
-      pageSize: 1000
+      pageSize: 1000,
+      orderByColumn: '',
+      isAsc: ''
     })
     
     // 按项目类型分组

+ 35 - 64
src/views/system/gameReferee/index.vue

@@ -31,24 +31,21 @@
           <el-col :span="1.5">
             <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['system:gameReferee:export']">导出</el-button>
           </el-col>
-          <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
+          <right-toolbar v-model:showSearch="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
         </el-row>
       </template>
 
       <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="refereeId" v-if="true" />
-        <el-table-column label="裁判姓名" align="center" prop="name" />
-        <el-table-column label="账号" align="center" prop="account" />
-        <el-table-column label="密码" align="center" prop="password" />
-        <!-- <el-table-column label="组别" align="center" prop="groupList" /> -->
-        <el-table-column label="项目" align="center">
+        <el-table-column label="裁判ID" align="center" prop="refereeId" v-if="columns[0].visible" />
+        <el-table-column label="裁判姓名" align="center" prop="name" v-if="columns[1].visible" />
+        <el-table-column label="账号" align="center" prop="account" v-if="columns[2].visible" />
+        <el-table-column label="密码" align="center" prop="password" v-if="columns[3].visible" />
+        <el-table-column label="项目" align="center" v-if="columns[4].visible">
           <template #default="scope">
             <span>{{ scope.row.projectNameList || '无' }}</span>
           </template>
         </el-table-column>
-        <!-- <el-table-column label="裁判码" align="center" prop="refereeCode" /> -->
         <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
           <template #default="scope">
             <el-tooltip content="修改" placement="top">
@@ -121,11 +118,8 @@ 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);
@@ -137,6 +131,15 @@ const multiple = ref(true);
 const total = ref(0);
 const allProjects = ref<{key: string, label: string }[]>([]); // 添加项目数据
 
+// 列显隐数据
+const columns = ref<FieldOption[]>([
+  { key: 0, label: '裁判ID', visible: true },
+  { key: 1, label: '裁判姓名', visible: true },
+  { key: 2, label: '账号', visible: true },
+  { key: 3, label: '密码', visible: true },
+  { key: 4, label: '项目', visible: true }
+]);
+
 const queryFormRef = ref<ElFormInstance>();
 const gameRefereeFormRef = ref<ElFormInstance>();
 
@@ -181,9 +184,10 @@ const form = reactive({
 const queryParams = reactive<GameRefereeQuery>({
   pageNum: 1,
   pageSize: 10,
-  eventId: undefined,
   name: undefined,
-  params: {}
+  params: {},
+  orderByColumn: '',
+  isAsc: ''
 });
 
 const rules = {
@@ -195,46 +199,22 @@ const rules = {
   ],
 }
 
-// 添加额外的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);
   
   // 为每个裁判添加项目名称列表用于展示
   for (const referee of res.rows) {
     if (referee.projectList) {
-      // 加载该项目对应的赛事的所有项目信息
-      const projectRes = await listGameEventProject({ 
-        eventId: referee.eventId,
+      // 加载所有项目信息
+      const projectRes = await listGameEventProject({
         pageNum: 1,
-        pageSize: 1000
+        pageSize: 1000,
+        orderByColumn: '',
+        isAsc: ''
       });
       
       // 获取项目ID数组
@@ -287,8 +267,6 @@ const handleQuery = () => {
 /** 重置按钮操作 */
 const resetQuery = () => {
   queryFormRef.value?.resetFields();
-  // 保留默认赛事ID
-  queryParams.eventId = defaultEvent.value?.eventId;
   handleQuery();
 }
 
@@ -300,15 +278,12 @@ const handleSelectionChange = (selection: GameRefereeVO[]) => {
 }
 
 /** 获取赛事项目列表 */
-const loadProjects = async (eventId: string | number) => {
-  // if (!eventId) {
-  //   allProjects.value = [];
-  //   return;
-  // }
-  const res = await listGameEventProject({ 
-    eventId: eventId,
+const loadProjects = async () => {
+  const res = await listGameEventProject({
     pageNum: 1,
-    pageSize: 1000
+    pageSize: 1000,
+    orderByColumn: '',
+    isAsc: ''
   });
   // 赛事项目穿梭框可选数据拼接
   allProjects.value = res.rows.map(item => ({
@@ -321,10 +296,7 @@ const loadProjects = async (eventId: string | number) => {
 /** 新增按钮操作 */
 const handleAdd = async () => {
   reset();
-  // 监听赛事ID变化,加载对应项目
-  watch(() => form.eventId, async (newVal) => {
-    await loadProjects(newVal);
-  }, { once: true });
+  await loadProjects();
   dialog.visible = true;
   dialog.title = "添加裁判";
 }
@@ -337,7 +309,7 @@ const handleUpdate = async (row?: GameRefereeVO) => {
   Object.assign(form, res.data);
   
   // 如果是修改操作,先加载项目列表
-  await loadProjects(form.eventId);
+  await loadProjects();
   
   // 处理项目列表数据格式,参考athlete.vue的实现方式
   if (res.data.projectList && typeof res.data.projectList === 'string') {
@@ -427,8 +399,7 @@ const handleExport = () => {
 }
 
 onMounted(() => {
-  getDefaultEventInfo().then(() => {
-    getList();
-  });
+  getList();
 });
-</script>
+
+</script>

+ 5 - 1
src/views/system/gameScore/gameScoreEdit.vue

@@ -207,12 +207,14 @@ const submitForm = () => {
 // 修改:加载运动员成绩列表方法,支持搜索
 const loadAthleteScores = async () => {
   loading.value = true;
-  const resAthletes = await listGameAthlete({ 
+  const resAthletes = await listGameAthlete({
     eventId: eventId,
     pageNum: queryParams.pageNum,
     pageSize: queryParams.pageSize,
     // 使用name属性替代keyword进行搜索
     name: searchValue.value,
+    orderByColumn: '',
+    isAsc: ''
   });
   const athletes = resAthletes.rows;
   total.value = resAthletes.total;
@@ -226,6 +228,8 @@ const loadAthleteScores = async () => {
         athleteId: athlete.athleteId,
         pageNum: queryParams.pageNum,
         pageSize: queryParams.pageSize,
+        orderByColumn: '',
+        isAsc: ''
       });
       const scores = resScores.rows;
 

+ 27 - 16
src/views/system/gameScore/index.vue

@@ -51,6 +51,7 @@
           <el-col :span="1.5">
             <el-button type="primary" @click="exportNumberMapping">导出号码对照表</el-button>
           </el-col>
+          <right-toolbar v-model:showSearch="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
         </el-row>
       </template>
       <!-- <el-dropdown>
@@ -67,10 +68,10 @@
 
       <el-table v-loading="loading" border :data="projectList" @selection-change="handleSelectionChange">
         <el-table-column type="selection" width="55" align="center" />
-        <el-table-column label="ID" align="center" prop="projectId" />
-        <el-table-column label="项目" align="center" prop="projectName" />
-        <el-table-column label="分组" align="center" prop="groupType" />
-        <el-table-column label="状态" align="center" prop="status">
+        <el-table-column label="ID" align="center" prop="projectId" v-if="columns[0].visible" />
+        <el-table-column label="项目" align="center" prop="projectName" v-if="columns[1].visible" />
+        <el-table-column label="分组" align="center" prop="groupType" v-if="columns[2].visible" />
+        <el-table-column label="状态" align="center" prop="status" v-if="columns[3].visible">
           <template #default="scope">
             <el-select v-model="scope.row.status" placeholder="请选择状态">
               <el-option label="等待处理" value="0"></el-option>
@@ -78,8 +79,8 @@
             </el-select>
           </template>
         </el-table-column>
-        <el-table-column label="比赛时间" align="center" prop="startTime" />
-        <el-table-column label="更新时间" align="center" prop="updateTime" />
+        <el-table-column label="比赛时间" align="center" prop="startTime" v-if="columns[4].visible" />
+        <el-table-column label="更新时间" align="center" prop="updateTime" v-if="columns[5].visible" />
         <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
           <template #default="scope">
             <el-tooltip content="修改成绩" placement="top">
@@ -117,6 +118,16 @@ const single = ref(true);
 const multiple = ref(true);
 const total = ref(0);
 
+// 列显隐数据
+const columns = ref<FieldOption[]>([
+  { key: 0, label: 'ID', visible: false },
+  { key: 1, label: '项目', visible: true },
+  { key: 2, label: '分组', visible: true },
+  { key: 3, label: '状态', visible: true },
+  { key: 4, label: '比赛时间', visible: true },
+  { key: 5, label: '更新时间', visible: true },
+]);
+
 // 下拉框数据
 // const eventList = ref<GameEventVO[]>([]);
 const projectList = ref<GameEventProjectVO[]>([]);
@@ -206,16 +217,16 @@ const getList = async () => {
 // }
 
 /** 根据赛事ID查询项目列表 */
-const getProjectList = async (eventId?: string | number) => {
-  if (!eventId) return;
-  const res = await listGameEventProject({
-    eventId: eventId,
-    // status: '0', // 只查询正常状态的项目
-    pageNum: 1,
-    pageSize: 1000
-  } as GameEventProjectQuery);
-  projectList.value = res.rows;
-}
+// const getProjectList = async (eventId?: string | number) => {
+//   if (!eventId) return;
+//   const res = await listGameEventProject({
+//     eventId: eventId,
+//     // status: '0', // 只查询正常状态的项目
+//     pageNum: 1,
+//     pageSize: 1000
+//   } as GameEventProjectQuery);
+//   projectList.value = res.rows;
+// }
 
 
 /** 赛事变更事件 */

+ 52 - 29
src/views/system/gameTeam/index.vue

@@ -41,18 +41,26 @@
           <el-col :span="1.5">
             <el-button type="info" plain icon="Upload" @click="handleImport" v-hasPermi="['system:gameTeam:import']"> 导入 </el-button>
           </el-col>
-          <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
+          <right-toolbar v-model:showSearch="showSearch" :columns="columns" @queryTable="getList"></right-toolbar>
         </el-row>
       </template>
 
       <el-table v-loading="loading" border :data="gameTeamList" @selection-change="handleSelectionChange">
         <el-table-column type="selection" width="55" align="center" />
-        <el-table-column label="主键" align="center" prop="teamId" v-if="false" />
-        <el-table-column label="队伍编号" align="center" prop="teamCode" />
-        <!--        <el-table-column label="赛事ID" align="center" prop="eventId" />-->
-        <el-table-column label="赛事名称" align="center" prop="eventName" />
-        <el-table-column label="队伍名称" align="center" prop="teamName" />
-        <el-table-column label="团队描述" align="center" prop="teamDescribe" />
+        <el-table-column label="主键" align="center" prop="teamId" v-if="columns[0].visible" />
+        <el-table-column label="队伍编号" align="center" prop="teamCode" v-if="columns[1].visible" />
+        <el-table-column label="赛事名称" align="center" prop="eventName" v-if="columns[2].visible" />
+        <el-table-column label="队伍名称" align="center" prop="teamName" v-if="columns[3].visible" />
+        <el-table-column label="团队描述" align="center" prop="teamDescribe" v-if="columns[4].visible" />
+        <el-table-column label="领队" align="center" prop="leader" v-if="columns[5].visible" />
+        <el-table-column label="人数" align="center" prop="athleteNum" v-if="columns[6].visible" />
+        <el-table-column label="号码段" align="center" prop="numberRange" v-if="columns[7].visible" />
+        <el-table-column label="状态" align="center" prop="status" v-if="columns[8].visible">
+          <template #default="scope">
+            <dict-tag :options="sys_normal_disable" :value="scope.row.status"/>
+          </template>
+        </el-table-column>
+        <el-table-column label="备注" align="center" prop="remark" v-if="columns[9].visible" />
         <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
           <template #default="scope">
             <el-tooltip content="修改" placement="top">
@@ -134,13 +142,14 @@
 
 <script setup name="GameTeam" lang="ts">
 import { listGameTeam, getGameTeam, delGameTeam, addGameTeam, updateGameTeam } from '@/api/system/gameTeam';
-import { getDefaultEvent } from '@/api/system/gameEvent';
+// import { getDefaultEvent } from '@/api/system/gameEvent';
 import { GameTeamVO, GameTeamQuery, GameTeamForm } from '@/api/system/gameTeam/types';
 import { getEventIdNameMap } from '@/api/system/gameEvent';
 import { globalHeaders } from '@/utils/request';
 import { GameEventVO } from '@/api/system/gameEvent/types';
 
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
+const { sys_normal_disable } = toRefs<any>(proxy?.useDict('sys_normal_disable'));
 const defaultEvent = ref<GameEventVO | null>(null); // 默认赛事信息
 
 const gameTeamList = ref<GameTeamVO[]>([]);
@@ -153,6 +162,20 @@ const multiple = ref(true);
 const total = ref(0);
 const eventOptions = ref<Array<{ label: string; value: string | number }>>([]);
 
+// 列显隐数据
+const columns = ref<FieldOption[]>([
+  { key: 0, label: '主键', visible: false },
+  { key: 1, label: '队伍编号', visible: true },
+  { key: 2, label: '赛事名称', visible: true },
+  { key: 3, label: '队伍名称', visible: true },
+  { key: 4, label: '团队描述', visible: true },
+  { key: 5, label: '领队', visible: false },
+  { key: 6, label: '人数', visible: false },
+  { key: 7, label: '号码段', visible: false },
+  { key: 8, label: '状态', visible: false },
+  { key: 9, label: '备注', visible: false }
+]);
+
 const queryFormRef = ref<ElFormInstance>();
 const gameTeamFormRef = ref<ElFormInstance>();
 const uploadRef = ref<ElUploadInstance>();
@@ -195,7 +218,9 @@ const data = reactive<PageData<GameTeamForm, GameTeamQuery>>({
   queryParams: {
     pageNum: 1,
     pageSize: 10,
-    eventId: undefined
+    eventId: undefined,
+    orderByColumn: undefined,
+    isAsc: undefined
     // teamName: undefined,
     // teamCode: undefined,
     // leader: undefined,
@@ -228,22 +253,22 @@ watchEffect(() => {
 });
 
 /** 获取默认赛事 */
-const getDefaultEventInfo = async () => {
-  try {
-    const res = await getDefaultEvent();
-    defaultEvent.value = res.data;
-  } catch (error) {
-    proxy?.$modal.msgError('获取默认赛事信息失败');
-  }
-};
+// 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;
-  }
+  // if (!queryParams.value.eventId) {
+  //   proxy?.$modal.msgWarning('未获取到默认赛事信息');
+  //   loading.value = false;
+  //   return;
+  // }
 
   loading.value = true;
   const res = await listGameTeam(queryParams.value);
@@ -258,7 +283,7 @@ const getEventOptions = async () => {
     const res = await getEventIdNameMap();
     eventOptions.value = Object.entries(res.data).map(([key, value]) => ({
       label: key as string,
-      value: value
+      value: value as string | number
     }));
   } catch (error) {
     console.error('获取赛事列表失败:', error);
@@ -273,7 +298,7 @@ const cancel = () => {
 
 /** 表单重置 */
 const reset = () => {
-  form.value = { ...initFormData, eventId: defaultEvent.value?.eventId };
+  form.value = { ...initFormData };
   gameTeamFormRef.value?.resetFields();
 };
 
@@ -287,7 +312,7 @@ const handleQuery = () => {
 const resetQuery = () => {
   queryFormRef.value?.resetFields();
   // 保留默认赛事ID
-  queryParams.value.eventId = defaultEvent.value?.eventId;
+  // queryParams.value.eventId = defaultEvent.value?.eventId;
   handleQuery();
 };
 
@@ -385,9 +410,7 @@ const importTemplate = () => {
 };
 
 onMounted(() => {
-  getDefaultEventInfo().then(() => {
-    getList();
-    getEventOptions();
-  });
+  getList();
+  getEventOptions();
 });
 </script>