Explorar o código

feat(gameScore): 添加归类筛选功能

- 在GameScoreQuery接口中添加classification字段用于区分个人项目和团体项目
- 在成绩管理页面添加归类下拉筛选项,支持按个人项目(0)和团体项目(1)筛选
- 配置归类选项数据并集成到查询参数中
- 清理已注释的加分相关代码以优化页面性能

Co-authored-by: Copilot <copilot@github.com>
zhou hai 1 mes
pai
achega
30a43a9668

+ 5 - 0
src/api/system/gameScore/types.ts

@@ -195,6 +195,11 @@ export interface GameScoreQuery extends PageQuery {
    */
   teamId?: string | number;
 
+  /**
+   * 归类(0个人项目/1团体项目)
+   */
+  classification: string;
+
   /**
    * 成绩状态(0等待处理1处理完毕)
    */

+ 15 - 120
src/views/system/gameScore/index.vue

@@ -14,6 +14,16 @@
                 </el-option>
               </el-select>
             </el-form-item>
+            <el-form-item label="归类" prop="classification">
+              <el-select v-model="queryParams.classification" placeholder="请选择项目" clearable filterable>
+                <el-option
+                  v-for="op in classificationOptions"
+                  :key="op.value"
+                  :label="op.label"
+                  :value="op.value">
+                </el-option>
+              </el-select>
+            </el-form-item>
             <!-- <el-form-item label="状态" prop="statusFlag">
               <el-input v-model="queryParams.statusFlag" placeholder="请输入成绩状态" clearable @keyup.enter="handleQuery" />
             </el-form-item> -->
@@ -138,7 +148,6 @@ const router = useRouter();
 // 默认赛事信息
 // const defaultEvent = ref<GameEventVO>({} as GameEventVO)
 const gameEventStore = useGameEventStore();
-const gameScoreList = ref<GameScoreVO[]>([]);
 
 const buttonLoading = ref(false);
 const loading = ref(true);
@@ -148,19 +157,6 @@ const single = ref(true);
 const multiple = ref(true);
 const total = ref(0);
 
-// // 加分弹窗相关数据
-// const bonusLoading = ref(false);
-// const saveLoading = ref(false);
-// const exportLoading = ref(false);
-// const bonusDialog = reactive({
-//   visible: false,
-//   title: '加分编辑'
-// });
-
-const bonusDataList = ref<any[]>([]);
-const bonusProjectList = ref<any[]>([]);
-const selectedBonusRows = ref<any[]>([]);
-
 // 列显隐数据
 const columns = ref<FieldOption[]>([
   { key: 0, label: 'ID', visible: false },
@@ -178,6 +174,10 @@ const columns = ref<FieldOption[]>([
 // 下拉框数据
 // const eventList = ref<GameEventVO[]>([]);
 const projectList = ref<GameEventProjectVO[]>([]);
+const classificationOptions = [
+  { label: '个人项目', value: '0' },
+  { label: '团体项目', value: '1' }
+];
 
 const queryFormRef = ref<ElFormInstance>();
 
@@ -204,6 +204,7 @@ const data = reactive<PageData<GameScoreForm, GameScoreQuery>>({
     pageNum: 1,
     pageSize: 10,
     projectId: undefined,
+    classification: undefined,
     orderByColumn: '',
     isAsc: ''
   },
@@ -212,33 +213,6 @@ const data = reactive<PageData<GameScoreForm, GameScoreQuery>>({
 
 const { queryParams, form, rules } = toRefs(data);
 
-// 加分相关方法
-// 打开加分弹窗
-// const openBonusDialog = async () => {
-//   try {
-//     bonusLoading.value = true;
-//     bonusDialog.visible = true;
-    
-//     // 获取默认赛事ID
-//     const event = gameEventStore.defaultEventInfo;
-//     const eventId = event?.eventId;
-
-//     if (!eventId) {
-//       proxy?.$modal.msgWarning('未指定赛事,无法进行加分操作');
-//       bonusDialog.visible = false;
-//       return;
-//     }
-    
-//     // 获取加分数据
-//     await loadBonusData(eventId);
-//   } catch (error) {
-//     console.error("打开加分弹窗失败:", error);
-//     proxy?.$modal.msgError("加载加分数据失败");
-//   } finally {
-//     bonusLoading.value = false;
-//   }
-// };
-
 /** 比赛数据(默认赛事) */
 const handleGameDataDefault = async () => {
   const defaultEvent = gameEventStore.defaultEventInfo;
@@ -257,82 +231,6 @@ const handleGameData = (row: GameEventVO) => {
   });
 };
 
-// 加载加分数据
-const loadBonusData = async (eventId: string | number) => {
-  try {
-    const response = await getBonusData({
-      eventId: eventId
-    });
-    
-    bonusDataList.value = response.data.rows || [];
-    bonusProjectList.value = response.data.projects || [];
-    
-    // 初始化加分字段
-    bonusDataList.value.forEach((row: any) => {
-      if (!row.leaderPoint) row.leaderPoint = 0;
-      if (!row.extraPoint) row.extraPoint = 0;
-      calculateTotalScore(row);
-    });
-  } catch (error) {
-    console.error("加载加分数据失败:", error);
-    proxy?.$modal.msgError("加载加分数据失败");
-  }
-};
-
-// 计算总分
-const calculateTotalScore = (row: any) => {
-  let totalScore = 0;
-  
-  // 累加各项目积分
-  Object.values(row.projectScores || {}).forEach((score: any) => {
-    totalScore += Number(score) || 0;
-  });
-  
-  // 加上领导加分和额外加分
-  totalScore += Number(row.leaderPoint) || 0;
-  totalScore += Number(row.extraPoint) || 0;
-  
-  row.totalScore = totalScore;
-  
-  // 重新计算排名
-  calculateBonusRankings();
-};
-
-// 计算excel表排名
-const calculateBonusRankings = () => {
-  // 按总分排序
-  const sortedData = [...bonusDataList.value].sort((a, b) => b.totalScore - a.totalScore);
-  
-  // 更新排名
-  sortedData.forEach((row, index) => {
-    row.rank = index + 1;
-  });
-  
-  // 更新原数组
-  bonusDataList.value = sortedData;
-};
-
-// 选择变化处理
-const handleBonusSelectionChange = (selection: any[]) => {
-  selectedBonusRows.value = selection;
-};
-
-/** 查询成绩列表 */
-const getList = async () => {
-  loading.value = true;
-  try{
-    const res = await listGameScore(queryParams.value);
-    gameScoreList.value = res.rows;
-    total.value = res.total;
-    loading.value = false;
-  }catch(error){
-    console.error("查询成绩列表失败:", error);
-    proxy?.$modal.msgError("查询成绩列表失败");
-  } finally{
-    loading.value = false;
-  }
-}
-
 /**
  * 刷新数据
  */
@@ -830,12 +728,10 @@ const exportScoresNames = () => {
 const loadProjects = async () => {
   loading.value = true;
   try {
-    // console.log('加载项目列表: ', queryParams.value);
     const res = await listGameEventProject(queryParams.value);
     projectList.value = res.rows;
     total.value = res.total;
   } catch (error) {
-    // console.error('加载项目列表失败:', error);
     proxy?.$modal.msgError('加载项目列表失败');
   } finally {
     loading.value = false;
@@ -884,7 +780,6 @@ const navigateToEditPage = (row: GameEventProjectVO) => {
 };
 
 onMounted(() => {
-  // 页面初始化时加载项目列表
   loadProjects();
 });
 </script>

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

@@ -65,7 +65,7 @@
         <el-table-column type="selection" width="55" align="center" />
         <el-table-column label="序号" align="center" type="index" />
         <el-table-column label="队伍id" 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="teamCode" sortable />
         <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="rgId" v-if="columns[4].visible">