sync changes

This commit is contained in:
Z-WICK
2026-01-10 11:22:11 +08:00
parent 279af5f8b6
commit 940e2f55e1
+67 -154
View File
@@ -646,124 +646,51 @@
<i class="el-icon-medal"></i> <i class="el-icon-medal"></i>
项目列表 项目列表
</div> </div>
<el-form-item label="" class="button-right"> <el-alert
<el-button title="项目配置提示"
v-if="currentView !== 'view'" type="info"
type="primary" :closable="false"
icon="el-icon-plus" show-icon
size="small" style="margin-bottom: 15px;"
@click="handleAddProject"
>
添加项目
</el-button>
</el-form-item>
<el-table
:data="formData.projects"
border
style="width: 100%"
> >
<el-table-column <template #default>
label="项目名称" <p>请先保存赛事基本信息然后前往 <strong>项目管理</strong> 功能配置比赛项目</p>
min-width="150" <el-button
> v-if="competitionId"
<template #default="scope"> type="primary"
<el-input size="small"
v-if="currentView !== 'view'" style="margin-top: 10px;"
v-model="scope.row.projectName" @click="goToProjectManagement"
placeholder="例如:太极拳" >
size="small" 前往项目管理
/> </el-button>
<span v-else>{{ scope.row.projectName }}</span> </template>
</template> </el-alert>
</el-table-column>
<div v-if="formData.projects && formData.projects.length > 0">
<el-table-column <el-table :data="formData.projects" border size="small" style="width: 100%">
label="项目码" <el-table-column prop="projectCode" label="项目码" width="120" />
width="120" <el-table-column prop="projectName" label="项目名称" min-width="150" />
> <el-table-column prop="category" label="组别" width="120" />
<template #default="scope"> <el-table-column label="项目类型" width="100" align="center">
<el-input <template #default="scope">
v-if="currentView !== 'view'" <el-tag v-if="scope.row.eventType === 1" type="primary" size="small">套路</el-tag>
v-model="scope.row.projectCode" <el-tag v-else-if="scope.row.eventType === 2" type="danger" size="small">散打</el-tag>
placeholder="例如:TJQ001" <el-tag v-else-if="scope.row.eventType === 3" type="success" size="small">器械</el-tag>
size="small" <el-tag v-else-if="scope.row.eventType === 4" type="warning" size="small">对练</el-tag>
/> <span v-else>-</span>
<span v-else>{{ scope.row.projectCode }}</span> </template>
</template> </el-table-column>
</el-table-column> <el-table-column prop="price" label="报名费(元)" width="100" align="center">
<template #default="scope">
<el-table-column <span style="color: #f56c6c">¥{{ scope.row.price || 0 }}</span>
label="组别" </template>
width="120" </el-table-column>
> <el-table-column prop="maxParticipants" label="容纳人数" width="100" align="center" />
<template #default="scope"> </el-table>
<el-input </div>
v-if="currentView !== 'view'" <el-empty v-else description="暂无项目,请前往项目管理添加" :image-size="60" />
v-model="scope.row.category"
placeholder="例如:成年男子组"
size="small"
/>
<span v-else>{{ scope.row.category }}</span>
</template>
</el-table-column>
<el-table-column
label="报名费用(元)"
width="130"
align="center"
>
<template #default="scope">
<el-input-number
v-if="currentView !== 'view'"
v-model="scope.row.price"
:min="0"
:precision="2"
:step="10"
size="small"
style="width: 100%"
placeholder="0.00"
/>
<span v-else style="color: #f56c6c">¥{{ scope.row.price || 0 }}</span>
</template>
</el-table-column>
<el-table-column
label="项目说明"
min-width="200"
>
<template #default="scope">
<el-input
v-if="currentView !== 'view'"
v-model="scope.row.description"
placeholder="请输入项目说明"
size="small"
/>
<span v-else>{{ scope.row.description }}</span>
</template>
</el-table-column>
<el-table-column
v-if="currentView !== 'view'"
label="操作"
width="80"
align="center"
>
<template #default="scope">
<el-button
type="danger"
link
size="small"
icon="el-icon-delete"
@click="handleDeleteProject(scope.$index)"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
</div> </div>
<!-- 场地配置 --> <!-- 场地配置 -->
@@ -1274,18 +1201,7 @@ export default {
console.log('项目列表长度:', projectList.length); console.log('项目列表长度:', projectList.length);
if (projectList.length > 0) { if (projectList.length > 0) {
this.formData.projects = projectList.map(item => ({ this.formData.projects = projectList.map(item => ({ ...item }));
id: item.id,
projectName: item.projectName,
projectCode: item.projectCode,
category: item.category,
type: item.type,
minParticipants: item.minParticipants,
maxParticipants: item.maxParticipants,
estimatedDuration: item.estimatedDuration,
price: item.price,
description: item.description
}));
console.log('✅ 加载的项目列表:', this.formData.projects); console.log('✅ 加载的项目列表:', this.formData.projects);
console.log('✅ 项目数量:', this.formData.projects.length); console.log('✅ 项目数量:', this.formData.projects.length);
} else { } else {
@@ -1645,20 +1561,16 @@ export default {
this.formData.schedule.splice(index, 1); this.formData.schedule.splice(index, 1);
}, },
// 项目列表管理 // 项目列表管理 - 跳转到项目管理页面
handleAddProject() { goToProjectManagement() {
this.formData.projects.push({ if (this.competitionId) {
projectName: '', this.$router.push({
projectCode: '', path: '/martial/project/list',
category: '', query: { competitionId: this.competitionId }
maxParticipants: null, });
price: 0, } else {
description: '' this.$message.warning('请先保存赛事基本信息');
}); }
},
handleDeleteProject(index) {
this.formData.projects.splice(index, 1);
}, },
// 场地配置管理 // 场地配置管理
@@ -1707,10 +1619,10 @@ export default {
savePromises.push(this.saveActivitySchedules(savedCompetitionId)); savePromises.push(this.saveActivitySchedules(savedCompetitionId));
} }
// 2. 保存项目列表 // 2. 项目列表 - 已移至项目管理功能配置
if (this.formData.projects && this.formData.projects.length > 0) { // if (this.formData.projects && this.formData.projects.length > 0) {
savePromises.push(this.saveProjects(savedCompetitionId)); // savePromises.push(this.saveProjects(savedCompetitionId));
} // }
// 3. 保存场地配置 // 3. 保存场地配置
if (this.formData.venues && this.formData.venues.length > 0) { if (this.formData.venues && this.formData.venues.length > 0) {
@@ -1794,9 +1706,7 @@ export default {
}, },
async saveProjects(competitionId) { async saveProjects(competitionId) {
const projects = this.formData.projects.filter(item => const projects = this.formData.projects.filter(item => item.projectName);
item.projectName && item.projectCode
);
if (projects.length === 0) { if (projects.length === 0) {
return Promise.resolve(); return Promise.resolve();
@@ -1814,16 +1724,19 @@ export default {
const promises = projects.map(project => { const promises = projects.map(project => {
const projectData = { const projectData = {
...project,
competitionId: finalCompetitionId, competitionId: finalCompetitionId,
projectName: project.projectName, projectName: project.projectName,
projectCode: project.projectCode,
category: project.category || '', category: project.category || '',
type: project.type || 1, // 默认个人项目 eventType: project.eventType || 1,
type: project.type || 1,
minParticipants: project.minParticipants || 1, minParticipants: project.minParticipants || 1,
maxParticipants: project.maxParticipants || 1, maxParticipants: project.maxParticipants || 100,
estimatedDuration: project.estimatedDuration || 5, estimatedDuration: project.estimatedDuration || 5,
price: project.price || 0, price: project.price || 0,
description: project.description || '' sortOrder: project.sortOrder || 0,
description: project.description || '',
rules: project.rules || ''
}; };
// 如果有 id,说明是编辑已有的项目 // 如果有 id,说明是编辑已有的项目