fix: 修复项目管理页面数据显示问题

- 修复 API 响应数据解析 (res.data.data.records)
- 移除后端不支持的 eventType 参数
- 修复报名费字段映射 (registrationFee -> price)
- 修复分组类别显示为文本而非数字

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
This commit is contained in:
DevOps
2025-12-28 17:09:38 +08:00
parent a6768c394a
commit 6befd3644a

View File

@@ -141,20 +141,10 @@
/> />
<el-table-column prop="category" label="分组类别" width="100" align="center"> <el-table-column prop="category" label="分组类别" width="100" align="center">
<template #default="{ row }"> <template #default="{ row }">
<el-tag v-if="row.category === 1" type="primary">男子</el-tag> <span>{{ row.category || '-' }}</span>
<el-tag v-else-if="row.category === 2" type="danger">女子</el-tag>
<el-tag v-else-if="row.category === 3" type="success">团体</el-tag>
<el-tag v-else-if="row.category === 4" type="warning">混合</el-tag>
</template>
</el-table-column>
<el-table-column prop="eventType" label="项目类型" width="100" align="center">
<template #default="{ row }">
<span v-if="row.eventType === 1">套路</span>
<span v-else-if="row.eventType === 2">散打</span>
<span v-else-if="row.eventType === 3">器械</span>
<span v-else-if="row.eventType === 4">对练</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="type" label="参赛类型" width="100" align="center"> <el-table-column prop="type" label="参赛类型" width="100" align="center">
<template #default="{ row }"> <template #default="{ row }">
<el-tag v-if="row.type === 1" type="success" size="small">单人</el-tag> <el-tag v-if="row.type === 1" type="success" size="small">单人</el-tag>
@@ -162,13 +152,13 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="registrationFee" prop="price"
label="报名费(元)" label="报名费(元)"
width="110" width="110"
align="center" align="center"
> >
<template #default="{ row }"> <template #default="{ row }">
<span style="color: #f56c6c">¥{{ row.registrationFee || 0 }}</span> <span style="color: #f56c6c">¥{{ row.price || 0 }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="报名时间" width="180" align="center"> <el-table-column label="报名时间" width="180" align="center">
@@ -607,8 +597,8 @@ const rules = {
const loadCompetitionList = async () => { const loadCompetitionList = async () => {
try { try {
const res = await getCompetitionList(1, 1000, { status: 1 }) const res = await getCompetitionList(1, 1000, { status: 1 })
if (res.data && res.data.records) { if (res.data && res.data.data && res.data.data.records) {
competitionList.value = res.data.records competitionList.value = res.data.data.records
} }
} catch (error) { } catch (error) {
console.error('加载赛事列表失败:', error) console.error('加载赛事列表失败:', error)
@@ -619,14 +609,21 @@ const loadCompetitionList = async () => {
const fetchData = async () => { const fetchData = async () => {
loading.value = true loading.value = true
try { try {
// Only pass parameters that backend supports
const params = {
competitionId: queryParams.competitionId || undefined,
projectName: queryParams.projectName || undefined,
category: queryParams.category || undefined,
type: queryParams.type || undefined
}
const res = await getProjectList( const res = await getProjectList(
queryParams.current, queryParams.current,
queryParams.size, queryParams.size,
queryParams params
) )
if (res.data) { if (res.data && res.data.data) {
tableData.value = res.data.records || [] tableData.value = res.data.data.records || []
total.value = res.data.total || 0 total.value = res.data.data.total || 0
} }
} catch (error) { } catch (error) {
ElMessage.error('获取数据失败') ElMessage.error('获取数据失败')