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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
| import type { VbenFormSchema } from '#/adapter/form';
| import type { VxeTableGridOptions } from '#/adapter/vxe-table';
| import type { AftersalesProblemApi } from '#/api/aftersales/problem';
|
| /** 表单类型 */
| export type ProblemFormType = 'create' | 'update' | 'detail';
|
| /** 问题类型选项(对齐 AfterSaleIssueTypeEnum) */
| export const ISSUE_TYPE_OPTIONS = [
| { label: '一般问题', value: 1 },
| { label: '维修问题', value: 2 },
| { label: '退货问题', value: 3 },
| ];
|
| /** 严重程度选项 */
| export const SEVERITY_LEVEL_OPTIONS = [
| { label: '轻微', value: 0 },
| { label: '一般', value: 1 },
| { label: '严重', value: 2 },
| { label: '致命', value: 3 },
| ];
|
| /** 根因分类选项(对齐 AfterSaleRootCauseCategoryEnum) */
| export const ROOT_CAUSE_CATEGORY_OPTIONS = [
| { label: '设计缺陷', value: 1 },
| { label: '物料缺陷', value: 2 },
| { label: '工艺缺陷', value: 3 },
| { label: '装配缺陷', value: 4 },
| { label: '运输损坏', value: 5 },
| { label: '包装缺陷', value: 6 },
| { label: '使用不当', value: 7 },
| { label: '软件缺陷', value: 8 },
| { label: '其他', value: 9 },
| ];
|
| /** 问题状态选项(对齐 AfterSaleProblemStatusEnum) */
| export const PROBLEM_STATUS_OPTIONS = [
| { label: '草稿', value: 0 },
| { label: '已发布', value: 1 },
| { label: '已停用', value: 2 },
| ];
|
| /** 问题库表单 */
| export function useProblemFormSchema(
| formType: ProblemFormType,
| ): VbenFormSchema[] {
| const readonly = formType === 'detail';
| return [
| {
| fieldName: 'id',
| component: 'Input',
| dependencies: { triggerFields: [''], show: () => false },
| },
| {
| fieldName: 'title',
| label: '问题标题',
| component: 'Input',
| componentProps: { placeholder: '请输入问题标题' },
| rules: 'required',
| },
| {
| fieldName: 'issueType',
| label: '问题类型',
| component: 'Select',
| componentProps: {
| options: ISSUE_TYPE_OPTIONS,
| placeholder: '请选择问题类型',
| disabled: readonly,
| },
| },
| {
| fieldName: 'issueCategory',
| label: '问题分类',
| component: 'Input',
| componentProps: {
| placeholder: '如功能故障、外观缺陷',
| disabled: readonly,
| },
| },
| {
| fieldName: 'severityLevel',
| label: '严重程度',
| component: 'Select',
| componentProps: {
| options: SEVERITY_LEVEL_OPTIONS,
| placeholder: '请选择',
| disabled: readonly,
| },
| },
| {
| fieldName: 'rootCauseCategory',
| label: '根因分类',
| component: 'Select',
| componentProps: {
| options: ROOT_CAUSE_CATEGORY_OPTIONS,
| placeholder: '请选择根因分类',
| disabled: readonly,
| },
| },
| {
| fieldName: 'itemCode',
| label: '物料编码',
| component: 'Input',
| componentProps: { placeholder: '来源于工单明细', disabled: readonly },
| },
| {
| fieldName: 'itemName',
| label: '物料名称',
| component: 'Input',
| componentProps: { placeholder: '来源于工单明细', disabled: readonly },
| },
| {
| fieldName: 'batchCode',
| label: '批次号',
| component: 'Input',
| componentProps: { placeholder: '来源于工单明细', disabled: readonly },
| },
| {
| fieldName: 'description',
| label: '问题描述',
| component: 'Textarea',
| formItemClass: 'col-span-2',
| componentProps: {
| rows: 3,
| placeholder: '问题现象与背景',
| disabled: readonly,
| },
| },
| {
| fieldName: 'rootCause',
| label: '根因分析',
| component: 'Textarea',
| formItemClass: 'col-span-2',
| componentProps: {
| rows: 3,
| placeholder: '缺陷产生的根本原因',
| disabled: readonly,
| },
| },
| {
| fieldName: 'solution',
| label: '解决方案',
| component: 'Textarea',
| formItemClass: 'col-span-2',
| componentProps: {
| rows: 3,
| placeholder: '处理措施/SOP,供后续工单参考',
| disabled: readonly,
| },
| },
| {
| fieldName: 'remark',
| label: '备注',
| component: 'Textarea',
| formItemClass: 'col-span-2',
| componentProps: { rows: 2, placeholder: '备注', disabled: readonly },
| },
| {
| fieldName: 'blobIds',
| label: '附件',
| component: 'FileUpload',
| componentProps: {
| valueKey: 'id',
| maxNumber: 10,
| multiple: true,
| disabled: readonly,
| },
| formItemClass: 'col-span-2',
| },
| ];
| }
|
| /** 问题库搜索表单 */
| export function useProblemSearchFormSchema(): VbenFormSchema[] {
| return [
| {
| fieldName: 'keyword',
| label: '关键字',
| component: 'Input',
| componentProps: {
| allowClear: true,
| placeholder: '单号/标题/描述/方案',
| },
| },
| {
| fieldName: 'itemCode',
| label: '物料编码',
| component: 'Input',
| componentProps: {
| allowClear: true,
| placeholder: '请输入物料编码',
| },
| },
| {
| fieldName: 'issueCategory',
| label: '问题分类',
| component: 'Input',
| componentProps: {
| allowClear: true,
| placeholder: '请输入问题分类',
| },
| },
| {
| fieldName: 'issueType',
| label: '问题类型',
| component: 'Select',
| componentProps: {
| allowClear: true,
| options: ISSUE_TYPE_OPTIONS,
| placeholder: '请选择',
| },
| },
| {
| fieldName: 'rootCauseCategory',
| label: '根因分类',
| component: 'Select',
| componentProps: {
| allowClear: true,
| options: ROOT_CAUSE_CATEGORY_OPTIONS,
| placeholder: '请选择',
| },
| },
| {
| fieldName: 'status',
| label: '状态',
| component: 'Select',
| componentProps: {
| allowClear: true,
| options: PROBLEM_STATUS_OPTIONS,
| placeholder: '请选择状态',
| },
| },
| ];
| }
|
| /** 问题库列表字段 */
| export function useProblemGridColumns(): VxeTableGridOptions<AftersalesProblemApi.Problem>['columns'] {
| return [
| { field: 'no', title: '问题单号', minWidth: 170, slots: { default: 'no' } },
| { field: 'title', title: '问题标题', minWidth: 180 },
| { field: 'sourceTicketNo', title: '来源工单', minWidth: 150 },
| { field: 'itemName', title: '物料名称', minWidth: 120 },
| { field: 'itemCode', title: '物料编码', minWidth: 120 },
| { field: 'issueType', title: '问题类型', width: 100, slots: { default: 'issueType' } },
| { field: 'severityLevel', title: '严重程度', width: 100, slots: { default: 'severityLevel' } },
| { field: 'rootCauseCategory', title: '根因分类', width: 100, slots: { default: 'rootCauseCategory' } },
| { field: 'status', title: '状态', width: 90, slots: { default: 'status' } },
| { field: 'ownerUserName', title: '沉淀人', minWidth: 100 },
| { field: 'updateTime', title: '更新时间', width: 170, formatter: 'formatDate' },
| { title: '操作', width: 220, fixed: 'right', slots: { default: 'actions' } },
| ];
| }
|
|