|
|
@@ -393,6 +393,87 @@
|
|
|
</el-select>
|
|
|
</div>
|
|
|
</el-form-item>
|
|
|
+
|
|
|
+
|
|
|
+ <el-form-item label="赛事标识" prop="tournamentType">
|
|
|
+ <el-select
|
|
|
+ v-model="form.tournamentType"
|
|
|
+ placeholder="请选择"
|
|
|
+ :disabled="dialog.mode === 'view'"
|
|
|
+ >
|
|
|
+ <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-select
|
|
|
+ v-model="form.targetTournamentId"
|
|
|
+ placeholder="请选择比赛"
|
|
|
+ :disabled="dialog.mode === 'view'"
|
|
|
+ remote
|
|
|
+ :remote-method="loadTargetTournaments"
|
|
|
+ :loading="selectLoading"
|
|
|
+ clearable
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in selectOptions"
|
|
|
+ :key="item.id"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.id"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item
|
|
|
+ label="晋级条件类型"
|
|
|
+ prop="qualifierType"
|
|
|
+ v-if="form.tournamentType === 1"
|
|
|
+ >
|
|
|
+ <el-select
|
|
|
+ aria-required="true"
|
|
|
+ v-model="form.qualifierType"
|
|
|
+ placeholder="请选择"
|
|
|
+ :disabled="dialog.mode === 'view'"
|
|
|
+ @change="handleQualifierTypeChange"
|
|
|
+ >
|
|
|
+ <el-option v-for="dict in qualifier_type" :key="dict.value" :label="dict.label" :value="dict.value" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item
|
|
|
+ label="晋级条件值"
|
|
|
+ prop="qualifierValue"
|
|
|
+ v-if="form.tournamentType === 1 && form.qualifierType === '2'"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model="form.qualifierValue"
|
|
|
+ placeholder="请输入晋级条件值"
|
|
|
+ :disabled="dialog.mode === 'view'"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item
|
|
|
+ label="晋级级别"
|
|
|
+ prop="qualifierValue"
|
|
|
+ v-if="form.tournamentType === 1 && form.qualifierType === '1'"
|
|
|
+ >
|
|
|
+ <el-select
|
|
|
+ v-model="form.qualifierValue"
|
|
|
+ placeholder="选项"
|
|
|
+ style="width: 200px"
|
|
|
+ :disabled="dialog.mode === 'view'"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in itemOptionsStructuresLevel2"
|
|
|
+ :key="item.id"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.id"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
</el-form>
|
|
|
<template #footer>
|
|
|
<div class="dialog-footer">
|
|
|
@@ -416,7 +497,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup name="Tournaments" lang="ts">
|
|
|
-import { listTournaments, getTournaments, delTournaments, addTournaments, updateTournaments } from '@/api/system/physical/tournaments';
|
|
|
+import { listTournaments, getTournaments, delTournaments, addTournaments, updateTournaments, selectPhysicalTournamentsLeagueId } from '@/api/system/physical/tournaments';
|
|
|
import { TournamentsVO, TournamentsQuery, TournamentsForm } from '@/api/system/physical/tournaments/types';
|
|
|
import { selectItemsSelList, selectXianXiaItemsSelList } from '@/api/system/business/items';
|
|
|
import { selectPhysicalBlingStructuresInfo } from '@/api/system/physical/blindStructures';
|
|
|
@@ -429,9 +510,10 @@ import LevelsIndex from '@/views/system/physical/blindLevels/index.vue';
|
|
|
import { LeagueTournamentVO } from '@/api/system/physical/leagueTournament/types';
|
|
|
import { JudgeVO } from '@/api/system/physical/judge/types';
|
|
|
import { ElSelect } from 'element-plus';
|
|
|
+import { ref } from 'vue';
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
-const { game_variant_type, tournaments_time, physical_tournaments_type } = toRefs<any>(
|
|
|
- proxy?.useDict('game_variant_type', 'tournaments_time', 'physical_tournaments_type')
|
|
|
+const { game_variant_type, tournaments_time, physical_tournaments_type , qualifier_type } = toRefs<any>(
|
|
|
+ proxy?.useDict('game_variant_type', 'tournaments_time', 'physical_tournaments_type', 'qualifier_type')
|
|
|
);
|
|
|
const tournamentsList = ref<TournamentsVO[]>([]);
|
|
|
const buttonLoading = ref(false);
|
|
|
@@ -486,7 +568,8 @@ const initFormData: TournamentsForm = {
|
|
|
actionTime: undefined,
|
|
|
targetTournamentId: undefined,
|
|
|
qualifierType: undefined,
|
|
|
- qualifierValue: undefined
|
|
|
+ qualifierValue: undefined,
|
|
|
+ tournamentType: 0, // 👈 默认普通赛
|
|
|
};
|
|
|
const data = reactive<PageData<TournamentsForm, TournamentsQuery>>({
|
|
|
form: { ...initFormData },
|
|
|
@@ -738,6 +821,7 @@ const handleUpdate = async (row?: TournamentsVO, mode: 'edit' | 'view' = 'edit')
|
|
|
form.value.signTime = String(res.data.signTime);
|
|
|
form.value.gameType = String(res.data.gameType); // 转为字符串
|
|
|
form.value.gameVariant = String(res.data.gameVariant); // 转为字符串
|
|
|
+ form.value.qualifierType = String(res.data.qualifierType);
|
|
|
competitionIcon.value = res.data.competitionIcon;
|
|
|
competitionBg.value = res.data.competitionBg;
|
|
|
// 处理报名条件数据
|
|
|
@@ -774,6 +858,10 @@ const handleUpdate = async (row?: TournamentsVO, mode: 'edit' | 'view' = 'edit')
|
|
|
}
|
|
|
];
|
|
|
}
|
|
|
+ // ✅ 主动触发盲注等级加载
|
|
|
+ if (form.value.blindStructureId) {
|
|
|
+ await handleBlindStructureChange(form.value.blindStructureId);
|
|
|
+ }
|
|
|
dialog.visible = true;
|
|
|
dialog.title = mode === 'view' ? '查看比赛' : '编辑比赛';
|
|
|
dialog.mode = mode; // 设置模式
|
|
|
@@ -859,6 +947,7 @@ onMounted(() => {
|
|
|
loadLeagueTournamentOptions();
|
|
|
loadJudgeOptions();
|
|
|
loadItemPrizeOptions();
|
|
|
+ loadLeagueRelatedTournaments();
|
|
|
});
|
|
|
const itemOptions = ref<{ id: number; label: string }[]>([]);
|
|
|
// 加载报名条件选项
|
|
|
@@ -936,7 +1025,7 @@ const loadItemStructuresOptions = async () => {
|
|
|
|
|
|
// 下拉选项数据
|
|
|
const itemOptionsStructuresLevel = ref<{ id: number; label: string }[]>([]);
|
|
|
-
|
|
|
+const itemOptionsStructuresLevel2 = ref<{ id: number; label: string }[]>([]);
|
|
|
// 加载报名条件选项
|
|
|
const handleBlindStructureChange = async (value: number) => {
|
|
|
//data.form.lateRegistrationLevel = null;
|
|
|
@@ -957,6 +1046,7 @@ const handleBlindStructureChange = async (value: number) => {
|
|
|
}
|
|
|
}
|
|
|
itemOptionsStructuresLevel.value = list;
|
|
|
+ itemOptionsStructuresLevel2.value = list;
|
|
|
// 判断当前选择的 lateRegistrationLevel 是否在新列表中
|
|
|
const currentLevel = data.form.lateRegistrationLevel;
|
|
|
if (currentLevel && !list.some((item) => item.id === currentLevel)) {
|
|
|
@@ -1293,5 +1383,41 @@ const resetFormConditions = () => {
|
|
|
const getConditionTooltipContent = (conditions: any[]) => {
|
|
|
return conditions.map((condition) => `${condition.itemsName} x ${condition.quantity}`).join('\n');
|
|
|
};
|
|
|
-
|
|
|
+const tournamentTypeOptions = ref([
|
|
|
+ { value: 0, label: '普通赛' },
|
|
|
+ { value: 1, label: '晋级赛' }
|
|
|
+]);
|
|
|
+const selectOptions = ref<{ id: string | number; label: string }[]>([]); // 👈 类型明确:id 可能是 string/number,name 是必填字段
|
|
|
+const selectLoading = ref(false);
|
|
|
+const loadLeagueRelatedTournaments = async () => {
|
|
|
+ try {
|
|
|
+ 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;
|
|
|
+ } catch (error) {
|
|
|
+ console.error('加载联赛关联赛事失败', error);
|
|
|
+ ElMessage.error('加载失败');
|
|
|
+ } finally {
|
|
|
+ selectLoading.value = false;
|
|
|
+ }
|
|
|
+};
|
|
|
+const loadTargetTournaments = (query: string) => {
|
|
|
+ if (!query.trim()) {
|
|
|
+ selectOptions.value = leagueRelatedTournaments.value;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 这里可加模糊搜索逻辑(如 filter)
|
|
|
+ selectOptions.value = leagueRelatedTournaments.value.filter(item =>
|
|
|
+ item.name.toLowerCase().includes(query.toLowerCase())
|
|
|
+ );
|
|
|
+};
|
|
|
</script>
|