文件:src/app/utils/project-stage-mapper.ts (Line 77)
修改内容:
normalizedStage === '白膜') {
return 'delivery';
}
现在"白膜"阶段会被正确识别为交付执行阶段。
文件:src/modules/project/components/project-bottom-card/project-bottom-card.component.ts (Line 100-112)
已修复(之前的checkpoint中完成):
getProjectStatus(): string {
const currentStage = this.project?.get('currentStage') || '订单分配';
const corePhase = mapStageToCorePhase(currentStage);
// 如果是交付执行阶段的子阶段,统一显示"交付执行"
if (corePhase === 'delivery') {
return '交付执行';
}
return currentStage;
}
效果:底部卡片现在统一显示"交付执行"而不是子阶段。
文件:src/modules/project/pages/project-detail/stages/stage-delivery.component.ts (Line 1727-1748)
修改内容:
if (allStagesApproved) {
// 所有阶段都已通过,推进到尾款结算
this.project.set('currentStage', '尾款结算');
data.deliveryCompletedAt = now;
data.deliveryCompletedBy = this.currentUser.get('name');
delete data.deliverySubStage; // 清除子阶段标记
console.log('✅ 所有交付阶段已完成,推进到尾款结算');
} else {
// 🔥 保持 currentStage 为"交付执行",更新 deliverySubStage 为下一个子阶段
const nextStage = this.getNextStage(currentType);
if (nextStage) {
const nextStageName = stageNameMap[nextStage] || '白模';
data.deliverySubStage = nextStageName;
this.project.set('currentStage', '交付执行'); // 统一为"交付执行"
console.log(`当前阶段审批通过,currentStage保持为"交付执行",deliverySubStage更新为: ${nextStageName}`);
} else {
const currentStageName = stageNameMap[currentType] || '白模';
data.deliverySubStage = currentStageName;
this.project.set('currentStage', '交付执行'); // 统一为"交付执行"
console.log(`当前阶段审批通过,currentStage保持为"交付执行",deliverySubStage保持为: ${currentStageName}`);
}
}
效果:
currentStage 保持为"交付执行"data.deliverySubStage 中{
currentStage: "白模", // 子阶段名称
data: {
deliveryStageStatus: {
whitemodel: { status: "pending" }
}
}
}
{
currentStage: "交付执行", // 统一为交付执行
data: {
deliverySubStage: "白模", // 子阶段保存在这里
deliveryStageStatus: {
whitemodel: { status: "pending" }
}
}
}
对于已经存在的旧数据(currentStage 为"白模"、"软装"等),需要添加初始化逻辑。
在 stage-delivery.component.ts 的 ngOnInit 中添加调用(Line 436):
// 🔥 统一 currentStage 为"交付执行"
await this.unifyDeliveryStage();
并添加方法:
async unifyDeliveryStage(): Promise<void> {
if (!this.project) return;
const currentStage = this.project.get('currentStage');
const validDeliveryStages = ['白模', '软装', '渲染', '后期'];
// 如果是子阶段,统一为"交付执行"
if (validDeliveryStages.includes(currentStage)) {
console.log(`🔥 [统一阶段] "${currentStage}" → "交付执行"`);
const data = this.project.get('data') || {};
data.deliverySubStage = currentStage; // 保存子阶段
this.project.set('currentStage', '交付执行');
this.project.set('data', data);
try {
await this.project.save();
console.log('✅ [统一阶段] 完成');
} catch (e) {
console.error('❌ [统一阶段] 失败:', e);
}
}
}
在浏览器控制台执行以下脚本:
// 查询所有处于子阶段的项目
const Parse = window.Parse;
const query = new Parse.Query('Project');
query.containedIn('currentStage', ['白模', '软装', '渲染', '后期']);
const projects = await query.find();
console.log(`找到 ${projects.length} 个需要统一的项目`);
// 批量更新
for (const project of projects) {
const currentStage = project.get('currentStage');
const data = project.get('data') || {};
data.deliverySubStage = currentStage;
project.set('currentStage', '交付执行');
project.set('data', data);
await project.save();
console.log(`✅ ${project.get('title')}: "${currentStage}" → "交付执行"`);
}
console.log('✅ 统一完成!');
currentStage 字段deliverySubStage 更新为"软装"打开项目后,控制台应显示:
✅ [统一阶段] currentStage 已为"交付执行"
或
🔥 [统一阶段] "白模" → "交付执行"
✅ [统一阶段] 完成
currentStage 统一为"交付执行"data.deliverySubStage 中,不丢失deliverySubStage 字段保留了所有子阶段信息修复完成!所有交付执行阶段的项目现在都会统一显示"交付执行"。 🎉