From 7ba080d35812e6db7bd5aa8f88161c02653eb6c1 Mon Sep 17 00:00:00 2001
From: lrj <owen.stl@gmail.com>
Date: 星期三, 24 九月 2025 22:42:35 +0800
Subject: [PATCH] feat: 优化员工和评委编辑功能的密码重置逻辑
---
web/src/views/player/index.vue | 126 ++++++++++++++++++++++++++++++-----------
1 files changed, 91 insertions(+), 35 deletions(-)
diff --git a/web/src/views/player/index.vue b/web/src/views/player/index.vue
index 543137f..1780c81 100644
--- a/web/src/views/player/index.vue
+++ b/web/src/views/player/index.vue
@@ -17,7 +17,26 @@
</template>
</el-input>
<el-select
- v-model="searchForm.status"
+ v-model="searchForm.activityId"
+ placeholder="閫夋嫨姣旇禌"
+ style="width: 300px"
+ clearable
+ filterable
+ >
+ <el-option
+ v-for="activity in activityOptions"
+ :key="activity.id"
+ :label="getActivityDisplayName(activity)"
+ :value="activity.id"
+ >
+ <span>{{ getCompetitionName(activity) }}</span>
+ <span v-if="activity.pid > 0" style="color: #409eff; margin-left: 8px;">
+ {{ activity.name }}
+ </span>
+ </el-option>
+ </el-select>
+ <el-select
+ v-model="searchForm.state"
placeholder="閫夋嫨鐘舵��"
style="width: 150px"
clearable
@@ -46,16 +65,16 @@
<el-table-column prop="activityName" label="鎶ュ悕椤圭洰" min-width="200" />
<el-table-column prop="phone" label="鑱旂郴鐢佃瘽" width="140" />
<el-table-column prop="applyTime" label="鐢宠鏃堕棿" width="180" />
- <el-table-column prop="status" label="鐘舵��" width="100" align="center">
+ <el-table-column prop="state" label="鐘舵��" width="100" align="center">
<template #default="{ row }">
- <el-tag :type="getStatusType(row.status)">{{ getStatusText(row.status) }}</el-tag>
+ <el-tag :type="getStateType(row.state)">{{ getStateText(row.state) }}</el-tag>
</template>
</el-table-column>
<el-table-column label="鎿嶄綔" width="200" fixed="right">
<template #default="{ row }">
<div class="table-actions">
<el-button
- v-if="row.status === 1"
+ v-if="row.state === 1"
type="success"
size="small"
@click="handleApprove(row)"
@@ -63,7 +82,7 @@
瀹℃牳閫氳繃
</el-button>
<el-button
- v-if="row.status === 1"
+ v-if="row.state === 1"
type="danger"
size="small"
@click="handleReject(row)"
@@ -99,14 +118,19 @@
import { useRouter } from 'vue-router'
import { ElMessage, ElMessageBox } from 'element-plus'
import { PlayerApi } from '@/api/player'
+import { getAllActivities } from '@/api/activity'
const loading = ref(false)
const router = useRouter()
+// 娲诲姩閫夐」
+const activityOptions = ref([])
+
// 鎼滅储琛ㄥ崟
const searchForm = reactive({
name: '',
- status: ''
+ activityId: '',
+ state: ''
})
// 鍒嗛〉淇℃伅
@@ -125,48 +149,48 @@
activityName: '2024骞村垱鏂板垱涓氬ぇ璧�',
phone: '13800138001',
applyTime: '2024-01-05 14:30:00',
- status: 1 // 1-寰呭鏍�, 2-杩涜涓�, 3-宸茬粨鏉�
+ state: 1 // 1-寰呭鏍�, 2-杩涜涓�, 3-宸茬粨鏉�
},
{
id: 2,
name: '鏉庡洓',
avatar: '',
- activityName: '鎶�鑳界珵璧涘垵璧�',
- phone: '13800138002',
- applyTime: '2024-01-06 09:15:00',
- status: 2
+ activityName: '涔︽硶姣旇禌',
+ phone: '13900139002',
+ applyTime: '2024-01-16 10:30:00',
+ state: 2
},
{
id: 3,
name: '鐜嬩簲',
avatar: '',
- activityName: '璁捐澶ц禌鍐宠禌',
- phone: '13800138003',
- applyTime: '2024-01-07 16:45:00',
- status: 1
+ activityName: '缁樼敾姣旇禌',
+ phone: '13900139003',
+ applyTime: '2024-01-17 14:20:00',
+ state: 1
}
])
// 鑾峰彇鐘舵�佹爣绛剧被鍨�
-const getStatusType = (status: number | null | undefined) => {
+const getStateType = (state: number | null | undefined) => {
const typeMap: Record<number, string> = {
0: 'warning', // 寰呭鏍�
1: 'success', // 杩涜涓�
2: 'danger', // 鏈�氳繃
3: 'info' // 宸茬粨鏉�
}
- return status != null ? (typeMap[status] || 'info') : 'info'
+ return state != null ? (typeMap[state] || 'info') : 'info'
}
// 鑾峰彇鐘舵�佹枃鏈�
-const getStatusText = (status: number | null | undefined) => {
+const getStateText = (state: number | null | undefined) => {
const textMap: Record<number, string> = {
0: '寰呭鏍�',
1: '杩涜涓�',
2: '鏈�氳繃',
3: '宸茬粨鏉�'
}
- return status != null ? (textMap[status] || '鏈煡') : '鏈煡'
+ return state != null ? (textMap[state] || '鏈煡') : '鏈煡'
}
// 鎼滅储
@@ -185,26 +209,25 @@
})
ElMessage.success('瀹℃牳閫氳繃鎴愬姛')
- row.status = 2
+ row.state = 2
} catch {
// 鐢ㄦ埛鍙栨秷
}
}
// 瀹℃牳鎷掔粷
-const handleReject = async (row: any) => {
- try {
- await ElMessageBox.confirm(`纭畾鎷掔粷瀛﹀憳"${row.name}"鐨勬姤鍚嶇敵璇峰悧锛焋, '鎻愮ず', {
- confirmButtonText: '纭畾',
- cancelButtonText: '鍙栨秷',
- type: 'warning'
- })
-
- ElMessage.success('瀹℃牳鎷掔粷鎴愬姛')
- // 杩欓噷鍙互璁剧疆涓哄垹闄ょ姸鎬佹垨鍏朵粬鐘舵��
- } catch {
- // 鐢ㄦ埛鍙栨秷
- }
+const handleReject = (row: any) => {
+ ElMessageBox.confirm('纭鎷掔粷璇ョ敵璇凤紵', '鎻愮ず', {
+ confirmButtonText: '纭畾',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning'
+ }).then(() => {
+ // 杩欓噷搴旇璋冪敤API鏇存柊鐘舵��
+ row.state = 3 // 鏇存柊涓哄凡缁撴潫
+ ElMessage.success('宸叉嫆缁�')
+ }).catch(() => {
+ ElMessage.info('宸插彇娑�')
+ })
}
// 鏌ョ湅璇︽儏锛堣烦杞埌璇勫垎椤甸潰锛�
@@ -228,11 +251,43 @@
loadData()
}
+// 鑾峰彇姣旇禌鍚嶇О锛堝鏋滄槸闃舵锛岃繑鍥炵埗姣旇禌鍚嶇О锛涘鏋滄槸姣旇禌锛岃繑鍥炶嚜宸辩殑鍚嶇О锛�
+const getCompetitionName = (activity: any) => {
+ if (activity.pid > 0 && activity.parent) {
+ return activity.parent.name
+ }
+ return activity.name
+}
+
+// 鑾峰彇娲诲姩鏄剧ず鍚嶇О锛堢敤浜庢悳绱㈠拰閫変腑鏃舵樉绀猴級
+const getActivityDisplayName = (activity: any) => {
+ if (activity.pid > 0 && activity.parent) {
+ return `${activity.parent.name} - ${activity.name}`
+ }
+ return activity.name
+}
+
+// 鍔犺浇娲诲姩閫夐」
+const loadActivityOptions = async () => {
+ try {
+ const activities = await getAllActivities()
+ // 鍙樉绀虹姸鎬佷负1锛堣繘琛屼腑锛夌殑姣旇禌鍙婂叾闃舵
+ activityOptions.value = (activities || []).filter(activity => activity.state === 1)
+ } catch (e: any) {
+ console.error('鍔犺浇娲诲姩閫夐」澶辫触:', e)
+ }
+}
+
// 鍔犺浇鏁版嵁
const loadData = async () => {
loading.value = true
try {
- const list = await PlayerApi.getApplications(searchForm.name || '', pagination.page, pagination.size)
+ const list = await PlayerApi.getApplications(
+ searchForm.name || '',
+ searchForm.activityId || null,
+ pagination.page,
+ pagination.size
+ )
tableData.value = (list || []).map((item: any) => ({
id: item.id,
name: item.playerName,
@@ -240,7 +295,7 @@
activityName: item.activityName,
phone: item.phone,
applyTime: item.applyTime,
- status: item.state
+ state: item.state
}))
pagination.total = tableData.value.length
} catch (e: any) {
@@ -251,6 +306,7 @@
}
onMounted(() => {
+ loadActivityOptions()
loadData()
})
</script>
--
Gitblit v1.8.0