Browse Source

feat(system): 优化赛事相关功能界面和导出文件命名

- 启用并优化赛事运动员、赛事项目等导出按钮功能
- 修改导出文件命名规则,使用中文描述替代英文前缀
- 调整排行榜页面倒计时显示样式,使用按钮替代卡片
- 修复团队分组成员性别字典引用错误问题
- 优化数据加载逻辑,提高页面初始化性能
- 调整自动刷新机制,增强倒计时准确性
- 统一各页面倒计时显示文本格式
zhou 2 weeks ago
parent
commit
f53dec6aad

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

@@ -41,9 +41,9 @@
               >删除
             </el-button>
           </el-col>
-          <!-- <el-col :span="1.5">
+          <el-col :span="1.5">
             <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['system:gameAthlete:export']">导出 </el-button>
-          </el-col> -->
+          </el-col>
           <el-col :span="1.5">
             <el-button type="info" plain icon="Upload" @click="handleImport" v-hasPermi="['system:gameAthlete:import']"> 导入 </el-button>
           </el-col>
@@ -755,7 +755,7 @@ const handleExport = () => {
     {
       ...queryParams.value
     },
-    `gameAthlete_${new Date().getTime()}.xlsx`
+    `运动员详情_${new Date().getTime()}.xlsx`
   );
 };
 

+ 28 - 39
src/views/system/gameEvent/RankingBoardPage.vue

@@ -2,20 +2,15 @@
   <div class="ranking-board-page">
     <!-- 右上角倒计时显示 -->
     <div class="countdown-display">
-      <el-card shadow="never" class="countdown-card">
+      <!-- <el-card shadow="never" class="countdown-card"> -->
+      <el-button size="default" type="primary">
         <div class="countdown-content">
-          <el-icon class="countdown-icon"><Timer /></el-icon>
-          <span class="countdown-text">{{ countdownSeconds }}s</span>
-          <!-- <el-button 
-            type="text" 
-            size="small" 
-            @click="stopAutoRefresh"
-            class="stop-btn"
-          >
-            <el-icon><Close /></el-icon>
-          </el-button> -->
+          <!-- <el-icon class="countdown-icon"><Timer /></el-icon> -->
+          <span>{{ countdownSeconds }}秒后刷新</span>
         </div>
-      </el-card>
+      </el-button>
+        
+      <!-- </el-card> -->
     </div>
     <!-- 赛事名称标题 -->
     <div class="event-title">
@@ -253,20 +248,21 @@ const teamRefreshing = ref(false); // 团队排行榜刷新状态
 
 // 自动刷新相关
 const autoRefreshInterval = ref<NodeJS.Timeout | null>(null);
-const autoRefreshSeconds = 300; // 默认300秒自动刷新
+const autoRefreshSeconds = ref(300); // 默认300秒自动刷新
 // 添加倒计时相关状态
-const countdownSeconds = ref(300); // 倒计时秒数
+const countdownSeconds = ref(0); // 倒计时秒数
 const countdownInterval = ref<NodeJS.Timeout | null>(null); // 倒计时定时器
 
 // 启动倒计时
 const startCountdown = () => {
-  countdownSeconds.value = autoRefreshSeconds;
+  stopCountdown();
+  countdownSeconds.value = autoRefreshSeconds.value;
   
   countdownInterval.value = setInterval(() => {
     countdownSeconds.value--;
     
     if (countdownSeconds.value <= 0) {
-      countdownSeconds.value = autoRefreshSeconds;
+      countdownSeconds.value = autoRefreshSeconds.value;
     }
   }, 1000);
 };
@@ -605,7 +601,6 @@ const refreshAllData = async () => {
       refreshTeamRanking(),
       loadProjectProgress()
     ]);
