根据你的需求,我创建了一个独立的、可复用的员工信息侧边栏组件,它集成了:
通过顶部导航标签,可以在两个板块之间灵活切换。
yss-project/src/app/shared/components/employee-info-panel/
├── employee-info-panel.component.ts # TypeScript 组件逻辑
├── employee-info-panel.component.html # HTML 模板
├── employee-info-panel.component.scss # SCSS 样式
├── index.ts # 导出文件
├── README.md # 组件文档
└── USAGE_EXAMPLE.md # 使用示例
export interface EmployeeFullInfo {
// === 基础信息(必填) ===
id: string;
name: string;
realname?: string;
mobile: string;
userid: string;
roleName: string;
department: string;
departmentId?: string;
isDisabled?: boolean;
createdAt?: Date;
avatar?: string;
email?: string;
position?: string;
gender?: string;
level?: string;
skills?: string[];
joinDate?: Date | string;
// === 工作量统计(可选) ===
workload?: {
currentProjects?: number;
completedProjects?: number;
averageQuality?: number;
};
// === 项目负载信息(可选) ===
currentProjects?: number;
projectNames?: string[];
projectData?: Array<{ id: string; name: string }>;
leaveRecords?: LeaveRecord[];
redMarkExplanation?: string;
calendarData?: EmployeeCalendarData;
// === 能力问卷(可选) ===
surveyCompleted?: boolean;
surveyData?: any;
profileId?: string;
}
| 属性 | 类型 | 必填 | 说明 |
|---|---|---|---|
visible |
boolean |
是 | 面板是否可见 |
employee |
EmployeeFullInfo \| null |
是 | 员工完整信息 |
departments |
Array<{id, name}> |
否 | 部门列表 |
roles |
string[] |
否 | 角色列表 |
| 事件 | 参数 | 说明 |
|---|---|---|
close |
void |
关闭面板 |
update |
Partial<EmployeeFullInfo> |
更新员工信息 |
calendarMonthChange |
number |
切换日历月份 |
calendarDayClick |
EmployeeCalendarDay |
点击日历日期 |
projectClick |
string |
点击项目 |
refreshSurvey |
void |
刷新问卷 |
import { EmployeeInfoPanelComponent, EmployeeFullInfo } from '@shared/components/employee-info-panel';
@Component({
imports: [EmployeeInfoPanelComponent]
})
<app-employee-info-panel
[visible]="showPanel"
[employee]="selectedEmployee"
[departments]="departments"
(close)="handleClose()"
(update)="handleUpdate($event)">
</app-employee-info-panel>
const employee: EmployeeFullInfo = {
id: 'emp001',
name: '张三',
realname: '张三丰',
mobile: '13800138000',
userid: 'zhangsan',
roleName: '组员',
department: '设计一组',
// ... 其他字段
};
只需要提供基本信息字段,不需要项目负载数据。用户只能看到"基本信息"标签页。
提供完整的员工信息(包括项目负载、日历、问卷等),用户可以在两个标签页之间切换查看。
在"基本信息"标签页点击"编辑基本信息"按钮,可以在线编辑并保存。
employees.html 侧边面板保持不变employee-detail-panel 组件保持不变DesignerCalendarComponent 可用这个员工信息侧边栏组件完全满足你的需求:
✅ 集成了管理员端和组长端两个视角的员工信息 ✅ 通过顶部导航标签可以灵活切换查看 ✅ 不影响原有的面板功能 ✅ 作为独立组件,可以在任何地方复用 ✅ 提供了完整的文档和使用示例
你现在可以:
如果有任何问题或需要调整,随时告诉我!🚀