StageRequirementsComponent (父容器)
├── AIDesignAnalysisComponent (AI设计分析)
│ ├── SpaceSelectorComponent (空间选择器)
│ ├── FileUploadComponent (文件上传)
│ └── AnalysisResultComponent (分析结果展示)
├── AIChatSidebarComponent (AI对话侧边栏)
│ ├── ChatMessagesComponent (对话消息列表)
│ ├── ChatInputComponent (输入框)
│ └── QuickActionsComponent (快捷操作)
├── SpaceRequirementsManagementComponent (空间需求管理)
│ ├── SpaceListComponent (空间列表)
│ ├── SpaceItemComponent (单个空间项)
│ └── SpecialRequirementsComponent (特殊需求)
├── RequirementsFormComponent (需求表单)
│ ├── FormFieldsComponent (表单字段)
│ └── FormActionsComponent (表单操作)
└── SharedServicesModule (共享服务)
├── RequirementsStateService (状态管理)
├── AIAnalysisService (AI分析服务)
└── FileUploadService (文件上传服务)
ai-design-analysis)功能:
文件:
ai-design-analysis.component.ts/html/scssspace-selector.component.ts/html/scssfile-upload-zone.component.ts/html/scssanalysis-result.component.ts/html/scss输入:
@Input() projectId: string@Input() products: ProductSpace[]@Input() currentSpace: ProductSpace | null输出:
@Output() analysisComplete: EventEmitter<AnalysisResult>@Output() spaceChange: EventEmitter<ProductSpace>ai-chat-sidebar)功能:
文件:
ai-chat-sidebar.component.ts/html/scsschat-message.component.ts/html/scsschat-input.component.ts/html/scss输入:
@Input() messages: ChatMessage[]@Input() analyzing: boolean@Input() currentSpace: ProductSpace | null输出:
@Output() sendMessage: EventEmitter<string>@Output() uploadFile: EventEmitter<File[]>@Output() clearMessages: EventEmitter<void>space-requirements-management)功能:
文件:
space-requirements-management.component.ts/html/scssspace-list.component.ts/html/scssspace-item.component.ts/html/scssspecial-requirements-editor.component.ts/html/scss输入:
@Input() projectId: string@Input() products: ProductSpace[]@Input() specialRequirements: Record<string, string>输出:
@Output() requirementsChange: EventEmitter<any>@Output() save: EventEmitter<void>requirements-form)功能:
文件:
requirements-form.component.ts/html/scssform-field.component.ts/html/scss输入:
@Input() projectId: string@Input() formData: any输出:
@Output() submit: EventEmitter<any>@Output() formChange: EventEmitter<any>@Injectable()
export class RequirementsStateService {
// 状态管理
private projectId$ = new BehaviorSubject<string>('');
private products$ = new BehaviorSubject<ProductSpace[]>([]);
private currentSpace$ = new BehaviorSubject<ProductSpace | null>(null);
private formData$ = new BehaviorSubject<any>({});
// 方法
updateProject(projectId: string): void
updateProducts(products: ProductSpace[]): void
selectSpace(space: ProductSpace): void
updateFormData(data: any): void
}
@Injectable()
export class AIAnalysisService {
// AI分析相关
analyzeDesign(options: AnalysisOptions): Promise<AnalysisResult>
sendChatMessage(message: string, history: ChatMessage[]): Promise<string>
uploadFiles(files: File[], projectId: string): Promise<UploadedFile[]>
}
@Injectable()
export class FileUploadService {
uploadFile(file: File, path: string): Promise<UploadedFile>
uploadMultiple(files: File[], path: string): Promise<UploadedFile[]>
deleteFile(fileId: string): Promise<void>
}
父组件 (StageRequirementsComponent)
↓ (通过服务管理全局状态)
RequirementsStateService
↓ (订阅状态)
子组件们 (通过@Input接收数据)
↓ (用户操作)
@Output事件发射
↓
父组件处理 / 服务更新状态
RequirementsStateServiceAIAnalysisServiceFileUploadServiceAIDesignAnalysisComponentFileUploadZoneComponentAnalysisResultComponentAIChatSidebarComponentChatMessageComponentChatInputComponentSpaceRequirementsManagementComponentSpaceItemComponentRequirementsFormComponent风险1: 功能遗漏或变更
风险2: 数据流混乱
风险3: 重构时间长
风险4: 性能下降