日期: 2025-10-22 12:00 需求: 移除异常提醒,将工作量负载概览改为甘特图,直观显示组员工作状态
<!-- 移除:异常提醒面板(65-115行) -->
@if (getAlertSummary().totalAlerts > 0) {
  <div class="alert-panel">...</div>
}
<!-- 移除:卡片式工作量概览(117-141行) -->
<div class="workload-summary cards">...</div>
<!-- 新增:工作负载甘特图(65-83行) -->
<div class="workload-gantt-card">
  <div class="gantt-header">
    <h3>工作负载概览</h3>
    <div class="gantt-controls">
      <!-- 周/月视图切换 -->
      <div class="scale-switch">
        <button [class.active]="workloadGanttScale === 'week'" 
                (click)="setWorkloadGanttScale('week')">周视图</button>
        <button [class.active]="workloadGanttScale === 'month'" 
                (click)="setWorkloadGanttScale('month')">月视图</button>
      </div>
      <!-- 图例 -->
      <div class="legend">
        <span class="legend-item"><span class="dot busy"></span>忙碌</span>
        <span class="legend-item"><span class="dot idle"></span>空闲</span>
        <span class="legend-item"><span class="dot leave"></span>请假</span>
        <span class="legend-item"><span class="dot overload"></span>超负荷</span>
      </div>
    </div>
  </div>
  <div class="gantt-container" #workloadGanttContainer></div>
</div>
@ViewChild('workloadGanttContainer', { static: false }) workloadGanttContainer!: ElementRef<HTMLDivElement>;
private workloadGanttChart: any | null = null;
workloadGanttScale: 'week' | 'month' = 'week';
setWorkloadGanttScale(scale: 'week' | 'month'): void {
  if (this.workloadGanttScale !== scale) {
    this.workloadGanttScale = scale;
    this.updateWorkloadGantt();
  }
}
核心算法:
时间范围计算
工作状态判断
if (dayProjects.length === 0) {
 status = 'idle';    // 空闲
 color = '#d1fae5';  // 浅绿色
} else if (dayProjects.length >= 3) {
 status = 'overload'; // 超负荷
 color = '#fecaca';   // 浅红色
} else {
 status = 'busy';     // 忙碌
 color = '#bfdbfe';   // 浅蓝色
}
TODO: 请假状态
// TODO: 检查请假记录,如果该天请假则标记为leave
// const isOnLeave = this.checkLeave(designerName, dayStart, dayEnd);
// if (isOnLeave) {
//   status = 'leave';
//   color = '#e5e7eb'; // 请假-灰色
// }
ECharts 配置
// 移除:旧的工作量图表相关
- @ViewChild('workloadChartRef')
- private workloadChart
- workloadDimension: 'designer' | 'member'
- setWorkloadDimension()
- updateWorkloadChart()
// ngOnInit(第211行)
setTimeout(() => this.updateWorkloadGantt(), 0);
// applyFilters(第815行)
setTimeout(() => this.updateWorkloadGantt(), 0);
// ngOnDestroy(第1803-1806行)
if (this.workloadGanttChart) {
  this.workloadGanttChart.dispose();
  this.workloadGanttChart = null;
}
.workload-gantt-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin-bottom: 24px;
  
  .gantt-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    
    h3 { ... }
    
    .gantt-controls {
      display: flex;
      gap: 20px;
      
      .scale-switch { ... }
      
      .legend {
        .legend-item {
          .dot {
            width: 16px;
            height: 16px;
            border-radius: 4px;
            
            &.busy { background: #bfdbfe; }
            &.idle { background: #d1fae5; }
            &.leave { background: #e5e7eb; }
            &.overload { background: #fecaca; }
          }
        }
      }
    }
  }
  
  .gantt-container {
    width: 100%;
    height: 500px;
    min-height: 400px;
  }
}
月/日 + 星期几10/23 周三月/日10/23| 状态 | 颜色 | 判断条件 | 说明 | 
|---|---|---|---|
| 空闲 | 浅绿色 (#d1fae5) | 0个项目 | 可接单 | 
| 忙碌 | 浅蓝色 (#bfdbfe) | 1-2个项目 | 正常工作 | 
| 超负荷 | 浅红色 (#fecaca) | ≥3个项目 | 需要关注 | 
| 请假 | 灰色 (#e5e7eb) | 待实现 | 需要请假记录数据 | 
鼠标悬浮时显示:
1. ngOnInit() 
   └→ loadProjects()
      └→ applyFilters()
         └→ updateWorkloadGantt()
2. 用户点击周/月切换
   └→ setWorkloadGanttScale()
      └→ updateWorkloadGantt()
3. 用户筛选项目
   └→ applyFilters()
      └→ updateWorkloadGantt()
需要实现 checkLeave(designerName, dayStart, dayEnd) 方法:
/**
 * 检查设计师在指定时间段是否请假
 * @param designerName 设计师姓名
 * @param dayStart 开始时间戳
 * @param dayEnd 结束时间戳
 * @returns 是否请假
 */
private async checkLeave(
  designerName: string, 
  dayStart: number, 
  dayEnd: number
): Promise<boolean> {
  // TODO: 查询请假记录表
  // 1. 从Parse查询LeaveRecord表
  // 2. 条件:设计师名称 + 时间段重叠
  // 3. 返回是否有请假记录
  
  // 示例实现:
  // const query = new Parse.Query('LeaveRecord');
  // query.equalTo('designer', designerName);
  // query.greaterThan('endDate', new Date(dayStart));
  // query.lessThan('startDate', new Date(dayEnd));
  // const records = await query.find();
  // return records.length > 0;
  
  return false;
}
需要的数据表结构:
LeaveRecord {
  objectId: string;
  designer: Pointer<Profile>;  // 设计师
  startDate: Date;              // 请假开始日期
  endDate: Date;                // 请假结束日期
  reason: string;               // 请假原因
  status: 'pending' | 'approved' | 'rejected';  // 审批状态
  approvedBy: Pointer<Profile>; // 审批人
}
| 文件 | 变更内容 | 
|---|---|
| dashboard.html | 移除异常提醒面板,新增工作负载甘特图HTML结构 | 
| dashboard.ts | 新增工作负载甘特图逻辑,移除旧的工作量图表代码 | 
| dashboard-new-styles.scss | 新增工作负载甘特图样式 | 
| designer.service.ts | 已有数据查询功能(无需修改) | 
实施完成时间: 2025-10-22 12:00 状态: ✅ 已完成(除请假功能待实现)