-    
     ElMessage.success('所有数据已刷新');
   } catch (error) {
     console.error('刷新数据失败:', error);
@@ -623,22 +618,11 @@ const startAutoRefresh = () => {
   }
   
   autoRefreshInterval.value = setInterval(() => {
-    refreshAllData();
-  }, autoRefreshSeconds * 1000);
+    // refreshAllData();
+  }, autoRefreshSeconds.value * 1000);
   // 开启倒计时
   startCountdown();
-  ElMessage.success(`已开启自动刷新,每${autoRefreshSeconds}秒刷新一次`);
-};
-
-// 停止自动刷新
-const stopAutoRefresh = () => {
-  if (autoRefreshInterval.value) {
-    clearInterval(autoRefreshInterval.value);
-    autoRefreshInterval.value = null;
-  }
-  // 停止倒计时
-  stopCountdown();
-  ElMessage.info('已停止自动刷新');
+  ElMessage.success(`已开启自动刷新,每${autoRefreshSeconds.value}秒刷新一次`);
 };
 
 // 组件卸载时清理定时器
@@ -652,17 +636,22 @@ onUnmounted(() => {
 
 onMounted(async () => {
   try{
+    // refreshAllData();
+    startAutoRefresh();
     const res = await listScoreRanking(defaultEventInfo.value.eventId.toString());
     // 按照totalScore字段降序排序(分数高的在前面)
     athleteScoreList.value = res.data.sort((a, b) => b.totalScore - a.totalScore);
-    // 加载队伍积分排行榜
-    await loadTeamScores();
-    // 加载分组选项
-    await loadRankGroupOptions();
-    // 加载项目进度信息
-    await loadProjectProgress();
-    // 开启自动刷新
-    startAutoRefresh();
+    // 并行加载其他数据
+    await Promise.all([
+      // 加载队伍积分排行榜
+      loadTeamScores(),
+      // 加载分组选项
+      loadRankGroupOptions(),
+      // 加载项目进度信息
+      loadProjectProgress()
+    ]);
+    // // 开启自动刷新
+    // startAutoRefresh();
   } catch (error) {
     console.error('加载数据失败:', error);
   }

+ 1 - 1
src/views/system/gameEvent/index.vue

@@ -667,7 +667,7 @@ const handleExport = () => {
     {
       ...queryParams.value
     },
-    `gameEvent_${new Date().getTime()}.xlsx`
+    `赛事详情_${new Date().getTime()}.xlsx`
   );
 };
 

+ 2 - 2
src/views/system/gameEventConfigType/index.vue

@@ -42,9 +42,9 @@
           <el-col :span="1.5">
             <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['system:gameEventConfigType:remove']">删除</el-button>
           </el-col>
-          <!-- <el-col :span="1.5">
+          <el-col :span="1.5">
             <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['system:gameEventConfigType:export']">导出</el-button>
-          </el-col> -->
+          </el-col>
           <right-toolbar v-model:showSearch="showSearch" :columns="columns" @queryTable="getList"></right-toolbar>
         </el-row>
       </template>

+ 3 - 3
src/views/system/gameEventGroup/index.vue

@@ -86,7 +86,7 @@
         </el-table-column>
         <el-table-column label="成员性别" align="center" prop="memberGender" v-if="columns[10].visible">
           <template #default="scope">
-            <dict-tag :options="sys_user_sex" :value="scope.row.memberGender" />
+            <dict-tag :options="sys_group_sex" :value="scope.row.memberGender" />
           </template>
         </el-table-column>
         <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
@@ -159,7 +159,7 @@
             <el-form-item label="成员性别" prop="memberGender">
               <el-select v-model="form.memberGender" placeholder="请选择性别" style="width: 100%">
                 <el-option
-                  v-for="dict in sys_user_sex"
+                  v-for="dict in sys_group_sex"
                   :key="dict.value"
                   :label="dict.label"
                   :value="dict.value"
@@ -256,7 +256,7 @@ const { proxy } = getCurrentInstance() as ComponentInternalInstance;
 const router = useRouter();
 
 // 字典数据
-const { game_project_type, sys_user_sex } = toRefs<any>(proxy?.useDict('game_project_type', 'sys_user_sex'));
+const { game_project_type, sys_group_sex } = toRefs<any>(proxy?.useDict('game_project_type', 'sys_group_sex'));
 
 const gameEventGroupList = ref<GameEventGroupVO[]>([]);
 const projectList = ref<GameEventProjectVO[]>([]);

+ 3 - 3
src/views/system/gameEventProject/index.vue

@@ -40,9 +40,9 @@
               >删除
             </el-button>
           </el-col>
-          <!-- <el-col :span="1.5">
+          <el-col :span="1.5">
             <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['system:gameEventProject:export']">导出 </el-button>
-          </el-col> -->
+          </el-col>
           <right-toolbar v-model:showSearch="showSearch" :columns="columns" @queryTable="getList"></right-toolbar>
         </el-row>
       </template>
@@ -458,7 +458,7 @@ const handleExport = () => {
     {
       ...queryParams.value
     },
-    `gameEventProject_${new Date().getTime()}.xlsx`
+    `项目详情_${new Date().getTime()}.xlsx`
   );
 };
 

+ 4 - 4
src/views/system/gameScore/gameScoreBonus.vue

@@ -21,10 +21,10 @@
           <!-- 倒计时显示区域 -->
           <el-col :span="6">
             <div class="countdown-info">
-              <el-tag type="info" size="small" class="countdown-tag">
-                <el-icon class="countdown-icon"><Timer /></el-icon>
-                {{ countdownSeconds }}s
-              </el-tag>
+              <el-button size="default" type="primary">
+                <!-- <el-icon class="countdown-icon"><Timer /></el-icon> -->
+                {{ countdownSeconds }}秒后刷新
+              </el-button>
               <!-- <span class="countdown-description">数据将自动刷新</span> -->
             </div>
           </el-col>

+ 7 - 7
src/views/system/gameScore/gameScoreEdit.vue

@@ -9,18 +9,18 @@
         </div>
       </el-card>
     </div> -->
-    <!-- 新增:顶部搜索框 -->
+    <!-- 顶部搜索框 -->
     <div class="flex items-center mb-4">
       <el-button type="primary" @click="refreshData"><el-icon><Refresh /></el-icon> 刷新</el-button>
-      <el-button type="success" @click="calculateRankings" :loading="rankingLoading">
-        <el-icon><Trophy /></el-icon> 计算排名
-      </el-button>
       <div class="countdown-button" v-if="countdownSeconds > 0">
-        <el-button size="default" disabled class="countdown-btn">
-          <el-icon class="countdown-icon"><Timer /></el-icon>
-          {{ countdownSeconds }}s
+        <el-button size="default" type="primary">
+          <!-- <el-icon class="countdown-icon"><Timer /></el-icon> -->
+          {{ countdownSeconds }}秒后刷新
         </el-button>
       </div>
+      <el-button type="success" @click="calculateRankings" :loading="rankingLoading">
+        <el-icon><Trophy /></el-icon> 计算排名
+      </el-button>
       <el-input 
         v-model="searchValue" 
         :placeholder="projectClassification === '0' ? '输入运动员姓名搜索' : '输入队伍名称搜索'" 

+ 4 - 1
src/views/system/gameTeam/index.vue

@@ -34,6 +34,9 @@
           <el-col :span="1.5">
             <el-button type="info" plain icon="Upload" @click="handleImport" v-hasPermi="['system:gameTeam:import']">导入</el-button>
           </el-col>
+          <el-col :span="1.5">
+            <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['system:gameTeam:export']">导出</el-button>
+          </el-col>
           <el-col :span="6" >
             <el-select v-model="selectedRankGroupId" placeholder="选择分组" clearable style="width: 100px;">
               <el-option
@@ -468,7 +471,7 @@ const handleExport = () => {
     {
       ...queryParams.value
     },
-    `gameTeam_${new Date().getTime()}.xlsx`
+    `队伍详情_${new Date().getTime()}.xlsx`
   );
 };