|
@@ -17,7 +17,7 @@ import { RequirementsConfirmCardComponent } from '../../../shared/components/req
|
|
|
import { SettlementCardComponent } from '../../../shared/components/settlement-card/settlement-card';
|
|
|
import { CustomerReviewCardComponent } from '../../../shared/components/customer-review-card/customer-review-card';
|
|
|
import { ComplaintCardComponent } from '../../../shared/components/complaint-card/complaint-card';
|
|
|
-import { TeamAssignmentModalComponent } from '../../../shared/components/team-assignment-modal/team-assignment-modal.component';
|
|
|
+
|
|
|
import { VerticalNavComponent } from './components/vertical-nav/vertical-nav.component';
|
|
|
|
|
|
interface ExceptionHistory {
|
|
@@ -62,7 +62,7 @@ type SectionKey = 'order' | 'requirements' | 'delivery' | 'aftercare';
|
|
|
@Component({
|
|
|
selector: 'app-project-detail',
|
|
|
standalone: true,
|
|
|
- imports: [CommonModule, FormsModule, ReactiveFormsModule, ConsultationOrderPanelComponent, RequirementsConfirmCardComponent, SettlementCardComponent, CustomerReviewCardComponent, ComplaintCardComponent, TeamAssignmentModalComponent, VerticalNavComponent],
|
|
|
+ imports: [CommonModule, FormsModule, ReactiveFormsModule, ConsultationOrderPanelComponent, RequirementsConfirmCardComponent, SettlementCardComponent, CustomerReviewCardComponent, ComplaintCardComponent, VerticalNavComponent],
|
|
|
templateUrl: './project-detail.html',
|
|
|
styleUrls: ['./project-detail.scss', './debug-styles.scss']
|
|
|
})
|
|
@@ -141,7 +141,6 @@ export class ProjectDetail implements OnInit, OnDestroy {
|
|
|
timelineEvents: TimelineEvent[] = [];
|
|
|
|
|
|
// 团队分配弹窗相关
|
|
|
- showTeamAssignmentModal = false;
|
|
|
selectedDesigner: any = null;
|
|
|
projectData: any = null;
|
|
|
|
|
@@ -206,7 +205,25 @@ export class ProjectDetail implements OnInit, OnDestroy {
|
|
|
|
|
|
// 检查是否处于订单创建阶段,用于红色高亮显示
|
|
|
isCurrentOrderCreation(): boolean {
|
|
|
- return this.project?.currentStage === '订单创建';
|
|
|
+ // 只有当订单创建阶段是当前活跃阶段时才标红显示
|
|
|
+ // 修复逻辑:完成前序环节后才标红当前阶段
|
|
|
+ const currentStage = this.project?.currentStage;
|
|
|
+ if (!currentStage) return false;
|
|
|
+
|
|
|
+ // 如果当前阶段就是订单创建阶段,说明需要标红显示
|
|
|
+ if (currentStage === '订单创建') return true;
|
|
|
+
|
|
|
+ // 如果当前阶段在订单创建之后,说明订单创建已完成,不应标红
|
|
|
+ const stageOrder = [
|
|
|
+ '订单创建', '需求沟通', '方案确认', '建模', '软装',
|
|
|
+ '渲染', '后期', '尾款结算', '客户评价', '投诉处理'
|
|
|
+ ];
|
|
|
+
|
|
|
+ const currentIndex = stageOrder.indexOf(currentStage);
|
|
|
+ const orderCreationIndex = stageOrder.indexOf('订单创建');
|
|
|
+
|
|
|
+ // 如果当前阶段在订单创建之后,说明订单创建已完成
|
|
|
+ return currentIndex <= orderCreationIndex;
|
|
|
}
|
|
|
|
|
|
// 返回工作台
|
|
@@ -235,7 +252,8 @@ export class ProjectDetail implements OnInit, OnDestroy {
|
|
|
// 获取阶段状态:completed/active/pending
|
|
|
getStageStatus(stage: ProjectStage): 'completed' | 'active' | 'pending' {
|
|
|
const order = this.stageOrder;
|
|
|
- const current = this.project?.currentStage as ProjectStage | undefined;
|
|
|
+ // 优先使用 currentStage 属性,如果没有则使用 project.currentStage
|
|
|
+ const current = (this.currentStage as ProjectStage) || (this.project?.currentStage as ProjectStage | undefined);
|
|
|
const currentIdx = current ? order.indexOf(current) : -1;
|
|
|
const idx = order.indexOf(stage);
|
|
|
if (idx === -1) return 'pending';
|
|
@@ -273,9 +291,12 @@ export class ProjectDetail implements OnInit, OnDestroy {
|
|
|
this.loadProjectMembers();
|
|
|
this.loadProjectFiles();
|
|
|
this.loadTimelineEvents();
|
|
|
+
|
|
|
+ // 启动客户信息自动同步
|
|
|
+ this.startAutoSync();
|
|
|
});
|
|
|
|
|
|
- // 新增:监听查询参数,支持通过 activeTab 设置初始标签页
|
|
|
+ // 新增:监听查询参数,支持通过 activeTab 设置初始标签页和 currentStage 设置当前阶段
|
|
|
this.route.queryParamMap.subscribe(qp => {
|
|
|
const raw = qp.get('activeTab');
|
|
|
const alias: Record<string, 'progress' | 'members' | 'files'> = {
|
|
@@ -286,6 +307,26 @@ export class ProjectDetail implements OnInit, OnDestroy {
|
|
|
if (tab === 'progress' || tab === 'members' || tab === 'files') {
|
|
|
this.activeTab = tab;
|
|
|
}
|
|
|
+
|
|
|
+ // 处理 currentStage 查询参数
|
|
|
+ const currentStageParam = qp.get('currentStage');
|
|
|
+ if (currentStageParam) {
|
|
|
+ this.currentStage = currentStageParam;
|
|
|
+
|
|
|
+ // 根据当前阶段设置项目状态和展开相应区域
|
|
|
+ this.initializeStageFromRoute(currentStageParam as ProjectStage);
|
|
|
+
|
|
|
+ // 根据当前阶段自动展开对应的区域
|
|
|
+ const sectionKey = this.getSectionKeyForStage(currentStageParam as ProjectStage);
|
|
|
+ if (sectionKey) {
|
|
|
+ this.expandedSection = sectionKey;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 延迟滚动到对应阶段
|
|
|
+ setTimeout(() => {
|
|
|
+ this.scrollToStage(currentStageParam as ProjectStage);
|
|
|
+ }, 500);
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
// 添加点击事件监听器,当点击页面其他位置时关闭下拉菜单
|
|
@@ -310,11 +351,40 @@ export class ProjectDetail implements OnInit, OnDestroy {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- // 在组件销毁时移除事件监听器和清理资源
|
|
|
+ // 新增:根据路由参数初始化阶段状态
|
|
|
+ private initializeStageFromRoute(targetStage: ProjectStage): void {
|
|
|
+ // 设置当前阶段
|
|
|
+ this.currentStage = targetStage;
|
|
|
+
|
|
|
+ // 根据目标阶段设置之前的阶段为已完成
|
|
|
+ const targetIndex = this.stageOrder.indexOf(targetStage);
|
|
|
+ if (targetIndex > 0) {
|
|
|
+ // 将目标阶段之前的所有阶段设置为已完成
|
|
|
+ for (let i = 0; i < targetIndex; i++) {
|
|
|
+ const stage = this.stageOrder[i];
|
|
|
+ this.expandedStages[stage] = false; // 已完成的阶段收起
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 展开当前阶段
|
|
|
+ this.expandedStages[targetStage] = true;
|
|
|
+
|
|
|
+ // 如果项目对象存在,更新项目的当前阶段
|
|
|
+ if (this.project) {
|
|
|
+ this.project.currentStage = targetStage;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 触发变更检测以更新UI
|
|
|
+ this.cdr.detectChanges();
|
|
|
+ }
|
|
|
ngOnDestroy(): void {
|
|
|
if (this.countdownInterval) {
|
|
|
clearInterval(this.countdownInterval);
|
|
|
}
|
|
|
+
|
|
|
+ // 停止自动同步
|
|
|
+ this.stopAutoSync();
|
|
|
+
|
|
|
document.removeEventListener('click', this.closeDropdownOnClickOutside);
|
|
|
// 释放所有 blob 预览 URL
|
|
|
const revokeList: string[] = [];
|
|
@@ -730,7 +800,9 @@ export class ProjectDetail implements OnInit, OnDestroy {
|
|
|
updateProjectStage(stage: ProjectStage): void {
|
|
|
if (this.project) {
|
|
|
this.projectService.updateProjectStage(this.projectId, stage).subscribe(() => {
|
|
|
+ this.currentStage = stage; // 同步更新本地状态
|
|
|
this.loadProjectDetails(); // 重新加载项目详情
|
|
|
+ this.cdr.detectChanges(); // 触发变更检测以更新导航栏颜色
|
|
|
});
|
|
|
}
|
|
|
}
|
|
@@ -741,9 +813,11 @@ export class ProjectDetail implements OnInit, OnDestroy {
|
|
|
if (idx >= 0 && idx < this.stageOrder.length - 1) {
|
|
|
const next = this.stageOrder[idx + 1];
|
|
|
this.updateProjectStage(next);
|
|
|
- // 可选:更新展开状态,折叠当前、展开下一阶段,提升体验
|
|
|
+ // 更新展开状态,折叠当前、展开下一阶段,提升体验
|
|
|
if (this.expandedStages[afterStage] !== undefined) this.expandedStages[afterStage] = false as any;
|
|
|
if (this.expandedStages[next] !== undefined) this.expandedStages[next] = true as any;
|
|
|
+ // 触发变更检测以更新导航栏颜色
|
|
|
+ this.cdr.detectChanges();
|
|
|
}
|
|
|
}
|
|
|
generateReminderMessage(): void {
|
|
@@ -1338,6 +1412,21 @@ export class ProjectDetail implements OnInit, OnDestroy {
|
|
|
this.advanceToNextStage('后期');
|
|
|
}
|
|
|
|
|
|
+ // 新增:尾款结算阶段确认并自动进入下一阶段(客户评价)
|
|
|
+ confirmSettlement(): void {
|
|
|
+ this.advanceToNextStage('尾款结算');
|
|
|
+ }
|
|
|
+
|
|
|
+ // 新增:客户评价阶段确认并自动进入下一阶段(投诉处理)
|
|
|
+ confirmCustomerReview(): void {
|
|
|
+ this.advanceToNextStage('客户评价');
|
|
|
+ }
|
|
|
+
|
|
|
+ // 新增:投诉处理阶段确认并完成项目
|
|
|
+ confirmComplaint(): void {
|
|
|
+ this.advanceToNextStage('投诉处理');
|
|
|
+ }
|
|
|
+
|
|
|
// 新增:软装阶段 确认上传并自动进入下一阶段(渲染)
|
|
|
confirmSoftDecorUpload(): void {
|
|
|
if (this.softDecorImages.length === 0) return;
|
|
@@ -1417,16 +1506,27 @@ export class ProjectDetail implements OnInit, OnDestroy {
|
|
|
// 获取板块状态:completed | 'active' | 'pending'
|
|
|
getSectionStatus(key: SectionKey): 'completed' | 'active' | 'pending' {
|
|
|
const current = this.project?.currentStage as ProjectStage | undefined;
|
|
|
- if (!current) return 'pending';
|
|
|
+
|
|
|
+ // 如果没有当前阶段(新创建的项目),默认订单创建板块为active(红色)
|
|
|
+ if (!current || current === '订单创建') {
|
|
|
+ return key === 'order' ? 'active' : 'pending';
|
|
|
+ }
|
|
|
|
|
|
+ // 获取当前阶段所属的板块
|
|
|
const currentSection = this.getSectionKeyForStage(current);
|
|
|
const sectionOrder = this.sections.map(s => s.key);
|
|
|
const currentIdx = sectionOrder.indexOf(currentSection);
|
|
|
const idx = sectionOrder.indexOf(key);
|
|
|
+
|
|
|
if (idx === -1 || currentIdx === -1) return 'pending';
|
|
|
|
|
|
+ // 已完成的板块:当前阶段所在板块之前的所有板块
|
|
|
if (idx < currentIdx) return 'completed';
|
|
|
+
|
|
|
+ // 当前进行中的板块:当前阶段所在的板块
|
|
|
if (idx === currentIdx) return 'active';
|
|
|
+
|
|
|
+ // 未开始的板块:当前阶段所在板块之后的所有板块
|
|
|
return 'pending';
|
|
|
}
|
|
|
|
|
@@ -1475,6 +1575,11 @@ export class ProjectDetail implements OnInit, OnDestroy {
|
|
|
isSyncing: boolean = false;
|
|
|
orderTime: string = '';
|
|
|
|
|
|
+ // 客户信息实时同步相关变量
|
|
|
+ isSyncingCustomerInfo: boolean = false;
|
|
|
+ lastSyncTime: Date | null = null;
|
|
|
+ syncInterval: any = null;
|
|
|
+
|
|
|
customerForm!: FormGroup;
|
|
|
customerSearchKeyword: string = '';
|
|
|
customerSearchResults: Array<{ id: string; name: string; phone: string; wechat?: string; avatar?: string; customerType?: string; source?: string; remark?: string }> = [];
|
|
@@ -1576,9 +1681,61 @@ export class ProjectDetail implements OnInit, OnDestroy {
|
|
|
source: '小程序下单'
|
|
|
});
|
|
|
this.isSyncing = false;
|
|
|
+
|
|
|
+ // 触发客户信息同步显示
|
|
|
+ this.syncCustomerInfoDisplay();
|
|
|
}, 1000);
|
|
|
}
|
|
|
|
|
|
+ // 同步客户信息显示
|
|
|
+ syncCustomerInfoDisplay(): void {
|
|
|
+ this.isSyncingCustomerInfo = true;
|
|
|
+
|
|
|
+ // 模拟同步过程
|
|
|
+ setTimeout(() => {
|
|
|
+ this.lastSyncTime = new Date();
|
|
|
+ this.isSyncingCustomerInfo = false;
|
|
|
+
|
|
|
+ console.log('客户信息显示已同步:', this.lastSyncTime);
|
|
|
+ }, 800);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 启动自动同步
|
|
|
+ startAutoSync(): void {
|
|
|
+ if (this.syncInterval) {
|
|
|
+ clearInterval(this.syncInterval);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 每30秒自动同步一次
|
|
|
+ this.syncInterval = setInterval(() => {
|
|
|
+ this.syncCustomerInfoDisplay();
|
|
|
+ }, 30000);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 停止自动同步
|
|
|
+ stopAutoSync(): void {
|
|
|
+ if (this.syncInterval) {
|
|
|
+ clearInterval(this.syncInterval);
|
|
|
+ this.syncInterval = null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 格式化时间显示
|
|
|
+ formatTime(date: Date): string {
|
|
|
+ const now = new Date();
|
|
|
+ const diff = now.getTime() - date.getTime();
|
|
|
+ const minutes = Math.floor(diff / 60000);
|
|
|
+
|
|
|
+ if (minutes < 1) {
|
|
|
+ return '刚刚';
|
|
|
+ } else if (minutes < 60) {
|
|
|
+ return `${minutes}分钟前`;
|
|
|
+ } else {
|
|
|
+ const hours = Math.floor(minutes / 60);
|
|
|
+ return `${hours}小时前`;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
downloadFile(file: ProjectFile): void {
|
|
|
// 实现文件下载逻辑
|
|
|
const link = document.createElement('a');
|
|
@@ -1637,6 +1794,36 @@ export class ProjectDetail implements OnInit, OnDestroy {
|
|
|
};
|
|
|
}
|
|
|
|
|
|
+ // 新增:实时更新左侧客户信息显示
|
|
|
+ if (this.project) {
|
|
|
+ // 更新项目的客户信息
|
|
|
+ if (requirementData.colorIndicators && requirementData.colorIndicators.length > 0) {
|
|
|
+ this.project.customerInfo = {
|
|
|
+ ...this.project.customerInfo,
|
|
|
+ colorPreference: requirementData.colorIndicators.map((indicator: any) => indicator.name).join(', ')
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
+ // 更新空间结构信息
|
|
|
+ if (requirementData.spaceIndicators && requirementData.spaceIndicators.length > 0) {
|
|
|
+ this.project.customerInfo = {
|
|
|
+ ...this.project.customerInfo,
|
|
|
+ spaceRequirements: requirementData.spaceIndicators.map((indicator: any) => `${indicator.name}: ${indicator.value}`).join(', ')
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
+ // 更新材质偏好
|
|
|
+ if (requirementData.materialIndicators && requirementData.materialIndicators.length > 0) {
|
|
|
+ this.project.customerInfo = {
|
|
|
+ ...this.project.customerInfo,
|
|
|
+ materialPreference: requirementData.materialIndicators.map((indicator: any) => `${indicator.name}: ${indicator.value}%`).join(', ')
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
+ // 触发变更检测以更新UI
|
|
|
+ this.cdr.detectChanges();
|
|
|
+ }
|
|
|
+
|
|
|
console.log('需求关键信息已同步:', this.requirementKeyInfo);
|
|
|
} else {
|
|
|
// 模拟数据用于演示
|
|
@@ -1692,16 +1879,8 @@ export class ProjectDetail implements OnInit, OnDestroy {
|
|
|
confirmProposal(): void {
|
|
|
console.log('确认方案按钮被点击');
|
|
|
|
|
|
- // 自动跳转到建模阶段
|
|
|
- this.currentStage = '建模';
|
|
|
- this.expandedStages['建模'] = true;
|
|
|
- this.expandedStages['方案确认'] = false;
|
|
|
-
|
|
|
- // 更新项目状态
|
|
|
- this.updateProjectStage('建模');
|
|
|
-
|
|
|
- // 滚动到建模阶段
|
|
|
- this.scrollToStage('建模');
|
|
|
+ // 使用统一的阶段推进方法
|
|
|
+ this.advanceToNextStage('方案确认');
|
|
|
|
|
|
console.log('已跳转到建模阶段');
|
|
|
}
|
|
@@ -1784,26 +1963,54 @@ export class ProjectDetail implements OnInit, OnDestroy {
|
|
|
// 保存订单创建数据
|
|
|
this.orderCreationData = formData;
|
|
|
|
|
|
+ // 实时更新左侧客户信息显示
|
|
|
+ this.updateCustomerInfoDisplay(formData);
|
|
|
+
|
|
|
// 根据角色上下文处理数据同步
|
|
|
if (formData.roleContext === 'customer-service') {
|
|
|
// 客服端创建的订单需要同步到设计师端
|
|
|
this.syncOrderToDesignerView(formData);
|
|
|
}
|
|
|
|
|
|
- // 更新项目阶段到下一个阶段(需求沟通)
|
|
|
- this.updateProjectStage('需求沟通');
|
|
|
-
|
|
|
- // 展开下一个阶段
|
|
|
- this.expandedStages['需求沟通'] = true;
|
|
|
- this.expandedStages['订单创建'] = false;
|
|
|
-
|
|
|
- // 滚动到下一个阶段
|
|
|
- setTimeout(() => {
|
|
|
- this.scrollToStage('需求沟通');
|
|
|
- }, 100);
|
|
|
-
|
|
|
- // 显示成功提示
|
|
|
- console.log('订单创建成功,已跳转到需求沟通阶段');
|
|
|
+ // 触发变更检测以更新UI
|
|
|
+ this.cdr.detectChanges();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 新增:更新客户信息显示
|
|
|
+ private updateCustomerInfoDisplay(formData: any): void {
|
|
|
+ if (formData.customerInfo) {
|
|
|
+ // 更新项目对象中的客户信息
|
|
|
+ if (this.project) {
|
|
|
+ this.project.customerName = formData.customerInfo.name;
|
|
|
+ this.project.customerPhone = formData.customerInfo.phone;
|
|
|
+ this.project.customerWechat = formData.customerInfo.wechat;
|
|
|
+ this.project.customerType = formData.customerInfo.customerType;
|
|
|
+ this.project.customerSource = formData.customerInfo.source;
|
|
|
+ this.project.customerRemark = formData.customerInfo.remark;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 更新客户标签
|
|
|
+ if (formData.preferenceTags) {
|
|
|
+ this.project = {
|
|
|
+ ...this.project,
|
|
|
+ customerTags: formData.preferenceTags
|
|
|
+ } as any;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 更新需求信息
|
|
|
+ if (formData.requirementInfo) {
|
|
|
+ this.project = {
|
|
|
+ ...this.project,
|
|
|
+ decorationType: formData.requirementInfo.decorationType,
|
|
|
+ downPayment: formData.requirementInfo.downPayment,
|
|
|
+ firstDraftDate: formData.requirementInfo.firstDraftDate,
|
|
|
+ style: formData.requirementInfo.style,
|
|
|
+ spaceRequirements: formData.requirementInfo.spaceRequirements
|
|
|
+ } as any;
|
|
|
+ }
|
|
|
+
|
|
|
+ console.log('客户信息已实时更新:', this.project);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 新增:同步订单数据到设计师视图
|
|
@@ -1835,27 +2042,24 @@ export class ProjectDetail implements OnInit, OnDestroy {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- // 关闭团队分配模态框
|
|
|
- closeTeamAssignmentModal(): void {
|
|
|
- this.showTeamAssignmentModal = false;
|
|
|
- this.selectedDesigner = null;
|
|
|
- this.projectData = null;
|
|
|
- }
|
|
|
-
|
|
|
// 确认团队分配
|
|
|
- confirmTeamAssignment(event: any): void {
|
|
|
- if (event && event.designer) {
|
|
|
- this.selectedDesigner = event.designer;
|
|
|
- console.log('团队分配确认:', event);
|
|
|
+ confirmTeamAssignment(designer: any): void {
|
|
|
+ if (designer) {
|
|
|
+ this.selectedDesigner = designer;
|
|
|
+ console.log('团队分配确认:', designer);
|
|
|
|
|
|
// 这里可以添加实际的团队分配逻辑
|
|
|
// 例如调用服务来分配设计师到项目
|
|
|
|
|
|
- // 关闭模态框
|
|
|
- this.closeTeamAssignmentModal();
|
|
|
+ // 进入下一个阶段:需求沟通
|
|
|
+ this.updateProjectStage('需求沟通');
|
|
|
+ this.expandedStages['需求沟通'] = true;
|
|
|
+ this.expandedStages['订单创建'] = false;
|
|
|
|
|
|
// 显示成功消息
|
|
|
- alert('团队分配成功!');
|
|
|
+ alert('团队分配成功!已进入需求沟通阶段');
|
|
|
+
|
|
|
+ console.log('团队分配完成,已跳转到需求沟通阶段');
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1863,6 +2067,82 @@ export class ProjectDetail implements OnInit, OnDestroy {
|
|
|
onProjectCreated(projectData: any): void {
|
|
|
console.log('项目创建完成:', projectData);
|
|
|
this.projectData = projectData;
|
|
|
- this.showTeamAssignmentModal = true;
|
|
|
+
|
|
|
+ // 团队分配已在子组件中完成并触发该事件:推进到需求沟通阶段
|
|
|
+ this.updateProjectStage('需求沟通');
|
|
|
+
|
|
|
+ // 更新项目对象的当前阶段,确保四大板块状态正确显示
|
|
|
+ if (this.project) {
|
|
|
+ this.project.currentStage = '需求沟通';
|
|
|
+ }
|
|
|
+
|
|
|
+ // 展开需求沟通阶段,收起订单创建阶段
|
|
|
+ this.expandedStages['需求沟通'] = true;
|
|
|
+ this.expandedStages['订单创建'] = false;
|
|
|
+
|
|
|
+ // 自动展开确认需求板块
|
|
|
+ this.expandedSection = 'requirements';
|
|
|
+
|
|
|
+ // 强制触发变更检测,确保UI更新
|
|
|
+ this.cdr.detectChanges();
|
|
|
+
|
|
|
+ // 延迟滚动到需求沟通阶段,确保DOM更新完成
|
|
|
+ setTimeout(() => {
|
|
|
+ this.scrollToStage('需求沟通');
|
|
|
+ // 再次触发变更检测,确保所有状态都已正确更新
|
|
|
+ this.cdr.detectChanges();
|
|
|
+ }, 100);
|
|
|
+
|
|
|
+ console.log('项目创建成功,已推进到需求沟通阶段,四大板块状态已更新');
|
|
|
+ }
|
|
|
+
|
|
|
+ // 新增:处理实时需求数据更新
|
|
|
+ onRequirementDataUpdated(data: any): void {
|
|
|
+ console.log('收到需求数据更新:', data);
|
|
|
+
|
|
|
+ // 同步关键信息
|
|
|
+ this.syncRequirementKeyInfo(data);
|
|
|
+
|
|
|
+ // 更新客户信息显示
|
|
|
+ if (data && this.project) {
|
|
|
+ // 更新项目的客户信息
|
|
|
+ if (data.colorIndicators && data.colorIndicators.length > 0) {
|
|
|
+ this.project.customerInfo = {
|
|
|
+ ...this.project.customerInfo,
|
|
|
+ colorPreference: data.colorIndicators.map((indicator: any) => indicator.name).join(', ')
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
+ // 更新空间结构信息
|
|
|
+ if (data.spaceIndicators && data.spaceIndicators.length > 0) {
|
|
|
+ this.project.customerInfo = {
|
|
|
+ ...this.project.customerInfo,
|
|
|
+ spaceRequirements: data.spaceIndicators.map((indicator: any) => `${indicator.name}: ${indicator.value}`).join(', ')
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
+ // 更新材质偏好
|
|
|
+ if (data.materialIndicators && data.materialIndicators.length > 0) {
|
|
|
+ this.project.customerInfo = {
|
|
|
+ ...this.project.customerInfo,
|
|
|
+ materialPreference: data.materialIndicators.map((indicator: any) => `${indicator.name}: ${indicator.value}%`).join(', ')
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
+ // 更新需求项目
|
|
|
+ if (data.requirementItems && data.requirementItems.length > 0) {
|
|
|
+ this.project.requirements = data.requirementItems.map((item: any) => ({
|
|
|
+ id: item.id,
|
|
|
+ description: item.description,
|
|
|
+ status: item.status,
|
|
|
+ priority: item.priority || 'medium'
|
|
|
+ }));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 触发变更检测以更新UI
|
|
|
+ this.cdr.detectChanges();
|
|
|
+
|
|
|
+ console.log('客户信息已实时更新');
|
|
|
+ }
|
|
|
}
|
|
|
}
|