feat: 裁判邀请导入功能添加场地和项目选择
- 导入对话框添加场地下拉选择 - 导入对话框添加项目多选 - 调用API时传递venueId和projects参数 🤖 Generated with Claude Code Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -185,6 +185,42 @@
|
|||||||
width="900px"
|
width="900px"
|
||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
>
|
>
|
||||||
|
<!-- 场地和项目选择 -->
|
||||||
|
<el-form :inline="true" class="venue-project-form" style="margin-bottom: 15px; padding: 15px; background: #f5f7fa; border-radius: 8px;">
|
||||||
|
<el-form-item label="分配场地" required>
|
||||||
|
<el-select
|
||||||
|
v-model="importForm.venueId"
|
||||||
|
placeholder="请选择场地"
|
||||||
|
clearable
|
||||||
|
style="width: 200px"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in venueList"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.venueName"
|
||||||
|
:value="item.id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="分配项目" required>
|
||||||
|
<el-select
|
||||||
|
v-model="importForm.projectIds"
|
||||||
|
placeholder="请选择项目(可多选)"
|
||||||
|
multiple
|
||||||
|
collapse-tags
|
||||||
|
collapse-tags-tooltip
|
||||||
|
style="width: 300px"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in projectList"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.projectName"
|
||||||
|
:value="item.id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
<!-- 搜索表单 -->
|
<!-- 搜索表单 -->
|
||||||
<el-form :inline="true" :model="judgeQueryParams" class="judge-search-form">
|
<el-form :inline="true" :model="judgeQueryParams" class="judge-search-form">
|
||||||
<el-form-item label="姓名">
|
<el-form-item label="姓名">
|
||||||
@@ -303,6 +339,8 @@ import {
|
|||||||
removeInvite
|
removeInvite
|
||||||
} from '@/api/martial/judgeInvite'
|
} from '@/api/martial/judgeInvite'
|
||||||
import { getCompetitionList } from '@/api/martial/competition'
|
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 { getRefereeList } from '@/api/martial/referee'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
|
|
||||||
@@ -316,6 +354,16 @@ const competitionLoading = ref(false) // 赛事列表加载状态
|
|||||||
|
|
||||||
// 裁判选择对话框
|
// 裁判选择对话框
|
||||||
const judgeDialogVisible = ref(false)
|
const judgeDialogVisible = ref(false)
|
||||||
|
|
||||||
|
// 场地和项目列表
|
||||||
|
const venueList = ref([])
|
||||||
|
const projectList = ref([])
|
||||||
|
|
||||||
|
// 导入表单
|
||||||
|
const importForm = reactive({
|
||||||
|
venueId: null,
|
||||||
|
projectIds: []
|
||||||
|
})
|
||||||
const judgeLoading = ref(false)
|
const judgeLoading = ref(false)
|
||||||
const judgeList = ref([])
|
const judgeList = ref([])
|
||||||
const judgeTotal = ref(0)
|
const judgeTotal = ref(0)
|
||||||
@@ -454,12 +502,48 @@ const handleImportFromPool = async () => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 重置导入表单
|
||||||
|
importForm.venueId = null
|
||||||
|
importForm.projectIds = []
|
||||||
|
|
||||||
|
// 加载场地和项目列表
|
||||||
|
await loadVenueAndProjectList()
|
||||||
|
|
||||||
// 打开裁判选择对话框
|
// 打开裁判选择对话框
|
||||||
judgeDialogVisible.value = true
|
judgeDialogVisible.value = true
|
||||||
selectedJudges.value = []
|
selectedJudges.value = []
|
||||||
loadJudgeList()
|
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 () => {
|
const loadJudgeList = async () => {
|
||||||
judgeLoading.value = true
|
judgeLoading.value = true
|
||||||
@@ -523,6 +607,16 @@ const handleConfirmImport = async () => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 验证场地和项目
|
||||||
|
if (!importForm.venueId) {
|
||||||
|
ElMessage.warning('请选择分配的场地')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!importForm.projectIds || importForm.projectIds.length === 0) {
|
||||||
|
ElMessage.warning('请选择分配的项目')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await ElMessageBox.confirm(
|
await ElMessageBox.confirm(
|
||||||
`确定为选中的 ${selectedJudges.value.length} 位裁判生成邀请码吗?`,
|
`确定为选中的 ${selectedJudges.value.length} 位裁判生成邀请码吗?`,
|
||||||
@@ -541,6 +635,8 @@ const handleConfirmImport = async () => {
|
|||||||
competitionId: queryParams.competitionId,
|
competitionId: queryParams.competitionId,
|
||||||
judgeIds: judgeIds,
|
judgeIds: judgeIds,
|
||||||
role: 'judge',
|
role: 'judge',
|
||||||
|
venueId: importForm.venueId,
|
||||||
|
projects: JSON.stringify(importForm.projectIds),
|
||||||
expireDays: 30
|
expireDays: 30
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ export default ({ mode, command }) => {
|
|||||||
__INTLIFY_PROD_DEVTOOLS__: false,
|
__INTLIFY_PROD_DEVTOOLS__: false,
|
||||||
},
|
},
|
||||||
server: {
|
server: {
|
||||||
port: 2888,
|
port: 8083,
|
||||||
|
host: '0.0.0.0',
|
||||||
proxy: {
|
proxy: {
|
||||||
'/api': {
|
'/api': {
|
||||||
target: 'http://localhost:8123',
|
target: 'http://localhost:8123',
|
||||||
|
|||||||
Reference in New Issue
Block a user