Bläddra i källkod

Merge branch 'master' of http://115.190.200.22:3000/xpg/ui

wengan01 3 veckor sedan
förälder
incheckning
c17914b019

+ 7 - 1
src/api/system/physical/tournaments/index.ts

@@ -50,7 +50,13 @@ export const updateTournaments = (data: TournamentsForm) => {
     data: data
   });
 };
-
+export const updateByTournament = (data: TournamentsForm) => {
+  return request({
+    url: '/physical/tournaments/updateByTournament',
+    method: 'put',
+    data: data
+  });
+};
 /**
  * 删除线下赛事
  * @param id

+ 4 - 1
src/api/system/physical/tournaments/types.ts

@@ -161,6 +161,8 @@ export interface TournamentsVO {
   qualifierValue: number;
 
   tournamentType?: number;
+
+  isShow: number;
 }
 
 export interface TournamentsForm extends BaseEntity {
@@ -343,6 +345,7 @@ export interface TournamentsForm extends BaseEntity {
   leagueTournamentRegionId?: number;
   leagueTournamentRegion?: string;
   judgeId?: number[];
+  isShow: number;
 }
 export interface ItemsPrize {
   ranking: number;
@@ -506,7 +509,7 @@ export interface TournamentsQuery extends PageQuery {
    */
   qualifierValue?: number;
   tournamentType?: number;
-
+  isShow: number;
   /**
    * 日期范围参数
    */

+ 2 - 2
src/views/system/business/tournaments/index.vue

@@ -54,12 +54,12 @@
           </el-col>
           <el-col :span="1.5">
             <el-button type="warning" plain icon="Operation">
-              <router-link to="/service/catory">比赛类目管理</router-link>
+              <router-link to="/operation/catory">比赛类目管理</router-link>
             </el-button>
           </el-col>
           <el-col :span="1.5">
             <el-button type="success" plain icon="Operation">
-              <router-link to="/service/tag">比赛标签管理</router-link>
+              <router-link to="/operation/tag">比赛标签管理</router-link>
             </el-button>
           </el-col>
           <!-- 新增的 “盲注管理” 按钮 -->

+ 1 - 1
src/views/system/physical/merchantPartner/index.vue

