From ecd569337d6768f9f121f70992b1a42a697afcc4 Mon Sep 17 00:00:00 2001 From: DevOps Date: Mon, 5 Jan 2026 15:08:04 +0800 Subject: [PATCH] feat(judgeInvite): add project assignment editing feature - Add edit projects button in judge invite list - Add edit projects dialog with project multi-select - Add updateInviteProjects API method - Fix: load project list before opening edit dialog Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> --- src/api/martial/judgeInvite.js | 14 ++++ src/views/martial/judgeInvite/index.vue | 107 ++++++++++++++++++++++++ 2 files changed, 121 insertions(+) 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 {