diff --git a/src/views/martial/judgeInvite/index.vue b/src/views/martial/judgeInvite/index.vue index 3950b8d..a7044df 100644 --- a/src/views/martial/judgeInvite/index.vue +++ b/src/views/martial/judgeInvite/index.vue @@ -185,6 +185,42 @@ width="900px" :close-on-click-modal="false" > + + + + + + + + + + + + + + @@ -303,6 +339,8 @@ import { removeInvite } from '@/api/martial/judgeInvite' import { getCompetitionList } from '@/api/martial/competition' +import { getVenuesByCompetition } from '@/api/martial/venue' +import { getProjectsByCompetition } from '@/api/martial/project' import { getRefereeList } from '@/api/martial/referee' import dayjs from 'dayjs' @@ -316,6 +354,16 @@ const competitionLoading = ref(false) // 赛事列表加载状态 // 裁判选择对话框 const judgeDialogVisible = ref(false) + +// 场地和项目列表 +const venueList = ref([]) +const projectList = ref([]) + +// 导入表单 +const importForm = reactive({ + venueId: null, + projectIds: [] +}) const judgeLoading = ref(false) const judgeList = ref([]) const judgeTotal = ref(0) @@ -454,12 +502,48 @@ const handleImportFromPool = async () => { return } + // 重置导入表单 + importForm.venueId = null + importForm.projectIds = [] + + // 加载场地和项目列表 + await loadVenueAndProjectList() + // 打开裁判选择对话框 judgeDialogVisible.value = true selectedJudges.value = [] loadJudgeList() } +// 加载场地和项目列表 +const loadVenueAndProjectList = async () => { + try { + // 并行加载场地和项目 + const [venueRes, projectRes] = await Promise.all([ + getVenuesByCompetition(queryParams.competitionId), + getProjectsByCompetition(queryParams.competitionId) + ]) + + // 处理场地数据 + const venueData = venueRes.data?.data || venueRes.data || {} + venueList.value = venueData.records || [] + + // 处理项目数据 + const projectData = projectRes.data?.data || projectRes.data || {} + projectList.value = projectData.records || [] + + if (venueList.value.length === 0) { + ElMessage.warning('该赛事暂无场地,请先添加场地') + } + if (projectList.value.length === 0) { + ElMessage.warning('该赛事暂无项目,请先添加项目') + } + } catch (error) { + console.error('加载场地/项目列表失败:', error) + ElMessage.error('加载场地/项目列表失败') + } +} + // 加载裁判列表 const loadJudgeList = async () => { judgeLoading.value = true @@ -523,6 +607,16 @@ const handleConfirmImport = async () => { return } + // 验证场地和项目 + if (!importForm.venueId) { + ElMessage.warning('请选择分配的场地') + return + } + if (!importForm.projectIds || importForm.projectIds.length === 0) { + ElMessage.warning('请选择分配的项目') + return + } + try { await ElMessageBox.confirm( `确定为选中的 ${selectedJudges.value.length} 位裁判生成邀请码吗?`, @@ -541,6 +635,8 @@ const handleConfirmImport = async () => { competitionId: queryParams.competitionId, judgeIds: judgeIds, role: 'judge', + venueId: importForm.venueId, + projects: JSON.stringify(importForm.projectIds), expireDays: 30 }) diff --git a/vite.config.js b/vite.config.js index 56afff1..c8d55ac 100644 --- a/vite.config.js +++ b/vite.config.js @@ -14,7 +14,8 @@ export default ({ mode, command }) => { __INTLIFY_PROD_DEVTOOLS__: false, }, server: { - port: 2888, + port: 8083, + host: '0.0.0.0', proxy: { '/api': { target: 'http://localhost:8123',