|
|
@@ -2,7 +2,6 @@ import { Component, Input, Output, EventEmitter, OnInit, OnChanges, SimpleChange
|
|
|
import { CommonModule } from '@angular/common';
|
|
|
import { FormsModule } from '@angular/forms';
|
|
|
import { Router } from '@angular/router';
|
|
|
-import { DesignerCalendarComponent, Designer as CalendarDesigner } from '../../../pages/customer-service/consultation-order/components/designer-calendar/designer-calendar.component';
|
|
|
import { EmployeeDetailPanelComponent, EmployeeDetail as TeamLeaderEmployeeDetail } from '../../../pages/team-leader/employee-detail-panel';
|
|
|
|
|
|
/**
|
|
|
@@ -102,15 +101,8 @@ export class EmployeeInfoPanelComponent implements OnInit, OnChanges {
|
|
|
editMode: boolean = false; // 是否处于编辑模式
|
|
|
formModel: Partial<EmployeeFullInfo> = {}; // 编辑表单模型
|
|
|
|
|
|
- // 项目负载相关
|
|
|
- showFullSurvey: boolean = false;
|
|
|
+ // 项目负载相关(保持最小状态)
|
|
|
refreshingSurvey: boolean = false;
|
|
|
- showCalendarProjectList: boolean = false;
|
|
|
- selectedDate: Date | null = null;
|
|
|
- selectedDayProjects: Array<{ id: string; name: string; deadline?: Date }> = [];
|
|
|
- showDesignerCalendar: boolean = false;
|
|
|
- calendarDesigners: CalendarDesigner[] = [];
|
|
|
- calendarViewMode: 'week' | 'month' | 'quarter' = 'month';
|
|
|
|
|
|
constructor(private router: Router) {}
|
|
|
|
|
|
@@ -262,9 +254,6 @@ export class EmployeeInfoPanelComponent implements OnInit, OnChanges {
|
|
|
private resetPanel(): void {
|
|
|
this.activeTab = 'basic';
|
|
|
this.editMode = false;
|
|
|
- this.showFullSurvey = false;
|
|
|
- this.showCalendarProjectList = false;
|
|
|
- this.showDesignerCalendar = false;
|
|
|
this.resetFormModel();
|
|
|
}
|
|
|
|
|
|
@@ -285,98 +274,60 @@ export class EmployeeInfoPanelComponent implements OnInit, OnChanges {
|
|
|
};
|
|
|
}
|
|
|
|
|
|
- // ========== 项目负载相关方法 ==========
|
|
|
+ // ========== 项目负载相关方法(完全对齐组长端) ==========
|
|
|
|
|
|
/**
|
|
|
- * 切换月份
|
|
|
+ * 关闭员工详情面板(嵌入模式下可能不需要,但保留接口)
|
|
|
*/
|
|
|
- onChangeMonth(direction: number): void {
|
|
|
- this.calendarMonthChange.emit(direction);
|
|
|
+ closeEmployeeDetailPanel(): void {
|
|
|
+ console.log('📋 [closeEmployeeDetailPanel] 嵌入模式,不执行关闭操作');
|
|
|
+ // 嵌入模式下不需要关闭,因为面板是标签页的一部分
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 日历日期点击
|
|
|
+ * 切换员工日历月份(完全对齐组长端)
|
|
|
+ * @param direction -1=上月, 1=下月
|
|
|
*/
|
|
|
- onCalendarDayClick(day: EmployeeCalendarDay): void {
|
|
|
- if (!day.isCurrentMonth || day.projectCount === 0) {
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- this.selectedDate = day.date;
|
|
|
- this.selectedDayProjects = day.projects;
|
|
|
- this.showCalendarProjectList = true;
|
|
|
+ changeEmployeeCalendarMonth(direction: number): void {
|
|
|
+ console.log(`📅 [changeEmployeeCalendarMonth] 切换月份: ${direction > 0 ? '下月' : '上月'}`);
|
|
|
+ this.calendarMonthChange.emit(direction);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 关闭项目列表弹窗
|
|
|
+ * 处理日历日期点击事件(完全对齐组长端)
|
|
|
*/
|
|
|
- closeCalendarProjectList(): void {
|
|
|
- this.showCalendarProjectList = false;
|
|
|
- this.selectedDate = null;
|
|
|
- this.selectedDayProjects = [];
|
|
|
+ onCalendarDayClick(day: EmployeeCalendarDay): void {
|
|
|
+ console.log(`📅 [onCalendarDayClick] 点击日期:`, {
|
|
|
+ 日期: day.date,
|
|
|
+ 项目数: day.projectCount,
|
|
|
+ 项目列表: day.projects
|
|
|
+ });
|
|
|
+ this.calendarDayClick.emit(day);
|
|
|
+ // 如果需要在内部处理,可以展开:
|
|
|
+ // if (!day.isCurrentMonth || day.projectCount === 0) return;
|
|
|
+ // this.selectedDate = day.date;
|
|
|
+ // this.selectedDayProjects = day.projects;
|
|
|
+ // this.showCalendarProjectList = true;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 项目点击
|
|
|
+ * 项目点击事件(完全对齐组长端)
|
|
|
*/
|
|
|
- onProjectClick(projectId: string): void {
|
|
|
+ navigateToProjectFromPanel(projectId: string): void {
|
|
|
+ console.log('🔗 [navigateToProjectFromPanel] 点击项目:', projectId);
|
|
|
this.projectClick.emit(projectId);
|
|
|
- this.closeCalendarProjectList();
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 打开详细日历
|
|
|
- */
|
|
|
- openDesignerCalendar(): void {
|
|
|
- if (!this.employee) return;
|
|
|
-
|
|
|
- const name = this.employee.name || '设计师';
|
|
|
- const currentProjects = this.employee.currentProjects || 0;
|
|
|
-
|
|
|
- const upcomingEvents: CalendarDesigner['upcomingEvents'] = [];
|
|
|
- const days = this.employee.calendarData?.days || [];
|
|
|
- for (const day of days) {
|
|
|
- if (day.projectCount > 0) {
|
|
|
- upcomingEvents.push({
|
|
|
- id: `${day.date.getTime()}`,
|
|
|
- date: day.date,
|
|
|
- title: `${day.projectCount}个项目`,
|
|
|
- type: 'project',
|
|
|
- duration: 6
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- this.calendarDesigners = [{
|
|
|
- id: this.employee.profileId || this.employee.id,
|
|
|
- name,
|
|
|
- groupId: this.employee.departmentId || '',
|
|
|
- groupName: this.employee.department || '',
|
|
|
- isLeader: this.employee.roleName === '组长',
|
|
|
- status: currentProjects >= 3 ? 'busy' : 'available',
|
|
|
- currentProjects,
|
|
|
- upcomingEvents,
|
|
|
- workload: Math.min(100, currentProjects * 30)
|
|
|
- }];
|
|
|
-
|
|
|
- this.showDesignerCalendar = true;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 关闭详细日历
|
|
|
- */
|
|
|
- closeDesignerCalendar(): void {
|
|
|
- this.showDesignerCalendar = false;
|
|
|
- this.calendarDesigners = [];
|
|
|
+ // 可以在这里实现跳转逻辑
|
|
|
+ // this.router.navigate(['/wxwork', cid, 'project', projectId]);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 刷新问卷
|
|
|
+ * 刷新员工问卷(完全对齐组长端)
|
|
|
*/
|
|
|
- onRefreshSurvey(): void {
|
|
|
+ refreshEmployeeSurvey(): void {
|
|
|
if (this.refreshingSurvey) return;
|
|
|
|
|
|
this.refreshingSurvey = true;
|
|
|
+ console.log('🔄 [refreshEmployeeSurvey] 刷新问卷状态...');
|
|
|
this.refreshSurvey.emit();
|
|
|
|
|
|
setTimeout(() => {
|
|
|
@@ -384,55 +335,6 @@ export class EmployeeInfoPanelComponent implements OnInit, OnChanges {
|
|
|
}, 2000);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 切换问卷显示模式
|
|
|
- */
|
|
|
- toggleSurveyDisplay(): void {
|
|
|
- this.showFullSurvey = !this.showFullSurvey;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取能力画像摘要
|
|
|
- */
|
|
|
- getCapabilitySummary(answers: any[]): any {
|
|
|
- const findAnswer = (questionId: string) => {
|
|
|
- const item = answers.find((a: any) => a.questionId === questionId);
|
|
|
- return item?.answer;
|
|
|
- };
|
|
|
-
|
|
|
- const formatArray = (value: any): string => {
|
|
|
- if (Array.isArray(value)) {
|
|
|
- return value.join('、');
|
|
|
- }
|
|
|
- return value || '未填写';
|
|
|
- };
|
|
|
-
|
|
|
- return {
|
|
|
- styles: formatArray(findAnswer('q1_expertise_styles')),
|
|
|
- spaces: formatArray(findAnswer('q2_expertise_spaces')),
|
|
|
- advantages: formatArray(findAnswer('q3_technical_advantages')),
|
|
|
- difficulty: findAnswer('q5_project_difficulty') || '未填写',
|
|
|
- capacity: findAnswer('q7_weekly_capacity') || '未填写',
|
|
|
- urgent: findAnswer('q8_urgent_willingness') || '未填写',
|
|
|
- urgentLimit: findAnswer('q8_urgent_limit') || '',
|
|
|
- feedback: findAnswer('q9_progress_feedback') || '未填写',
|
|
|
- communication: formatArray(findAnswer('q12_communication_methods'))
|
|
|
- };
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取请假类型显示文本
|
|
|
- */
|
|
|
- getLeaveTypeText(leaveType?: string): string {
|
|
|
- const typeMap: Record<string, string> = {
|
|
|
- 'sick': '病假',
|
|
|
- 'personal': '事假',
|
|
|
- 'annual': '年假',
|
|
|
- 'other': '其他'
|
|
|
- };
|
|
|
- return typeMap[leaveType || ''] || '未知';
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 阻止事件冒泡
|
|
|
*/
|