Эх сурвалжийг харах

```
feat: add scrollable todo list and overdue reason tracking

- Added scrollable container to todo section with max-height of 520px and custom scrollbar styling
- Implemented overdue reason detection based on project stalled days (3+ days indicates customer delay, otherwise designer delay)
- Updated urgent event descriptions to include overdue reasons for review, delivery, and phase deadline events
- Fixed stalledDays calculation to always return days since update instead of conditional 0
- Added flex

0235711 3 өдөр өмнө
parent
commit
96fa45398e

+ 20 - 0
src/app/pages/team-leader/dashboard/components/todo-section/todo-section.component.scss

@@ -118,8 +118,28 @@
     display: flex;
     flex-direction: column;
     gap: 12px;
+    max-height: 520px; // Show approx 3 items
+    overflow-y: auto;
+    padding-right: 4px;
+
+    // Custom scrollbar
+    &::-webkit-scrollbar {
+      width: 6px;
+    }
+    &::-webkit-scrollbar-track {
+      background: transparent;
+      border-radius: 3px;
+    }
+    &::-webkit-scrollbar-thumb {
+      background: #d1d5db;
+      border-radius: 3px;
+      &:hover {
+        background: #9ca3af;
+      }
+    }
     
     .todo-item-compact {
+      flex-shrink: 0; // Prevent items from shrinking in flex container
       position: relative;
       display: flex;
       align-items: stretch;

+ 25 - 4
src/app/pages/team-leader/dashboard/dashboard.ts

@@ -565,7 +565,7 @@ export class Dashboard implements OnInit, OnDestroy {
         const daysSinceUpdate = Math.floor((now.getTime() - updatedAt.getTime()) / (1000 * 60 * 60 * 24));
         // 如果超过7天未更新,认为停滞
         isStalled = daysSinceUpdate > 7;
-        stalledDays = isStalled ? daysSinceUpdate : 0;
+        stalledDays = daysSinceUpdate;
       }
       
       // 9. 催办次数(基于状态和历史记录)
@@ -1582,6 +1582,19 @@ export class Dashboard implements OnInit, OnDestroy {
       }
     };
 
+    // 🆕 辅助方法:获取逾期原因
+    const getOverdueReason = (daysDiff: number, stalledDays: number = 0) => {
+      if (daysDiff >= 0) return ''; // 未逾期
+      
+      // 如果项目超过3天未更新/无反馈,推测为客户原因
+      if (stalledDays >= 3) {
+        return '原因:客户未跟进反馈导致逾期';
+      }
+      
+      // 否则推测为设计师进度原因
+      return '原因:设计师进度原因导致逾期';
+    };
+
     const addEvent = (
       partial: Omit<UrgentEvent, 'category' | 'statusType' | 'labels' | 'allowConfirmOnTime' | 'allowMarkHandled' | 'allowCreateTodo' | 'followUpNeeded'> &
         Partial<UrgentEvent>
@@ -1626,10 +1639,13 @@ export class Dashboard implements OnInit, OnDestroy {
           
           // 如果小图对图已经到期或即将到期(1天内),且不在已完成状态
           if (daysDiff <= 1 && project.currentStage !== 'delivery') {
+            const reason = getOverdueReason(daysDiff, project.stalledDays);
+            const descSuffix = reason ? `,${reason}` : '';
+            
             addEvent({
               id: `${project.projectId}-review`,
               title: `小图对图截止`,
-              description: `项目「${project.projectName}」的小图对图时间已${daysDiff < 0 ? '逾期' : '临近'}`,
+              description: `项目「${project.projectName}」的小图对图时间已${daysDiff < 0 ? '逾期' : '临近'}${descSuffix}`,
               eventType: 'review',
               deadline: project.reviewDate,
               projectId: project.projectId,
@@ -1653,11 +1669,13 @@ export class Dashboard implements OnInit, OnDestroy {
           if (daysDiff <= 1 && project.currentStage !== 'delivery') {
             const summary = project.spaceDeliverableSummary;
             const completionRate = summary?.overallCompletionRate || 0;
+            const reason = getOverdueReason(daysDiff, project.stalledDays);
+            const descSuffix = reason ? `,${reason}` : '';
             
             addEvent({
               id: `${project.projectId}-delivery`,
               title: `项目交付截止`,
-              description: `项目「${project.projectName}」需要在 ${project.deliveryDate.toLocaleDateString()} 交付(当前完成率 ${completionRate}%)`,
+              description: `项目「${project.projectName}」需要在 ${project.deliveryDate.toLocaleDateString()} 交付(当前完成率 ${completionRate}%)${descSuffix}`,
               eventType: 'delivery',
               deadline: project.deliveryDate,
               projectId: project.projectId,
@@ -1699,10 +1717,13 @@ export class Dashboard implements OnInit, OnDestroy {
                   completionRate = phaseProgress?.completionRate || 0;
                 }
                 
+                const reason = getOverdueReason(daysDiff, project.stalledDays);
+                const descSuffix = reason ? `,${reason}` : '';
+
                 addEvent({
                   id: `${project.projectId}-phase-${key}`,
                   title: `${phaseName}阶段截止`,
-                  description: `项目「${project.projectName}」的${phaseName}阶段截止时间已${daysDiff < 0 ? '逾期' : '临近'}(完成率 ${completionRate}%)`,
+                  description: `项目「${project.projectName}」的${phaseName}阶段截止时间已${daysDiff < 0 ? '逾期' : '临近'}(完成率 ${completionRate}%)${descSuffix}`,
                   eventType: 'phase_deadline',
                   phaseName,
                   deadline,