sync changes
This commit is contained in:
@@ -647,124 +647,51 @@
|
|||||||
项目列表
|
项目列表
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-form-item label="" class="button-right">
|
<el-alert
|
||||||
|
title="项目配置提示"
|
||||||
|
type="info"
|
||||||
|
:closable="false"
|
||||||
|
show-icon
|
||||||
|
style="margin-bottom: 15px;"
|
||||||
|
>
|
||||||
|
<template #default>
|
||||||
|
<p>请先保存赛事基本信息,然后前往 <strong>项目管理</strong> 功能配置比赛项目。</p>
|
||||||
<el-button
|
<el-button
|
||||||
v-if="currentView !== 'view'"
|
v-if="competitionId"
|
||||||
type="primary"
|
type="primary"
|
||||||
icon="el-icon-plus"
|
|
||||||
size="small"
|
size="small"
|
||||||
@click="handleAddProject"
|
style="margin-top: 10px;"
|
||||||
|
@click="goToProjectManagement"
|
||||||
>
|
>
|
||||||
添加项目
|
前往项目管理
|
||||||
</el-button>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-table
|
|
||||||
:data="formData.projects"
|
|
||||||
border
|
|
||||||
style="width: 100%"
|
|
||||||
>
|
|
||||||
<el-table-column
|
|
||||||
label="项目名称"
|
|
||||||
min-width="150"
|
|
||||||
>
|
|
||||||
<template #default="scope">
|
|
||||||
<el-input
|
|
||||||
v-if="currentView !== 'view'"
|
|
||||||
v-model="scope.row.projectName"
|
|
||||||
placeholder="例如:太极拳"
|
|
||||||
size="small"
|
|
||||||
/>
|
|
||||||
<span v-else>{{ scope.row.projectName }}</span>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
<el-table-column
|
|
||||||
label="项目代码"
|
|
||||||
width="120"
|
|
||||||
>
|
|
||||||
<template #default="scope">
|
|
||||||
<el-input
|
|
||||||
v-if="currentView !== 'view'"
|
|
||||||
v-model="scope.row.projectCode"
|
|
||||||
placeholder="例如:TJQ001"
|
|
||||||
size="small"
|
|
||||||
/>
|
|
||||||
<span v-else>{{ scope.row.projectCode }}</span>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
<el-table-column
|
|
||||||
label="组别"
|
|
||||||
width="120"
|
|
||||||
>
|
|
||||||
<template #default="scope">
|
|
||||||
<el-input
|
|
||||||
v-if="currentView !== 'view'"
|
|
||||||
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>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
|
</el-alert>
|
||||||
|
|
||||||
|
<div v-if="formData.projects && formData.projects.length > 0">
|
||||||
|
<el-table :data="formData.projects" border size="small" style="width: 100%">
|
||||||
|
<el-table-column prop="projectCode" label="项目编码" width="120" />
|
||||||
|
<el-table-column prop="projectName" label="项目名称" min-width="150" />
|
||||||
|
<el-table-column prop="category" label="组别" width="120" />
|
||||||
|
<el-table-column label="项目类型" width="100" align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-tag v-if="scope.row.eventType === 1" type="primary" size="small">套路</el-tag>
|
||||||
|
<el-tag v-else-if="scope.row.eventType === 2" type="danger" size="small">散打</el-tag>
|
||||||
|
<el-tag v-else-if="scope.row.eventType === 3" type="success" size="small">器械</el-tag>
|
||||||
|
<el-tag v-else-if="scope.row.eventType === 4" type="warning" size="small">对练</el-tag>
|
||||||
|
<span v-else>-</span>
|
||||||
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column prop="price" label="报名费(元)" width="100" align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
<span style="color: #f56c6c">¥{{ scope.row.price || 0 }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="maxParticipants" label="容纳人数" width="100" align="center" />
|
||||||
</el-table>
|
</el-table>
|
||||||
</div>
|
</div>
|
||||||
|
<el-empty v-else description="暂无项目,请前往项目管理添加" :image-size="60" />
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- 场地配置 -->
|
<!-- 场地配置 -->
|
||||||
<div class="form-section">
|
<div class="form-section">
|
||||||
@@ -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,
|
|
||||||
description: ''
|
|
||||||
});
|
});
|
||||||
},
|
} else {
|
||||||
|
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,说明是编辑已有的项目
|
||||||
|
|||||||
Reference in New Issue
Block a user