s8ExceptionApi.ts 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. import service from '/@/utils/request';
  2. function unwrap<T>(res: { data: T }): T {
  3. return res.data;
  4. }
  5. function silentHeaders(silent?: boolean) {
  6. return silent ? { 'X-Silent-Error': '1' } : undefined;
  7. }
  8. export interface S8Paged<T> {
  9. total: number;
  10. page: number;
  11. pageSize: number;
  12. list: T[];
  13. }
  14. export interface S8ExceptionRow {
  15. id: number;
  16. exceptionCode: string;
  17. title: string;
  18. status: string;
  19. statusLabel?: string | null;
  20. severity: string;
  21. severityLabel?: string | null;
  22. priorityScore: number;
  23. priorityLevel: string;
  24. sceneCode: string;
  25. sceneName?: string | null;
  26. moduleCode?: string | null;
  27. moduleName?: string | null;
  28. responsibleDeptId?: number | null;
  29. responsibleDeptName?: string | null;
  30. occurrenceDeptId?: number | null;
  31. occurrenceDeptName?: string | null;
  32. assigneeId?: number | null;
  33. slaDeadline?: string | null;
  34. timeoutFlag: boolean;
  35. createdAt: string;
  36. closedAt?: string | null;
  37. // S8-DEMO-CORE-FIELD-COMPLETE-1:损失时间(小时,1 位小数)与"是否超时关闭"冻结判定。
  38. lossHours?: number | null;
  39. isOverdueClosed?: boolean | null;
  40. activeFlowInstanceId?: number | null;
  41. activeFlowBizType?: string | null;
  42. verifierId?: number | null;
  43. verifierName?: string | null;
  44. verificationAssignedAt?: string | null;
  45. verifiedAt?: string | null;
  46. verificationResult?: string | null;
  47. verificationRemark?: string | null;
  48. exceptionTypeCode?: string | null;
  49. recoveredAt?: string | null;
  50. sourceRuleCode?: string | null;
  51. sourceObjectType?: string | null;
  52. sourceObjectId?: string | null;
  53. dedupKey?: string | null;
  54. lastDetectedAt?: string | null;
  55. ruleType?: string | null;
  56. // ORDER-FLOW-S8-INTEGRATED-DOMAIN-RESET-1 t3j:异常列表/详情携带订单链路字段。
  57. relatedObjectCode?: string | null;
  58. orderFlowCode?: string | null;
  59. orderFlowName?: string | null;
  60. stageCode?: string | null;
  61. ruleMechanism?: string | null;
  62. // S8-DEMO-IMPACT-SORT-NOTICE-1:30 天影响统计(运行期计算,不落库)。
  63. repeatCount30d?: number | null;
  64. cumulativeLossHours30d?: number | null;
  65. impactScore?: number | null;
  66. suggestedAttentionLevel?: string | null;
  67. suggestedAttentionLabel?: string | null;
  68. impactReason?: string | null;
  69. }
  70. export interface S8DecisionRow {
  71. id: number;
  72. decisionType: string;
  73. decisionMakerName: string;
  74. decisionBasis?: string | null;
  75. decisionResult?: string | null;
  76. decisionRemark?: string | null;
  77. decisionTime: string;
  78. }
  79. export interface S8EvidenceRow {
  80. id: number;
  81. evidenceType: string;
  82. fileName: string;
  83. fileUrl: string;
  84. sourceSystem?: string | null;
  85. uploadedBy?: number | null;
  86. uploadedAt: string;
  87. }
  88. export const s8ExceptionApi = {
  89. list: (params: Record<string, unknown>) =>
  90. service.get<S8Paged<S8ExceptionRow>>('/api/aidop/s8/exceptions', { params }).then(unwrap),
  91. filterOptions: (params?: { tenantId?: number; factoryId?: number }) =>
  92. service.get('/api/aidop/s8/exceptions/filter-options', { params }).then(unwrap),
  93. detail: (id: number, params?: { tenantId?: number; factoryId?: number }, options?: { silentError?: boolean }) =>
  94. service.get(`/api/aidop/s8/exceptions/${id}`, { params, headers: silentHeaders(options?.silentError) }).then(unwrap),
  95. timeline: (id: number, options?: { silentError?: boolean }) =>
  96. service.get(`/api/aidop/s8/exceptions/${id}/timeline`, { headers: silentHeaders(options?.silentError) }).then(unwrap),
  97. decisions: (id: number, options?: { silentError?: boolean }) =>
  98. service.get(`/api/aidop/s8/exceptions/${id}/decisions`, { headers: silentHeaders(options?.silentError) }).then(unwrap),
  99. evidences: (id: number, options?: { silentError?: boolean }) =>
  100. service.get(`/api/aidop/s8/exceptions/${id}/evidences`, { headers: silentHeaders(options?.silentError) }).then(unwrap),
  101. employees: (params?: { factoryRefId?: number }) =>
  102. service.get('/api/aidop/s8/master-data/employees', { params }).then(unwrap),
  103. claim: (id: number, body: { assigneeId: number; remark?: string }) =>
  104. service.post(`/api/aidop/s8/exceptions/${id}/claim`, body).then(unwrap),
  105. transfer: (id: number, body: { assigneeId: number; remark?: string }) =>
  106. service.post(`/api/aidop/s8/exceptions/${id}/transfer`, body).then(unwrap),
  107. upgrade: (id: number, body?: { remark?: string }) =>
  108. service.post(`/api/aidop/s8/exceptions/${id}/upgrade`, body ?? {}).then(unwrap),
  109. reject: (id: number, body?: { remark?: string }) =>
  110. service.post(`/api/aidop/s8/exceptions/${id}/reject`, body ?? {}).then(unwrap),
  111. startProgress: (id: number, body?: { remark?: string }) =>
  112. service.post(`/api/aidop/s8/exceptions/${id}/start-progress`, body ?? {}).then(unwrap),
  113. comment: (id: number, body?: { remark?: string }) =>
  114. service.post(`/api/aidop/s8/exceptions/${id}/comment`, body ?? {}).then(unwrap),
  115. submitVerification: (id: number, body: { verifierId: number; remark?: string }) =>
  116. service.post(`/api/aidop/s8/exceptions/${id}/submit-verification`, body).then(unwrap),
  117. approveVerification: (id: number, body: { remark?: string }) =>
  118. service.post(`/api/aidop/s8/exceptions/${id}/approve-verification`, body).then(unwrap),
  119. rejectVerification: (id: number, body: { remark: string }) =>
  120. service.post(`/api/aidop/s8/exceptions/${id}/reject-verification`, body).then(unwrap),
  121. };