ソースを参照

feat(tournament): 新增线下道具选择和锦标赛菜单审核功能

- 添加selectXianXiaItemsSelList API用于线下道具选择
- 新增auditTournamentMenu API用于锦标赛菜单审核
- 实现tournamentMenu组件中的审核状态切换确认弹窗
- 区分报名条件道具和奖励道具的选择列表
- 优化tournamentsRegistration组件中的状态显示逻辑
- 调整tournamentMenu界面布局和图标资源配置
fugui001 1 週間 前
コミット
20668259b4

+ 6 - 0
src/api/system/business/items/index.ts

@@ -72,3 +72,9 @@ export const selectItemsSelList = (): AxiosPromise<ItemsVO> => {
     method: 'get'
   });
 };
+export const selectXianXiaItemsSelList = (): AxiosPromise<ItemsVO> => {
+  return request({
+    url: '/business/items/selectXianXiaItemsSelList',
+    method: 'get'
+  });
+};

+ 7 - 2
src/api/system/physical/tournamentMenu/index.ts

@@ -38,7 +38,6 @@ export const addTournamentMenu = (data: TournamentMenuForm) => {
     data: data
   });
 };
-
 /**
  * 修改锦标赛功能菜单配置
  * @param data
@@ -50,7 +49,13 @@ export const updateTournamentMenu = (data: TournamentMenuForm) => {
     data: data
   });
 };
-
+export const auditTournamentMenu = (data: TournamentMenuForm) => {
+  return request({
+    url: '/physical/tournamentMenu/auditTournamentMenu',
+    method: 'put',
+    data: data
+  });
+};
 /**
  * 删除锦标赛功能菜单配置
  * @param id

+ 19 - 5
src/views/system/physical/tournamentMenu/index.vue

@@ -35,7 +35,7 @@
               >删除</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="['physical:tournamentMenu:export']">导出</el-button>
           </el-col>-->
           <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
@@ -152,7 +152,7 @@
           </div>
         </el-form-item>
 
-<!--        <el-form-item label="图标资源名" prop="iconName">
+        <!--        <el-form-item label="图标资源名" prop="iconName">
           <el-input v-model="form.iconName" placeholder="请输入图标资源名" />
         </el-form-item>-->
         <el-form-item label="排序索引" prop="orderIndex">
@@ -182,7 +182,7 @@ import {
   getTournamentMenu,
   delTournamentMenu,
   addTournamentMenu,
-  updateTournamentMenu
+  updateTournamentMenu, auditTournamentMenu
 } from '@/api/system/physical/tournamentMenu';
 import { TournamentMenuVO, TournamentMenuQuery, TournamentMenuForm } from '@/api/system/physical/tournamentMenu/types';
 import { uploadTournament } from '@/api/system/business/tournaments';
@@ -431,6 +431,20 @@ const parseTime = (timestamp: number, format: string): string => {
 const handleStatusChange = async (row: TournamentMenuVO, newValue: boolean) => {
   const newStatus = newValue ? 1 : 0;
   const currentStatus = row.status;
+  const actionText = newStatus === 1 ? '显示' : '隐藏';
+
+  // 添加二次确认
+  try {
+    await ElMessageBox.confirm(`确认要${actionText} "${row.menuName}" 菜单项吗?`, '警告', {
+      confirmButtonText: '确定',
+      cancelButtonText: '取消',
+      type: 'warning'
+    });
+  } catch {
+    // 用户取消操作,恢复原来的开关状态
+    row.status = currentStatus;
+    return;
+  }
 
   // 准备更新数据
   const updateData = {
@@ -440,8 +454,8 @@ const handleStatusChange = async (row: TournamentMenuVO, newValue: boolean) => {
 
   try {
     // 使用现有的更新接口
-    await updateTournamentMenu(updateData);
-    proxy?.$modal.msgSuccess(`${newStatus === 1 ? '显示' : '隐藏'}操作成功`);
+    await auditTournamentMenu(updateData);
+    proxy?.$modal.msgSuccess(`${actionText}操作成功`);
     // 确保本地状态与服务器一致
     row.status = newStatus;
   } catch (error) {

+ 29 - 3
src/views/system/physical/tournaments/index.vue

@@ -358,7 +358,7 @@
 
             <!-- 道具选择 -->
             <el-select v-model="reward.itemId" placeholder="选项" style="width: 120px; margin-right: 8px" :disabled="dialog.mode === 'view'">
-              <el-option v-for="item in itemOptions" :key="item.id" :label="item.label" :value="item.id" />
+              <el-option v-for="item in itemPrizeOptions" :key="item.id" :label="item.label" :value="item.id" />
             </el-select>
 
             <!-- 数量输入 -->
@@ -418,7 +418,7 @@
 <script setup name="Tournaments" lang="ts">
 import { listTournaments, getTournaments, delTournaments, addTournaments, updateTournaments } from '@/api/system/physical/tournaments';
 import { TournamentsVO, TournamentsQuery, TournamentsForm } from '@/api/system/physical/tournaments/types';
-import { selectItemsSelList } from '@/api/system/business/items';
+import { selectItemsSelList, selectXianXiaItemsSelList } from '@/api/system/business/items';
 import { selectPhysicalBlingStructuresInfo } from '@/api/system/physical/blindStructures';
 import { selectPhysicalBlindLevelsById } from '@/api/system/physical/blindLevels';
 import { uploadTournament } from '@/api/system/business/tournaments';
@@ -858,12 +858,13 @@ onMounted(() => {
   loadItemStructuresOptions();
   loadLeagueTournamentOptions();
   loadJudgeOptions();
+  loadItemPrizeOptions();
 });
 const itemOptions = ref<{ id: number; label: string }[]>([]);
 // 加载报名条件选项
 const loadItemOptions = async () => {
   try {
-    const res = await selectItemsSelList();
+    const res = await selectXianXiaItemsSelList();
     if (res.code === 200) {
       // 类型断言
       const data = res.data as unknown as { id: number; name: string }[];
@@ -883,6 +884,31 @@ const loadItemOptions = async () => {
     ElMessage.error('请求失败,请检查网络');
   }
 };
+const itemPrizeOptions = ref<{ id: number; label: string }[]>([]);
+// 加载报名条件选项
+const loadItemPrizeOptions = async () => {
+  try {
+    const res = await selectItemsSelList();
+    if (res.code === 200) {
+      // 类型断言
+      const data = res.data as unknown as { id: number; name: string }[];
+
+      // 过滤掉 id === 2 的项,并映射为 { id, label }
+      itemPrizeOptions.value = data
+        .filter((item) => item.id !== 2) // ✅ 过滤 id 为 2 的
+        .map((item) => ({
+          id: item.id,
+          label: item.name
+        }));
+    } else {
+      ElMessage.error('加载失败:' + res.msg);
+    }
+  } catch (error) {
+    console.error('请求出错:', error);
+    ElMessage.error('请求失败,请检查网络');
+  }
+};
+
 // 下拉选项数据 selectPhysicalBlingStructuresInfo
 const itemOptionsStructures = ref<{ id: number; label: string }[]>([]);
 const loadItemStructuresOptions = async () => {

+ 12 - 4
src/views/system/physical/tournamentsRegistration/index.vue

@@ -96,8 +96,8 @@
         </el-table-column>
         <el-table-column label="审核状态" align="center" prop="status">
           <template #default="scope">
-            <el-tag :type="getStatusTagType(scope.row.status)" size="small">
-              {{ getStatusText(scope.row.status) }}
+            <el-tag :type="getStatusTagType(scope.row.autoStatus, scope.row.status)" size="small">
+              {{ getStatusText(scope.row.autoStatus, scope.row.status) }}
             </el-tag>
           </template>
         </el-table-column>
@@ -365,7 +365,10 @@ onMounted(() => {
   loadLeagueTournamentOptions();
 });
 /** 获取状态文本 */
-const getStatusText = (status: string) => {
+const getStatusText = (autoStatus: number, status: string) => {
+  if (autoStatus === 1) {
+    return '自动绑定';
+  }
   switch (status) {
     case 'pending':
       return '待审核';
@@ -377,8 +380,13 @@ const getStatusText = (status: string) => {
       return status;
   }
 };
+
 /** 获取状态标签类型 */
-const getStatusTagType = (status: string) => {
+const getStatusTagType = (autoStatus: number, status: string) => {
+  if (autoStatus === 1) {
+    return 'info'; // 或者使用其他颜色表示自动绑定
+  }
+
   switch (status) {
     case 'pending':
       return 'warning'; // 黄色标签表示待审核