采用模板复用方式,直接在 employee-info-panel.component.html 中渲染 employee-detail-panel 的所有内容,确保显示效果完全一致。
employee-info-panel.component.html)项目负载标签页 现在直接包含了 employee-detail-panel 的所有 sections:
@if (activeTab === 'workload') {
<div class="tab-content workload-tab">
@if (employeeDetailForTeamLeader) {
<div class="embedded-panel-content">
<!-- ✅ 完全复制 employee-detail-panel 的所有 sections -->
<!-- 负载概况栏 -->
<!-- 负载详细日历 -->
<!-- 请假明细栏 -->
<!-- 红色标记说明 -->
<!-- 能力问卷 -->
</div>
}
</div>
}
employee-info-panel.component.scss)直接引用 employee-detail-panel 的样式文件:
// 引用组长端组件的样式
@import '../../../pages/team-leader/employee-detail-panel/employee-detail-panel.scss';
// 为嵌入内容添加适配样式
.embedded-panel-content {
// 所有 section 样式与组长端完全一致
.section { ... }
.section-header { ... }
}
employee-info-panel.component.ts)保持不变 - 所有必要的方法都已存在:
employeeDetailForTeamLeader getter - 数据转换onChangeMonth() - 日历切换onCalendarDayClick() - 日历点击onProjectClick() - 项目跳转onRefreshSurvey() - 刷新问卷toggleSurveyDisplay() - 展开/收起问卷getCapabilitySummary() - 获取能力画像getLeaveTypeText() - 请假类型文本employeeDetailForTeamLeader.currentProjectsemployeeDetailForTeamLeader.projectDataemployeeDetailForTeamLeader.calendarDataemployeeDetailForTeamLeader.leaveRecordsemployeeDetailForTeamLeader.surveyData@import 引用组长端的 SCSSonChangeMonth()onCalendarDayClick()onProjectClick()onRefreshSurvey()toggleSurveyDisplay()员工管理页 (Admin Employees)
↓ 选择员工
employee-info-panel (侧边栏)
↓ 转换数据 (employeeDetailForTeamLeader getter)
渲染 employee-detail-panel 的内容
↓ 使用相同的 SCSS
显示效果与组长端完全一致
| 特性 | 组长端 employee-detail-panel | 员工管理端 employee-info-panel |
|---|---|---|
| 渲染方式 | 完整侧边栏(overlay + panel) | 嵌入式(保留外层侧边栏,内部嵌入内容) |
| 内容 | panel-content 的所有 sections | 完全相同的 sections |
| 样式 | employee-detail-panel.scss | @import 引用相同的 SCSS |
| 数据 | EmployeeDetail 接口 | 转换为相同的 EmployeeDetail |
| 功能 | 所有交互方法 | 完全相同的交互方法 |
✅ yss-project/src/app/shared/components/employee-info-panel/employee-info-panel.component.html
✅ yss-project/src/app/shared/components/employee-info-panel/employee-info-panel.component.scss
✅ yss-project/src/app/shared/components/employee-info-panel/employee-info-panel.component.ts
employee-detail-panel.html - 组长端组件保持完整模式employee-detail-panel.ts - 不需要 embedModeemployee-detail-panel.scss - 样式文件被引用如果将来 employee-detail-panel.html 的内容有更新:
panel-content 部分的变化employee-info-panel.html 的 embedded-panel-content由于使用了 @import,样式会自动同步,无需额外操作。
确保 employeeDetailForTeamLeader getter 正确转换所有字段:
访问 /admin/employees 并进行以下测试:
这次重新设计采用了模板内容复用的方式,而不是组件嵌套。这种方式:
现在 employee-info-panel 的项目负载标签页与 employee-detail-panel 的显示完全一致,真正实现了严格复用!