瀏覽代碼

feat(system): 增加比赛历史记录的高级搜索功能

- 添加了等级范围筛选功能
- 增加了比赛时间、盲注等级等信息的显示- 实现了根据比赛ID加载盲注结构的下拉选项- 优化了搜索逻辑,支持按盲注等级筛选历史记录
fugui001 4 月之前
父節點
當前提交
f00adb718e

+ 9 - 0
src/api/system/business/history/types.ts

@@ -56,6 +56,9 @@ export interface HistoryVO {
 
   parseBlindsInfo: string;
   publicBrand: string;
+  blindLevelIds: string;
+  beginPeopleIds: string;
+  endPeopleIds: string;
 }
 
 export interface HistoryForm extends BaseEntity {
@@ -180,4 +183,10 @@ export interface HistoryQuery extends PageQuery {
   tableId?: number;
 
   playerNameOrId?: string;
+
+  startLateRegistrationLevel?: string;
+
+  endLateRegistrationLevel?: string;
+
+  blindStructureId?: number;
 }

+ 11 - 0
src/api/system/business/levels/index.ts

@@ -72,3 +72,14 @@ export const selectBlindLevelsById = (id: number): AxiosPromise<LevelsVO[]> => {
     method: 'get'
   });
 };
+
+/**
+ * 查询【请填写功能名称】详细
+ * @param id
+ */
+export const selectBlindLevelsByTournament = (id: number): AxiosPromise<LevelsVO[]> => {
+  return request({
+    url: '/business/levels/selectBlindLevelsByTournament/' + id,
+    method: 'get'
+  });
+};

+ 138 - 16
src/views/system/business/history/index.vue

@@ -18,6 +18,20 @@
         <el-form-item label="">
           <el-input v-model="queryParams.playerNameOrId" placeholder="请输入玩家名称或选手ID" clearable @keyup.enter="handlePlayerSearch" />
         </el-form-item>
+        <!-- 报名截止等级 -->
+        <el-form-item label="等级范围">
+          <el-select v-model="queryParams.startLateRegistrationLevel" placeholder="请选择起始等级" style="width: 200px">
+            <!-- 手动添加空选项 -->
+            <el-option :value="null" label="全部" />
+            <el-option v-for="item in itemOptionsStructuresLevelLeft" :key="item.id" :label="item.label" :value="item.id" />
+          </el-select>
+          至
+          <el-select v-model="queryParams.endLateRegistrationLevel" placeholder="请选择结束等级" style="width: 200px">
+            <!-- 手动添加空选项 -->
+            <el-option :value="null" label="全部" />
+            <el-option v-for="item in itemOptionsStructuresLevelRight" :key="item.id" :label="item.label" :value="item.id" />
+          </el-select>
+        </el-form-item>
         <el-form-item>
           <el-button type="primary" @click="handlePlayerSearch">搜索</el-button>
         </el-form-item>
@@ -111,11 +125,26 @@
             <strong>发牌信息:</strong>
             <span v-html="blindsInfoText"></span>
           </el-col>-->
+          <el-col :span="24" style="font-size: 14px; color: #333; margin-bottom: 6px">
+            <strong>比赛时间:</strong>
+            <span v-html="beginTimeOrEndTime"></span>
+            <span style="margin-left: 20px">
+              <strong>盲注等级:</strong>
+              <span v-html="blindLevelIds"></span>
+            </span>
+            <span style="margin-left: 20px">
+              <strong>比赛开始时人数:</strong>
+              <span v-html="beginPeopleIds"></span>
+            </span>
+            <span style="margin-left: 20px">
+              <strong>比赛结束时人数:</strong>
+              <span v-html="endPeopleIds"></span>
+            </span>
+          </el-col>
           <el-col :span="24" style="font-size: 14px; color: #333; margin-bottom: 6px">
             <strong>公共牌:</strong>
             <span v-html="publicInfoText"></span>
           </el-col>
-
           <!--          <el-col :span="1.5">
             <el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['system:history:add']">新增</el-button>
           </el-col>
@@ -213,6 +242,7 @@ import {
   selectAllHandNumber
 } from '@/api/system/business/history';
 import { getTournaments } from '@/api/system/business/tournaments';
+import { selectBlindLevelsById, selectBlindLevelsByTournament } from '@/api/system/business/levels';
 import { HistoryVO, HistoryQuery, HistoryForm } from '@/api/system/business/history/types';
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
 
