todo-section.component.html 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  1. <section class="todo-section todo-section-dual">
  2. <div class="section-header">
  3. <h2>待办事项</h2>
  4. <button
  5. class="btn-refresh"
  6. (click)="refreshTodoTasks()"
  7. [disabled]="loadingTodoTasks || loadingUrgentEvents"
  8. title="刷新待办事项">
  9. <svg viewBox="0 0 24 24" width="16" height="16" [class.rotating]="loadingTodoTasks || loadingUrgentEvents">
  10. <path fill="currentColor" d="M17.65 6.35A7.958 7.958 0 0 0 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08A5.99 5.99 0 0 1 12 18c-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"/>
  11. </svg>
  12. </button>
  13. </div>
  14. <!-- 🆕 双栏容器 -->
  15. <div class="todo-dual-columns">
  16. <!-- ========== 左栏:待办问题 ========== -->
  17. <div class="todo-column todo-column-issues">
  18. <div class="column-header">
  19. <h3>
  20. <svg viewBox="0 0 24 24" width="18" height="18" fill="currentColor">
  21. <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"/>
  22. </svg>
  23. 待办问题
  24. <span class="task-count" *ngIf="todoTasksFromIssues.length > 0">({{ todoTasksFromIssues.length }})</span>
  25. </h3>
  26. <span class="column-subtitle">来自项目问题板块</span>
  27. </div>
  28. <!-- 加载状态 -->
  29. <div class="loading-state" *ngIf="loadingTodoTasks">
  30. <svg class="spinner" viewBox="0 0 50 50">
  31. <circle cx="25" cy="25" r="20" fill="none" stroke-width="4"></circle>
  32. </svg>
  33. <p>加载待办任务中...</p>
  34. </div>
  35. <!-- 错误状态 -->
  36. <div class="error-state" *ngIf="!loadingTodoTasks && todoTaskError">
  37. <svg viewBox="0 0 24 24" width="48" height="48" fill="#ef4444">
  38. <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"/>
  39. </svg>
  40. <p>{{ todoTaskError }}</p>
  41. <button class="btn-retry" (click)="refreshTodoTasks()">重试</button>
  42. </div>
  43. <!-- 空状态 -->
  44. <div class="empty-state" *ngIf="!loadingTodoTasks && !todoTaskError && todoTasksFromIssues.length === 0">
  45. <svg viewBox="0 0 24 24" width="64" height="64" fill="#d1d5db">
  46. <path d="M19 3h-4.18C14.4 1.84 13.3 1 12 1c-1.3 0-2.4.84-2.82 2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-7 0c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm2 14H7v-2h7v2zm3-4H7v-2h10v2zm0-4H7V7h10v2z"/>
  47. </svg>
  48. <p>暂无待办任务</p>
  49. <p class="hint">所有项目问题都已处理完毕 🎉</p>
  50. </div>
  51. <!-- 待办任务列表 -->
  52. <div class="todo-list-compact" *ngIf="!loadingTodoTasks && !todoTaskError && todoTasksFromIssues.length > 0">
  53. <div class="todo-item-compact" *ngFor="let task of todoTasksFromIssues" [attr.data-priority]="task.priority">
  54. <!-- 左侧优先级色条 -->
  55. <div class="priority-indicator" [attr.data-priority]="task.priority"></div>
  56. <!-- 任务内容 -->
  57. <div class="task-content">
  58. <!-- 标题行 -->
  59. <div class="task-header">
  60. <span class="task-title">{{ task.title }}</span>
  61. <div class="task-badges">
  62. <span class="badge badge-priority" [attr.data-priority]="task.priority">
  63. {{ getPriorityConfig(task.priority).label }}
  64. </span>
  65. <span class="badge badge-type">{{ getIssueTypeLabel(task.type) }}</span>
  66. </div>
  67. </div>
  68. <!-- 项目信息行 -->
  69. <div class="task-meta">
  70. <span class="project-info">
  71. <svg viewBox="0 0 24 24" width="12" height="12" fill="currentColor">
  72. <path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"/>
  73. </svg>
  74. 项目: {{ task.projectName }}
  75. <ng-container *ngIf="task.relatedSpace"> | {{ task.relatedSpace }}</ng-container>
  76. <ng-container *ngIf="task.relatedStage"> | {{ task.relatedStage }}</ng-container>
  77. </span>
  78. </div>
  79. <!-- 底部信息行 -->
  80. <div class="task-footer">
  81. <span class="time-info" [title]="formatExactTime(task.createdAt)">
  82. <svg viewBox="0 0 24 24" width="12" height="12" fill="currentColor">
  83. <path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm.5-13H11v6l5.25 3.15.75-1.23-4.5-2.67z"/>
  84. </svg>
  85. 创建于 {{ formatRelativeTime(task.createdAt) }}
  86. </span>
  87. <span class="assignee-info">
  88. <svg viewBox="0 0 24 24" width="12" height="12" fill="currentColor">
  89. <path d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"/>
  90. </svg>
  91. 指派给: {{ task.assigneeName }}
  92. </span>
  93. </div>
  94. </div>
  95. <!-- 右侧操作按钮 -->
  96. <div class="task-actions">
  97. <button
  98. class="btn-action btn-view"
  99. (click)="onNavigateToIssue(task)"
  100. title="查看详情">
  101. <svg viewBox="0 0 24 24" width="14" height="14" fill="currentColor">
  102. <path d="M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"/>
  103. </svg>
  104. 查看详情
  105. </button>
  106. <button
  107. class="btn-action btn-mark-read"
  108. (click)="onMarkAsRead(task)"
  109. title="标记已读">
  110. <svg viewBox="0 0 24 24" width="14" height="14" fill="currentColor">
  111. <path d="M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"/>
  112. </svg>
  113. 标记已读
  114. </button>
  115. </div>
  116. </div>
  117. </div>
  118. </div>
  119. <!-- ========== 左栏结束 ========== -->
  120. <!-- ========== 右栏:紧急事件 ========== -->
  121. <div class="todo-column todo-column-urgent">
  122. <div class="column-header">
  123. <h3>
  124. <svg viewBox="0 0 24 24" width="18" height="18" fill="currentColor">
  125. <path d="M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"/>
  126. </svg>
  127. 紧急事件
  128. <span class="task-count urgent" *ngIf="urgentEvents.length > 0">({{ urgentEvents.length }})</span>
  129. </h3>
  130. <span class="column-subtitle">自动计算的截止事件</span>
  131. </div>
  132. <div class="tag-filter-bar" *ngIf="!loadingUrgentEvents && urgentEvents.length > 0">
  133. <button
  134. class="tag-button"
  135. [class.active]="urgentEventTagFilter === 'all'"
  136. (click)="filterUrgentEventsByTag('all')"
  137. title="显示所有紧急事件"
  138. >
  139. <span class="tag-icon">📋</span>
  140. <span class="tag-label">全部</span>
  141. <span class="tag-count">{{ urgentEvents.length }}</span>
  142. </button>
  143. <button
  144. class="tag-button"
  145. [class.active]="urgentEventTagFilter === 'customer'"
  146. (click)="filterUrgentEventsByTag('customer')"
  147. title="客户服务"
  148. >
  149. <span class="tag-icon">👥</span>
  150. <span class="tag-label">客户服务</span>
  151. <span class="tag-count">{{ getTagCount('customer') }}</span>
  152. </button>
  153. <button
  154. class="tag-button"
  155. [class.active]="urgentEventTagFilter === 'phase'"
  156. (click)="filterUrgentEventsByTag('phase')"
  157. title="工作阶段"
  158. >
  159. <span class="tag-icon">🔧</span>
  160. <span class="tag-label">工作阶段</span>
  161. <span class="tag-count">{{ getTagCount('phase') }}</span>
  162. </button>
  163. <button
  164. class="tag-button"
  165. [class.active]="urgentEventTagFilter === 'review'"
  166. (click)="filterUrgentEventsByTag('review')"
  167. title="小图截止"
  168. >
  169. <span class="tag-icon">📐</span>
  170. <span class="tag-label">小图截止</span>
  171. <span class="tag-count">{{ getTagCount('review') }}</span>
  172. </button>
  173. <button
  174. class="tag-button"
  175. [class.active]="urgentEventTagFilter === 'delivery'"
  176. (click)="filterUrgentEventsByTag('delivery')"
  177. title="交付延期"
  178. >
  179. <span class="tag-icon">📦</span>
  180. <span class="tag-label">交付延期</span>
  181. <span class="tag-count">{{ getTagCount('delivery') }}</span>
  182. </button>
  183. </div>
  184. <!-- 加载状态 -->
  185. <div class="loading-state" *ngIf="loadingUrgentEvents">
  186. <svg class="spinner" viewBox="0 0 50 50">
  187. <circle cx="25" cy="25" r="20" fill="none" stroke-width="4"></circle>
  188. </svg>
  189. <p>计算紧急事件中...</p>
  190. </div>
  191. <!-- 空状态 -->
  192. <div class="empty-state" *ngIf="!loadingUrgentEvents && urgentEvents.length === 0">
  193. <svg viewBox="0 0 24 24" width="64" height="64" fill="#d1d5db">
  194. <path d="M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"/>
  195. </svg>
  196. <p>暂无紧急事件</p>
  197. <p class="hint">所有项目时间节点正常 ✅</p>
  198. </div>
  199. <div class="empty-state filtered" *ngIf="!loadingUrgentEvents && urgentEvents.length > 0 && filteredUrgentEventsList.length === 0">
  200. <svg viewBox="0 0 24 24" width="48" height="48" fill="#d1d5db">
  201. <path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"/>
  202. </svg>
  203. <p>该筛选条件下暂无事件</p>
  204. <p class="hint">尝试切换其他标签</p>
  205. </div>
  206. <!-- 紧急事件列表 -->
  207. <div class="todo-list-compact urgent-list" *ngIf="!loadingUrgentEvents && filteredUrgentEventsList.length > 0">
  208. <div class="todo-item-compact urgent-item" *ngFor="let event of filteredUrgentEventsList; trackBy: trackUrgentEventById" [attr.data-urgency]="event.urgencyLevel">
  209. <!-- 左侧紧急程度色条 -->
  210. <div class="urgency-indicator" [attr.data-urgency]="event.urgencyLevel"></div>
  211. <!-- 事件内容 -->
  212. <div class="task-content">
  213. <!-- 标题行 -->
  214. <div class="task-header">
  215. <span class="task-title">{{ event.title }}</span>
  216. <div class="task-badges">
  217. <span class="badge badge-urgency" [attr.data-urgency]="event.urgencyLevel">
  218. <ng-container *ngIf="event.urgencyLevel === 'critical'">🔴 紧急</ng-container>
  219. <ng-container *ngIf="event.urgencyLevel === 'high'">🟠 重要</ng-container>
  220. <ng-container *ngIf="event.urgencyLevel === 'medium'">🟡 注意</ng-container>
  221. </span>
  222. <span class="badge badge-event-type">
  223. <ng-container *ngIf="event.eventType === 'review'">对图</ng-container>
  224. <ng-container *ngIf="event.eventType === 'delivery'">交付</ng-container>
  225. <ng-container *ngIf="event.eventType === 'phase_deadline'">{{ event.phaseName }}</ng-container>
  226. <ng-container *ngIf="getEventCategory(event) === 'customer'">客户</ng-container>
  227. </span>
  228. <span class="badge-status overdue" *ngIf="event.statusType === 'overdue'">逾期</span>
  229. <span class="badge-status upcoming" *ngIf="event.statusType === 'dueSoon'">临近</span>
  230. <span class="badge-status stagnant" *ngIf="event.statusType === 'stagnant'">
  231. 停滞{{ event.stagnationDays || 7 }}天
  232. </span>
  233. <span class="badge-status customer" *ngIf="getEventCategory(event) === 'customer'">客户预警</span>
  234. </div>
  235. </div>
  236. <!-- 描述 -->
  237. <div class="task-description">
  238. {{ event.description }}
  239. </div>
  240. <div class="followup-tip" *ngIf="event.followUpNeeded">
  241. 客户反馈待跟进 · 请及时追踪
  242. </div>
  243. <!-- 项目信息行 -->
  244. <div class="task-meta">
  245. <span class="project-info">
  246. <svg viewBox="0 0 24 24" width="12" height="12" fill="currentColor">
  247. <path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"/>
  248. </svg>
  249. 项目: {{ event.projectName }}
  250. </span>
  251. <span class="designer-info" *ngIf="event.designerName">
  252. <svg viewBox="0 0 24 24" width="12" height="12" fill="currentColor">
  253. <path d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"/>
  254. </svg>
  255. 设计师: {{ event.designerName }}
  256. </span>
  257. </div>
  258. <!-- 底部信息行 -->
  259. <div class="task-footer">
  260. <span class="deadline-info" [class.overdue]="event.overdueDays && event.overdueDays > 0">
  261. <svg viewBox="0 0 24 24" width="12" height="12" fill="currentColor">
  262. <path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm.5-13H11v6l5.25 3.15.75-1.23-4.5-2.67z"/>
  263. </svg>
  264. 截止: {{ event.deadline | date:'MM-dd HH:mm' }}
  265. <span class="overdue-label" *ngIf="event.overdueDays && event.overdueDays > 0">(逾期{{ event.overdueDays }}天)</span>
  266. <span class="upcoming-label" *ngIf="event.overdueDays && event.overdueDays < 0">(还剩{{ -event.overdueDays }}天)</span>
  267. <span class="today-label" *ngIf="!event.overdueDays">(今天)</span>
  268. </span>
  269. <span class="completion-info" *ngIf="event.completionRate !== undefined">
  270. <svg viewBox="0 0 24 24" width="12" height="12" fill="currentColor">
  271. <path d="M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"/>
  272. </svg>
  273. 完成率: {{ event.completionRate }}%
  274. </span>
  275. </div>
  276. </div>
  277. <!-- 右侧操作按钮 -->
  278. <div class="task-actions">
  279. <button
  280. class="btn-action btn-muted"
  281. *ngIf="event.allowConfirmOnTime"
  282. (click)="onConfirmEventOnTime(event)"
  283. >
  284. 可按时交付
  285. </button>
  286. <button
  287. class="btn-action btn-stagnant"
  288. *ngIf="event.statusType !== 'stagnant'"
  289. (click)="onMarkEventAsStagnant(event)"
  290. >
  291. 标记停滞
  292. </button>
  293. <button
  294. class="btn-action btn-resolve"
  295. *ngIf="event.allowMarkHandled"
  296. (click)="onResolveUrgentEvent(event)"
  297. >
  298. 事件已处理
  299. </button>
  300. <button
  301. class="btn-action btn-todo"
  302. *ngIf="event.allowCreateTodo"
  303. (click)="onCreateTodoFromEvent(event)"
  304. >
  305. 创建代办
  306. </button>
  307. <button
  308. class="btn-action btn-view"
  309. (click)="onProjectClickHandler(event.projectId)"
  310. title="查看项目">
  311. <svg viewBox="0 0 24 24" width="14" height="14" fill="currentColor">
  312. <path d="M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"/>
  313. </svg>
  314. 查看项目
  315. </button>
  316. </div>
  317. </div>
  318. </div>
  319. </div>
  320. <!-- ========== 右栏结束 ========== -->
  321. </div>
  322. <!-- ========== 双栏容器结束 ========== -->
  323. </section>