exceptionWorkorder.ts
5.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
import { request } from '../utils/request'
// 异常工单相关类型定义
export interface ExceptionWorkorderInfo {
workorderId: number
workorderNo: string
orderNo: string
dealerCode: string
dealerName: string
exceptionType: number
exceptionTypeName: string
severityLevel: number
severityLevelName: string
workorderStatus: number
workorderStatusName: string
createTime: string
expectCompleteTime?: string
handlerUser?: string
exceptionDesc?: string
handleSuggest?: string
dataSource?: string
createBy?: string
updateBy?: string
updateTime?: string
workorderLogs?: ExceptionWorkorderLogInfo[]
}
export interface ExceptionWorkorderLogInfo {
logId: number
workorderId: number
workorderNo: string
handleUser: string
handleTime: string
beforeStatus: number
beforeStatusName: string
afterStatus: number
afterStatusName: string
handleOpinion?: string
attachUrl?: string
createBy?: string
createTime: string
}
export interface ExceptionWorkorderQueryReq {
workorderNo?: string
orderNo?: string
dealerCode?: string
dealerName?: string
workorderStatus?: number
exceptionType?: number
severityLevel?: number
handlerUser?: string
startTime?: string
endTime?: string
pageNum?: number
pageSize?: number
}
export interface ExceptionWorkorderAddReq {
workorderNo: string
orderNo?: string
dealerCode?: string
dealerName?: string
exceptionType: number
severityLevel: number
workorderStatus?: number
expectCompleteTime?: string
handlerUser?: string
exceptionDesc?: string
handleSuggest?: string
dataSource?: string
}
export interface ExceptionWorkorderUpdateReq {
workorderId: number
workorderNo?: string
orderNo?: string
dealerCode?: string
dealerName?: string
exceptionType?: number
severityLevel?: number
workorderStatus?: number
expectCompleteTime?: string
handlerUser?: string
exceptionDesc?: string
handleSuggest?: string
dataSource?: string
}
export interface ExceptionWorkorderStatusUpdateReq {
workorderId: number
workorderStatus: number
handlerUser?: string
handleOpinion?: string
attachUrl?: string
}
// 异常工单API接口
export const exceptionWorkorderApi = {
// 分页查询异常工单列表
getExceptionWorkorderList: (params: ExceptionWorkorderQueryReq) => {
return request.get('/api/exception-workorder/list', params)
},
// 获取异常工单详情
getExceptionWorkorderDetail: (workorderId: number) => {
return request.get(`/api/exception-workorder/${workorderId}`)
},
// 新增异常工单
addExceptionWorkorder: (data: ExceptionWorkorderAddReq) => {
return request.post('/api/exception-workorder', data)
},
// 更新异常工单
updateExceptionWorkorder: (data: ExceptionWorkorderUpdateReq) => {
return request.put('/api/exception-workorder', data)
},
// 更新工单状态
updateWorkorderStatus: (data: ExceptionWorkorderStatusUpdateReq) => {
return request.post('/api/exception-workorder/status', data)
},
// 删除异常工单
deleteExceptionWorkorder: (workorderId: number) => {
return request.delete(`/api/exception-workorder/${workorderId}`)
},
// 批量删除异常工单
batchDeleteExceptionWorkorders: (workorderIds: number[]) => {
return request.delete('/api/exception-workorder/batch', workorderIds)
},
// 批量更新工单状态
batchUpdateWorkorderStatus: (workorderIds: number[], workorderStatus: number, handlerUser: string) => {
return request.post('/api/exception-workorder/batch-status', null, {
params: {
workorderIds: workorderIds.join(','),
workorderStatus,
handlerUser
}
})
},
// 获取异常工单统计信息
getExceptionWorkorderStats: () => {
return request.get('/api/exception-workorder/stats')
}
}
// 异常类型枚举
export const EXCEPTION_TYPE = {
1: '逻辑验证异常',
2: '源头验证异常',
3: '交叉验证异常'
}
// 严重程度枚举
export const SEVERITY_LEVEL = {
1: '高',
2: '中',
3: '低'
}
// 工单状态枚举
export const WORKORDER_STATUS = {
1: '待处理',
2: '处理中',
3: '已解决',
4: '已关闭'
}
// 获取异常类型名称
export const getExceptionTypeName = (type: number): string => {
return EXCEPTION_TYPE[type as keyof typeof EXCEPTION_TYPE] || '未知类型'
}
// 获取严重程度名称
export const getSeverityLevelName = (level: number): string => {
return SEVERITY_LEVEL[level as keyof typeof SEVERITY_LEVEL] || '未知'
}
// 获取工单状态名称
export const getWorkorderStatusName = (status: number): string => {
return WORKORDER_STATUS[status as keyof typeof WORKORDER_STATUS] || '未知状态'
}
// 获取严重程度颜色
export const getSeverityLevelColor = (level: number): string => {
const colors = {
1: '#f56c6c', // 高 - 红色
2: '#e6a23c', // 中 - 橙色
3: '#409eff' // 低 - 蓝色
}
return colors[level as keyof typeof colors] || '#909399'
}
// 获取工单状态颜色
export const getWorkorderStatusColor = (status: number): string => {
const colors = {
1: '#909399', // 待处理 - 灰色
2: '#e6a23c', // 处理中 - 橙色
3: '#67c23a', // 已解决 - 绿色
4: '#f56c6c' // 已关闭 - 红色
}
return colors[status as keyof typeof colors] || '#909399'
}