|
|
@@ -394,19 +394,9 @@
|
|
|
</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 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">
|
|
|
@@ -419,19 +409,10 @@
|
|
|
:loading="selectLoading"
|
|
|
clearable
|
|
|
>
|
|
|
- <el-option
|
|
|
- v-for="item in selectOptions"
|
|
|
- :key="item.id"
|
|
|
- :label="item.label"
|
|
|
- :value="item.id"
|
|
|
- />
|
|
|
+ <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-form-item>
|
|
|
+ <el-form-item label="晋级条件类型" prop="qualifierType" v-if="form.tournamentType === 1">
|
|
|
<el-select
|
|
|
aria-required="true"
|
|
|
v-model="form.qualifierType"
|
|
|
@@ -443,35 +424,13 @@
|
|
|
</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 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-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>
|
|
|
@@ -497,7 +456,14 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup name="Tournaments" lang="ts">
|
|
|
-import { listTournaments, getTournaments, delTournaments, addTournaments, updateTournaments, selectPhysicalTournamentsLeagueId } 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';
|
|
|
@@ -512,7 +478,7 @@ 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 , qualifier_type } = toRefs<any>(
|
|
|
+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[]>([]);
|
|
|
@@ -569,7 +535,7 @@ const initFormData: TournamentsForm = {
|
|
|
targetTournamentId: undefined,
|
|
|
qualifierType: undefined,
|
|
|
qualifierValue: undefined,
|
|
|
- tournamentType: 0, // 👈 默认普通赛
|
|
|
+ tournamentType: 0 // 👈 默认普通赛
|
|
|
};
|
|
|
const data = reactive<PageData<TournamentsForm, TournamentsQuery>>({
|
|
|
form: { ...initFormData },
|
|
|
@@ -617,9 +583,16 @@ const data = reactive<PageData<TournamentsForm, TournamentsQuery>>({
|
|
|
lateRegistrationLevel: [{ required: true, message: '截止报名级别不能为空', trigger: 'change' }],
|
|
|
signTime: [{ required: true, message: '报名时间不能为空', trigger: 'change' }],
|
|
|
// ...其他规则
|
|
|
+ // ... existing code ...
|
|
|
itemsId: [
|
|
|
{
|
|
|
validator: (rule, value, callback) => {
|
|
|
+ // 当 tournamentType 为 1(卫星赛)时,不进行校验
|
|
|
+ if (data.form.tournamentType === 1) {
|
|
|
+ callback();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
// 检查是否至少有一个报名条件被设置
|
|
|
const hasValidCondition = formConditions.conditions.some((condition) => condition.itemId && condition.quantity);
|
|
|
|
|
|
@@ -850,13 +823,13 @@ const handleUpdate = async (row?: TournamentsVO, mode: 'edit' | 'view' = 'edit')
|
|
|
quantity: Number(item.quantity)
|
|
|
}));
|
|
|
} else {
|
|
|
- formPrize.rewards = [
|
|
|
+ /*formPrize.rewards = [
|
|
|
{
|
|
|
ranking: 1,
|
|
|
itemId: null,
|
|
|
quantity: null
|
|
|
}
|
|
|
- ];
|
|
|
+ ];*/
|
|
|
}
|
|
|
// ✅ 主动触发盲注等级加载
|
|
|
if (form.value.blindStructureId) {
|
|
|
@@ -871,11 +844,12 @@ const handleUpdate = async (row?: TournamentsVO, mode: 'edit' | 'view' = 'edit')
|
|
|
const submitForm = () => {
|
|
|
tournamentsFormRef.value?.validate(async (valid: boolean) => {
|
|
|
// 校验奖励内容是否至少填写了一项
|
|
|
- if (!formPrize.rewards.some((r) => r.itemId && r.quantity)) {
|
|
|
- ElMessage.warning('请至少填写一项奖励内容');
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
+ /* if (data.form.tournamentType !== 1) {
|
|
|
+ if (!formPrize.rewards.some((r) => r.itemId && r.quantity)) {
|
|
|
+ ElMessage.warning('请至少填写一项奖励内容');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }*/
|
|
|
if (!valid) return;
|
|
|
try {
|
|
|
buttonLoading.value = true;
|
|
|
@@ -884,11 +858,6 @@ const submitForm = () => {
|
|
|
const formData: TournamentsForm = {
|
|
|
...data.form,
|
|
|
competitionIcon: data.form.competitionIcon, // 确保 iconUrl 存在
|
|
|
- itemsPrizeList: formPrize.rewards.map((reward) => ({
|
|
|
- ranking: Number(reward.ranking),
|
|
|
- itemId: Number(reward.itemId),
|
|
|
- quantity: Number(reward.quantity)
|
|
|
- })),
|
|
|
// 添加报名条件数据
|
|
|
itemsConditionList: formConditions.conditions
|
|
|
.filter((condition) => condition.itemId && condition.quantity) // 过滤掉未填写的条件
|
|
|
@@ -898,6 +867,16 @@ const submitForm = () => {
|
|
|
quantity: Number(condition.quantity)
|
|
|
}))
|
|
|
};
|
|
|
+ // 只有在有奖励数据时才添加 itemsPrizeList
|
|
|
+ if (formPrize.rewards && formPrize.rewards.length > 0) {
|
|
|
+ formData.itemsPrizeList = formPrize.rewards
|
|
|
+ .filter((reward) => reward.itemId && reward.itemId !== 0) // 过滤掉 itemId 为 0 的项
|
|
|
+ .map((reward) => ({
|
|
|
+ ranking: Number(reward.ranking),
|
|
|
+ itemId: Number(reward.itemId),
|
|
|
+ quantity: Number(reward.quantity)
|
|
|
+ }));
|
|
|
+ }
|
|
|
// 提交数据(区分新增/编辑)
|
|
|
let response;
|
|
|
if (formData.id) {
|
|
|
@@ -1416,8 +1395,6 @@ const loadTargetTournaments = (query: string) => {
|
|
|
return;
|
|
|
}
|
|
|
// 这里可加模糊搜索逻辑(如 filter)
|
|
|
- selectOptions.value = leagueRelatedTournaments.value.filter(item =>
|
|
|
- item.name.toLowerCase().includes(query.toLowerCase())
|
|
|
- );
|
|
|
+ selectOptions.value = leagueRelatedTournaments.value.filter((item) => item.name.toLowerCase().includes(query.toLowerCase()));
|
|
|
};
|
|
|
</script>
|