|
|
|
@@ -14,6 +14,9 @@
|
|
|
|
|
<el-button type="danger" @click="handleClearAll">
|
|
|
|
|
清除所有队伍
|
|
|
|
|
</el-button>
|
|
|
|
|
<el-button type="warning" @click="showClearUserDialog = true">
|
|
|
|
|
清除用户队伍
|
|
|
|
|
</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</el-card>
|
|
|
|
|
|
|
|
|
@@ -21,13 +24,6 @@
|
|
|
|
|
<el-table :data="groupList" v-loading="loading" stripe border>
|
|
|
|
|
<el-table-column prop="id" label="队伍ID" />
|
|
|
|
|
<el-table-column prop="name" label="队伍名称" min-width="150" />
|
|
|
|
|
<!-- <el-table-column label="队伍类型" width="120">
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
<el-tag :type="row.type === 0 ? 'primary' : 'success'">
|
|
|
|
|
{{ row.type === 0 ? '5人队' : '10人队' }}
|
|
|
|
|
</el-tag>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column> -->
|
|
|
|
|
<el-table-column prop="currentMembers" label="当前人数" width="100" align="center" />
|
|
|
|
|
<el-table-column prop="maxMembers" label="需要人数" width="100" align="center" />
|
|
|
|
|
<el-table-column label="状态" width="120">
|
|
|
|
@@ -130,10 +126,31 @@
|
|
|
|
|
<el-tag v-if="row.teamLeader" type="warning" size="small">队长</el-tag>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<!-- <el-table-column prop="idcUid" label="IDC UID" width="120" />
|
|
|
|
|
<el-table-column prop="idcPhone" label="IDC手机号" width="130" /> -->
|
|
|
|
|
<el-table-column label="操作" width="120" align="center">
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
<el-button type="danger" size="small" @click="handleClearUserGroups(row.userId)">清除队伍</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
|
|
|
|
<!-- 清除用户队伍对话框 -->
|
|
|
|
|
<el-dialog
|
|
|
|
|
v-model="showClearUserDialog"
|
|
|
|
|
title="清除指定用户的所有队伍"
|
|
|
|
|
width="400px"
|
|
|
|
|
:close-on-click-modal="false"
|
|
|
|
|
>
|
|
|
|
|
<el-form :model="clearUserForm" label-width="80px">
|
|
|
|
|
<el-form-item label="用户ID">
|
|
|
|
|
<el-input v-model="clearUserForm.userId" placeholder="请输入用户ID" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
<template #footer>
|
|
|
|
|
<el-button @click="showClearUserDialog = false">取消</el-button>
|
|
|
|
|
<el-button type="danger" @click="handleClearUserSubmit" :loading="clearUserLoading">确认清除</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
@@ -159,7 +176,10 @@ const groupList = ref([])
|
|
|
|
|
// 对话框状态
|
|
|
|
|
const showCreateDialog = ref(false)
|
|
|
|
|
const showMembersDialog = ref(false)
|
|
|
|
|
const showClearUserDialog = ref(false)
|
|
|
|
|
const currentMembers = ref([])
|
|
|
|
|
const clearUserLoading = ref(false)
|
|
|
|
|
const clearUserForm = reactive({ userId: '' })
|
|
|
|
|
|
|
|
|
|
// 创建表单
|
|
|
|
|
const createFormRef = ref(null)
|
|
|
|
@@ -497,12 +517,38 @@ const handleClearUserGroups = async (userId) => {
|
|
|
|
|
const res = await clearUserGroupBuy(userId)
|
|
|
|
|
if (res.code === 200) {
|
|
|
|
|
ElMessage.success('清除成功')
|
|
|
|
|
showMembersDialog.value = false
|
|
|
|
|
fetchGroupList()
|
|
|
|
|
} else {
|
|
|
|
|
ElMessage.error(res.message || '清除失败')
|
|
|
|
|
}
|
|
|
|
|
} catch { /* 取消 */ }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 通过弹窗清除用户队伍
|
|
|
|
|
const handleClearUserSubmit = async () => {
|
|
|
|
|
if (!clearUserForm.userId) {
|
|
|
|
|
ElMessage.warning('请输入用户ID')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
clearUserLoading.value = true
|
|
|
|
|
try {
|
|
|
|
|
const res = await clearUserGroupBuy(clearUserForm.userId)
|
|
|
|
|
if (res.code === 200) {
|
|
|
|
|
ElMessage.success('清除成功')
|
|
|
|
|
showClearUserDialog.value = false
|
|
|
|
|
clearUserForm.userId = ''
|
|
|
|
|
fetchGroupList()
|
|
|
|
|
} else {
|
|
|
|
|
ElMessage.error(res.message || '清除失败')
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('清除用户队伍失败:', error)
|
|
|
|
|
ElMessage.error('网络错误')
|
|
|
|
|
} finally {
|
|
|
|
|
clearUserLoading.value = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|