@@ -233,6 +263,16 @@ const showMoreNumber = ref(false); // 定义 showMore 状态
 const blindsInfoText = ref<string>('');
 //公共牌
 const publicInfoText = ref<string>('');
+//比赛开始时间-结束时间
+const beginTimeOrEndTime = ref<string>('');
+
+//比赛开始时间-结束时间
+const blindLevelIds = ref<string>('');
+//开始时人数
+const beginPeopleIds = ref<string>('');
+//结束时人数
+const endPeopleIds = ref<string>('');
+
 const dialog = reactive<DialogOption>({
   visible: false,
   title: ''
@@ -301,6 +341,14 @@ const getList = async () => {
     //queryParams.value.playerId = String(playerId);
   }
   loading.value = true;
+  if (queryParams.value.startLateRegistrationLevel != undefined && queryParams.value.startLateRegistrationLevel != null) {
+    debugger;
+    queryParams.value.blindStructureId = blindStructureId.value;
+  } else {
+    debugger;
+    queryParams.value.blindStructureId = null;
+  }
+
   /*  queryParams.value.tournamentId = 5147;
   queryParams.value.historyId = 46569;*/
   const res = await listHistory2(queryParams.value);
@@ -317,6 +365,30 @@ const getList = async () => {
     publicInfoText.value = '';
   }
 
+  if (res.rows && res.rows.length > 0 && res.rows[0]?.handStartTime) {
+    beginTimeOrEndTime.value = res.rows[0].handStartTime + '-' + res.rows[0].handEndTime;
+  } else {
+    beginTimeOrEndTime.value = '';
+  }
+
+  if (res.rows && res.rows.length > 0 && res.rows[0]?.blindLevelIds) {
+    blindLevelIds.value = res.rows[0].blindLevelIds;
+  } else {
+    blindLevelIds.value = '';
+  }
+
+  if (res.rows && res.rows.length > 0 && res.rows[0]?.beginPeopleIds) {
+    beginPeopleIds.value = res.rows[0].beginPeopleIds;
+  } else {
+    beginPeopleIds.value = '';
+  }
+
+  if (res.rows && res.rows.length > 0 && res.rows[0]?.endPeopleIds) {
+    endPeopleIds.value = res.rows[0].endPeopleIds;
+  } else {
+    endPeopleIds.value = '';
+  }
+
   historyList.value = res.rows;
   total.value = res.total;
   loading.value = false;
@@ -418,7 +490,7 @@ const getTableData = async (playerId: string | number, tournamentId: string | nu
     if (!isNaN(playerIdNum)) {
       queryParams.value.playerId = playerIdNum;
       queryParams.value.handId = null;
-    }else{
+    } else {
       queryParams.value.playerId = null;
     }
     const res = await selectAllHandZhuoCi2(queryParams.value);
@@ -439,19 +511,18 @@ const getTableData = async (playerId: string | number, tournamentId: string | nu
         selectedTableHandNumberId.value = firstHandTable.handNumber;
         if (!isNaN(playerIdNum)) {
           queryParams.value.historyId = firstHandTable.id;
-        }else{
+        } else {
           //拼接handId
           const tid = tournamentId ?? 'unknown';
           const tableId = firstTable.tableId ?? 'unknown';
           const handNum = firstHandTable.handNumber ?? 'unknown';
           queryParams.value.handId = `${tid}-${tableId}-${handNum}`;
           queryParams.value.playerId = null;
-          if(queryParams.value.handId!=null){
-            queryParams.value.historyId=null;
+          if (queryParams.value.handId != null) {
+            queryParams.value.historyId = null;
           }
         }
         queryParams.value.tournamentId = String(tournamentId);
-
       }
     }
     /*   } else {
@@ -463,7 +534,7 @@ const getTableData = async (playerId: string | number, tournamentId: string | nu
 };
 
 const tournamentInfo = ref<Partial<TournamentsVO>>({
-  id: '',
+  id: null,
   startTime: '',
   endTime: '',
   itemsNum: 0,
@@ -540,6 +611,7 @@ watch(
         if (res.code === 200) {
           tournamentInfo.value = res.data;
         }
+        handleBlindStructureChange(Number(tournamentId));
       } catch (error) {
         console.error('获取赛事信息失败', error);
       }
@@ -568,14 +640,12 @@ const handleTableClick = async (table: any) => {
     //选中对应的变颜色底部
     selectedTableHandNumberId.value = firstHandTable.handNumber; // 添加这行代码
     queryParams.value.historyId = firstHandTable.id;
-    if(firstHandTable.id==undefined){
+    if (firstHandTable.id == undefined) {
       const tid = tournamentId ?? 'unknown';
       const tableId = table.tableId ?? 'unknown';
       const handNum = firstHandTable.handNumber ?? 'unknown';
       queryParams.value.handId = `${tid}-${tableId}-${handNum}`;
     }
-
-
   } catch (error) {
     console.error('请求失败:', error);
     // 可选:清空数据或提示用户
@@ -598,8 +668,8 @@ const handleTableNumberClick = async (table: any) => {
   const tableId = selectedTableId.value ?? 'unknown';
   const handNum = table.handNumber ?? 'unknown';
   queryParams.value.handId = `${tid}-${tableId}-${handNum}`;
-  if(queryParams.value.handId!=null){
-    queryParams.value.historyId=null;
+  if (queryParams.value.handId != null) {
+    queryParams.value.historyId = null;
   }
   try {
     // 如果 getList 也需要异步等待,也应加上 async/await
@@ -624,10 +694,10 @@ const handlePlayerSearch = async () => {
 
   // 获取玩家名称或ID
   const playerNameOrId = queryParams.value.playerNameOrId;
-  if (!playerNameOrId) {
+  /*  if (!playerNameOrId) {
     proxy?.$modal.msgError('请输入玩家名称或选手ID');
     return;
-  }
+  }*/
 
   try {
     // 调用 API 获取桌次数据
@@ -655,8 +725,8 @@ const handlePlayerSearch = async () => {
           const tableId = firstTable.tableId ?? 'unknown';
           const handNum = firstHandTable.handNumber ?? 'unknown';
           queryParams.value.handId = `${tid}-${tableId}-${handNum}`;
-          if(queryParams.value.handId!=null){
-            queryParams.value.historyId=null;
+          if (queryParams.value.handId != null) {
+            queryParams.value.historyId = null;
           }
         }
       } else {
@@ -673,6 +743,58 @@ const handlePlayerSearch = async () => {
   }
 };
 
+// 下拉选项数据
+const itemOptionsStructuresLevelLeft = ref<{ id: number; label: string }[]>([]);
+const itemOptionsStructuresLevelRight = ref<{ id: number; label: string }[]>([]);
+const blindStructureId = ref<number | null>(null); // 用于存储选中的结构ID
+// 加载报名条件选项
+const handleBlindStructureChange = async (value: number) => {
+  try {
+    const res = await selectBlindLevelsByTournament(value);
+    if (res.code === 200) {
+      // 使用 unknown 中间类型进行类型转换
+      const data = res.data as unknown as {
+        id: number;
+        levelNumber: number;
+        smallBlind: number;
+        bigBlind: number;
+        ante: number;
+        blindStructureId: number;
+      }[];
+      // ✅ 取第一条数据的 id,赋值给公共变量
+      blindStructureId.value = data[0].id;
+      const list = data.map((item) => {
+        const { levelNumber, smallBlind, bigBlind, ante } = item;
+        const blindText = `${smallBlind}/${bigBlind} (${ante})`;
+        return {
+          id: levelNumber,
+          label: `等级${levelNumber} ${blindText}`
+        };
+      });
+
+      /*  itemOptionsStructuresLevel.value = list;
+
+      for (let i = 0; i < data.length; i++) {
+        const item = data[i];
+        debugger;
+        let smallBlind=item.smallBlind;
+        let bigBlind=item.bigBlind;
+        let ante=item.ante;
+        let pubvar=smallBlind+"/"+bigBlind+" "+"("+ante+")";
+        list.push({
+          id: item.levelNumber,
+          label: item.levelNumber
+        })*/
+      itemOptionsStructuresLevelLeft.value = list;
+      itemOptionsStructuresLevelRight.value = list;
+    } else {
+      alert('加载失败:' + res.msg);
+    }
+  } catch (error) {
+    console.error('请求出错:', error);
+  }
+};
+
 // 高亮小盲、大盲
 function highlightBlinds(text: string): string {
   if (!text) return '';