|
|
@@ -242,7 +242,7 @@ import {
|
|
|
selectAllHandNumber
|
|
|
} from '@/api/system/business/history';
|
|
|
import { getTournaments } from '@/api/system/business/tournaments';
|
|
|
-import { selectBlindLevelsByTournament } from '@/api/system/business/levels';
|
|
|
+import { selectBlindLevelsByTournament } from '@/api/system/business/levels';
|
|
|
import { HistoryVO, HistoryQuery, HistoryForm } from '@/api/system/business/history/types';
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
|
|
|
@@ -405,7 +405,7 @@ const reset = () => {
|
|
|
};
|
|
|
|
|
|
const resetQueryParams = () => {
|
|
|
-/* const defaults = {
|
|
|
+ const defaults = {
|
|
|
pageNum: 1,
|
|
|
pageSize: 10,
|
|
|
handId: undefined,
|
|
|
@@ -422,7 +422,7 @@ const resetQueryParams = () => {
|
|
|
params: {},
|
|
|
playerNameOrId: undefined
|
|
|
};
|
|
|
- Object.assign(data.queryParams, defaults);*/
|
|
|
+ Object.assign(data.queryParams, defaults);
|
|
|
};
|
|
|
/** 搜索按钮操作 */
|
|
|
const handleQuery = () => {
|
|
|
@@ -505,7 +505,7 @@ const getTableData = async (playerId: string | number, tournamentId: string | nu
|
|
|
const tournamentIdNum = String(tournamentId);
|
|
|
/* if (!isNaN(playerIdNum) && !isNaN(tournamentIdNum)) {*/
|
|
|
queryParams.value.tournamentId = tournamentIdNum;
|
|
|
- if (playerIdNum !== null && playerIdNum !== undefined) {
|
|
|
+ if (playerIdNum !== null && playerIdNum !== undefined && playerIdNum != '') {
|
|
|
queryParams.value.playerId = playerIdNum;
|
|
|
queryParams.value.handId = null;
|
|
|
} else {
|
|
|
@@ -514,7 +514,6 @@ const getTableData = async (playerId: string | number, tournamentId: string | nu
|
|
|
const res = await selectAllHandZhuoCi2(queryParams.value);
|
|
|
if (res.code === 200) {
|
|
|
tableData.value = res.data;
|
|
|
-
|
|
|
// ✅ 默认选中第一个桌次
|
|
|
if (tableData.value.length > 0) {
|
|
|
const firstTable = tableData.value[0];
|
|
|
@@ -527,7 +526,7 @@ const getTableData = async (playerId: string | number, tournamentId: string | nu
|
|
|
tableNumberData.value = res.data;
|
|
|
const firstHandTable = tableNumberData.value[0];
|
|
|
selectedTableHandNumberId.value = firstHandTable.handNumber;
|
|
|
- if (!isNaN(playerIdNum)) {
|
|
|
+ if (playerIdNum !== null && playerIdNum !== undefined && playerIdNum != '') {
|
|
|
queryParams.value.historyId = firstHandTable.id;
|
|
|
queryParams.value.handId = null;
|
|
|
} else {
|
|
|
@@ -538,7 +537,7 @@ const getTableData = async (playerId: string | number, tournamentId: string | nu
|
|
|
queryParams.value.handId = `${tid}-${tableId}-${handNum}`;
|
|
|
queryParams.value.playerId = null;
|
|
|
if (queryParams.value.handId != null) {
|
|
|
- queryParams.value.historyId = null;
|
|
|
+ queryParams.value.historyId = '';
|
|
|
}
|
|
|
}
|
|
|
queryParams.value.tournamentId = String(tournamentId);
|
|
|
@@ -615,28 +614,41 @@ watch(
|
|
|
() => route.query,
|
|
|
async (newQuery) => {
|
|
|
const { tournamentId, playerId } = newQuery;
|
|
|
- if (tournamentId && playerId) {
|
|
|
- const playerIdNum = String(playerId);
|
|
|
- const tournamentIdNum = String(tournamentId);
|
|
|
- await getTableData(playerIdNum, tournamentIdNum);
|
|
|
- /* if (!isNaN(playerIdNum) && !isNaN(tournamentIdNum)) {
|
|
|
- await getTableData(playerIdNum, tournamentIdNum);
|
|
|
- }*/
|
|
|
- }
|
|
|
|
|
|
- if (tournamentId) {
|
|
|
- const id = Array.isArray(tournamentId) ? tournamentId[0] : tournamentId;
|
|
|
+ // 判断 tournamentId 是否存在(字符串非空)
|
|
|
+ const isValidTournamentId = tournamentId && (typeof tournamentId === 'string' ? tournamentId.trim() !== '' : true);
|
|
|
+
|
|
|
+ if (isValidTournamentId) {
|
|
|
+ // 处理 tournamentId 可能是数组的情况
|
|
|
+ const tid = Array.isArray(tournamentId) ? tournamentId[0] : tournamentId;
|
|
|
+ const playerIdStr = playerId != null ? (Array.isArray(playerId) ? playerId[0] : playerId) : null;
|
|
|
+
|
|
|
try {
|
|
|
- const res = await getTournaments(id);
|
|
|
+ // 1. 获取表格数据
|
|
|
+ await getTableData(String(playerIdStr), String(tid));
|
|
|
+
|
|
|
+ // 2. 获取赛事详情
|
|
|
+ const res = await getTournaments(tid);
|
|
|
if (res.code === 200) {
|
|
|
tournamentInfo.value = res.data;
|
|
|
}
|
|
|
- handleBlindStructureChange(Number(tournamentId));
|
|
|
+
|
|
|
+ // 3. 处理盲注结构
|
|
|
+ handleBlindStructureChange(Number(tid));
|
|
|
} catch (error) {
|
|
|
- console.error('获取赛事信息失败', error);
|
|
|
+ console.error('数据加载失败', error);
|
|
|
}
|
|
|
}
|
|
|
- await getList();
|
|
|
+
|
|
|
+ // ✅ 条件:只有当有查询参数时才调用 getList
|
|
|
+ // 比如:你想在打开“历史记录”页面时才加载列表
|
|
|
+ if (isValidTournamentId || playerId) {
|
|
|
+ await getList();
|
|
|
+ } else {
|
|
|
+ // 没有参数,可能是初始进入页面,可选:清空数据 or 不操作
|
|
|
+ // tournamentInfo.value = null;
|
|
|
+ // tableData.value = [];
|
|
|
+ }
|
|
|
},
|
|
|
{ deep: true, immediate: true }
|
|
|
);
|