@ebuilding/biz-form 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/LICENSE +0 -0
  2. package/README.md +0 -0
  3. package/advanced/index.d.ts +1 -0
  4. package/advanced/src/index.module.d.ts +8 -0
  5. package/advanced/src/main/index.d.ts +29 -0
  6. package/advanced/src/public_api.d.ts +2 -0
  7. package/basic/index.d.ts +1 -0
  8. package/basic/src/basic.d.ts +53 -0
  9. package/basic/src/basic.drawer.d.ts +30 -0
  10. package/basic/src/default/index.d.ts +27 -0
  11. package/basic/src/index.module.d.ts +9 -0
  12. package/basic/src/main/index.d.ts +32 -0
  13. package/basic/src/public_api.d.ts +3 -0
  14. package/custom/index.d.ts +1 -0
  15. package/custom/src/default/index.d.ts +30 -0
  16. package/custom/src/index.module.d.ts +9 -0
  17. package/custom/src/main/index.d.ts +27 -0
  18. package/custom/src/public_api.d.ts +3 -0
  19. package/design/index.d.ts +1 -0
  20. package/design/src/default/index.d.ts +25 -0
  21. package/design/src/index.module.d.ts +8 -0
  22. package/design/src/public_api.d.ts +2 -0
  23. package/empInfo/index.d.ts +1 -0
  24. package/empInfo/src/children/index.d.ts +28 -0
  25. package/empInfo/src/default/index.d.ts +34 -0
  26. package/empInfo/src/index.module.d.ts +9 -0
  27. package/empInfo/src/public_api.d.ts +2 -0
  28. package/empInfo/src/service.d.ts +14 -0
  29. package/fesm2022/advanced.mjs +114 -0
  30. package/fesm2022/advanced.mjs.map +1 -0
  31. package/fesm2022/basic.mjs +431 -0
  32. package/fesm2022/basic.mjs.map +1 -0
  33. package/fesm2022/custom.mjs +156 -0
  34. package/fesm2022/custom.mjs.map +1 -0
  35. package/fesm2022/design.mjs +109 -0
  36. package/fesm2022/design.mjs.map +1 -0
  37. package/fesm2022/ebuilding-biz-form.mjs +7 -0
  38. package/fesm2022/ebuilding-biz-form.mjs.map +1 -0
  39. package/fesm2022/empInfo.mjs +273 -0
  40. package/fesm2022/empInfo.mjs.map +1 -0
  41. package/fesm2022/history.mjs +119 -0
  42. package/fesm2022/history.mjs.map +1 -0
  43. package/fesm2022/page.mjs +200 -0
  44. package/fesm2022/page.mjs.map +1 -0
  45. package/fesm2022/preview.mjs +317 -0
  46. package/fesm2022/preview.mjs.map +1 -0
  47. package/fesm2022/rule.mjs +204 -0
  48. package/fesm2022/rule.mjs.map +1 -0
  49. package/fesm2022/service.mjs +813 -0
  50. package/fesm2022/service.mjs.map +1 -0
  51. package/fesm2022/srv.basic.default.mjs +48 -0
  52. package/fesm2022/srv.basic.default.mjs.map +1 -0
  53. package/fesm2022/srv.basic.drawer.mjs +70 -0
  54. package/fesm2022/srv.basic.drawer.mjs.map +1 -0
  55. package/fesm2022/srv.basic.flow.mjs +353 -0
  56. package/fesm2022/srv.basic.flow.mjs.map +1 -0
  57. package/fesm2022/srv.basic.mjs +813 -0
  58. package/fesm2022/srv.basic.mjs.map +1 -0
  59. package/fesm2022/srv.default.service.mjs +186 -0
  60. package/fesm2022/srv.default.service.mjs.map +1 -0
  61. package/fesm2022/srv.form.default.service.mjs +224 -0
  62. package/fesm2022/srv.form.default.service.mjs.map +1 -0
  63. package/fesm2022/srv.form.service.mjs +502 -0
  64. package/fesm2022/srv.form.service.mjs.map +1 -0
  65. package/fesm2022/srv.form.workflow.mjs +573 -0
  66. package/fesm2022/srv.form.workflow.mjs.map +1 -0
  67. package/fesm2022/srv.form2.service.mjs +238 -0
  68. package/fesm2022/srv.form2.service.mjs.map +1 -0
  69. package/fesm2022/srv.formGroup.service.mjs +242 -0
  70. package/fesm2022/srv.formGroup.service.mjs.map +1 -0
  71. package/history/index.d.ts +1 -0
  72. package/history/src/default/index.d.ts +34 -0
  73. package/history/src/index.module.d.ts +8 -0
  74. package/history/src/public_api.d.ts +2 -0
  75. package/index.d.ts +2 -0
  76. package/package.json +100 -0
  77. package/page/index.d.ts +1 -0
  78. package/page/src/default/index.d.ts +35 -0
  79. package/page/src/index.module.d.ts +8 -0
  80. package/page/src/public_api.d.ts +2 -0
  81. package/preview/index.d.ts +1 -0
  82. package/preview/src/default/index.d.ts +37 -0
  83. package/preview/src/index.module.d.ts +9 -0
  84. package/preview/src/main/index.d.ts +38 -0
  85. package/preview/src/public_api.d.ts +3 -0
  86. package/rule/index.d.ts +1 -0
  87. package/rule/src/default/index.d.ts +39 -0
  88. package/rule/src/index.module.d.ts +8 -0
  89. package/rule/src/public_api.d.ts +2 -0
  90. package/service/basic/index.d.ts +166 -0
  91. package/service/basic.default/index.d.ts +25 -0
  92. package/service/basic.drawer/index.d.ts +36 -0
  93. package/service/basic.flow/index.d.ts +103 -0
  94. package/service/default.service/index.d.ts +59 -0
  95. package/service/form.default.service/index.d.ts +45 -0
  96. package/service/form.service/index.d.ts +77 -0
  97. package/service/form.workflow/index.d.ts +139 -0
  98. package/service/form2.service/index.d.ts +51 -0
  99. package/service/formGroup.service/index.d.ts +52 -0
  100. package/service/index.d.ts +1 -0
