work-hour.model.ts 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. // 工时统计模块模型定义
  2. // 项目阶段类型
  3. export type ProjectPhase = '建模' | '渲染' | '后期' | '软装' | '对图' | '修改';
  4. // 项目空间类型
  5. export type SpaceType = '客餐厅' | '卧室' | '厨房' | '卫生间' | '书房' | '阳台' | '玄关' | '别墅';
  6. // 项目风格类型
  7. export type ProjectStyle = '现代简约' | '新中式' | '北欧' | '工业风' | '轻奢' | '美式' | '欧式' | '日式';
  8. // 绩效等级
  9. export type PerformanceLevel = 'S' | 'A' | 'B' | 'C';
  10. // 工时记录状态
  11. export type WorkHourStatus = '工作中' | '停滞' | '等待' | '完成';
  12. // 难度系数配置
  13. export interface DifficultyCoefficient {
  14. spaceType: SpaceType;
  15. spaceCoefficient: number; // 空间复杂度系数
  16. styleType: ProjectStyle;
  17. styleCoefficient: number; // 风格难度系数
  18. }
  19. // 工时记录
  20. export interface WorkHourRecord {
  21. id: string;
  22. projectId: string;
  23. projectName: string;
  24. designerId: string;
  25. designerName: string;
  26. phase: ProjectPhase;
  27. startTime: Date;
  28. endTime?: Date;
  29. actualHours: number; // 实际工作时间
  30. status: WorkHourStatus;
  31. pauseReason?: string; // 停滞原因(如"客户3天未反馈"、"等待渲染1天")
  32. pauseHours?: number; // 停滞时间
  33. spaceType: SpaceType;
  34. projectStyle: ProjectStyle;
  35. difficultyCoefficient: number; // 综合难度系数
  36. effectiveHours: number; // 有效工时 = 实际工作时间 × 难度系数
  37. notes?: string;
  38. }
  39. // 月度工时统计
  40. export interface MonthlyWorkHourStats {
  41. designerId: string;
  42. designerName: string;
  43. month: string; // YYYY-MM格式
  44. totalActualHours: number; // 总实际工时
  45. totalEffectiveHours: number; // 总有效工时
  46. totalPauseHours: number; // 总停滞时间
  47. completedProjects: number; // 完成项目数
  48. averageCustomerSatisfaction: number; // 平均客户满意度
  49. performanceLevel: PerformanceLevel; // 绩效等级
  50. onTimeCompletionRate: number; // 按时完成率
  51. excellentWorkRate: number; // 优秀作品率
  52. records: WorkHourRecord[]; // 详细记录
  53. }
  54. // 绩效等级标准
  55. export interface PerformanceCriteria {
  56. level: PerformanceLevel;
  57. timeCompletionRate: number; // 时间完成率阈值(如提前20%以上为S级)
  58. customerSatisfactionMin: number; // 客户满意度最低要求
  59. description: string;
  60. bonusMultiplier: number; // 奖金系数
  61. }
  62. // 报价规则配置
  63. export interface PricingRule {
  64. spaceType: SpaceType;
  65. basePrice: number; // 基础价格(元/人天)
  66. styleType: ProjectStyle;
  67. styleMultiplier: number; // 风格系数
  68. finalPrice: number; // 最终价格 = 基础价格 × 风格系数
  69. serviceIncludes: string[]; // 包含服务内容
  70. }
  71. // 报价话术
  72. export interface PricingScript {
  73. id: string;
  74. category: string; // 话术分类(如"高端报价解释"、"价格构成说明")
  75. title: string;
  76. content: string;
  77. applicableScenarios: string[]; // 适用场景
  78. tags: string[];
  79. }
  80. // 自动报价结果
  81. export interface AutoQuotationResult {
  82. id: string;
  83. projectId?: string;
  84. spaceType: SpaceType;
  85. projectStyle: ProjectStyle;
  86. estimatedWorkDays: number; // 预估工作天数
  87. basePrice: number;
  88. styleMultiplier: number;
  89. finalPrice: number;
  90. serviceIncludes: string[];
  91. createdAt: Date;
  92. createdBy: string; // 客服ID
  93. adjustments?: PriceAdjustment[]; // 价格调整记录
  94. status: 'draft' | 'sent' | 'approved' | 'rejected';
  95. }
  96. // 价格调整记录
  97. export interface PriceAdjustment {
  98. id: string;
  99. originalPrice: number;
  100. adjustedPrice: number;
  101. reason: string;
  102. adjustedBy: string; // 调整人ID
  103. adjustedAt: Date;
  104. approvedBy?: string; // 审批人ID
  105. approvedAt?: Date;
  106. }
  107. // 工时统计仪表板数据
  108. export interface WorkHourDashboardData {
  109. totalDesigners: number;
  110. totalProjects: number;
  111. averageEffectiveHours: number;
  112. performanceDistribution: {
  113. S: number;
  114. A: number;
  115. B: number;
  116. C: number;
  117. };
  118. monthlyTrends: {
  119. month: string;
  120. totalHours: number;
  121. effectiveHours: number;
  122. efficiency: number; // 效率 = 有效工时 / 总工时
  123. }[];
  124. topPerformers: {
  125. designerId: string;
  126. designerName: string;
  127. effectiveHours: number;
  128. performanceLevel: PerformanceLevel;
  129. efficiency: number;
  130. }[];
  131. }
  132. // 默认难度系数配置
  133. export const DEFAULT_DIFFICULTY_COEFFICIENTS: DifficultyCoefficient[] = [
  134. // 空间类型系数
  135. { spaceType: '客餐厅', spaceCoefficient: 1.0, styleType: '现代简约', styleCoefficient: 1.0 },
  136. { spaceType: '卧室', spaceCoefficient: 0.8, styleType: '现代简约', styleCoefficient: 1.0 },
  137. { spaceType: '厨房', spaceCoefficient: 0.9, styleType: '现代简约', styleCoefficient: 1.0 },
  138. { spaceType: '卫生间', spaceCoefficient: 0.7, styleType: '现代简约', styleCoefficient: 1.0 },
  139. { spaceType: '书房', spaceCoefficient: 0.8, styleType: '现代简约', styleCoefficient: 1.0 },
  140. { spaceType: '阳台', spaceCoefficient: 0.6, styleType: '现代简约', styleCoefficient: 1.0 },
  141. { spaceType: '玄关', spaceCoefficient: 0.5, styleType: '现代简约', styleCoefficient: 1.0 },
  142. { spaceType: '别墅', spaceCoefficient: 1.5, styleType: '现代简约', styleCoefficient: 1.0 },
  143. // 风格类型系数
  144. { spaceType: '客餐厅', spaceCoefficient: 1.0, styleType: '新中式', styleCoefficient: 1.2 },
  145. { spaceType: '客餐厅', spaceCoefficient: 1.0, styleType: '北欧', styleCoefficient: 1.0 },
  146. { spaceType: '客餐厅', spaceCoefficient: 1.0, styleType: '工业风', styleCoefficient: 1.1 },
  147. { spaceType: '客餐厅', spaceCoefficient: 1.0, styleType: '轻奢', styleCoefficient: 1.3 },
  148. { spaceType: '客餐厅', spaceCoefficient: 1.0, styleType: '美式', styleCoefficient: 1.2 },
  149. { spaceType: '客餐厅', spaceCoefficient: 1.0, styleType: '欧式', styleCoefficient: 1.4 },
  150. { spaceType: '客餐厅', spaceCoefficient: 1.0, styleType: '日式', styleCoefficient: 1.1 }
  151. ];
  152. // 默认绩效等级标准
  153. export const DEFAULT_PERFORMANCE_CRITERIA: PerformanceCriteria[] = [
  154. {
  155. level: 'S',
  156. timeCompletionRate: 120, // 提前20%以上完成
  157. customerSatisfactionMin: 5.0,
  158. description: '提前20%以上完成,客户满意度5分',
  159. bonusMultiplier: 1.5
  160. },
  161. {
  162. level: 'A',
  163. timeCompletionRate: 100, // 标准时间内完成
  164. customerSatisfactionMin: 4.0,
  165. description: '标准时间内完成,客户满意度4-5分',
  166. bonusMultiplier: 1.2
  167. },
  168. {
  169. level: 'B',
  170. timeCompletionRate: 80, // 超时但客户满意度达标
  171. customerSatisfactionMin: 4.0,
  172. description: '超时但客户满意度4分以上',
  173. bonusMultiplier: 1.0
  174. },
  175. {
  176. level: 'C',
  177. timeCompletionRate: 0, // 多次修改且耗时过长
  178. customerSatisfactionMin: 0,
  179. description: '多次修改且耗时过长,客户满意度<4分',
  180. bonusMultiplier: 0.8
  181. }
  182. ];
  183. // 默认报价规则
  184. export const DEFAULT_PRICING_RULES: PricingRule[] = [
  185. // 客餐厅
  186. { spaceType: '客餐厅', basePrice: 600, styleType: '现代简约', styleMultiplier: 1.0, finalPrice: 600, serviceIncludes: ['建模', '渲染', '1次小图修改'] },
  187. { spaceType: '客餐厅', basePrice: 600, styleType: '新中式', styleMultiplier: 1.2, finalPrice: 720, serviceIncludes: ['建模', '渲染', '1次小图修改'] },
  188. { spaceType: '客餐厅', basePrice: 600, styleType: '轻奢', styleMultiplier: 1.5, finalPrice: 900, serviceIncludes: ['建模', '渲染', '1次小图修改', '4K高清交付'] },
  189. // 卧室
  190. { spaceType: '卧室', basePrice: 400, styleType: '现代简约', styleMultiplier: 1.0, finalPrice: 400, serviceIncludes: ['建模', '渲染', '1次小图修改'] },
  191. { spaceType: '卧室', basePrice: 400, styleType: '新中式', styleMultiplier: 1.2, finalPrice: 480, serviceIncludes: ['建模', '渲染', '1次小图修改'] },
  192. { spaceType: '卧室', basePrice: 400, styleType: '轻奢', styleMultiplier: 1.5, finalPrice: 600, serviceIncludes: ['建模', '渲染', '1次小图修改', '4K高清交付'] },
  193. // 厨房
  194. { spaceType: '厨房', basePrice: 500, styleType: '现代简约', styleMultiplier: 1.0, finalPrice: 500, serviceIncludes: ['建模', '渲染', '1次小图修改'] },
  195. { spaceType: '厨房', basePrice: 500, styleType: '新中式', styleMultiplier: 1.2, finalPrice: 600, serviceIncludes: ['建模', '渲染', '1次小图修改'] },
  196. // 别墅
  197. { spaceType: '别墅', basePrice: 1200, styleType: '现代简约', styleMultiplier: 1.0, finalPrice: 1200, serviceIncludes: ['建模', '渲染', '2次修改', '全景6K交付'] },
  198. { spaceType: '别墅', basePrice: 1200, styleType: '新中式', styleMultiplier: 1.5, finalPrice: 1800, serviceIncludes: ['建模', '渲染', '2次修改', '全景6K交付', '专属设计师'] }
  199. ];