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
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
| import { ActionItem, BasicColumn, FormSchema } from '/@/components/Table';
| import { useMessage } from '/@/hooks/web/useMessage';
| import { useI18n } from '/@/hooks/web/useI18n';
| import { FunctionType } from '/@/api/tigerapi/model/systemModel';
| import { DeleteEntity, getEntity } from '/@/api/tigerapi/system';
| import { Tag } from 'ant-design-vue';
| import { Ref, h } from 'vue';
| import { isNullOrEmpty } from '/@/utils/is';
| import { buildUUID } from '/@/utils/uuid';
| import { useUserStore } from '/@/store/modules/user';
| import { formatToDateTime } from '/@/utils/dateUtil';
|
| const { t } = useI18n();
| const { notification } = useMessage();
| /* 自定义按钮方法 */
| export function RsGrpRelease(reload: Fn, params: {}) {
| console.log('点击了下发按钮');
| notification.success({
| message: '点击了下发按钮',
| description: `${params.entityName}`,
| duration: 3,
| });
| reload();
| }
|
| /**
| * @description: 自定义编辑方法,跳转到高级页面
| * @param {Fn} args
| * @param {*} params
| * @return {*}
| */
| export function rsnGrpEdit(args: Fn[], params: {}) {
| const param = { CODE: params['record']['RSNG_CODE'], ID: params['record']['ID'], Name: 'BAS_REASON', Title: `编辑不良原因组:${params['record']['RSNG_CODE']}`, pCode: 'RSNG_CODE', IsID: false };
| args[5](`/BAS_REASON/High/${encodeURI(JSON.stringify(param))}`);
| }
|
| export const rsGrpactionColumn: BasicColumn = {
| width: 180,
| title: '操作',
| dataIndex: 'action',
| slots: { customRender: 'action' },
| fixed: undefined,
| };
|
| export const rsGrpActionItem: ActionItem[] = [
| {
| icon: 'release|svg',
| tooltip: '下发',
| onClick: () => {},
| },
| ];
|
| /**
| * @description: 自定义删除方法
| * @param {Fn} args
| * @param {*} params
| * @return {*}
| */
| export function rsnGrpDel(args: Fn[], params: {}) {
| if (!isNullOrEmpty(params['data'])) {
| var _data = params['data'].value.filter((item) => item['ID'] != params['record']['ID']);
| params['data'].value = _data;
| args[6]({
| dataSource: [],
| });
| args[6]({
| dataSource: params['data'],
| });
| args[1]();
| }else{
| DeleteEntity(params['record'], params['entityName']).then((action) => {
| if (action.IsSuccessed) {
| args[1]();
| }
| });
| }
| }
|
| /**
| * @description: 自定义明细表中编辑返回方法
| * @param {string} type
| * @param {*} d
| * @param {*} u
| * @return {*}
| */
| export function rsnEditeOperation( data: Ref<any[]>, d, u) {
| if (u.isUpdate) {
| //更新
| var _data = data.value.map((item) => {
| if (item['ID'] == d.ID)
| return {
| ...item,
| RSN_CODE: d.RSN_CODE,
| RSN_NAME: d.RSN_NAME,
| NEED_REPLACE: d.NEED_REPLACE,
| REMARK: d.REMARK,
| };
| return item;
| });
| data.value = _data;
| } else {
| //新增
| d.ID = buildUUID();
| d.CREATE_USER = useUserStore().getUserInfo.userId as string;
| d.UPDATE_TIME = formatToDateTime(new Date());
| d.UPDATE_USER = useUserStore().getUserInfo.userId as string;
| var _data2: any[] = [];
| if (!isNullOrEmpty(data.value)) {
| _data2 = data.value.map((item) => {
| return item;
| });
| }
| _data2.push(d);
| data.value = _data2;
| }
| }
|
| export function rsGrpGetSelectSuccess(d, u) {
| return {
| RSNG_CODE: d.values['val'],
| };
| }
|
| export function rsGrpOpenSelectItem(openItemModal: Fn) {
| openItemModal(true, {
| title: '不良原因组列表',
| schemas: [
| {
| field: 'RSNG_CODE',
| component: 'Input',
| label: '不良原因组代码',
| colProps: {
| span: 12,
| },
| },
| ],
| ItemColumns: [
| {
| title: t('不良原因组代码'),
| dataIndex: 'RSNG_CODE',
| resizable: true,
| sorter: true,
| width: 200,
| },
| {
| title: t('不良原因组名称'),
| dataIndex: 'RSNG_NAME',
| resizable: true,
| sorter: true,
| width: 180,
| },
| ],
| tableName: 'BAS_REASON_GRP',
| rowKey: 'RSNG_CODE',
| searchInfo: {TABLE_NAME: 'BAS_REASON_GRP'}
| });
| }
|
| /* Select onChange 方法字典 */
| export const onChangeFns: Record<string, FunctionType> = {
| ABC: (e) => {
| notification.success({
| message: '进入了onChange函数',
| description: `${e}`,
| duration: 3,
| });
| },
| XXX: (e) => {},
| };
|
| /**
| * @description: 不良原因主基本信息表单字段
| * @return {*}
| */
| export const rsnBaseSchema: FormSchema[] = [
| {
| field: 'RSNG_CODE',
| label: '不良原因组编码',
| component: 'Input',
| required: true,
| colProps: {
| span: 8,
| },
| },
| {
| label: '不良原因组名称',
| field: 'RSNG_NAME',
| required: true,
| component: 'Input',
| colProps: {
| span: 8,
| },
| },
| {
| label: '备注',
| field: 'REMARK',
| component: 'Input',
| colProps: {
| span: 8,
| },
| },
| {
| label: 'ID',
| field: 'ID',
| component: 'Input',
| colProps: {
| span: 8,
| },
| show: false,
| },
| ];
|
| /**
| * @description: 不良原因增删改字段
| * @return {*}
| */
| export const rsnCrudSchema: FormSchema[] = [
| {
| field: 'RSN_CODE',
| label: '不良原因编码',
| component: 'Input',
| required: true,
| colProps: {
| span: 24,
| },
| },
| {
| label: '不良原因名称',
| field: 'RSN_NAME',
| component: 'Input',
| required: true,
| colProps: {
| span: 24,
| },
| },
| {
| label: '不良原因组编码',
| field: 'RSNG_CODE',
| component: 'ApiSelect',
| colProps: {
| span: 24,
| },
| componentProps: {
| api: getEntity,
| params: { entityName: 'BAS_REASON_GRP', sqlcmd: ' 1=1 ' },
| resultField: 'Data.Items',
| labelField: 'RSNG_NAME',
| valueField: 'RSNG_CODE',
| },
| dynamicDisabled: ({ values }) => {
| return true;
| },
| },
| {
| label: '是否必须更换零件',
| field: 'NEED_REPLACE',
| component: 'Select',
| required: true,
| colProps: {
| span: 24,
| },
| componentProps: {
| options: [
| {
| label: '更换',
| value: 'Y',
| key: 'Y',
| },
| {
| label: '不更换',
| value: 'N',
| key: 'N',
| },
| ],
| },
| },
| {
| label: '备注',
| field: 'REMARK',
| component: 'Input',
| colProps: {
| span: 24,
| },
| },
| {
| label: 'ID',
| field: 'ID',
| component: 'Input',
| colProps: {
| span: 24,
| },
| show: false,
| },
| ];
|
| /**
| * @description: 不良原因查询字段
| * @return {*}
| */
| export const rsnSearchSchema: FormSchema[] = [
| {
| field: 'RSN_CODE',
| label: '不良原因编码',
| component: 'Input',
| colProps: {
| span: 8,
| },
| },
| {
| label: '不良原因名称',
| field: 'RSN_NAME',
| component: 'Input',
| colProps: {
| span: 8,
| },
| },
| ];
|
| /**
| * @description: 不良原因表格列
| * @return {*}
| */
| export const rsnBaseColumn: BasicColumn[] = [
| {
| title: '不良原因编码',
| dataIndex: 'RSN_CODE',
| // ifShow: false,
| width: 180,
| },
| {
| title: '不良原因名称',
| dataIndex: 'RSN_NAME',
| },
| {
| title: '是否必须更换零件',
| dataIndex: 'NEED_REPLACE',
| customRender: ({ record }) => {
| const type = record.NEED_REPLACE;
| var text = '';
| var color = 'green';
| switch (type) {
| case 'Y':
| text = '更换';
| break;
| case 'N':
| color = 'blue';
| text = '不更换';
| break;
| }
| return h(Tag, { color: color }, () => text);
| },
| },
| {
| title: '不良原因组编码',
| dataIndex: 'RSNG_CODE',
| },
| {
| title: '备注',
| dataIndex: 'REMARK',
| },
| {
| title: '更新时间',
| dataIndex: 'UPDATE_TIME',
| },
| {
| title: '更新人',
| dataIndex: 'UPDATE_USER',
| },
| ];
|
|