@@ -0,0 +1,813 @@
1
+ import * as i0 from '@angular/core';
2
+ import { EventEmitter, Output, Input, Directive } from '@angular/core';
3
+ import { FormGroup, FormControl } from '@angular/forms';
4
+ import { ModuleAPI } from '@ebuilding/base/shared.var/shared.constant';
5
+ import { PageDialogDefaultComponent } from '@ebuilding/dialog/default';
6
+ import { Subject, zip, of } from 'rxjs';
7
+ import _ from 'lodash';
8
+ import * as i1 from '@delon/theme';
9
+ import * as i2 from '@ebuilding/base/shared.srv/deon.util';
10
+ import * as i3 from '@ebuilding/base/shared.srv/deon2.util';
11
+ import * as i4 from '@kre-form/core';
12
+ import * as i5 from '@ebuilding/base/shared.srv/global.event';
13
+ import * as i6 from 'ng-zorro-antd/message';
14
+ import * as i7 from 'ng-zorro-antd/modal';
15
+ import * as i8 from '@ebuilding/base/shared.srv/base-dialog.service';
16
+ import * as i9 from '@ebuilding/base/shared.srv/commApi.service';
17
+
18
+ class BasicService {
19
+ http;
20
+ utilService;
21
+ resetService;
22
+ deonFormBuilder;
23
+ globalSrv;
24
+ msg;
25
+ modal;
26
+ dialogService;
27
+ commAPISrv;
28
+ loading = true;
29
+ headerLoading = false;
30
+ form = new FormGroup({
31
+ appoveDesc: new FormControl('')
32
+ });
33
+ model = {};
34
+ options = {};
35
+ fields = [];
36
+ /**
37
+ * 待生效
38
+ */
39
+ izEffect = false;
40
+ effectField = null;
41
+ effectStatus = null;
42
+ /**
43
+ * 配置参数
44
+ */
45
+ argList = [];
46
+ /**
47
+ * 销毁
48
+ */
49
+ onDestroy$ = new Subject();
50
+ buttons = {
51
+ cancel: { text: '取消' },
52
+ draft: { text: '暂存' },
53
+ save: { text: '保存' },
54
+ rollback: { text: '撤销' },
55
+ };
56
+ /**
57
+ * 是否有数据提交前按钮事件
58
+ */
59
+ addPreEventRule = false;
60
+ editPreEventRule = false;
61
+ addInterface = null;
62
+ editInterface = null;
63
+ /**
64
+ * 表单设计对象
65
+ */
66
+ designData = null;
67
+ /**
68
+ * 表单Header配置
69
+ */
70
+ headerConfig = null;
71
+ isHeader = false;
72
+ otherData = null;
73
+ config = null;
74
+ btnCloseEvent = new EventEmitter();
75
+ btnSaveEvent = new EventEmitter();
76
+ constructor(http, utilService, resetService, deonFormBuilder, globalSrv, msg, modal, dialogService, commAPISrv) {
77
+ this.http = http;
78
+ this.utilService = utilService;
79
+ this.resetService = resetService;
80
+ this.deonFormBuilder = deonFormBuilder;
81
+ this.globalSrv = globalSrv;
82
+ this.msg = msg;
83
+ this.modal = modal;
84
+ this.dialogService = dialogService;
85
+ this.commAPISrv = commAPISrv;
86
+ this.globalSrv.subscribe('deon-field-repeat', (res) => {
87
+ if (res != undefined && res.field != undefined && res.data != undefined && res.type != undefined) {
88
+ if (res.type == 'delete') {
89
+ this.options._buildForm(true);
90
+ }
91
+ }
92
+ });
93
+ }
94
+ ngOnDestroy() {
95
+ this.onDestroy$.next();
96
+ this.onDestroy$.complete();
97
+ }
98
+ /**
99
+ * 组装配置
100
+ */
101
+ getPageConfig() {
102
+ new Promise((resolve) => {
103
+ zip(this.getDesign(), this.getRole(), this.getDropDown(), this.getFromModel(), this.getFromDefaultModel(), this.getFromRuleData(), this.getFromOtherData()).subscribe(([design, role, drop, d, m, r, other]) => {
104
+ let roleData = null;
105
+ let dropData = null;
106
+ let formData = null;
107
+ let formDefaultData = null;
108
+ let ruleData = null;
109
+ if (design && design?.success && design?.result) {
110
+ this.designData = design.result;
111
+ /**
112
+ * 独立API
113
+ */
114
+ if (design.result?.basic?.apiAdd) {
115
+ if (this.config?.api == undefined || this.config?.api == null) {
116
+ this.config.api = {};
117
+ }
118
+ this.config.api['addAPI'] = design.result.basic.apiAdd;
119
+ }
120
+ if (design.result?.basic?.apiUpdate) {
121
+ if (this.config?.api == undefined || this.config?.api == null) {
122
+ this.config.api = {};
123
+ }
124
+ this.config.api['editAPI'] = design.result.basic.apiUpdate;
125
+ }
126
+ if (design.result?.basic?.apiModel) {
127
+ if (this.config?.api == undefined || this.config?.api == null) {
128
+ this.config.api = {};
129
+ }
130
+ this.config.api['modelAPI'] = design.result.basic.apiModel;
131
+ }
132
+ }
133
+ if (role && role?.success && role?.result) {
134
+ roleData = role.result;
135
+ }
136
+ if (drop && drop?.success && drop?.result) {
137
+ dropData = drop.result;
138
+ }
139
+ if (d && d?.success && d?.result) {
140
+ formData = d.result;
141
+ }
142
+ if (m && m?.success && m?.result) {
143
+ formDefaultData = m.result;
144
+ }
145
+ if (r && r?.success && r?.result) {
146
+ ruleData = r.result;
147
+ }
148
+ if (other && other["success"] && other["result"]) {
149
+ this.otherData = other["result"];
150
+ }
151
+ this.initPageModel();
152
+ if (this.designData) {
153
+ if (_.get(this.designData, 'basic.json')) {
154
+ this.initPageForm(this.designData, roleData, dropData, formData, formDefaultData, ruleData);
155
+ }
156
+ }
157
+ this.pageConfigAfter();
158
+ this.loading = false;
159
+ }, () => {
160
+ this.loading = false;
161
+ }, () => {
162
+ this.loading = false;
163
+ resolve();
164
+ });
165
+ });
166
+ }
167
+ pageConfigAfter() { }
168
+ /**
169
+ * 第一步:初始Model值
170
+ */
171
+ initPageModel() {
172
+ this.model = {};
173
+ //传入的值
174
+ if (this.config?.model != undefined && this.config?.model != null) {
175
+ this.model = Object.assign(this.model, this.config.model);
176
+ }
177
+ }
178
+ /**
179
+ * 第二步:初始表单所需数据
180
+ * @param designData
181
+ * @param roleData
182
+ * @param dropData
183
+ * @param formData
184
+ * @param formDefaultData
185
+ * @param ruleData
186
+ */
187
+ initPageForm(designData, roleData, dropData, formData, formDefaultData, ruleData) {
188
+ /**
189
+ * 表单JSON
190
+ */
191
+ let fieldConfigs = JSON.parse(designData.basic.json);
192
+ this.initPageFormDesign(designData);
193
+ //默认值
194
+ if (formData) {
195
+ this.model = Object.assign(this.model, formData);
196
+ if (this.izEffect && this.effectField && this.model) {
197
+ this.effectStatus = this.model[this.effectField];
198
+ }
199
+ }
200
+ //获取的表单值
201
+ if (formDefaultData) {
202
+ this.model = Object.assign(this.model, formDefaultData);
203
+ }
204
+ this.utilService.initConfig(fieldConfigs, roleData, dropData, this.model, ruleData, this.config?.fieldParameter, this, (e, field) => {
205
+ this.getPageRuleData(field, e);
206
+ });
207
+ this.fields = fieldConfigs;
208
+ setTimeout(() => {
209
+ if (this.options != undefined && this.options != null && this.options?.resetModel) {
210
+ this.options?.resetModel();
211
+ }
212
+ }, 0);
213
+ }
214
+ /**
215
+ * initPageForm调用:表单设计相关默认值
216
+ * @param designData
217
+ */
218
+ initPageFormDesign(designData) {
219
+ /**
220
+ * 表单Header
221
+ */
222
+ if (this.designData && this.designData?.basic?.izHeader && this.designData?.basic?.headerId) {
223
+ this.headerLoading = true;
224
+ this.headerConfig = {
225
+ headerId: this.designData?.basic?.headerId,
226
+ rd: Math.random(),
227
+ };
228
+ this.isHeader = true;
229
+ }
230
+ this.addInterface = null;
231
+ this.editInterface = null;
232
+ /**
233
+ * 判断是否有提交前事件
234
+ */
235
+ if (designData?.addPreEventRule) {
236
+ this.addPreEventRule = true;
237
+ if (designData?.addInterface) {
238
+ this.addInterface = designData?.addInterface;
239
+ }
240
+ }
241
+ if (designData?.editPreEventRule) {
242
+ this.editPreEventRule = true;
243
+ if (designData?.editInterface) {
244
+ this.editInterface = designData?.editInterface;
245
+ }
246
+ }
247
+ /**
248
+ * 生效期
249
+ */
250
+ if (designData.basic?.izEffect) {
251
+ this.izEffect = true;
252
+ if (designData.basic?.effectField) {
253
+ this.effectField = designData.basic?.effectField;
254
+ }
255
+ }
256
+ else {
257
+ this.izEffect = false;
258
+ this.effectField = null;
259
+ this.effectStatus = null;
260
+ }
261
+ if (designData.basic?.buttonCancel) {
262
+ let hide = false;
263
+ if (designData.basic?.izButtonCancel == false) {
264
+ hide = true;
265
+ }
266
+ this.buttons['cancel'] = {
267
+ text: designData.basic?.buttonCancel,
268
+ hide: hide,
269
+ };
270
+ }
271
+ if (designData.basic?.buttonDraft) {
272
+ let hide = false;
273
+ if (designData.basic?.izButtonDraft == false) {
274
+ hide = true;
275
+ }
276
+ this.buttons['draft'] = {
277
+ text: designData.basic?.buttonDraft,
278
+ hide: hide,
279
+ };
280
+ }
281
+ if (designData.basic?.buttonSave) {
282
+ let hide = false;
283
+ if (designData.basic?.izButtonSave == false) {
284
+ hide = true;
285
+ }
286
+ this.buttons['save'] = {
287
+ text: designData.basic?.buttonSave,
288
+ hide: hide,
289
+ };
290
+ }
291
+ /**
292
+ * 配置参数
293
+ */
294
+ if (designData?.listArg && Array.isArray(designData?.listArg)) {
295
+ this.argList = designData?.listArg;
296
+ }
297
+ if (this.config?.argInfo && this.argList && Array.isArray(this.argList) && this.argList.length > 0) {
298
+ this.argList.forEach((item) => {
299
+ if (item.argFieldId && item.argName && this.config.argInfo[item.argName]) {
300
+ this.model[item.argFieldId] = this.config?.argInfo[item.argName];
301
+ }
302
+ });
303
+ }
304
+ }
305
+ /**
306
+ * 1、获取设计
307
+ * @returns
308
+ */
309
+ getDesign() {
310
+ let apiName = this.commAPISrv.getFormDesign(this.config.moduleCode, this.config.formId);
311
+ return this.http.post(`${apiName}`);
312
+ }
313
+ /**
314
+ * 2、获取配置-业务角色
315
+ * @returns
316
+ */
317
+ getRole() {
318
+ let params = {
319
+ formId: this.config.formId,
320
+ type: this.config.type,
321
+ };
322
+ let apiName = this.commAPISrv.getFormRole(this.config.moduleCode);
323
+ return this.http.post(`${apiName}`, params);
324
+ }
325
+ /**
326
+ * 3、获取配置-下拉选项
327
+ * @returns
328
+ */
329
+ getDropDown() {
330
+ let apiName = this.commAPISrv.getFormDropDown(this.config.moduleCode, this.config.formId);
331
+ return this.http.post(`${apiName}`);
332
+ }
333
+ /*
334
+ 4、获取配置-表单数据(编辑、查看)
335
+ */
336
+ getFromModel() {
337
+ let params = {
338
+ formId: this.config.formId,
339
+ id: this.config.id,
340
+ button: this.config?.buttonCode,
341
+ };
342
+ if (this.config?.type != 'ADD' && this.config?.id) {
343
+ let apiName = null;
344
+ if (this.config?.api && this.config?.api?.modelAPI) {
345
+ apiName = this.config.api.modelAPI;
346
+ }
347
+ else {
348
+ apiName = this.commAPISrv.getFormModel(this.config.moduleCode);
349
+ }
350
+ return this.http.post(`${apiName}`, params);
351
+ }
352
+ else {
353
+ return of(null);
354
+ }
355
+ }
356
+ /*
357
+ 5、获取配置-表单默认值
358
+ */
359
+ getFromDefaultModel() {
360
+ if (this.config.type == 'ADD' && this.config?.formId) {
361
+ let apiName = null;
362
+ if (this.config?.api && this.config?.api?.modelDefaultAPI) {
363
+ apiName = this.config.api.modelDefaultAPI;
364
+ }
365
+ else {
366
+ apiName = this.commAPISrv.getFormDefaultModel(this.config.moduleCode);
367
+ }
368
+ return this.http.post(`${apiName}/${this.config.formId}`);
369
+ }
370
+ else {
371
+ return of(null);
372
+ }
373
+ }
374
+ /**
375
+ * 6、获取配置-表单规则
376
+ * @returns
377
+ */
378
+ getFromRuleData() {
379
+ if (this.config?.formId) {
380
+ return this.http.post(`${ModuleAPI.rule}/rule/form/listByForm/${this.config.formId}`);
381
+ }
382
+ else {
383
+ return of(null);
384
+ }
385
+ }
386
+ /**
387
+ * 7、获取其他数据
388
+ * @returns
389
+ */
390
+ getFromOtherData() {
391
+ return of(null);
392
+ }
393
+ /**
394
+ * 触发卡片
395
+ * @param field
396
+ * @param value
397
+ */
398
+ fieldChangeCallCard(field, value) {
399
+ let id = null;
400
+ if (value) {
401
+ if (value instanceof Object && value?.id) {
402
+ id = value.id;
403
+ }
404
+ else {
405
+ id = value;
406
+ }
407
+ }
408
+ this.headerConfig = {
409
+ headerId: this.designData?.basic?.headerId,
410
+ id: id,
411
+ rd: Math.random(),
412
+ };
413
+ this.isHeader = true;
414
+ }
415
+ headerLoadAfter(e) {
416
+ this.headerLoading = false;
417
+ }
418
+ /**
419
+ * 规则触发
420
+ * @param field
421
+ * @param value
422
+ */
423
+ getPageRuleData(field, value) {
424
+ if (field?.props && field?.props["callBack"]) {
425
+ let key = field.key;
426
+ if (key != undefined && key != null) {
427
+ switch (key) {
428
+ case 'overtime':
429
+ this.getPageRuleOverTime(field, value);
430
+ break;
431
+ default:
432
+ this.getPageRuleDefault(field, value);
433
+ break;
434
+ }
435
+ }
436
+ }
437
+ }
438
+ /**
439
+ * 默认规则触发
440
+ * @param field
441
+ * @param value
442
+ */
443
+ getPageRuleDefault(field, value) {
444
+ this.loading = true;
445
+ let postData = {};
446
+ let props = field.props;
447
+ if (props) {
448
+ if (props?.callCard == true) {
449
+ this.headerLoading = true;
450
+ this.fieldChangeCallCard(field, value);
451
+ }
452
+ field.props ??= {};
453
+ if (field.props["callBackFields"] && Array.isArray(field.props["callBackFields"])) {
454
+ field.props["callBackFields"].forEach((a) => {
455
+ if (this.model && this.model[a] != undefined) {
456
+ postData[a] = {
457
+ key: a,
458
+ value: this.model[a],
459
+ };
460
+ }
461
+ });
462
+ }
463
+ if (props['arrKey']) {
464
+ /**
465
+ * 数组内部组件触发
466
+ */
467
+ let findModel = this.model[props.arrKey];
468
+ let createModel = [];
469
+ if (findModel && Array.isArray(findModel)) {
470
+ findModel.forEach((a) => {
471
+ if (a) {
472
+ let tmp = {};
473
+ Object.keys(a).forEach((b) => {
474
+ tmp[b] = {
475
+ key: b,
476
+ value: a[b],
477
+ };
478
+ });
479
+ createModel.push(tmp);
480
+ }
481
+ });
482
+ }
483
+ postData[props.arrKey] = {
484
+ key: props.arrKey,
485
+ value: createModel,
486
+ };
487
+ }
488
+ else {
489
+ let fieldKey = field.key;
490
+ /**
491
+ * 非数组内部触发
492
+ */
493
+ if ((field.type == 'lookup' || field.type == 'lookup_tree') && field.props?.selectType != 'multiple') {
494
+ if (value && value?.id) {
495
+ postData[fieldKey] = {
496
+ key: field.key,
497
+ value: value.id,
498
+ };
499
+ }
500
+ }
501
+ else {
502
+ postData[fieldKey] = {
503
+ key: field.key,
504
+ value: value,
505
+ };
506
+ }
507
+ }
508
+ if (field.props["callBackRule"]) {
509
+ this.http
510
+ .post(`${ModuleAPI.rule}/rule/run/formRule`, {
511
+ ruleId: field.props["callBackRule"],
512
+ modelJson: postData,
513
+ })
514
+ .subscribe((res) => {
515
+ if (res && res?.success && res?.result) {
516
+ this.resetService.resetConfig(this.fields, this.model, res.result);
517
+ this.options._buildForm(true);
518
+ }
519
+ this.loading = false;
520
+ }, (res) => {
521
+ this.loading = false;
522
+ });
523
+ }
524
+ else {
525
+ this.loading = false;
526
+ }
527
+ }
528
+ else {
529
+ this.loading = false;
530
+ }
531
+ }
532
+ /**
533
+ * 加班规则触发
534
+ * @param field
535
+ * @param value
536
+ */
537
+ getPageRuleOverTime(field, value) {
538
+ /**
539
+ * EmpId
540
+ */
541
+ let empId = null;
542
+ if (this.model['f_1715977697390137346'] && this.model['f_1715977697390137346']?.id) {
543
+ empId = this.model['f_1715977697390137346'].id;
544
+ }
545
+ if (this.model['f_1673864077973692418'] && this.model['f_1673864077973692418']?.id) {
546
+ empId = this.model['f_1673864077973692418'].id;
547
+ }
548
+ /**
549
+ * Repeat Key
550
+ */
551
+ let dataKey = field?.parent?.parent?.key;
552
+ /**
553
+ * Repeat 下面的OverTime 所属行下标
554
+ */
555
+ let dataIndex = field?.parent?.['index'];
556
+ this.loading = true;
557
+ let postData = _.cloneDeep(value);
558
+ postData['index'] = dataIndex;
559
+ postData['empId'] = empId;
560
+ this.http
561
+ .post(`${ModuleAPI.rule}/rule/run/overtimeRule`, {
562
+ ruleId: field?.props?.["callBackRule"],
563
+ modelJson: postData,
564
+ })
565
+ .subscribe((res) => {
566
+ if (res && res?.success && res?.result) {
567
+ this.resetService.resetOverTime(this.fields, this.model, res.result, dataKey, dataIndex);
568
+ this.options._buildForm(true);
569
+ }
570
+ this.loading = false;
571
+ }, (res) => {
572
+ this.loading = false;
573
+ });
574
+ }
575
+ btnSubmit() {
576
+ console.log("[]");
577
+ this.loading = true;
578
+ if (!this.form.valid) {
579
+ this.loading = false;
580
+ return;
581
+ }
582
+ if (this.config.type == 'ADD') {
583
+ if (!this.addPreEventRule) {
584
+ this.runSaveData();
585
+ }
586
+ else {
587
+ if (this.addInterface) {
588
+ this.runPreInterface(this.addInterface);
589
+ }
590
+ else {
591
+ this.runPreEvent();
592
+ }
593
+ }
594
+ }
595
+ else if (this.config.type == 'EDIT') {
596
+ if (!this.editPreEventRule) {
597
+ this.runSaveData();
598
+ }
599
+ else {
600
+ if (this.editInterface) {
601
+ this.runPreInterface(this.editInterface);
602
+ }
603
+ else {
604
+ this.runPreEvent();
605
+ }
606
+ }
607
+ }
608
+ else {
609
+ }
610
+ }
611
+ runPreEvent() {
612
+ this.loading = true;
613
+ this.http
614
+ .post(`${ModuleAPI.rule}/rule/run/eventFormRule`, {
615
+ buttonId: this.config.type,
616
+ dataId: this.config.id,
617
+ formId: this.config.formId,
618
+ sourceId: this.config.formId,
619
+ sourceType: 'FORM_BUTTON',
620
+ requestJson: this.model,
621
+ })
622
+ .subscribe((res) => {
623
+ if (res && res?.success == true) {
624
+ if (res?.result) {
625
+ switch (res.result.eventResult) {
626
+ case 'NONE':
627
+ this.runSaveData();
628
+ break;
629
+ case 'TIPS':
630
+ this.msg.error(res.result.tips);
631
+ break;
632
+ case 'CONFIRM':
633
+ this.modal.confirm({
634
+ nzTitle: '提示',
635
+ nzContent: `${res.result.tips}`,
636
+ nzOnOk: () => {
637
+ this.runSaveData();
638
+ },
639
+ });
640
+ break;
641
+ }
642
+ }
643
+ else {
644
+ this.runSaveData();
645
+ }
646
+ }
647
+ this.loading = false;
648
+ }, () => {
649
+ this.loading = false;
650
+ });
651
+ }
652
+ runPreInterface(e) {
653
+ this.loading = true;
654
+ let postData = {};
655
+ if (e.izFormId) {
656
+ postData['formId'] = this.config.formId;
657
+ }
658
+ if (e.izFormId) {
659
+ postData['izFormModel'] = this.model;
660
+ }
661
+ if (Array.isArray(e.listInterface)) {
662
+ e.listInterface.forEach((item) => {
663
+ let value = null;
664
+ if (this.model && this.model[item.formKey] != undefined) {
665
+ value = this.model[item.formKey];
666
+ }
667
+ postData[item.postKey] = value;
668
+ });
669
+ }
670
+ let url = e.formInterface;
671
+ if (!e.formInterface.startsWith('/')) {
672
+ url = '/' + e.formInterface;
673
+ }
674
+ this.http.post(`${url}`, postData).subscribe((res) => {
675
+ if (res && res?.success == true) {
676
+ if (res?.result) {
677
+ switch (res.result.eventResult) {
678
+ case 'NONE':
679
+ this.runSaveData();
680
+ break;
681
+ case 'TIPS':
682
+ this.msg.error(res.result.tips);
683
+ break;
684
+ case 'CONFIRM':
685
+ this.modal.confirm({
686
+ nzTitle: '提示',
687
+ nzContent: `${res.result.tips}`,
688
+ nzOnOk: () => {
689
+ this.runSaveData();
690
+ },
691
+ });
692
+ break;
693
+ }
694
+ }
695
+ else {
696
+ this.runSaveData();
697
+ }
698
+ }
699
+ this.loading = false;
700
+ }, () => {
701
+ this.loading = false;
702
+ });
703
+ }
704
+ runSaveData() {
705
+ this.loading = true;
706
+ let apiName = null;
707
+ let buttonType = 'SAVE';
708
+ if (this.config.type == 'ADD') {
709
+ if (this.config?.api && this.config?.api?.addAPI) {
710
+ apiName = this.config.api.addAPI;
711
+ }
712
+ else {
713
+ apiName = this.commAPISrv.getFormAdd(this.config.moduleCode);
714
+ }
715
+ }
716
+ else if (this.config.type == 'EDIT') {
717
+ if (this.config?.api && this.config?.api?.editAPI) {
718
+ apiName = this.config.api.editAPI;
719
+ }
720
+ else {
721
+ apiName = this.commAPISrv.getFormUpdate(this.config.moduleCode);
722
+ }
723
+ }
724
+ else {
725
+ if (this.config?.api && this.config?.api?.editAPI) {
726
+ apiName = this.config.api.editAPI;
727
+ }
728
+ }
729
+ if (apiName) {
730
+ this.http
731
+ .post(`${apiName}`, {
732
+ type: buttonType,
733
+ id: this.config.id,
734
+ formId: this.config.formId,
735
+ modelJson: this.model,
736
+ button: this.config?.buttonCode,
737
+ })
738
+ .subscribe((res) => {
739
+ this.loading = false;
740
+ if (res && res.success == true) {
741
+ this.msg.success('操作成功!');
742
+ this.btnSave(res.data);
743
+ }
744
+ this.loading = false;
745
+ }, () => {
746
+ this.loading = false;
747
+ });
748
+ }
749
+ }
750
+ /**
751
+ * 取消-关闭
752
+ */
753
+ btnClose() {
754
+ this.btnCloseEvent.emit({
755
+ type: 'close',
756
+ data: null,
757
+ });
758
+ }
759
+ /**
760
+ * 保存-关闭
761
+ * @param e
762
+ */
763
+ btnSave(e) {
764
+ this.btnSaveEvent.emit({
765
+ type: 'save',
766
+ data: e,
767
+ });
768
+ }
769
+ /**
770
+ * 选择员工
771
+ * @param selectType
772
+ * @param selectData
773
+ */
774
+ selectEmp(selectType, selectData, caller, callback) {
775
+ let dialogConfig = {
776
+ pageCode: 'Dialog_Admin_System.emp',
777
+ selectData: selectData,
778
+ selectType: selectType == null ? 'single' : selectType,
779
+ parameter: {},
780
+ };
781
+ this.dialogService.CreateModelDialog({
782
+ nzTitle: '选择 - 员工',
783
+ size: 'large',
784
+ nzContent: PageDialogDefaultComponent,
785
+ }, {
786
+ config: dialogConfig,
787
+ }, (type, instance, modal) => {
788
+ let res = instance.getPageSelectData();
789
+ if (callback != undefined && callback != null && callback != '') {
790
+ callback.call(caller, res);
791
+ }
792
+ modal.destroy();
793
+ });
794
+ }
795
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: BasicService, deps: [{ token: i1._HttpClient }, { token: i2.DeonFormUtilService }, { token: i3.DeonFormResetService }, { token: i4.FormlyFormBuilder }, { token: i5.GramGlobalService }, { token: i6.NzMessageService }, { token: i7.NzModalService }, { token: i8.GramBaseDialogService }, { token: i9.CommAPIService }], target: i0.ɵɵFactoryTarget.Directive });
796
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.15", type: BasicService, isStandalone: true, inputs: { config: "config" }, outputs: { btnCloseEvent: "btnCloseEvent", btnSaveEvent: "btnSaveEvent" }, ngImport: i0 });
797
+ }
798
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: BasicService, decorators: [{
799
+ type: Directive
800
+ }], ctorParameters: () => [{ type: i1._HttpClient }, { type: i2.DeonFormUtilService }, { type: i3.DeonFormResetService }, { type: i4.FormlyFormBuilder }, { type: i5.GramGlobalService }, { type: i6.NzMessageService }, { type: i7.NzModalService }, { type: i8.GramBaseDialogService }, { type: i9.CommAPIService }], propDecorators: { config: [{
801
+ type: Input
802
+ }], btnCloseEvent: [{
803
+ type: Output
804
+ }], btnSaveEvent: [{
805
+ type: Output
806
+ }] } });
807
+
808
+ /**
809
+ * Generated bundle index. Do not edit.
810
+ */
811
+
812
+ export { BasicService };
813
+ //# sourceMappingURL=srv.basic.mjs.map