todo-section.component.html 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384
  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. <!-- 一级筛选 Tab -->
  133. <div class="filter-tabs" *ngIf="!loadingUrgentEvents && urgentEvents.length > 0">
  134. <div class="filter-tab"
  135. [class.active]="urgentEventCategoryFilter === 'all'"
  136. (click)="filterUrgentEventsByTag('all')">
  137. 全部 <span class="count-badge">{{ urgentEvents.length }}</span>
  138. </div>
  139. <div class="filter-tab"
  140. [class.active-customer]="urgentEventCategoryFilter === 'customer'"
  141. (click)="filterUrgentEventsByTag('customer')">
  142. <svg viewBox="0 0 24 24" width="14" height="14" fill="currentColor"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 3c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3 1.34-3 3-3zm0 14.2c-2.5 0-4.71-1.28-6-3.22.03-1.99 4-3.08 6-3.08 1.99 0 5.97 1.09 6 3.08-1.29 1.94-3.5 3.22-6 3.22z"/></svg>
  143. 客户 <span class="count-badge">{{ getTagCount('customer') }}</span>
  144. </div>
  145. <div class="filter-tab"
  146. [class.active-phase]="urgentEventCategoryFilter === 'phase'"
  147. (click)="filterUrgentEventsByTag('phase')">
  148. <svg viewBox="0 0 24 24" width="14" height="14" fill="currentColor"><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"/></svg>
  149. 阶段逾期 <span class="count-badge">{{ getTagCount('phase') }}</span>
  150. </div>
  151. <div class="filter-tab"
  152. [class.active]="urgentEventCategoryFilter === 'review'"
  153. (click)="filterUrgentEventsByTag('review')">
  154. <svg viewBox="0 0 24 24" width="14" height="14" fill="currentColor"><path d="M19 3H5c-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-4 6h-4v2h4v-2zm3 6H6v-2h12v2zm0-4H6V9h12v2z"/></svg>
  155. 小图/决策 <span class="count-badge">{{ getTagCount('review') }}</span>
  156. </div>
  157. <div class="filter-tab"
  158. [class.active-delivery]="urgentEventCategoryFilter === 'delivery'"
  159. (click)="filterUrgentEventsByTag('delivery')">
  160. <svg viewBox="0 0 24 24" width="14" height="14" fill="currentColor"><path d="M20 6h-4V4c0-1.11-.89-2-2-2h-4c-1.11 0-2 .89-2 2v2H4c-1.11 0-1.99.89-1.99 2L2 19c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V8c0-1.11-.89-2-2-2zm-6 0h-4V4h4v2z"/></svg>
  161. 交付延期 <span class="count-badge">{{ getTagCount('delivery') }}</span>
  162. </div>
  163. </div>
  164. <!-- 二级筛选 (阶段细分) -->
  165. <div class="sub-filters" *ngIf="urgentEventCategoryFilter === 'phase'">
  166. <span class="sub-label">阶段筛选:</span>
  167. <span class="sub-chip" [class.active]="!activePhaseFilter" (click)="togglePhaseFilter('')">全部</span>
  168. <span class="sub-chip" [class.active]="activePhaseFilter === 'modeling'" (click)="togglePhaseFilter('modeling')">建模</span>
  169. <span class="sub-chip" [class.active]="activePhaseFilter === 'rendering'" (click)="togglePhaseFilter('rendering')">渲染</span>
  170. <span class="sub-chip" [class.active]="activePhaseFilter === 'soft_fitting'" (click)="togglePhaseFilter('soft_fitting')">软装</span>
  171. <span class="sub-chip" [class.active]="activePhaseFilter === 'post_processing'" (click)="togglePhaseFilter('post_processing')">后期</span>
  172. </div>
  173. <!-- 小图视图子标签,仅在“小图/决策”主标签下展示 -->
  174. <div class="small-view-bar" *ngIf="urgentEventCategoryFilter === 'review'">
  175. <span class="small-view-label">小图视图:</span>
  176. <button
  177. type="button"
  178. class="small-view-chip"
  179. [class.active]="smallViewFilter === 'all'"
  180. (click)="setSmallViewFilter('all')">
  181. 全部小图
  182. <span class="chip-count" *ngIf="getSmallViewCount() > 0">{{ getSmallViewCount() }}</span>
  183. </button>
  184. <button
  185. type="button"
  186. class="small-view-chip"
  187. [class.active]="smallViewFilter === 'nearDeadline'"
  188. (click)="setSmallViewFilter('nearDeadline')">
  189. 临近截止
  190. </button>
  191. <button
  192. type="button"
  193. class="small-view-chip"
  194. [class.active]="smallViewFilter === 'overdue'"
  195. (click)="setSmallViewFilter('overdue')">
  196. 对图期逾期
  197. </button>
  198. <button
  199. type="button"
  200. class="small-view-chip"
  201. [class.active]="smallViewFilter === 'stagnant'"
  202. (click)="setSmallViewFilter('stagnant')">
  203. 停滞期项目
  204. </button>
  205. </div>
  206. <!-- 加载状态 -->
  207. <div class="loading-state" *ngIf="loadingUrgentEvents">
  208. <svg class="spinner" viewBox="0 0 50 50">
  209. <circle cx="25" cy="25" r="20" fill="none" stroke-width="4"></circle>
  210. </svg>
  211. <p>计算紧急事件中...</p>
  212. </div>
  213. <!-- 空状态 -->
  214. <div class="empty-state" *ngIf="!loadingUrgentEvents && urgentEvents.length === 0">
  215. <svg viewBox="0 0 24 24" width="64" height="64" fill="#d1d5db">
  216. <path d="M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"/>
  217. </svg>
  218. <p>暂无紧急事件</p>
  219. </div>
  220. <div class="empty-state filtered" *ngIf="!loadingUrgentEvents && urgentEvents.length > 0 && filteredUrgentEventsList.length === 0">
  221. <svg viewBox="0 0 24 24" width="48" height="48" fill="#d1d5db">
  222. <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"/>
  223. </svg>
  224. <p>该筛选条件下暂无事件</p>
  225. </div>
  226. <!-- 紧急事件列表 -->
  227. <div class="todo-list-compact urgent-list" *ngIf="!loadingUrgentEvents && filteredUrgentEventsList.length > 0">
  228. <div class="event-card" *ngFor="let event of filteredUrgentEventsList; trackBy: trackUrgentEventById"
  229. [attr.data-category]="getEventCategory(event)"
  230. [class.small-view-card]="urgentEventCategoryFilter === 'review' && isSmallImageEvent(event)">
  231. <!-- 左侧分类彩条 -->
  232. <div class="card-line" [attr.data-category]="getEventCategory(event)"></div>
  233. <div class="event-main">
  234. <!-- 标题行 -->
  235. <div class="event-header">
  236. <span class="event-title" [class.text-red-700]="getEventCategory(event) === 'customer'">{{ event.title }}</span>
  237. <!-- 标签组 -->
  238. <span class="event-tag" *ngIf="getEventCategory(event) === 'customer'">客户服务</span>
  239. <span class="event-tag" *ngIf="getEventCategory(event) === 'phase'">{{ event.phaseName || '阶段' }}</span>
  240. <span class="event-tag" *ngIf="getEventCategory(event) === 'review'">小图/决策</span>
  241. <span class="event-tag" *ngIf="getEventCategory(event) === 'delivery'">交付</span>
  242. <!-- 状态标签 -->
  243. <span class="badge-status overdue" *ngIf="event.statusType === 'overdue'">逾期{{ event.overdueDays }}天</span>
  244. <span class="badge-status upcoming" *ngIf="event.statusType === 'dueSoon'">临近</span>
  245. </div>
  246. <!-- 描述/内容 -->
  247. <div class="event-desc">
  248. {{ event.description }}
  249. </div>
  250. <!-- 如果是决策卡片,显示决策提示(在“小图/决策”主视图下隐藏,由右侧按钮承载) -->
  251. <div class="decision-prompt" *ngIf="(event.eventType === 'decision_needed' || event.statusType === 'stagnant') && urgentEventCategoryFilter !== 'review'">
  252. <span class="text-xs text-slate-500 block mt-1">小图发送已久,请确认当前状态:</span>
  253. <div class="decision-group">
  254. <button class="decision-btn btn-yes" (click)="onMarkEventAsModification(event, $event)">
  255. <svg viewBox="0 0 24 24" width="12" height="12" fill="currentColor"><path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"/></svg>
  256. 客户已反馈(转对图)
  257. </button>
  258. <button class="decision-btn btn-no" (click)="onMarkEventAsStagnant(event, $event)">
  259. <svg viewBox="0 0 24 24" width="12" height="12" fill="currentColor"><path d="M6 19h4V5H6v14zm8-14v14h4V5h-4z"/></svg>
  260. 未回复(转停滞)
  261. </button>
  262. </div>
  263. </div>
  264. <!-- 项目信息 -->
  265. <div class="event-meta">
  266. <span class="project-info">
  267. <svg viewBox="0 0 24 24" width="12" height="12" fill="currentColor"><path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"/></svg>
  268. {{ event.projectName }}
  269. </span>
  270. <span class="designer-info" *ngIf="event.designerName">
  271. <svg viewBox="0 0 24 24" width="12" height="12" fill="currentColor"><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"/></svg>
  272. {{ event.designerName }}
  273. </span>
  274. <span class="deadline-info" *ngIf="event.statusType !== 'stagnant'">
  275. 截止: {{ event.deadline | date:'MM-dd HH:mm' }}
  276. </span>
  277. </div>
  278. </div>
  279. <!-- 右侧操作按钮 -->
  280. <div class="event-actions" [class.small-view-actions]="urgentEventCategoryFilter === 'review' && isSmallImageEvent(event)">
  281. <!-- 小图/决策视图下的专用按钮组 -->
  282. <ng-container *ngIf="urgentEventCategoryFilter === 'review' && isSmallImageEvent(event); else defaultEventActions">
  283. <!-- 临近截止 -->
  284. <ng-container *ngIf="getSmallViewType(event) === 'nearDeadline'">
  285. <button class="btn-action btn-success" (click)="onConfirmEventOnTime(event)">
  286. 可以按时交付(隐藏本条)
  287. </button>
  288. <button class="btn-action btn-primary" (click)="onCreateTodoFromEvent(event)">
  289. 有风险,需要重点关注
  290. </button>
  291. </ng-container>
  292. <!-- 对图期逾期 -->
  293. <ng-container *ngIf="getSmallViewType(event) === 'overdue'">
  294. <button class="btn-action btn-success" (click)="onResolveUrgentEvent(event)">
  295. 已完成/售后
  296. </button>
  297. <button class="btn-action btn-primary" (click)="onMarkEventAsModification(event, $event)">
  298. 客户反馈·转改图
  299. </button>
  300. <button class="btn-action btn-default" (click)="onMarkEventAsStagnant(event, $event)">
  301. 未回复·转停滞
  302. </button>
  303. <button class="btn-action btn-default" (click)="onCreateTodoFromEvent(event)">
  304. 创建跟进代办
  305. </button>
  306. </ng-container>
  307. <!-- 停滞期项目 -->
  308. <ng-container *ngIf="getSmallViewType(event) === 'stagnant'">
  309. <button class="btn-action btn-success" (click)="onMarkEventAsModification(event, $event)">
  310. 客户已反馈 · 转入对图期
  311. </button>
  312. <button class="btn-action btn-primary" (click)="onMarkEventAsStagnant(event, $event)">
  313. 仍未反馈 · 继续停滞
  314. </button>
  315. <button class="btn-action btn-default" (click)="onResolveUrgentEvent(event)">
  316. 不再跟进 / 关闭事件
  317. </button>
  318. </ng-container>
  319. </ng-container>
  320. <!-- 默认事件操作按钮(非小图视图,保持原逻辑) -->
  321. <ng-template #defaultEventActions>
  322. <button class="btn-action btn-primary" *ngIf="event.statusType === 'overdue' && getEventCategory(event) !== 'decision'"
  323. title="催办" (click)="onProjectClickHandler(event.projectId)">
  324. <svg viewBox="0 0 24 24" width="14" height="14" fill="currentColor"><path d="M2.01 21L23 12 2.01 3 2 10l15 2-15 2z"/></svg>
  325. 催办
  326. </button>
  327. <button class="btn-action btn-success" *ngIf="event.statusType === 'dueSoon'"
  328. (click)="onConfirmEventOnTime(event)">
  329. <svg viewBox="0 0 24 24" width="14" height="14" fill="currentColor"><path d="M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"/></svg>
  330. 按时交付
  331. </button>
  332. <button class="btn-action btn-default" (click)="onProjectClickHandler(event.projectId)">
  333. 查看项目
  334. </button>
  335. </ng-template>
  336. </div>
  337. </div>
  338. </div>
  339. </div>
  340. <!-- ========== 右栏结束 ========== -->
  341. </div>
  342. <!-- ========== 双栏容器结束 ========== -->
  343. </section>
  344. <!-- 停滞/改图原因弹窗 -->
  345. <app-stagnation-reason-modal
  346. [isOpen]="showStagnationModal"
  347. [projectName]="stagnationModalEvent?.projectName || ''"
  348. [eventType]="stagnationModalType"
  349. (confirm)="onStagnationModalConfirm($event)"
  350. (cancel)="onStagnationModalCancel()">
  351. </app-stagnation-reason-modal>