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>
This commit is contained in:
@@ -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
|
||||
})
|
||||
}
|
||||
|
||||
@@ -162,6 +162,9 @@
|
||||
<el-button link type="primary" :icon="View" @click="handleView(row)">
|
||||
查看
|
||||
</el-button>
|
||||
<el-button link type="warning" :icon="Edit" @click="handleEditProjects(row)">
|
||||
编辑项目
|
||||
</el-button>
|
||||
<el-button link type="danger" :icon="Delete" @click="handleDelete(row)">
|
||||
删除
|
||||
</el-button>
|
||||
@@ -207,6 +210,23 @@
|
||||
/>
|
||||
</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>
|
||||
|
||||
@@ -305,6 +325,43 @@
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<!-- 编辑项目对话框 -->
|
||||
<el-dialog
|
||||
v-model="editProjectsDialogVisible"
|
||||
title="编辑分配项目"
|
||||
width="500px"
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
<el-form label-width="100px">
|
||||
<el-form-item label="评委姓名">
|
||||
<span>{{ editingInvite.judgeName }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="负责场地">
|
||||
<span>{{ editingInvite.venueName || "全部场地" }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="分配项目" required>
|
||||
<el-select
|
||||
v-model="editingProjectIds"
|
||||
placeholder="请选择项目"
|
||||
multiple
|
||||
collapse-tags
|
||||
collapse-tags-tooltip
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in projectList"
|
||||
:key="item.id"
|
||||
:label="item.projectName"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="editProjectsDialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="handleSaveProjects">保存</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user