diff --git a/src/api/martial/judgeInvite.js b/src/api/martial/judgeInvite.js index 42c8c87..c8f3212 100644 --- a/src/api/martial/judgeInvite.js +++ b/src/api/martial/judgeInvite.js @@ -264,3 +264,17 @@ export const getInviteByJudge = (competitionId, judgeId) => { params: { competitionId, judgeId } }) } + +/** + * 更新邀请的项目分配 + * @param {Object} data - 更新参数 + * @param {Number} data.inviteId - 邀请ID + * @param {String} data.projects - 项目列表(JSON字符串) + */ +export const updateInviteProjects = (data) => { + return request({ + url: '/api/martial/judgeInvite/updateProjects', + method: 'put', + data + }) +} diff --git a/src/views/martial/judgeInvite/index.vue b/src/views/martial/judgeInvite/index.vue index 5ac2622..323dc62 100644 --- a/src/views/martial/judgeInvite/index.vue +++ b/src/views/martial/judgeInvite/index.vue @@ -162,6 +162,9 @@ 查看 + + 编辑项目 + 删除 @@ -207,6 +210,23 @@ /> + + + + + @@ -305,6 +325,43 @@ + + + + + {{ editingInvite.judgeName }} + + + {{ editingInvite.venueName || "全部场地" }} + + + + + + + + + @@ -318,6 +375,7 @@ import { Download, FolderOpened, View, + Edit, } from '@element-plus/icons-vue' import { getJudgeInviteList, @@ -359,6 +417,11 @@ const judgeLoading = ref(false) const judgeList = ref([]) const judgeTotal = ref(0) const selectedJudges = ref([]) + +// 编辑项目对话框 +const editProjectsDialogVisible = ref(false) +const editingInvite = ref({}) +const editingProjectIds = ref([]) const judgeQueryParams = reactive({ current: 1, size: 10, @@ -673,6 +736,50 @@ const handleConfirmImport = async () => { } } +// 编辑项目 +const handleEditProjects = async (row) => { + // Load project list first + await loadVenueAndProjectList() + editingInvite.value = row + // 解析现有项目 + if (row.projects) { + try { + editingProjectIds.value = JSON.parse(row.projects) + } catch (e) { + editingProjectIds.value = [] + } + } else { + editingProjectIds.value = [] + } + editProjectsDialogVisible.value = true +} + +// 保存项目分配 +const handleSaveProjects = async () => { + if (!editingProjectIds.value || editingProjectIds.value.length === 0) { + ElMessage.warning("请至少选择一个项目") + return + } + + try { + const res = await updateInviteProjects({ + inviteId: editingInvite.value.id, + projects: JSON.stringify(editingProjectIds.value) + }) + + if (res.data?.success) { + ElMessage.success("项目分配更新成功") + editProjectsDialogVisible.value = false + await fetchData() + } else { + ElMessage.error(res.data?.msg || "更新失败") + } + } catch (error) { + console.error("更新项目分配失败:", error) + ElMessage.error("更新失败,请重试") + } +} + // 查看 const handleView = async (row) => { try {