@@ -280,7 +280,7 @@ const handleExport = () => {
 };
 const handleViewSubInfo = (merchantId: number) => {
   proxy?.$router.push({
-    path: '/physical/merchantItem',
+    path: '/mall/merchantItem',
     query: {
       merchantId: String(merchantId) // 转为字符串以兼容 URL 参数
     }

+ 77 - 24
src/views/system/physical/tournaments/index.vue

@@ -154,6 +154,17 @@
             <el-tooltip content="复制" placement="top" v-hasPermi="['business:tournaments:query']">
               <el-button link type="primary" icon="Files" @click="handleCopy(scope.row)"> 复制 </el-button>
             </el-tooltip>
+            <el-tooltip :content="scope.row.isShow === 1 ? '隐藏' : '展示'" placement="top">
+              <el-button
+                link
+                :type="scope.row.isShow === 1 ? 'warning' : 'success'"
+                :icon="scope.row.isShow === 1 ? 'Hide' : 'View'"
+                @click="handleToggleShow(scope.row)"
+                v-hasPermi="['physical:tournaments:edit']"
+              >
+                {{ scope.row.isShow === 1 ? '隐藏' : '展示' }}
+              </el-button>
+            </el-tooltip>
           </template>
         </el-table-column>
       </el-table>
@@ -171,7 +182,7 @@
             <el-option v-for="item in leagueTournamentOptions" :key="item.id" :label="item.title" :value="item.id" />
           </el-select>
         </el-form-item>
-        <el-form-item label="所属赛区" prop="leagueTournamentId">
+        <el-form-item label="所属赛区" prop="leagueTournamentRegionId">
           <el-select v-model="form.leagueTournamentRegionId" placeholder="请选择赛区" style="width: 100%" @change="handleCompetitionZoneChange">
             <el-option v-for="item in competitionZoneOptions" :key="item.id" :label="item.zoneName" :value="item.id" />
           </el-select>
@@ -188,7 +199,7 @@
           <el-input v-model="form.competitionLocation" placeholder="请输入赛事位置" />
         </el-form-item>-->
         <!-- 比赛图标 -->
-        <el-form-item label="比赛图标" prop="icon">
+        <el-form-item label="比赛图标" prop="competitionIcon">
           <div class="upload-container">
             <el-upload
               class="upload-icon"
@@ -229,7 +240,7 @@
           </div>
         </el-form-item>
         <!-- 比赛图标 -->
-        <el-form-item label="比赛背景" prop="icon">
+        <el-form-item label="比赛背景" prop="competitionBg">
           <div class="upload-container">
             <el-upload
               class="upload-icon"
@@ -424,7 +435,7 @@
             <el-option v-for="item in tournamentTypeOptions" :key="item.value" :label="item.label" :value="item.value" />
           </el-select>
         </el-form-item>
-        <el-form-item label="目标锦标赛" prop="targetTournamentId" v-if="form.tournamentType === 1">
+        <el-form-item label="目标赛" prop="targetTournamentId" v-if="form.tournamentType === 1">
           <el-select
             v-model="form.targetTournamentId"
             placeholder="请选择比赛"
@@ -433,8 +444,18 @@
             :remote-method="loadTargetTournaments"
             :loading="selectLoading"
             clearable
+            filterable
           >
             <el-option v-for="item in selectOptions" :key="item.id" :label="item.label" :value="item.id" />
+            <!-- 添加空状态提示 -->
+            <template #empty>
+              <div v-if="selectLoading" class="el-select-dropdown__empty">
+                <span>加载中...</span>
+              </div>
+              <div v-else-if="selectOptions.length === 0" class="el-select-dropdown__empty">
+                <span>暂无数据</span>
+              </div>
+            </template>
           </el-select>
         </el-form-item>
         <el-form-item label="晋级条件类型" prop="qualifierType" v-if="form.tournamentType === 1">
@@ -481,6 +502,7 @@ import {
   delTournaments,
   addTournaments,
   updateTournaments,
+  updateByTournament,
   selectPhysicalTournamentsLeagueId
 } from '@/api/system/physical/tournaments';
 import { TournamentsVO, TournamentsQuery, TournamentsForm } from '@/api/system/physical/tournaments/types';
@@ -525,13 +547,14 @@ const dialog = reactive<{
 });
 
 const initFormData: TournamentsForm = {
+
   id: undefined,
   name: undefined,
   startTime: undefined,
   endTime: undefined,
   pauseTime: undefined,
   gameType: undefined,
-  gameVariant: undefined,
+  gameVariant: '0',
   startingChips: undefined,
   levelDuration: undefined,
   lateRegistrationLevel: undefined,
@@ -603,10 +626,12 @@ const data = reactive<PageData<TournamentsForm, TournamentsQuery>>({
     startTime: [{ required: true, message: '比赛开始时间不能为空', trigger: 'blur' }],
     gameType: [{ required: true, message: '游戏类型不能为空', trigger: 'change' }],
     lateRegistrationLevel: [{ required: true, message: '截止报名级别不能为空', trigger: 'change' }],
+    leagueTournamentId: [{ required: true, message: '所属联赛不能为空', trigger: 'change' }],
+    leagueTournamentRegionId: [{ required: true, message: '所属赛区不能为空', trigger: 'change' }],
+    competitionIcon: [{ required: true, message: '比赛图标不能为空', trigger: 'change' }],
+    competitionBg: [{ required: true, message: '比赛背景不能为空', trigger: 'change' }],
     signTime: [{ required: true, message: '报名时间不能为空', trigger: 'change' }],
     judgeId: [{ required: true, message: '裁判不能为空', trigger: 'change' }],
-    // ...其他规则
-    // ... existing code ...
     itemsId: [
       {
         validator: (rule, value, callback) => {
@@ -615,15 +640,14 @@ const data = reactive<PageData<TournamentsForm, TournamentsQuery>>({
             callback();
             return;
           }
-
+          callback();
           // 检查是否至少有一个报名条件被设置
-          const hasValidCondition = formConditions.conditions.some((condition) => condition.itemId && condition.quantity);
-
-          if (!hasValidCondition) {
+          /*  const hasValidCondition = formConditions.conditions.some((condition) => condition.itemId && condition.quantity);
+         if (!hasValidCondition) {
             callback(new Error('报名条件不能为空'));
           } else {
             callback();
-          }
+          }*/
         },
         trigger: 'change'
       }
@@ -981,6 +1005,16 @@ watch(
   },
   { immediate: false }
 );
+// 添加watch监听对话框显示状态,确保打开时数据已加载
+watch(
+  () => dialog.visible,
+  async (newVal) => {
+    if (newVal && selectOptions.value.length === 0) {
+      // 只有在选项为空时才重新加载,避免重复请求
+      await loadLeagueRelatedTournaments();
+    }
+  }
+);
 const itemOptions = ref<{ id: number; label: string }[]>([]);
 // 加载报名条件选项
 const loadItemOptions = async () => {
@@ -1439,15 +1473,12 @@ const loadLeagueRelatedTournaments = async () => {
     selectLoading.value = true;
     const res = await selectPhysicalTournamentsLeagueId();
     const data2 = res.data as unknown as { id: number; name: string }[];
-    const list = [];
-    for (let i = 0; i < data2.length; i++) {
-      const item = data2[i];
-      list.push({
-        id: item.id,
-        label: item.name
-      });
-    }
-    selectOptions.value = list;
+
+    // 使用map方法提高效率和可读性
+    selectOptions.value = data2.map((item) => ({
+      id: item.id,
+      label: item.name
+    }));
   } catch (error) {
     console.error('加载联赛关联赛事失败', error);
     ElMessage.error('加载失败');
@@ -1457,12 +1488,11 @@ const loadLeagueRelatedTournaments = async () => {
 };
 const loadTargetTournaments = (query: string) => {
   if (!query.trim()) {
-    selectOptions.value = leagueRelatedTournaments.value;
+    selectOptions.value = selectOptions.value;
     return;
   }
   // 这里可加模糊搜索逻辑(如 filter)222
-  selectOptions.value = leagueRelatedTournaments.value.filter((item) => item.name.toLowerCase().includes(query.toLowerCase()));
-};
+  selectOptions.value = selectOptions.value.filter((item) => item.label.toLowerCase().includes(query.toLowerCase()));};
 const handleCompetitionZoneChange = (value: number) => {
   const selectedZone = competitionZoneOptions.value.find((item) => item.id === value);
   if (selectedZone) {
@@ -1471,4 +1501,27 @@ const handleCompetitionZoneChange = (value: number) => {
     form.value.leagueTournamentRegion = '';
   }
 };
+/** 切换展示/隐藏状态 */
+const handleToggleShow = async (row: TournamentsVO) => {
+  const newStatus = row.isShow === 1 ? 0 : 1;
+  const statusText = newStatus === 1 ? '展示' : '隐藏';
+
+  try {
+    await proxy?.$modal.confirm(`确认要${statusText}该赛事吗?`);
+
+    // 使用 updateTournaments 接口,只传入 id 和 isShow 字段
+    await updateByTournament({
+      id: row.id,
+      isShow: newStatus
+    } as TournamentsForm);
+
+    proxy?.$modal.msgSuccess(`${statusText}成功`);
+    await getList();
+  } catch (error) {
+    if (error !== 'cancel') {
+      console.error('切换状态失败:', error);
+      proxy?.$modal.msgError(`${statusText}失败,请重试`);
+    }
+  }
+};
 </script>