team-assignment-modal.component.ts 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. import { Component, EventEmitter, Input, Output } from '@angular/core';
  2. import { CommonModule } from '@angular/common';
  3. export interface Designer {
  4. id: string;
  5. name: string;
  6. role: string;
  7. avatar: string;
  8. skills: string[];
  9. workload: {
  10. level: 'low' | 'medium' | 'high';
  11. percentage: number;
  12. text: string;
  13. };
  14. recentTasks: {
  15. id: string;
  16. name: string;
  17. projectName: string;
  18. stage: 'modeling' | 'rendering' | 'soft-decoration' | 'post-production';
  19. deadline: string;
  20. }[];
  21. }
  22. @Component({
  23. selector: 'app-team-assignment-modal',
  24. standalone: true,
  25. imports: [CommonModule],
  26. templateUrl: './team-assignment-modal.component.html',
  27. styleUrls: ['./team-assignment-modal.component.scss']
  28. })
  29. export class TeamAssignmentModalComponent {
  30. @Input() isVisible = false;
  31. @Output() closeModal = new EventEmitter<void>();
  32. @Output() confirmAssignment = new EventEmitter<Designer>();
  33. selectedDesigner: Designer | null = null;
  34. // 模拟设计师数据
  35. designers: Designer[] = [
  36. {
  37. id: '1',
  38. name: '张设计师',
  39. role: '高级室内设计师',
  40. avatar: '/assets/images/default-avatar.svg',
  41. skills: ['现代简约', '北欧风格', '工业风'],
  42. workload: {
  43. level: 'low',
  44. percentage: 30,
  45. text: '轻度'
  46. },
  47. recentTasks: [
  48. {
  49. id: '1',
  50. name: '海景别墅设计',
  51. projectName: '海景别墅设计',
  52. stage: 'modeling',
  53. deadline: '2024-01-15'
  54. },
  55. {
  56. id: '2',
  57. name: '现代公寓改造',
  58. projectName: '现代公寓改造',
  59. stage: 'rendering',
  60. deadline: '2024-01-20'
  61. }
  62. ]
  63. },
  64. {
  65. id: '2',
  66. name: '李设计师',
  67. role: '资深设计总监',
  68. avatar: '/assets/images/default-avatar.svg',
  69. skills: ['欧式古典', '美式乡村', '中式传统'],
  70. workload: {
  71. level: 'medium',
  72. percentage: 65,
  73. text: '中度'
  74. },
  75. recentTasks: [
  76. {
  77. id: '3',
  78. name: '豪华会所设计',
  79. projectName: '豪华会所设计',
  80. stage: 'soft-decoration',
  81. deadline: '2024-01-18'
  82. },
  83. {
  84. id: '4',
  85. name: '商业空间规划',
  86. projectName: '商业空间规划',
  87. stage: 'post-production',
  88. deadline: '2024-01-25'
  89. },
  90. {
  91. id: '5',
  92. name: '私人定制住宅',
  93. projectName: '私人定制住宅',
  94. stage: 'modeling',
  95. deadline: '2024-02-01'
  96. }
  97. ]
  98. },
  99. {
  100. id: '3',
  101. name: '王设计师',
  102. role: '创意设计师',
  103. avatar: '/assets/images/default-avatar.svg',
  104. skills: ['极简主义', '日式禅风', '斯堪的纳维亚'],
  105. workload: {
  106. level: 'high',
  107. percentage: 85,
  108. text: '重度'
  109. },
  110. recentTasks: [
  111. {
  112. id: '6',
  113. name: '艺术画廊设计',
  114. projectName: '艺术画廊设计',
  115. stage: 'rendering',
  116. deadline: '2024-01-12'
  117. },
  118. {
  119. id: '7',
  120. name: '精品酒店套房',
  121. projectName: '精品酒店套房',
  122. stage: 'soft-decoration',
  123. deadline: '2024-01-16'
  124. },
  125. {
  126. id: '8',
  127. name: '创意办公空间',
  128. projectName: '创意办公空间',
  129. stage: 'post-production',
  130. deadline: '2024-01-22'
  131. },
  132. {
  133. id: '9',
  134. name: '高端住宅项目',
  135. projectName: '高端住宅项目',
  136. stage: 'modeling',
  137. deadline: '2024-01-28'
  138. }
  139. ]
  140. },
  141. {
  142. id: '4',
  143. name: '陈设计师',
  144. role: '室内设计师',
  145. avatar: '/assets/images/default-avatar.svg',
  146. skills: ['新中式', '轻奢风格', '混搭风格'],
  147. workload: {
  148. level: 'low',
  149. percentage: 20,
  150. text: '轻度'
  151. },
  152. recentTasks: [
  153. {
  154. id: '10',
  155. name: '温馨家庭住宅',
  156. projectName: '温馨家庭住宅',
  157. stage: 'modeling',
  158. deadline: '2024-01-30'
  159. }
  160. ]
  161. }
  162. ];
  163. selectDesigner(designer: Designer): void {
  164. this.selectedDesigner = designer;
  165. }
  166. closeModalAction(): void {
  167. this.selectedDesigner = null;
  168. this.closeModal.emit();
  169. }
  170. confirmAssignmentAction(): void {
  171. if (this.selectedDesigner) {
  172. this.confirmAssignment.emit(this.selectedDesigner);
  173. this.closeModalAction();
  174. }
  175. }
  176. getStageText(stage: string): string {
  177. const stageMap: { [key: string]: string } = {
  178. 'modeling': '建模',
  179. 'rendering': '渲染',
  180. 'soft-decoration': '软装',
  181. 'post-production': '后期'
  182. };
  183. return stageMap[stage] || stage;
  184. }
  185. // 图片加载错误处理
  186. onImageError(event: any, designer: Designer): void {
  187. event.target.src = '/assets/images/default-avatar.svg';
  188. }
  189. getWorkloadClass(workload: { level: 'low' | 'medium' | 'high'; percentage: number; text: string }): string {
  190. return `workload-${workload.level}`;
  191. }
  192. getWorkloadText(workload: { level: 'low' | 'medium' | 'high'; percentage: number; text: string }): string {
  193. return workload.text;
  194. }
  195. getTaskStageClass(stage: 'modeling' | 'rendering' | 'soft-decoration' | 'post-production'): string {
  196. const stageClassMap: { [key: string]: string } = {
  197. 'modeling': 'stage-modeling',
  198. 'rendering': 'stage-rendering',
  199. 'soft-decoration': 'stage-soft-decoration',
  200. 'post-production': 'stage-post-production'
  201. };
  202. return stageClassMap[stage] || '';
  203. }
  204. formatDeadline(deadline: string): string {
  205. const date = new Date(deadline);
  206. const now = new Date();
  207. const diffTime = date.getTime() - now.getTime();
  208. const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
  209. if (diffDays < 0) {
  210. return '已逾期';
  211. } else if (diffDays === 0) {
  212. return '今天';
  213. } else if (diffDays === 1) {
  214. return '明天';
  215. } else {
  216. return `${diffDays}天后`;
  217. }
  218. }
  219. }