|
@@ -60,70 +60,6 @@ export class ConsultationOrderPanelComponent implements OnInit, OnChanges {
|
|
showTeamAssignmentModal = false;
|
|
showTeamAssignmentModal = false;
|
|
selectedDesigner: Designer | null = null;
|
|
selectedDesigner: Designer | null = null;
|
|
|
|
|
|
- // 新增:自动分配用的设计师池(与弹窗组件保持一致的数据结构)
|
|
|
|
- private allDesigners: Designer[] = [
|
|
|
|
- {
|
|
|
|
- id: '1',
|
|
|
|
- name: '张设计师',
|
|
|
|
- role: '高级室内设计师',
|
|
|
|
- avatar: '/assets/images/default-avatar.svg',
|
|
|
|
- skills: ['现代简约', '北欧风格', '工业风'],
|
|
|
|
- workload: { level: 'low', percentage: 30, text: '轻度' },
|
|
|
|
- recentTasks: [
|
|
|
|
- { id: '1', name: '海景别墅设计', projectName: '海景别墅设计', stage: 'modeling', deadline: '2024-01-15' },
|
|
|
|
- { id: '2', name: '现代公寓改造', projectName: '现代公寓改造', stage: 'rendering', deadline: '2024-01-20' }
|
|
|
|
- ]
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- id: '2',
|
|
|
|
- name: '李设计师',
|
|
|
|
- role: '资深设计总监',
|
|
|
|
- avatar: '/assets/images/default-avatar.svg',
|
|
|
|
- skills: ['欧式古典', '美式乡村', '中式传统'],
|
|
|
|
- workload: { level: 'medium', percentage: 65, text: '中度' },
|
|
|
|
- recentTasks: [
|
|
|
|
- { id: '3', name: '豪华会所设计', projectName: '豪华会所设计', stage: 'soft-decoration', deadline: '2024-01-18' },
|
|
|
|
- { id: '4', name: '商业空间规划', projectName: '商业空间规划', stage: 'post-production', deadline: '2024-01-25' },
|
|
|
|
- { id: '5', name: '私人定制住宅', projectName: '私人定制住宅', stage: 'modeling', deadline: '2024-02-01' }
|
|
|
|
- ]
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- id: '3',
|
|
|
|
- name: '王设计师',
|
|
|
|
- role: '创意设计师',
|
|
|
|
- avatar: '/assets/images/default-avatar.svg',
|
|
|
|
- skills: ['极简主义', '日式禅风', '斯堪的纳维亚'],
|
|
|
|
- workload: { level: 'high', percentage: 85, text: '重度' },
|
|
|
|
- recentTasks: [
|
|
|
|
- { id: '6', name: '艺术画廊设计', projectName: '艺术画廊设计', stage: 'rendering', deadline: '2024-01-12' },
|
|
|
|
- { id: '7', name: '精品酒店套房', projectName: '精品酒店套房', stage: 'soft-decoration', deadline: '2024-01-16' },
|
|
|
|
- { id: '8', name: '创意办公空间', projectName: '创意办公空间', stage: 'post-production', deadline: '2024-01-22' },
|
|
|
|
- { id: '9', name: '高端住宅项目', projectName: '高端住宅项目', stage: 'modeling', deadline: '2024-01-28' }
|
|
|
|
- ]
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- id: '4',
|
|
|
|
- name: '陈设计师',
|
|
|
|
- role: '室内设计师',
|
|
|
|
- avatar: '/assets/images/default-avatar.svg',
|
|
|
|
- skills: ['新中式', '轻奢风格', '混搭风格'],
|
|
|
|
- workload: { level: 'low', percentage: 20, text: '轻度' },
|
|
|
|
- recentTasks: [
|
|
|
|
- { id: '10', name: '温馨家庭住宅', projectName: '温馨家庭住宅', stage: 'modeling', deadline: '2024-01-30' }
|
|
|
|
- ]
|
|
|
|
- },
|
|
|
|
- // 新增:完全空闲的设计师用于自动分配展示
|
|
|
|
- {
|
|
|
|
- id: '5',
|
|
|
|
- name: '赵设计师',
|
|
|
|
- role: '室内设计师',
|
|
|
|
- avatar: '/assets/images/default-avatar.svg',
|
|
|
|
- skills: ['现代简约', '北欧风格'],
|
|
|
|
- workload: { level: 'low', percentage: 0, text: '空闲' },
|
|
|
|
- recentTasks: []
|
|
|
|
- }
|
|
|
|
- ];
|
|
|
|
-
|
|
|
|
// 样式选项
|
|
// 样式选项
|
|
styleOptions = [
|
|
styleOptions = [
|
|
'现代简约', '北欧风', '工业风', '新中式', '法式轻奢', '日式', '美式', '混搭'
|
|
'现代简约', '北欧风', '工业风', '新中式', '法式轻奢', '日式', '美式', '混搭'
|
|
@@ -373,67 +309,14 @@ export class ConsultationOrderPanelComponent implements OnInit, OnChanges {
|
|
return this.customerForm.valid && this.requirementForm.valid;
|
|
return this.customerForm.valid && this.requirementForm.valid;
|
|
}
|
|
}
|
|
|
|
|
|
- // 检查是否可以创建订单(放宽条件:仅需表单有效即可点击创建,设计师由系统自动分配或人工分配)
|
|
|
|
- canCreateOrder(): boolean {
|
|
|
|
- return this.isFormValid();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 创建订单方法(支持自动分配空闲设计师)
|
|
|
|
- createOrder() {
|
|
|
|
- // 表单未通过校验则不允许创建
|
|
|
|
- if (!this.isFormValid()) {
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 若尚未选择设计师,尝试自动分配空闲设计师
|
|
|
|
- if (!this.selectedDesigner) {
|
|
|
|
- const assigned = this.autoAssignDesignerIfAvailable();
|
|
|
|
- if (!assigned) {
|
|
|
|
- // 无空闲设计师:阻止创建并弹出分配弹窗
|
|
|
|
- this.showTeamAssignmentModal = true;
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- this.isSubmitting = true;
|
|
|
|
-
|
|
|
|
- // 构建完整的项目数据
|
|
|
|
- const formData = {
|
|
|
|
- customerInfo: this.customerForm.value,
|
|
|
|
- requirementInfo: this.requirementForm.value,
|
|
|
|
- preferenceTags: this.preferenceTags,
|
|
|
|
- roleContext: this.roleContext,
|
|
|
|
- createdAt: new Date()
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
- const projectData = {
|
|
|
|
- customerInfo: this.customerForm.value,
|
|
|
|
- requirementInfo: this.requirementForm.value,
|
|
|
|
- preferenceTags: this.preferenceTags,
|
|
|
|
- assignedDesigner: this.selectedDesigner,
|
|
|
|
- createdAt: new Date()
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
- // 先触发订单创建事件(用于数据同步)
|
|
|
|
- this.orderCreated.emit(formData);
|
|
|
|
-
|
|
|
|
- // 再触发项目创建成功事件(用于阶段推进)
|
|
|
|
- this.projectCreated.emit(projectData);
|
|
|
|
-
|
|
|
|
- // 重置表单
|
|
|
|
- this.customerForm.reset({
|
|
|
|
- customerType: '新客户'
|
|
|
|
- });
|
|
|
|
- this.requirementForm.reset();
|
|
|
|
- this.preferenceTags = [];
|
|
|
|
- this.selectedCustomer = null;
|
|
|
|
- this.selectedDesigner = null;
|
|
|
|
- this.isSubmitting = false;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 提交表单 - 保留原有逻辑但简化
|
|
|
|
|
|
+ // 提交表单 - 优化流程:直接进入团队分配
|
|
submitForm() {
|
|
submitForm() {
|
|
- this.createOrder();
|
|
|
|
|
|
+ if (this.isFormValid()) {
|
|
|
|
+ this.isSubmitting = true;
|
|
|
|
+
|
|
|
|
+ // 直接显示团队分配弹窗,无需先触发订单创建事件
|
|
|
|
+ this.showTeamAssignmentModal = true;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
// 关闭团队分配弹窗
|
|
// 关闭团队分配弹窗
|
|
@@ -481,22 +364,4 @@ export class ConsultationOrderPanelComponent implements OnInit, OnChanges {
|
|
this.preferenceTags = [];
|
|
this.preferenceTags = [];
|
|
this.selectedCustomer = null;
|
|
this.selectedCustomer = null;
|
|
}
|
|
}
|
|
-
|
|
|
|
- // 新增:查找空闲设计师(低负载且在项少于等于1)
|
|
|
|
- private findAvailableDesigners(): Designer[] {
|
|
|
|
- return this.allDesigners.filter(d => d.workload.level === 'low' && (d.recentTasks?.length || 0) === 0);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 新增:自动随机分配空闲设计师
|
|
|
|
- private autoAssignDesignerIfAvailable(): boolean {
|
|
|
|
- const candidates = this.findAvailableDesigners();
|
|
|
|
- if (candidates.length === 0) {
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
- const randomIndex = Math.floor(Math.random() * candidates.length);
|
|
|
|
- this.selectedDesigner = candidates[randomIndex];
|
|
|
|
- // 更新阶段状态(选择了设计师)
|
|
|
|
- this.checkStageCompletion();
|
|
|
|
- return true;
|
|
|
|
- }
|
|
|
|
}
|
|
}
|