Quellcode durchsuchen

feat(gameAthlete): 优化参赛队员表格显示

- 将参与项目字段从projectList改为projectNames,直接显示项目名称
- 移除formatProjectList格式化函数和相关项目列表获取逻辑
- 简化表格列配置,移除不必要的模板渲染
- 移除组件初始化时的项目列表获取调用
zhou vor 2 Wochen
Ursprung
Commit
398ae88460
1 geänderte Dateien mit 3 neuen und 51 gelöschten Zeilen
  1. 3 51
      src/views/system/gameAthlete/index.vue

+ 3 - 51
src/views/system/gameAthlete/index.vue

@@ -70,10 +70,10 @@
         </el-table-column>
         <el-table-column label="年龄" align="center" prop="age" v-if="columns[5].visible" />
         <el-table-column label="手机号" align="center" prop="phone" v-if="columns[11].visible" />
-        <el-table-column label="参与项目" align="center" prop="projectList" width="200px" :show-overflow-tooltip="true" v-if="columns[6].visible">
-          <template #default="scope">
+        <el-table-column label="参与项目" align="center" prop="projectNames" width="200px" :show-overflow-tooltip="true" v-if="columns[6].visible" >
+          <!-- <template #default="scope">
             {{ formatProjectList(scope.row.projectList) }}
-          </template>
+          </template> -->
         </el-table-column>
         <!-- <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">
@@ -480,30 +480,6 @@ const getTeamNameById = (teamId: string | number | null | undefined) => {
   return team ? team.teamName : '';
 };
 
-// 获取赛事项目列表
-const getProjectList = async () => {
-  try {
-    const res = await listGameEventProject();
-    gameEventProjectList.value = res.rows.map((item) => ({
-      key: String(item.projectId),
-      label: item.projectName,
-      disabled: false
-    }));
-    
-    // 更新项目状态
-    await updateProjectStatus();
-  } catch (error) {
-    // console.error('获取项目列表失败:', error);
-  }
-};
-
-// 格式化项目列表显示
-const formatProjectList = (projectList: number[]) => {
-  if (!projectList) return '';
-  const projectNames = gameEventProjectList.value.filter((p) => projectList.includes(Number(p.key))).map((p) => p.label);
-  return projectNames.join(',');
-};
-
 /** 查询参赛队员列表 */
 const getList = async () => {
   loading.value = true;
@@ -562,12 +538,6 @@ const handleAdd = () => {
   reset();
   dialog.visible = true;
   dialog.title = '添加参赛队员';
-  // 获取项目列表
-  // nextTick(() => {
-  //   if (form.value.eventId) {
-  //     getProjectList(String(form.value.eventId));
-  //   }
-  // });
 };
 
 /** 修改按钮操作 */
@@ -588,12 +558,6 @@ const handleUpdate = async (row?: GameAthleteVO) => {
 
   dialog.visible = true;
   dialog.title = '修改参赛队员';
-  // 获取项目列表
-  // nextTick(() => {
-  //   if (form.value.eventId) {
-  //     getProjectList(String(form.value.eventId));
-  //   }
-  // });
 };
 
 // 添加一个计算属性用于处理projectList2的类型转换
@@ -698,17 +662,6 @@ const submitForm = () => {
   });
 };
 
-// 在组件加载时更新项目状态
-const updateProjectStatus = async () => {
-  if (gameEventProjectList.value.length > 0) {
-    for (const project of gameEventProjectList.value) {
-      const projectId = Number(project.key);
-      const isFull = await isProjectFull(projectId);
-      project.disabled = isFull;
-    }
-  }
-};
-
 /** 删除按钮操作 */
 const handleDelete = async (row?: GameAthleteVO) => {
   const _athleteIds = row?.athleteId || ids.value;
@@ -805,7 +758,6 @@ const importTemplate = () => {
 onMounted(() => {
   getList();
   getTeamList();
-  getProjectList();
 });
 </script>