feate:对接删除队伍接口
Build and Deploy Vue3 / build (push) Successful in 5m22s
Build and Deploy Vue3 / deploy (push) Successful in 3m12s

This commit is contained in:
2025-12-31 19:07:19 +08:00
parent cf7ac515f6
commit 4d10deef86
4 changed files with 207 additions and 27 deletions
+53 -1
View File
@@ -11,6 +11,9 @@
<el-button type="info" icon="Refresh" @click="fetchGroupList" :loading="loading">
刷新列表
</el-button>
<el-button type="danger" @click="handleClearAll">
清除所有队伍
</el-button>
</div>
</el-card>
@@ -61,6 +64,13 @@
>
查看详情
</el-button>
<el-button
type="danger"
size="small"
@click="handleRemoveGroup(row)"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
@@ -138,7 +148,7 @@ import {
exportIdcInfo,
setOrder
} from '@/api/admin/activity'
import { getGroupBuyTypeList,getGroupBuyTypeTags } from '@/api/groupBuy'
import { getGroupBuyTypeList, getGroupBuyTypeTags, removeGroupBuy, clearAllGroupBuy, clearUserGroupBuy } from '@/api/groupBuy'
// 数据状态
const loading = ref(false)
@@ -451,6 +461,48 @@ const handleExport = async () => {
onMounted(() => {
fetchGroupList()
})
// 删除指定队伍
const handleRemoveGroup = async (row) => {
try {
await ElMessageBox.confirm('确定要删除该队伍吗?', '确认删除', { type: 'warning' })
const res = await removeGroupBuy(row.id)
if (res.code === 200) {
ElMessage.success('删除成功')
fetchGroupList()
} else {
ElMessage.error(res.message || '删除失败')
}
} catch { /* 取消 */ }
}
// 清除所有队伍
const handleClearAll = async () => {
try {
await ElMessageBox.confirm('确定要清除所有队伍吗?此操作不可恢复!', '危险操作', { type: 'error', confirmButtonText: '确定清除' })
const res = await clearAllGroupBuy()
if (res.code === 200) {
ElMessage.success('已清除所有队伍')
fetchGroupList()
} else {
ElMessage.error(res.message || '清除失败')
}
} catch { /* 取消 */ }
}
// 清除指定用户的所有队伍
const handleClearUserGroups = async (userId) => {
try {
await ElMessageBox.confirm(`确定要清除用户 ${userId} 的所有队伍吗?`, '确认操作', { type: 'warning' })
const res = await clearUserGroupBuy(userId)
if (res.code === 200) {
ElMessage.success('清除成功')
fetchGroupList()
} else {
ElMessage.error(res.message || '清除失败')
}
} catch { /* 取消 */ }
}
</script>
<style scoped>
+7 -26
View File
@@ -69,37 +69,18 @@
<el-form-item label="过期时间" prop="expireTime">
<el-date-picker v-model="form.expireTime" type="datetime" placeholder="选择过期时间" style="width: 100%" />
</el-form-item>
<el-form-item label="备注字段" prop="noteFields">
<el-form-item label="备注字段">
<div class="note-fields-container">
<el-button type="primary" size="small" @click="addNoteField" style="margin-bottom: 10px">+ 添加字段</el-button>
<el-table :data="form.noteFields" border size="small" v-if="form.noteFields.length">
<el-table-column label="字段Key" width="120">
<el-table-column label="名称" min-width="120">
<template #default="{ row }">
<el-input v-model="row.key" placeholder="key" size="small" />
<el-input v-model="row.label" placeholder="如:内存" size="small" />
</template>
</el-table-column>
<el-table-column label="显示名称" width="120">
<el-table-column label="默认值" min-width="120">
<template #default="{ row }">
<el-input v-model="row.label" placeholder="名称" size="small" />
</template>
</el-table-column>
<el-table-column label="默认值" width="100">
<template #default="{ row }">
<el-input v-model="row.defaultValue" placeholder="默认值" size="small" />
</template>
</el-table-column>
<el-table-column label="输入类型" width="100">
<template #default="{ row }">
<el-select v-model="row.type" size="small">
<el-option label="文本" value="text" />
<el-option label="数字" value="number" />
<el-option label="选择" value="select" />
</el-select>
</template>
</el-table-column>
<el-table-column label="必填" width="60" align="center">
<template #default="{ row }">
<el-checkbox v-model="row.required" />
<el-input v-model="row.defaultValue" placeholder="如:20GB" size="small" />
</template>
</el-table-column>
<el-table-column label="操作" width="60" align="center">
@@ -149,7 +130,7 @@ const rules = {
// 添加备注字段
const addNoteField = () => {
form.noteFields.push({ key: '', label: '', defaultValue: '', type: 'text', required: false })
form.noteFields.push({ label: '', defaultValue: '' })
}
// 删除备注字段
@@ -223,7 +204,7 @@ const handleSubmit = async () => {
if (!valid) return
submitLoading.value = true
try {
const noteJson = JSON.stringify(form.noteFields.filter(f => f.key))
const noteJson = JSON.stringify(form.noteFields.filter(f => f.label))
const data = {
name: form.name,
price: String(form.price),