cloud-web-corejs 1.0.54-dev.163 → 1.0.54-dev.164
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.
- package/package.json +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/baseAttachment-widget.vue +3 -0
- package/src/components/xform/form-designer/form-widget/field-widget/button-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/fieldMixin.js +11 -1
- package/src/components/xform/form-designer/form-widget/field-widget/select-widget.vue +1 -1
- package/src/components/xform/form-render/indexMixin.js +384 -73
- package/src/components/xform/form-render/indexMixin2.js +2049 -0
- package/src/components/xform/mixins/defaultHandle.js +120 -1
- package/src/components/xform/mixins/scriptHttp.js +1 -1
- package/src/views/bd/setting/table_model/edit.vue +5 -2
@@ -0,0 +1,2049 @@
|
|
1
|
+
import emitter from '../../../components/xform/utils/emitter';
|
2
|
+
import i18n, {
|
3
|
+
changeLocale
|
4
|
+
} from '../../../components/xform/utils/i18n';
|
5
|
+
import Vue from 'vue'
|
6
|
+
import dynamicDialogRender from './dynamicDialogRender.js';
|
7
|
+
import VFormRender from '../../../components/xform/form-render/index.vue'
|
8
|
+
import {
|
9
|
+
generateId,
|
10
|
+
deepClone,
|
11
|
+
getAllContainerWidgets,
|
12
|
+
getAllFieldWidgets,
|
13
|
+
insertCustomCssToHead,
|
14
|
+
insertGlobalFunctionsToHtml,
|
15
|
+
traverseFieldWidgets,
|
16
|
+
buildDefaultFormJson,
|
17
|
+
traverseFieldWidgetsOfContainer,
|
18
|
+
getFieldWidgetByName,
|
19
|
+
getDSByName,
|
20
|
+
overwriteObj,
|
21
|
+
runDataSourceRequest,
|
22
|
+
getContainerWidgetByName,
|
23
|
+
cloneFormConfigWithoutEventHandler
|
24
|
+
} from '../../../components/xform/utils/util';
|
25
|
+
import {
|
26
|
+
containers,
|
27
|
+
advancedFields,
|
28
|
+
basicFields,
|
29
|
+
customFields
|
30
|
+
} from "../../../components/xform/form-designer/widget-panel/widgetsConfig.js"
|
31
|
+
import scriptHttpMixin from "../../../components/xform/mixins/scriptHttp";
|
32
|
+
import defaultHandleMixin from "../../../components/xform/mixins/defaultHandle";
|
33
|
+
import xeUtils from "xe-utils";
|
34
|
+
import {extendDeeply} from "@base/utils/index.js";
|
35
|
+
|
36
|
+
let modules = {};
|
37
|
+
const baseRefUtil = {
|
38
|
+
emitter,
|
39
|
+
i18n,
|
40
|
+
changeLocale,
|
41
|
+
Vue,
|
42
|
+
generateId,
|
43
|
+
deepClone,
|
44
|
+
getAllContainerWidgets,
|
45
|
+
getAllFieldWidgets,
|
46
|
+
insertCustomCssToHead,
|
47
|
+
insertGlobalFunctionsToHtml,
|
48
|
+
traverseFieldWidgets,
|
49
|
+
buildDefaultFormJson,
|
50
|
+
traverseFieldWidgetsOfContainer,
|
51
|
+
getFieldWidgetByName,
|
52
|
+
getDSByName,
|
53
|
+
overwriteObj,
|
54
|
+
runDataSourceRequest,
|
55
|
+
getContainerWidgetByName,
|
56
|
+
cloneFormConfigWithoutEventHandler,
|
57
|
+
dynamicDialogRender
|
58
|
+
};
|
59
|
+
|
60
|
+
modules = {
|
61
|
+
componentName: 'VFormRender',
|
62
|
+
mixins: [baseRefUtil.emitter, baseRefUtil.i18n, scriptHttpMixin, defaultHandleMixin],
|
63
|
+
props: {
|
64
|
+
formJson: {
|
65
|
+
//prop传入的表单JSON配置
|
66
|
+
type: Object,
|
67
|
+
default: () => buildDefaultFormJson()
|
68
|
+
},
|
69
|
+
formData: {
|
70
|
+
//prop传入的表单数据
|
71
|
+
type: Object,
|
72
|
+
default: () => ({})
|
73
|
+
},
|
74
|
+
optionData: {
|
75
|
+
//prop传入的选项数据
|
76
|
+
type: Object,
|
77
|
+
default: () => ({})
|
78
|
+
},
|
79
|
+
previewState: {
|
80
|
+
//是否表单预览状态
|
81
|
+
type: Boolean,
|
82
|
+
default: false
|
83
|
+
},
|
84
|
+
disabledMode: {
|
85
|
+
type: Boolean,
|
86
|
+
default: !1
|
87
|
+
},
|
88
|
+
globalDsv: {
|
89
|
+
type: Object,
|
90
|
+
default: function () {
|
91
|
+
return {};
|
92
|
+
}
|
93
|
+
},
|
94
|
+
parentForm: {
|
95
|
+
type: Object,
|
96
|
+
default: null
|
97
|
+
},
|
98
|
+
dynamicCreation: {
|
99
|
+
type: Boolean,
|
100
|
+
default: !1
|
101
|
+
},
|
102
|
+
reportTemplate: {
|
103
|
+
type: Object,
|
104
|
+
default: null
|
105
|
+
},
|
106
|
+
dataId: {
|
107
|
+
type: Number,
|
108
|
+
default: null
|
109
|
+
},
|
110
|
+
param: {
|
111
|
+
type: Object,
|
112
|
+
default: null
|
113
|
+
},
|
114
|
+
},
|
115
|
+
provide() {
|
116
|
+
let e = this;
|
117
|
+
return {
|
118
|
+
refList: this.widgetRefList,
|
119
|
+
widgetKeyNameMap: this.widgetKeyNameMap,
|
120
|
+
sfRefList: this.subFormRefList,
|
121
|
+
getFormConfig: function () {
|
122
|
+
return e.formJsonObj.formConfig;
|
123
|
+
},
|
124
|
+
getGlobalDsv: function () {
|
125
|
+
return e.globalDsv;
|
126
|
+
},
|
127
|
+
globalOptionData: this.optionData,
|
128
|
+
getOptionData: function () {
|
129
|
+
return e.optionData;
|
130
|
+
},
|
131
|
+
globalModel: {
|
132
|
+
formModel: this.formDataModel,
|
133
|
+
formData: this.currentFormData
|
134
|
+
},
|
135
|
+
previewState: this.previewState,
|
136
|
+
getReadMode: function () {
|
137
|
+
return e.readModeFlag;
|
138
|
+
},
|
139
|
+
getSubFormFieldFlag: function () {
|
140
|
+
return !1;
|
141
|
+
},
|
142
|
+
getSubFormName: function () {
|
143
|
+
return '';
|
144
|
+
},
|
145
|
+
doScriptAccess: this.doScriptAccess,
|
146
|
+
formHttp: this.formHttp,
|
147
|
+
getReportTemplate: () => this.reportTemplate,
|
148
|
+
getObjectFieldFlag: () => !1,
|
149
|
+
getObjectName: () => "",
|
150
|
+
getHasWf: () => this.hasWf,
|
151
|
+
hasConfig: this.hasConfig
|
152
|
+
};
|
153
|
+
},
|
154
|
+
data() {
|
155
|
+
return {
|
156
|
+
formJsonObj: this.formJson,
|
157
|
+
formDataModel: {},
|
158
|
+
widgetRefList: {},
|
159
|
+
subFormRefList: {},
|
160
|
+
widgetKeyNameMap: {},
|
161
|
+
formId: null,
|
162
|
+
externalComponents: {},
|
163
|
+
readModeFlag: !1,
|
164
|
+
dialogOrDrawerRef: null,
|
165
|
+
searchDialogOption: {},
|
166
|
+
showSearchDialog: false,
|
167
|
+
currentFormData: {},
|
168
|
+
timerMap: {},
|
169
|
+
hasWf: false,
|
170
|
+
showFormContent: false,
|
171
|
+
|
172
|
+
showFormDialog: false,
|
173
|
+
formDialogOption: {},
|
174
|
+
showImportDialog: false,
|
175
|
+
importDialogOption: {},
|
176
|
+
formDrawerOption: {},
|
177
|
+
showFormDrawer: false,
|
178
|
+
userSaleOrgDTOs: [],
|
179
|
+
userRoleDTOs: [],
|
180
|
+
bdService: null,
|
181
|
+
globalParam: {}
|
182
|
+
};
|
183
|
+
},
|
184
|
+
computed: {
|
185
|
+
formConfig() {
|
186
|
+
return this.formJsonObj.formConfig;
|
187
|
+
},
|
188
|
+
|
189
|
+
widgetList() {
|
190
|
+
return this.formJsonObj.widgetList;
|
191
|
+
},
|
192
|
+
|
193
|
+
labelPosition() {
|
194
|
+
if (!!this.formConfig && !!this.formConfig.labelPosition) {
|
195
|
+
return this.formConfig.labelPosition;
|
196
|
+
}
|
197
|
+
|
198
|
+
return 'left';
|
199
|
+
},
|
200
|
+
|
201
|
+
labelWidth() {
|
202
|
+
if (!!this.formConfig && !!this.formConfig.labelWidth) {
|
203
|
+
return this.formConfig.labelWidth + 'px';
|
204
|
+
}
|
205
|
+
|
206
|
+
return '112px';
|
207
|
+
},
|
208
|
+
|
209
|
+
size() {
|
210
|
+
if (!!this.formConfig && !!this.formConfig.size) {
|
211
|
+
return this.formConfig.size;
|
212
|
+
}
|
213
|
+
|
214
|
+
return 'medium';
|
215
|
+
},
|
216
|
+
|
217
|
+
customClass() {
|
218
|
+
return !!this.formConfig && !!this.formConfig.customClass ? this.formConfig.customClass : '';
|
219
|
+
}
|
220
|
+
},
|
221
|
+
watch: {
|
222
|
+
//
|
223
|
+
},
|
224
|
+
async created() {
|
225
|
+
this.registerFormToRefList()
|
226
|
+
this.currentFormData = this.formData;
|
227
|
+
let formConfig = this.formConfig;
|
228
|
+
await this.getSaleOrgData();
|
229
|
+
await this.getUserRoleData();
|
230
|
+
await this.getBdService();
|
231
|
+
this.buildFormModel(!this.formJsonObj ? null : this.formJsonObj.widgetList);
|
232
|
+
if (formConfig.isLoadEntity) {
|
233
|
+
await this.loadDefaultEntityData(() => {
|
234
|
+
this.handleCustomEvent(formConfig.formScriptSuccess);
|
235
|
+
});
|
236
|
+
} else {
|
237
|
+
this.handleShowContent();
|
238
|
+
}
|
239
|
+
this.handleOnCreated(),
|
240
|
+
// this.buildFormModel(!this.formJsonObj ? null : this.formJsonObj.widgetList);
|
241
|
+
this.initFormObject();
|
242
|
+
},
|
243
|
+
mounted() {
|
244
|
+
this.initLocale();
|
245
|
+
this.handleOnMounted();
|
246
|
+
},
|
247
|
+
methods: {
|
248
|
+
getSaleOrgData() {
|
249
|
+
if (this.$store.getters.userId) {
|
250
|
+
return this.$http({
|
251
|
+
url: USER_PREFIX + '/user/getUserSaleOrg',
|
252
|
+
method: `post`,
|
253
|
+
data: {id: this.$store.getters.userId},
|
254
|
+
isLoading: true,
|
255
|
+
loadingTarget: document.body,
|
256
|
+
modalStrictly: true,
|
257
|
+
success: res => {
|
258
|
+
let rows = res.objx || [];
|
259
|
+
this.userSaleOrgDTOs = rows;
|
260
|
+
}
|
261
|
+
});
|
262
|
+
}
|
263
|
+
},
|
264
|
+
getUserRoleData() {
|
265
|
+
if (this.$store.getters.userId) {
|
266
|
+
return this.$http({
|
267
|
+
url: USER_PREFIX + '/user/getUserRole',
|
268
|
+
method: `post`,
|
269
|
+
data: {id: this.$store.getters.userId},
|
270
|
+
isLoading: true,
|
271
|
+
loadingTarget: document.body,
|
272
|
+
modalStrictly: true,
|
273
|
+
success: res => {
|
274
|
+
let rows = res.objx || [];
|
275
|
+
this.userRoleDTOs = rows;
|
276
|
+
}
|
277
|
+
});
|
278
|
+
}
|
279
|
+
},
|
280
|
+
getBdService() {
|
281
|
+
return this.$http({
|
282
|
+
url: USER_PREFIX + '/form_develop/getBdService',
|
283
|
+
method: `post`,
|
284
|
+
data: {},
|
285
|
+
isLoading: true,
|
286
|
+
loadingTarget: document.body,
|
287
|
+
// modalStrictly: true,
|
288
|
+
success: res => {
|
289
|
+
this.bdService = res.objx;
|
290
|
+
}
|
291
|
+
});
|
292
|
+
},
|
293
|
+
handleShowContent(callback) {
|
294
|
+
// this.buildFormModel(!this.formJsonObj ? null : this.formJsonObj.widgetList);
|
295
|
+
this.showFormContent = true;
|
296
|
+
this.$nextTick(() => {
|
297
|
+
this.handleShowHideRule();
|
298
|
+
callback && callback();
|
299
|
+
})
|
300
|
+
},
|
301
|
+
hasConfig(widget, configName) {
|
302
|
+
if (!widget) return false;
|
303
|
+
let originalWidget = null;
|
304
|
+
if (!!widget.category) {
|
305
|
+
originalWidget = this.getContainerByType(widget.type);
|
306
|
+
} else {
|
307
|
+
originalWidget = this.getFieldWidgetByType(widget.type);
|
308
|
+
}
|
309
|
+
|
310
|
+
if (!originalWidget || !originalWidget.options) {
|
311
|
+
return false;
|
312
|
+
}
|
313
|
+
|
314
|
+
return Object.keys(originalWidget.options).indexOf(configName) > -1;
|
315
|
+
},
|
316
|
+
hanldeWfWidget() {
|
317
|
+
let wfParam = this.wfParam;
|
318
|
+
if (!wfParam.hasWf) return;
|
319
|
+
let refList = this.widgetRefList;
|
320
|
+
|
321
|
+
let toDo = (target, options, e) => {
|
322
|
+
let widget = options ? null : (target.field || target.widget);
|
323
|
+
let isWfFlag = options ? true : this.hasConfig(widget, 'wfFlag');
|
324
|
+
let widgetType = widget?.type;
|
325
|
+
let enabledByWf = options ? options.enabledByWf : widget?.options?.enabledByWf;
|
326
|
+
let hiddenByWf = options ? options.hiddenByWf : widget?.options?.hiddenByWf;
|
327
|
+
let widgetName = options ? options.name : widget?.options?.name;
|
328
|
+
if (isWfFlag) {
|
329
|
+
if (this.hasConfig(widget, 'disabled') || !!options) {
|
330
|
+
let disabled = null;
|
331
|
+
if (!enabledByWf) {
|
332
|
+
disabled = true;
|
333
|
+
// setDisabled(target,true);
|
334
|
+
let onClick = options ? options.onClick : widget.options.onClick;
|
335
|
+
if (onClick && onClick.startsWith("this.getFormRef().$baseReload()")) {
|
336
|
+
// setDisabled(target,false);
|
337
|
+
disabled = false;
|
338
|
+
}
|
339
|
+
} else {
|
340
|
+
// setDisabled(target,false);
|
341
|
+
disabled = false;
|
342
|
+
}
|
343
|
+
if (widgetType == 'reset_button' && enabledByWf === undefined) {
|
344
|
+
// setDisabled(target,false)
|
345
|
+
disabled = false;
|
346
|
+
}
|
347
|
+
if (disabled !== null) {
|
348
|
+
if (options) {
|
349
|
+
options.disabled = disabled;
|
350
|
+
} else {
|
351
|
+
widget.options.disabled = disabled;
|
352
|
+
}
|
353
|
+
}
|
354
|
+
}
|
355
|
+
|
356
|
+
let hidden = null;
|
357
|
+
if (hiddenByWf) {
|
358
|
+
// setHidden(target,true);
|
359
|
+
// widget.options.hidden = true;
|
360
|
+
hidden = true
|
361
|
+
}
|
362
|
+
if (widget && widgetType == 'save_button' && hiddenByWf === undefined) {
|
363
|
+
// setHidden(target,true)
|
364
|
+
// widget.options.hidden = true;
|
365
|
+
hidden = true
|
366
|
+
}
|
367
|
+
if (hidden !== null) {
|
368
|
+
if (options) {
|
369
|
+
options.hidden = hidden;
|
370
|
+
} else {
|
371
|
+
widget.options.hidden = hidden;
|
372
|
+
}
|
373
|
+
}
|
374
|
+
}
|
375
|
+
|
376
|
+
/*if (widget?.type == "data-table") {
|
377
|
+
debugger
|
378
|
+
let loopDo = (t,e) => {
|
379
|
+
if (t.children && t.children.length) {
|
380
|
+
t.children.forEach(item => {
|
381
|
+
loopDo(item,e)
|
382
|
+
})
|
383
|
+
} else {
|
384
|
+
if (t.columnOption) {
|
385
|
+
toDo(null,t.columnOption,e)
|
386
|
+
}
|
387
|
+
}
|
388
|
+
}
|
389
|
+
widget.options.tableColumns.forEach(item => {
|
390
|
+
loopDo(item,e)
|
391
|
+
this.loopHandleWidget(item.widgetList, (item1) => {
|
392
|
+
toDo(item1)
|
393
|
+
});
|
394
|
+
})
|
395
|
+
|
396
|
+
}*/
|
397
|
+
if (target && widgetType == 'baseAttachment') {
|
398
|
+
target.initOption();
|
399
|
+
}
|
400
|
+
}
|
401
|
+
|
402
|
+
for (let key in refList) {
|
403
|
+
let target = refList[key];
|
404
|
+
let widget = target.field || target.widget;
|
405
|
+
let formItemFlag = widget?.formItemFlag
|
406
|
+
if (formItemFlag) {
|
407
|
+
target.setDisabled && target.setDisabled(true);
|
408
|
+
}
|
409
|
+
/*if(target.tableParam){
|
410
|
+
debugger
|
411
|
+
}*/
|
412
|
+
toDo(target);
|
413
|
+
}
|
414
|
+
|
415
|
+
},
|
416
|
+
hanldeWfWidget2() {
|
417
|
+
let wfParam = this.wfParam;
|
418
|
+
if (!wfParam.hasWf) return;
|
419
|
+
let wfInfo = wfParam.wfInfo
|
420
|
+
let modelKey = wfInfo.modelKey;
|
421
|
+
let companyCode = this.$store.getters.companyCode;
|
422
|
+
let taskStep = (wfInfo.taskStep ?? "") + "";
|
423
|
+
let taskDefinitionKey = wfInfo.taskDefinitionKey;
|
424
|
+
if (!taskDefinitionKey) return
|
425
|
+
let toModify = wfInfo.toModify;
|
426
|
+
if (!toModify) return
|
427
|
+
|
428
|
+
let hasModifyItem = false;
|
429
|
+
let refList = this.widgetRefList;
|
430
|
+
let saveButton;
|
431
|
+
let bdService = this.bdService;
|
432
|
+
|
433
|
+
for (let key in refList) {
|
434
|
+
let target = refList[key];
|
435
|
+
let widget = target.field || target.widget;
|
436
|
+
/*
|
437
|
+
let wfEdit = widget?.options.wfEdit;
|
438
|
+
if (wfEdit) {
|
439
|
+
let wfConfigData = widget?.options?.wfConfigData || [];
|
440
|
+
wfConfigData.forEach(item => {
|
441
|
+
|
442
|
+
let type = item.type;
|
443
|
+
let taskStepList = item.taskSteps ? item.taskSteps.split(',') : []
|
444
|
+
if (type && taskStepList.includes(taskStep)) {
|
445
|
+
let companyCodeStr = item.companyCodes;
|
446
|
+
let companyCodes = companyCodeStr ? companyCodeStr.split(",").filter(item => !!item) : [];
|
447
|
+
let flag1 = !item.serveName || item.serveName == bdService;
|
448
|
+
let flag2 = !item.modelKey || item.modelKey == modelKey;
|
449
|
+
let flag3 = !companyCodes.length || companyCodes.includes(companyCode)
|
450
|
+
if (flag1 && flag2 && flag3) {
|
451
|
+
if (type === 1) {
|
452
|
+
//可编辑
|
453
|
+
hasModifyItem = true;
|
454
|
+
target.setDisabled && target.setDisabled(false);
|
455
|
+
target.setHidden(false);
|
456
|
+
} else if (type === 2) {
|
457
|
+
//仅显示
|
458
|
+
target.setDisabled && target.setDisabled(true);
|
459
|
+
target.setHidden(false);
|
460
|
+
} else if (type === 3) {
|
461
|
+
target.setHidden(true);
|
462
|
+
}
|
463
|
+
}
|
464
|
+
}
|
465
|
+
})
|
466
|
+
}*/
|
467
|
+
let flag = this.hanldeWfWidgetItem(target)
|
468
|
+
if (!hasModifyItem && flag) {
|
469
|
+
hasModifyItem = true
|
470
|
+
}
|
471
|
+
if (!saveButton && widget?.options?.saveButton) {
|
472
|
+
saveButton = target;
|
473
|
+
}
|
474
|
+
}
|
475
|
+
if (hasModifyItem) {
|
476
|
+
saveButton.setDisabled && saveButton.setDisabled(false);
|
477
|
+
saveButton.setHidden(false);
|
478
|
+
}
|
479
|
+
},
|
480
|
+
hanldeWfWidgetItem(target) {
|
481
|
+
let hasModifyItem = false;
|
482
|
+
let widget = target.field || target.widget;
|
483
|
+
let wfEdit = widget?.options.wfEdit;
|
484
|
+
// debugger
|
485
|
+
|
486
|
+
let bdService = this.bdService;
|
487
|
+
let wfParam = this.wfParam;
|
488
|
+
let wfInfo = wfParam.wfInfo
|
489
|
+
let modelKey = wfInfo.modelKey;
|
490
|
+
let companyCode = this.$store.getters.companyCode;
|
491
|
+
let taskStep = (wfInfo.taskStep ?? "") + "";
|
492
|
+
|
493
|
+
let handleWfConfigData = (e, widget) => {
|
494
|
+
let options = widget?.options;
|
495
|
+
if (!options || !options.wfEdit) return
|
496
|
+
let wfConfigData = options.wfConfigData || [];
|
497
|
+
let flag = false;
|
498
|
+
wfConfigData.forEach(item => {
|
499
|
+
let type = item.type;
|
500
|
+
let taskStepList = item.taskSteps ? item.taskSteps.split(',') : []
|
501
|
+
if (type && taskStepList.includes(taskStep)) {
|
502
|
+
let companyCodeStr = item.companyCodes;
|
503
|
+
let companyCodes = companyCodeStr ? companyCodeStr.split(",").filter(item => !!item) : [];
|
504
|
+
let flag1 = !item.serveName || item.serveName == bdService;
|
505
|
+
let flag2 = !item.modelKey || item.modelKey == modelKey;
|
506
|
+
let flag3 = !companyCodes.length || companyCodes.includes(companyCode)
|
507
|
+
if (flag1 && flag2 && flag3) {
|
508
|
+
if (type === 1) {
|
509
|
+
//可编辑
|
510
|
+
hasModifyItem = true;
|
511
|
+
if (options.disabled !== undefined) options.disabled = false;
|
512
|
+
// target.setDisabled && target.setDisabled(false);
|
513
|
+
// target.setHidden(false);
|
514
|
+
options.hidden = false;
|
515
|
+
flag = true;
|
516
|
+
} else if (type === 2) {
|
517
|
+
//仅显示
|
518
|
+
// target.setDisabled && target.setDisabled(true);
|
519
|
+
if (options.disabled !== undefined) options.disabled = true;
|
520
|
+
// target.setHidden(false);
|
521
|
+
options.hidden = false;
|
522
|
+
flag = true;
|
523
|
+
} else if (type === 3) {
|
524
|
+
// target.setHidden(true);
|
525
|
+
options.hidden = true;
|
526
|
+
flag = true;
|
527
|
+
}
|
528
|
+
}
|
529
|
+
}
|
530
|
+
})
|
531
|
+
if (flag && e && widget.type == 'baseAttachment') {
|
532
|
+
e.initOption();
|
533
|
+
}
|
534
|
+
}
|
535
|
+
handleWfConfigData(target, widget)
|
536
|
+
/*if (widget.type == "data-table") {
|
537
|
+
let loopDo = (t) => {
|
538
|
+
if (t.children && t.children.length) {
|
539
|
+
t.children.forEach(item => {
|
540
|
+
loopDo(item)
|
541
|
+
})
|
542
|
+
} else {
|
543
|
+
if (t.columnOption) {
|
544
|
+
handleWfConfigData(t.columnOption)
|
545
|
+
}
|
546
|
+
}
|
547
|
+
}
|
548
|
+
|
549
|
+
widget.options.tableColumns.forEach(item => {
|
550
|
+
loopDo(item)
|
551
|
+
this.loopHandleWidget(item.widgetList, (item1) => {
|
552
|
+
handleWfConfigData(item1.options)
|
553
|
+
});
|
554
|
+
})
|
555
|
+
this.loopHandleWidget(widget.widgetList, (item1) => {
|
556
|
+
handleWfConfigData(item1.options)
|
557
|
+
});
|
558
|
+
this.loopHandleWidget(widget.buttons, (item1) => {
|
559
|
+
handleWfConfigData(item1.options)
|
560
|
+
});
|
561
|
+
}*/
|
562
|
+
|
563
|
+
return hasModifyItem;
|
564
|
+
},
|
565
|
+
loadDefaultEntityData(callback) {
|
566
|
+
let formConfig = this.formConfig;
|
567
|
+
// let isLoadEntity = formConfig.isLoadEntity;
|
568
|
+
let entity = formConfig.entity;
|
569
|
+
let wfEnabled = formConfig.wfEnabled || false;
|
570
|
+
let dataId = this.dataId;
|
571
|
+
let reportTemplate = this.reportTemplate;
|
572
|
+
let scriptCode = formConfig.formScriptCode || "getOne";
|
573
|
+
|
574
|
+
let formData = {};
|
575
|
+
let wfConfig = null;
|
576
|
+
if (entity && dataId && scriptCode) {
|
577
|
+
let formCode = reportTemplate.formCode;
|
578
|
+
let otherParam = {};
|
579
|
+
let wfCode = reportTemplate.objTypeCode;
|
580
|
+
if (wfEnabled) {
|
581
|
+
wfConfig = (res) => {
|
582
|
+
let wfConfig1 = null;
|
583
|
+
let callback1 = null;
|
584
|
+
if (formConfig.wfConfig) {
|
585
|
+
let formData = res.objx;
|
586
|
+
let e = new Function('formCode', 'dataId', 'formData', formConfig.wfConfig);
|
587
|
+
wfConfig1 = e.call(this, formCode, dataId, formData);
|
588
|
+
callback1 = wfConfig1?.callback;
|
589
|
+
delete wfConfig1?.callback;
|
590
|
+
}
|
591
|
+
|
592
|
+
let option = {
|
593
|
+
objId: dataId, //单据ID
|
594
|
+
wfCode: wfCode, //流程编码
|
595
|
+
showStartBtn: true, //是否放出启动按钮,流程已启动时此参数失效
|
596
|
+
formCode: formCode,
|
597
|
+
callback: (wfParam) => {
|
598
|
+
this.setFormData(formData);
|
599
|
+
|
600
|
+
let {hasWf} = wfParam;
|
601
|
+
this.hasWf = hasWf;
|
602
|
+
this.wfParam = wfParam;
|
603
|
+
this.showFormContent = true;
|
604
|
+
this.$nextTick(() => {
|
605
|
+
this.handleShowHideRule();
|
606
|
+
if (hasWf) {
|
607
|
+
setTimeout(() => {
|
608
|
+
this.hanldeWfWidget();
|
609
|
+
this.hanldeWfWidget2();
|
610
|
+
callback && callback()
|
611
|
+
callback1 && callback1(wfParam)
|
612
|
+
}, 1000)
|
613
|
+
}
|
614
|
+
wfParam.done()
|
615
|
+
})
|
616
|
+
/*this.handleShowContent(() => {
|
617
|
+
if (hasWf) {
|
618
|
+
setTimeout(() => {
|
619
|
+
this.hanldeWfWidget();
|
620
|
+
this.hanldeWfWidget2();
|
621
|
+
callback && callback()
|
622
|
+
}, 1000)
|
623
|
+
}
|
624
|
+
wfParam.done()
|
625
|
+
});*/
|
626
|
+
}
|
627
|
+
};
|
628
|
+
if (formConfig.wfStartBindSave) {
|
629
|
+
option.onStart = (done) => {
|
630
|
+
let formRef = this.getFormRef ? this.getFormRef() : this;
|
631
|
+
formRef.validate(valid => {
|
632
|
+
if (valid) {
|
633
|
+
done();
|
634
|
+
}
|
635
|
+
});
|
636
|
+
}
|
637
|
+
option.onBeforeStartSubmit = (done) => {
|
638
|
+
this.saveDefaultHandle({
|
639
|
+
config: {
|
640
|
+
successMsg: false,
|
641
|
+
isConfirm: false,
|
642
|
+
success: res => {
|
643
|
+
done()
|
644
|
+
},
|
645
|
+
}
|
646
|
+
})
|
647
|
+
}
|
648
|
+
}
|
649
|
+
let resOption = option
|
650
|
+
if (wfConfig1) {
|
651
|
+
resOption = extendDeeply(resOption, wfConfig1)
|
652
|
+
}
|
653
|
+
return resOption;
|
654
|
+
}
|
655
|
+
}
|
656
|
+
|
657
|
+
let formScriptParam = this.handleCustomEvent(this.formConfig.formScriptParam);
|
658
|
+
|
659
|
+
let defaultOption = {
|
660
|
+
addCreateInfo: true,
|
661
|
+
queryCreateInfo: window.$vueRoot.$store.getters.queryCreateInfo || "0"
|
662
|
+
};
|
663
|
+
return this.formHttp({
|
664
|
+
// url: "/" + reportTemplate.serviceName + "/form_ins/getOne",
|
665
|
+
scriptCode: scriptCode,
|
666
|
+
data: {
|
667
|
+
formCode: formCode,
|
668
|
+
formVersion: reportTemplate.formVersion,
|
669
|
+
taBm: entity,
|
670
|
+
data: {
|
671
|
+
id: dataId,
|
672
|
+
...formScriptParam
|
673
|
+
}
|
674
|
+
},
|
675
|
+
...defaultOption,
|
676
|
+
sync: false,
|
677
|
+
wfConfig,
|
678
|
+
success: res => {
|
679
|
+
formData = res.objx || {};
|
680
|
+
// this.currentFormData = res.objx || {};
|
681
|
+
if (!wfConfig) {
|
682
|
+
this.setFormData(formData);
|
683
|
+
this.showFormContent = true;
|
684
|
+
this.$nextTick(() => {
|
685
|
+
this.handleShowHideRule();
|
686
|
+
callback && callback()
|
687
|
+
})
|
688
|
+
}
|
689
|
+
}
|
690
|
+
});
|
691
|
+
} else {
|
692
|
+
this.handleShowContent();
|
693
|
+
}
|
694
|
+
},
|
695
|
+
handleShowHideRule() {
|
696
|
+
return;
|
697
|
+
let userId = this.$store.getters.userId;
|
698
|
+
let userSaleOrgDTOs = this.userSaleOrgDTOs;
|
699
|
+
let userRoleDTOs = this.userRoleDTOs;
|
700
|
+
let saleOrgIds = userSaleOrgDTOs.map(item => item.saleOrgId);
|
701
|
+
let roleIds = userRoleDTOs.map(item => item.roleId);
|
702
|
+
let refList = this.widgetRefList;
|
703
|
+
for (let key in refList) {
|
704
|
+
let target = refList[key];
|
705
|
+
let widget = target.field || target.widget;
|
706
|
+
if (widget?.options?.showRuleEnabled) {
|
707
|
+
let showRules = widget.options.showRules || [];
|
708
|
+
showRules.forEach(showRule => {
|
709
|
+
let ruleType = showRule.ruleType
|
710
|
+
let isShow = showRule.show
|
711
|
+
let value = showRule.value || []
|
712
|
+
let valIds = value.map(item => item.id)
|
713
|
+
if (valIds.length) {
|
714
|
+
let result = !widget.options.hidden;
|
715
|
+
if (ruleType == 1) {
|
716
|
+
result = valIds.includes(userId) ? isShow : !isShow
|
717
|
+
} else if (ruleType == 2) {
|
718
|
+
result = saleOrgIds.find(item => valIds.includes(item)) ? isShow : !isShow
|
719
|
+
} else if (ruleType == 3) {
|
720
|
+
result = roleIds.find(item => valIds.includes(item)) ? isShow : !isShow
|
721
|
+
}
|
722
|
+
target.setHidden(!result)
|
723
|
+
}
|
724
|
+
})
|
725
|
+
}
|
726
|
+
}
|
727
|
+
},
|
728
|
+
initFormObject: function () {
|
729
|
+
let e = this,
|
730
|
+
t = !(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0];
|
731
|
+
(this.formId = 'vfRender' + baseRefUtil.generateId()),
|
732
|
+
t && !this.dynamicCreation && this.insertCustomStyleAndScriptNode(),
|
733
|
+
this.addFieldChangeEventHandler(),
|
734
|
+
this.addFieldValidateEventHandler(),
|
735
|
+
this.registerFormToRefList(),
|
736
|
+
// this.handleOnCreated(),
|
737
|
+
this.disabledMode
|
738
|
+
&& this.$nextTick(function () {
|
739
|
+
e.disableForm();
|
740
|
+
});
|
741
|
+
},
|
742
|
+
getContainerWidgetName: function (e) {
|
743
|
+
return 'grid' === e.type ? 'grid-item' : e.type + '-item';
|
744
|
+
},
|
745
|
+
getWidgetName: function (e) {
|
746
|
+
return (e.targetType || e.type) + '-widget';
|
747
|
+
},
|
748
|
+
initLocale: function () {
|
749
|
+
let e = localStorage.getItem('v_form_locale') || 'zh-CN';
|
750
|
+
this.changeLanguage(e);
|
751
|
+
},
|
752
|
+
insertCustomStyleAndScriptNode: function () {
|
753
|
+
this.formConfig && this.formConfig.cssCode && baseRefUtil.insertCustomCssToHead(this.formConfig.cssCode, this
|
754
|
+
.previewState ? '' : this.formId),
|
755
|
+
this.formConfig && this.formConfig.functions && baseRefUtil.insertGlobalFunctionsToHtml(this.formConfig
|
756
|
+
.functions, this
|
757
|
+
.previewState ? '' : this.formId);
|
758
|
+
},
|
759
|
+
buildFormModel: function (e) {
|
760
|
+
let t = this;
|
761
|
+
e
|
762
|
+
&& e.length > 0
|
763
|
+
&& e.forEach(function (e) {
|
764
|
+
t.buildDataFromWidget(e);
|
765
|
+
});
|
766
|
+
},
|
767
|
+
buildDataFromWidget: function (e) {
|
768
|
+
let t = this;
|
769
|
+
let dataId = this.dataId;
|
770
|
+
let currentFormData = this.currentFormData;
|
771
|
+
let fieldKeyName = this.getFieldKeyName(e)
|
772
|
+
let defaultValue = e.options.defaultValue === undefined || e.options.defaultValue === "" ? null : e.options.defaultValue;
|
773
|
+
if ('container' === e.category) {
|
774
|
+
if ('vf-dialog' === e.type || 'vf-drawer' === e.type) ;
|
775
|
+
else if ('data-table' === e.type) {
|
776
|
+
if (!!e.widgetList && (e.widgetList.length > 0)) {
|
777
|
+
e.widgetList.forEach((childItem) => {
|
778
|
+
this.buildDataFromWidget(childItem, e);
|
779
|
+
});
|
780
|
+
}
|
781
|
+
} else if ('list-h5' === e.type) {
|
782
|
+
if (!!e.widgetList && (e.widgetList.length > 0)) {
|
783
|
+
e.widgetList.forEach((childItem) => {
|
784
|
+
this.buildDataFromWidget(childItem, e);
|
785
|
+
});
|
786
|
+
}
|
787
|
+
} else if ('grid' === e.type)
|
788
|
+
e.cols
|
789
|
+
&& e.cols.length > 0
|
790
|
+
&& e.cols.forEach(function (e) {
|
791
|
+
t.buildDataFromWidget(e);
|
792
|
+
});
|
793
|
+
else if ('table' === e.type)
|
794
|
+
e.rows
|
795
|
+
&& e.rows.length > 0
|
796
|
+
&& e.rows.forEach(function (e) {
|
797
|
+
e.cols
|
798
|
+
&& e.cols.length > 0
|
799
|
+
&& e.cols.forEach(function (e) {
|
800
|
+
t.buildDataFromWidget(e);
|
801
|
+
});
|
802
|
+
});
|
803
|
+
else if ('h5-table' === e.type)
|
804
|
+
e.rows
|
805
|
+
&& e.rows.length > 0
|
806
|
+
&& e.rows.forEach(function (e) {
|
807
|
+
e.cols
|
808
|
+
&& e.cols.length > 0
|
809
|
+
&& e.cols.forEach(function (e) {
|
810
|
+
t.buildDataFromWidget(e);
|
811
|
+
});
|
812
|
+
});
|
813
|
+
else if ('tab' === e.type)
|
814
|
+
e.tabs
|
815
|
+
&& e.tabs.length > 0
|
816
|
+
&& e.tabs.forEach(function (e) {
|
817
|
+
e.widgetList
|
818
|
+
&& e.widgetList.length > 0
|
819
|
+
&& e.widgetList.forEach(function (e) {
|
820
|
+
t.buildDataFromWidget(e);
|
821
|
+
});
|
822
|
+
});
|
823
|
+
else if ('detail' === e.type)
|
824
|
+
e.panes
|
825
|
+
&& e.panes.length > 0
|
826
|
+
&& e.panes.forEach(function (e) {
|
827
|
+
e.widgetList
|
828
|
+
&& e.widgetList.length > 0
|
829
|
+
&& e.widgetList.forEach(function (e) {
|
830
|
+
t.buildDataFromWidget(e);
|
831
|
+
});
|
832
|
+
});
|
833
|
+
else if ('sub-form' === e.type) {
|
834
|
+
let i = e.options.name;
|
835
|
+
if (currentFormData.hasOwnProperty(i)) {
|
836
|
+
let n = currentFormData[i];
|
837
|
+
this.$set(this.formDataModel, i, baseRefUtil.deepClone(n));
|
838
|
+
} else {
|
839
|
+
let o = {};
|
840
|
+
e.options.showBlankRow
|
841
|
+
? (e.widgetList.forEach(function (e) {
|
842
|
+
e.formItemFlag && (o[e.options.name] = defaultValue);
|
843
|
+
}),
|
844
|
+
this.$set(this.formDataModel, i, [o]))
|
845
|
+
: this.$set(this.formDataModel, i, []);
|
846
|
+
}
|
847
|
+
} else if ('grid-sub-form' === e.type) {
|
848
|
+
let a = e.options.name;
|
849
|
+
if (currentFormData.hasOwnProperty(a)) {
|
850
|
+
let l = currentFormData[a];
|
851
|
+
this.$set(this.formDataModel, a, baseRefUtil.deepClone(l));
|
852
|
+
} else {
|
853
|
+
let s = [],
|
854
|
+
r = function (e) {
|
855
|
+
s.push(e);
|
856
|
+
};
|
857
|
+
baseRefUtil.traverseFieldWidgetsOfContainer(e, r);
|
858
|
+
let d = {};
|
859
|
+
e.options.showBlankRow
|
860
|
+
? (s.forEach(function (e) {
|
861
|
+
d[e.options.name] = defaultValue;
|
862
|
+
}),
|
863
|
+
this.$set(this.formDataModel, a, [d]))
|
864
|
+
: this.$set(this.formDataModel, a, []);
|
865
|
+
}
|
866
|
+
} else if ('detail-h5' === e.type) {
|
867
|
+
e.panes
|
868
|
+
&& e.panes.length > 0
|
869
|
+
&& e.panes.forEach(function (e) {
|
870
|
+
t.buildDataFromWidget(e);
|
871
|
+
});
|
872
|
+
} else if ('h5-card' === e.type) {
|
873
|
+
e.panes
|
874
|
+
&& e.panes.length > 0
|
875
|
+
&& e.panes.forEach(function (e) {
|
876
|
+
e.widgetList
|
877
|
+
&& e.widgetList.length > 0
|
878
|
+
&& e.widgetList.forEach(function (e) {
|
879
|
+
t.buildDataFromWidget(e);
|
880
|
+
});
|
881
|
+
});
|
882
|
+
} else
|
883
|
+
'grid-col' === e.type || e.type,
|
884
|
+
e.widgetList
|
885
|
+
&& e.widgetList.length > 0
|
886
|
+
&& e.widgetList.forEach(function (e) {
|
887
|
+
t.buildDataFromWidget(e);
|
888
|
+
});
|
889
|
+
} else if ('vabsearch' === e.type) {
|
890
|
+
|
891
|
+
let c = currentFormData[fieldKeyName];
|
892
|
+
this.$set(this.formDataModel, fieldKeyName, baseRefUtil.deepClone(c));
|
893
|
+
let vabSearchName = e.options.vabSearchName;
|
894
|
+
if (vabSearchName) {
|
895
|
+
let val = currentFormData[vabSearchName] ?? null;
|
896
|
+
this.$set(this.formDataModel, vabSearchName, baseRefUtil.deepClone(val));
|
897
|
+
}
|
898
|
+
} else if ('table2-item' === e.type) {
|
899
|
+
this.$set(this.formDataModel, fieldKeyName, []);
|
900
|
+
} else if (e.formItemFlag) {
|
901
|
+
if (dataId || currentFormData.hasOwnProperty(fieldKeyName)) {
|
902
|
+
let c = currentFormData[fieldKeyName] ?? null;
|
903
|
+
this.$set(this.formDataModel, fieldKeyName, baseRefUtil.deepClone(c));
|
904
|
+
} else {
|
905
|
+
this.$set(this.formDataModel, fieldKeyName, defaultValue);
|
906
|
+
}
|
907
|
+
}
|
908
|
+
},
|
909
|
+
addFieldChangeEventHandler: function () {
|
910
|
+
let e = this;
|
911
|
+
this.$off('fieldChange'),
|
912
|
+
this.$on('fieldChange', function (t, i, n, o, a) {
|
913
|
+
e.handleFieldDataChange(t, i, n, o, a), e.$emit('formChange', t, i, n, e.formDataModel, o, a);
|
914
|
+
});
|
915
|
+
},
|
916
|
+
addFieldValidateEventHandler: function () {
|
917
|
+
let e = this;
|
918
|
+
this.$off('fieldValidation'),
|
919
|
+
this.$on('fieldValidation', function (t) {
|
920
|
+
e.$refs.renderForm.validateField(t);
|
921
|
+
});
|
922
|
+
},
|
923
|
+
registerFormToRefList: function () {
|
924
|
+
this.widgetRefList['v_form_ref'] = this;
|
925
|
+
},
|
926
|
+
handleFieldDataChange: function (e, t, i, n, o) {
|
927
|
+
if (this.formConfig && this.formConfig.onFormDataChange) {
|
928
|
+
let a = new Function('fieldName', 'newValue', 'oldValue', 'formModel', 'subFormName', 'subFormRowIndex',
|
929
|
+
this.formConfig.onFormDataChange);
|
930
|
+
a.call(this, e, t, i, this.formDataModel, n, o);
|
931
|
+
}
|
932
|
+
},
|
933
|
+
|
934
|
+
getEventParam() {
|
935
|
+
let dataId = this.dataId;
|
936
|
+
let formCode = this.reportTemplate.formCode;
|
937
|
+
return {
|
938
|
+
eventParamNames: ["dataId", "formCode"],
|
939
|
+
eventParamValues: [dataId, formCode],
|
940
|
+
}
|
941
|
+
},
|
942
|
+
handleCustomEvent(funtionStr, eventParamNames = [], eventParamValues = []) {
|
943
|
+
if (!this.designState && funtionStr) {
|
944
|
+
let eventParam = this.getEventParam();
|
945
|
+
var e = new Function(...eventParam.eventParamNames, ...eventParamNames, funtionStr);
|
946
|
+
return e.call(this, ...eventParam.eventParamValues, ...eventParamValues);
|
947
|
+
}
|
948
|
+
},
|
949
|
+
|
950
|
+
handleOnCreated: function () {
|
951
|
+
this.handleCustomEvent(this.formConfig?.onFormCreated);
|
952
|
+
/*if (this.formConfig && this.formConfig.onFormCreated) {
|
953
|
+
let e = new Function(this.formConfig.onFormCreated);
|
954
|
+
e.call(this);
|
955
|
+
}*/
|
956
|
+
},
|
957
|
+
handleOnMounted: function () {
|
958
|
+
/*if (this.formConfig && this.formConfig.onFormMounted) {
|
959
|
+
let e = new Function(this.formConfig.onFormMounted);
|
960
|
+
e.call(this);
|
961
|
+
}*/
|
962
|
+
this.handleCustomEvent(this.formConfig?.onFormMounted);
|
963
|
+
},
|
964
|
+
findWidgetAndSetDisabled: function (e, t) {
|
965
|
+
let i = this.getWidgetRef(e);
|
966
|
+
i && i.setDisabled ? i.setDisabled(t) : this.findWidgetOfSubFormAndSetDisabled(e, t);
|
967
|
+
},
|
968
|
+
findWidgetOfSubFormAndSetDisabled: function (e, t) {
|
969
|
+
let i = this,
|
970
|
+
n = baseRefUtil.getFieldWidgetByName(this.formJsonObj.widgetList, e);
|
971
|
+
n && n.options && n.options.hasOwnProperty('disabled') && (n.options.disabled = t),
|
972
|
+
this.findWidgetNameInSubForm(e).forEach(function (e) {
|
973
|
+
let n = i.getWidgetRef(e);
|
974
|
+
n && n.setDisabled && n.setDisabled(t);
|
975
|
+
});
|
976
|
+
},
|
977
|
+
findWidgetAndSetHidden: function (e, t) {
|
978
|
+
let i = this.getWidgetRef(e);
|
979
|
+
i && i.setDisabled ? i.setHidden(t) : this.findWidgetOfSubFormAndSetHidden(e, t);
|
980
|
+
},
|
981
|
+
findWidgetOfSubFormAndSetHidden: function (e, t) {
|
982
|
+
let i = this,
|
983
|
+
n = baseRefUtil.getFieldWidgetByName(this.formJsonObj.widgetList, e);
|
984
|
+
n && n.options && n.options.hasOwnProperty('hidden') && (n.options.hidden = t),
|
985
|
+
this.findWidgetNameInSubForm(e).forEach(function (e) {
|
986
|
+
let n = i.getWidgetRef(e);
|
987
|
+
n && n.setDisabled && n.setHidden(t);
|
988
|
+
});
|
989
|
+
},
|
990
|
+
findWidgetNameInSubForm: function (e) {
|
991
|
+
let t = [],
|
992
|
+
i = null,
|
993
|
+
n = function (t, n) {
|
994
|
+
t.options && t.options.name === e && (i = n.options.name);
|
995
|
+
};
|
996
|
+
if ((baseRefUtil.traverseFieldWidgets(this.widgetList, n), i)) {
|
997
|
+
let o = this.getWidgetRef(i);
|
998
|
+
if (o) {
|
999
|
+
let a = o.getRowIdData();
|
1000
|
+
a
|
1001
|
+
&& a.length > 0
|
1002
|
+
&& a.forEach(function (i) {
|
1003
|
+
t.push(e + '@row' + i);
|
1004
|
+
});
|
1005
|
+
}
|
1006
|
+
}
|
1007
|
+
return t;
|
1008
|
+
},
|
1009
|
+
changeLanguage: function (e) {
|
1010
|
+
baseRefUtil.changeLocale(e);
|
1011
|
+
},
|
1012
|
+
getLanguageName: function () {
|
1013
|
+
return localStorage.getItem('v_form_locale') || 'zh-CN';
|
1014
|
+
},
|
1015
|
+
getNativeForm: function () {
|
1016
|
+
return this.$refs['renderForm'];
|
1017
|
+
},
|
1018
|
+
getWidgetRef: function (e) {
|
1019
|
+
let t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1],
|
1020
|
+
i = this.widgetRefList[e];
|
1021
|
+
return !i && t && this.$message.error(this.i18nt('render.hint.refNotFound') + e), i;
|
1022
|
+
},
|
1023
|
+
clearFormDataModel: function () {
|
1024
|
+
for (let e in this.formDataModel) delete this.formDataModel[e];
|
1025
|
+
},
|
1026
|
+
setFormJson: function (e) {
|
1027
|
+
let t = this;
|
1028
|
+
if (e)
|
1029
|
+
if ('string' === typeof e || e.constructor === Object) {
|
1030
|
+
let i = null;
|
1031
|
+
if (((i = 'string' === typeof e ? JSON.parse(e) : e), !i.formConfig || !i.widgetList)) return void this
|
1032
|
+
.$message.error('Invalid format of form json.');
|
1033
|
+
this.clearFormDataModel(),
|
1034
|
+
this.buildFormModel(i.widgetList),
|
1035
|
+
this.$set(this.formJsonObj, 'formConfig', i.formConfig),
|
1036
|
+
(this._provided.formConfig = i.formConfig),
|
1037
|
+
this.$set(this.formJsonObj, 'widgetList', i.widgetList),
|
1038
|
+
this.insertCustomStyleAndScriptNode(),
|
1039
|
+
this.$nextTick(function () {
|
1040
|
+
t.initFormObject(!1), t.handleOnMounted();
|
1041
|
+
});
|
1042
|
+
} else this.$message.error('Set form json failed.');
|
1043
|
+
},
|
1044
|
+
reloadOptionData: function (e) {
|
1045
|
+
let t = [];
|
1046
|
+
e && 'string' === typeof e ? (t = [e]) : e && Array.isArray(e) && (t = [...e]), this.broadcast('FieldWidget',
|
1047
|
+
'reloadOptionItems', [t]);
|
1048
|
+
},
|
1049
|
+
getFormData: function () {
|
1050
|
+
let e = this,
|
1051
|
+
t = !(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0];
|
1052
|
+
if (!t) return this.formDataModel;
|
1053
|
+
let i = function () {
|
1054
|
+
},
|
1055
|
+
n = new window.Promise(function (e, t) {
|
1056
|
+
i = function (i, n) {
|
1057
|
+
n ? t(n) : e(i);
|
1058
|
+
};
|
1059
|
+
});
|
1060
|
+
return (
|
1061
|
+
this.$refs['renderForm'].validate(function (t) {
|
1062
|
+
t ? i(e.formDataModel) : i(e.formDataModel, e.i18nt('render.hint.validationFailed'));
|
1063
|
+
}),
|
1064
|
+
n
|
1065
|
+
);
|
1066
|
+
},
|
1067
|
+
setFormData: function (e) {
|
1068
|
+
let t = this;
|
1069
|
+
/*Object.keys(this.formDataModel).forEach(function (i) {
|
1070
|
+
e && e.hasOwnProperty(i) && (t.formDataModel[i] = baseRefUtil.deepClone(e[i]));
|
1071
|
+
});*/
|
1072
|
+
Object.assign(t.formDataModel, baseRefUtil.deepClone(e))
|
1073
|
+
this.currentFormData = e || {};
|
1074
|
+
this.broadcast('ContainerItem', 'setFormData', this.formDataModel),
|
1075
|
+
this.broadcast('FieldWidget', 'setFormData', this.formDataModel);
|
1076
|
+
},
|
1077
|
+
getFieldValue: function (e) {
|
1078
|
+
let t = this,
|
1079
|
+
i = this.getWidgetRef(e);
|
1080
|
+
if (i && i.getValue) return i.getValue();
|
1081
|
+
if (!i) {
|
1082
|
+
let n = [];
|
1083
|
+
return (
|
1084
|
+
this.findWidgetNameInSubForm(e).forEach(function (e) {
|
1085
|
+
let i = t.getWidgetRef(e);
|
1086
|
+
i && i.getValue && n.push(i.getValue());
|
1087
|
+
}),
|
1088
|
+
n
|
1089
|
+
);
|
1090
|
+
}
|
1091
|
+
},
|
1092
|
+
setFieldValue: function (e, t) {
|
1093
|
+
let i = this,
|
1094
|
+
n = this.getWidgetRef(e);
|
1095
|
+
n && n.setValue && n.setValue(t),
|
1096
|
+
n
|
1097
|
+
|| this.findWidgetNameInSubForm(e).forEach(function (e) {
|
1098
|
+
let n = i.getWidgetRef(e);
|
1099
|
+
n && n.setValue && n.setValue(t);
|
1100
|
+
});
|
1101
|
+
},
|
1102
|
+
getSubFormValues: function (e) {
|
1103
|
+
let t = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1],
|
1104
|
+
i = this.subFormRefList[e];
|
1105
|
+
return i.getSubFormValues(t);
|
1106
|
+
},
|
1107
|
+
setSubFormValues: function (e, t) {
|
1108
|
+
},
|
1109
|
+
disableForm: function () {
|
1110
|
+
let e = this,
|
1111
|
+
t = Object.keys(this.widgetRefList);
|
1112
|
+
t.forEach(function (t) {
|
1113
|
+
let i = e.getWidgetRef(t);
|
1114
|
+
i
|
1115
|
+
&& (i.widget && 'sub-form' === i.widget.type
|
1116
|
+
? i.disableSubForm()
|
1117
|
+
: i.widget && 'grid-sub-form' === i.widget.type
|
1118
|
+
? i.disableGridSubForm()
|
1119
|
+
: i.setDisabled && i.setDisabled(!0));
|
1120
|
+
});
|
1121
|
+
},
|
1122
|
+
enableForm: function () {
|
1123
|
+
let e = this,
|
1124
|
+
t = Object.keys(this.widgetRefList);
|
1125
|
+
t.forEach(function (t) {
|
1126
|
+
let i = e.getWidgetRef(t);
|
1127
|
+
i
|
1128
|
+
&& (i.widget && 'sub-form' === i.widget.type
|
1129
|
+
? i.enableSubForm()
|
1130
|
+
: i.widget && 'grid-sub-form' === i.widget.type
|
1131
|
+
? i.enableGridSubForm()
|
1132
|
+
: i.setDisabled && i.setDisabled(!1));
|
1133
|
+
});
|
1134
|
+
},
|
1135
|
+
resetForm: function () {
|
1136
|
+
let e = this,
|
1137
|
+
t = Object.keys(this.subFormRefList);
|
1138
|
+
t.forEach(function (t) {
|
1139
|
+
e.subFormRefList[t].resetSubForm && e.subFormRefList[t].resetSubForm();
|
1140
|
+
});
|
1141
|
+
let i = Object.keys(this.widgetRefList);
|
1142
|
+
i.forEach(function (t) {
|
1143
|
+
let i = e.getWidgetRef(t);
|
1144
|
+
i && !i.subFormItemFlag && i.resetField && i.resetField();
|
1145
|
+
}),
|
1146
|
+
this.$nextTick(function () {
|
1147
|
+
e.clearValidate();
|
1148
|
+
});
|
1149
|
+
},
|
1150
|
+
clearValidate: function (e) {
|
1151
|
+
this.$refs.renderForm.clearValidate(e);
|
1152
|
+
},
|
1153
|
+
validateForm: function (e) {
|
1154
|
+
this.$refs['renderForm'].$baseValidate(function (t) {
|
1155
|
+
e(t);
|
1156
|
+
});
|
1157
|
+
},
|
1158
|
+
validateFields: function () {
|
1159
|
+
},
|
1160
|
+
disableWidgets: function (e) {
|
1161
|
+
let t = this;
|
1162
|
+
e
|
1163
|
+
&& ('string' === typeof e
|
1164
|
+
? this.findWidgetAndSetDisabled(e, !0)
|
1165
|
+
: Array.isArray(e)
|
1166
|
+
&& e.forEach(function (e) {
|
1167
|
+
t.findWidgetAndSetDisabled(e, !0);
|
1168
|
+
}));
|
1169
|
+
},
|
1170
|
+
enableWidgets: function (e) {
|
1171
|
+
let t = this;
|
1172
|
+
e
|
1173
|
+
&& ('string' === typeof e
|
1174
|
+
? this.findWidgetAndSetDisabled(e, !1)
|
1175
|
+
: Array.isArray(e)
|
1176
|
+
&& e.forEach(function (e) {
|
1177
|
+
t.findWidgetAndSetDisabled(e, !1);
|
1178
|
+
}));
|
1179
|
+
},
|
1180
|
+
hideWidgets: function (e) {
|
1181
|
+
let t = this;
|
1182
|
+
e
|
1183
|
+
&& ('string' === typeof e
|
1184
|
+
? this.findWidgetAndSetHidden(e, !0)
|
1185
|
+
: Array.isArray(e)
|
1186
|
+
&& e.forEach(function (e) {
|
1187
|
+
t.findWidgetAndSetHidden(e, !0);
|
1188
|
+
}));
|
1189
|
+
},
|
1190
|
+
showWidgets: function (e) {
|
1191
|
+
let t = this;
|
1192
|
+
e
|
1193
|
+
&& ('string' === typeof e
|
1194
|
+
? this.findWidgetAndSetHidden(e, !1)
|
1195
|
+
: Array.isArray(e)
|
1196
|
+
&& e.forEach(function (e) {
|
1197
|
+
t.findWidgetAndSetHidden(e, !1);
|
1198
|
+
}));
|
1199
|
+
},
|
1200
|
+
getFieldWidgets: function () {
|
1201
|
+
let e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null;
|
1202
|
+
return e ? baseRefUtil.getAllFieldWidgets(e) : baseRefUtil.getAllFieldWidgets(this.formJsonObj.widgetList);
|
1203
|
+
},
|
1204
|
+
getContainerWidgets: function () {
|
1205
|
+
let e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null;
|
1206
|
+
return e ? baseRefUtil.getAllContainerWidgets(e) : baseRefUtil.getAllContainerWidgets(this.formJsonObj
|
1207
|
+
.widgetList);
|
1208
|
+
},
|
1209
|
+
addEC: function (e, t) {
|
1210
|
+
this.externalComponents[e] = t;
|
1211
|
+
},
|
1212
|
+
hasEC: function (e) {
|
1213
|
+
return this.externalComponents.hasOwnProperty(e);
|
1214
|
+
},
|
1215
|
+
getEC: function (e) {
|
1216
|
+
return this.externalComponents[e];
|
1217
|
+
},
|
1218
|
+
setReadMode: function () {
|
1219
|
+
let e = !(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0];
|
1220
|
+
this.readModeFlag = e;
|
1221
|
+
},
|
1222
|
+
getReadMode: function () {
|
1223
|
+
return this.readModeFlag;
|
1224
|
+
},
|
1225
|
+
getGlobalDsv: function () {
|
1226
|
+
return this.globalDsv;
|
1227
|
+
},
|
1228
|
+
executeDataSource: function (e, t) {
|
1229
|
+
let i = this;
|
1230
|
+
return Object(ie['a'])(
|
1231
|
+
regeneratorRuntime.mark(function n() {
|
1232
|
+
let o, a;
|
1233
|
+
return regeneratorRuntime.wrap(function (n) {
|
1234
|
+
while (1)
|
1235
|
+
switch ((n.prev = n.next)) {
|
1236
|
+
case 0:
|
1237
|
+
return (
|
1238
|
+
(o = baseRefUtil.getDSByName(i.formJsonObj.formConfig, e)),
|
1239
|
+
(a = new Object({})),
|
1240
|
+
baseRefUtil.overwriteObj(a, i.globalDsv),
|
1241
|
+
baseRefUtil.overwriteObj(a, t),
|
1242
|
+
(n.next = 6),
|
1243
|
+
baseRefUtil.runDataSourceRequest(o, a, i, !1, i.$message)
|
1244
|
+
);
|
1245
|
+
case 6:
|
1246
|
+
return n.abrupt('return', n.sent);
|
1247
|
+
case 7:
|
1248
|
+
case 'end':
|
1249
|
+
return n.stop();
|
1250
|
+
}
|
1251
|
+
}, n);
|
1252
|
+
})
|
1253
|
+
)();
|
1254
|
+
},
|
1255
|
+
getParentFormRef: function () {
|
1256
|
+
return this.parentForm;
|
1257
|
+
},
|
1258
|
+
isDynamicCreation: function () {
|
1259
|
+
return this.dynamicCreation;
|
1260
|
+
},
|
1261
|
+
setDialogOrDrawerRef: function (e) {
|
1262
|
+
this.dialogOrDrawerRef = e;
|
1263
|
+
},
|
1264
|
+
getDialogOrDrawerRef: function () {
|
1265
|
+
return this.dialogOrDrawerRef;
|
1266
|
+
},
|
1267
|
+
showDialog: function (e, t) {
|
1268
|
+
let i = baseRefUtil.getContainerWidgetByName(this.widgetList, e);
|
1269
|
+
if (e && 'vf-dialog' === i.type) {
|
1270
|
+
let n = {
|
1271
|
+
widgetList: baseRefUtil.deepClone(i.widgetList),
|
1272
|
+
formConfig: baseRefUtil.cloneFormConfigWithoutEventHandler(this.formConfig)
|
1273
|
+
},
|
1274
|
+
// a = o.a.extend(fe),
|
1275
|
+
a = baseRefUtil.Vue.extend(baseRefUtil.dynamicDialogRender),
|
1276
|
+
l = new a({
|
1277
|
+
propsData: {
|
1278
|
+
options: i.options,
|
1279
|
+
formJson: n,
|
1280
|
+
formData: t || {},
|
1281
|
+
optionData: this.optionData,
|
1282
|
+
globalDsv: this.globalDsv,
|
1283
|
+
parentFormRef: this
|
1284
|
+
},
|
1285
|
+
components: {VFormRender}
|
1286
|
+
});
|
1287
|
+
document.body.appendChild(l.$mount().$el), l.show();
|
1288
|
+
} else {
|
1289
|
+
this.$message.error(this.i18nt('render.hint.refNotFound') + e);
|
1290
|
+
}
|
1291
|
+
},
|
1292
|
+
showDrawer: function (e, t) {
|
1293
|
+
let i = baseRefUtil.getContainerWidgetByName(this.widgetList, e);
|
1294
|
+
if (i && 'vf-drawer' === i.type) {
|
1295
|
+
let n = {
|
1296
|
+
widgetList: baseRefUtil.deepClone(i.widgetList),
|
1297
|
+
formConfig: baseRefUtil.cloneFormConfigWithoutEventHandler(this.formConfig)
|
1298
|
+
},
|
1299
|
+
a = o.a.extend(we),
|
1300
|
+
l = new a({
|
1301
|
+
propsData: {
|
1302
|
+
options: i.options,
|
1303
|
+
formJson: n,
|
1304
|
+
formData: t || {},
|
1305
|
+
optionData: this.optionData,
|
1306
|
+
globalDsv: this.globalDsv,
|
1307
|
+
parentFormRef: this
|
1308
|
+
}
|
1309
|
+
});
|
1310
|
+
document.body.appendChild(l.$mount().$el), l.show();
|
1311
|
+
} else this.$message.error(this.i18nt('render.hint.refNotFound') + e);
|
1312
|
+
},
|
1313
|
+
showDialogOrDrawer: function (e) {
|
1314
|
+
},
|
1315
|
+
getTableFiledMap(flag) {
|
1316
|
+
let fieldMap = {};
|
1317
|
+
let fJson = this.formJson;
|
1318
|
+
let itemFieldMap = {
|
1319
|
+
grid: "cols",
|
1320
|
+
table: "rows",
|
1321
|
+
"table-cell": "widgetList",
|
1322
|
+
'h5-table': "rows",
|
1323
|
+
"h5-table-cell": "widgetList",
|
1324
|
+
tab: "tabs",
|
1325
|
+
"tab-pane": "widgetList",
|
1326
|
+
"grid-col": "widgetList",
|
1327
|
+
"vf-box": "widgetList",
|
1328
|
+
"card": "widgetList",
|
1329
|
+
"detail": "panes",
|
1330
|
+
"detail-pane": "widgetList",
|
1331
|
+
"detail-h5": "panes",
|
1332
|
+
"h5-card": "panes",
|
1333
|
+
"h5-card-pane": "widgetList",
|
1334
|
+
}
|
1335
|
+
let loopDo = (widgetList) => {
|
1336
|
+
if (!widgetList) return;
|
1337
|
+
widgetList.forEach(widget => {
|
1338
|
+
let widgetName = widget.options.name;
|
1339
|
+
let fieldKeyName = this.getFieldKeyName(widget);
|
1340
|
+
if (widget.tableField) {
|
1341
|
+
if (flag == 1) {
|
1342
|
+
fieldMap[fieldKeyName] = widget;
|
1343
|
+
} else {
|
1344
|
+
fieldMap[fieldKeyName] = fieldKeyName;
|
1345
|
+
if (widget.type == 'vabsearch') {
|
1346
|
+
let vabSearchName = widget.options.vabSearchName;
|
1347
|
+
if (vabSearchName) fieldMap[vabSearchName] = vabSearchName;
|
1348
|
+
}
|
1349
|
+
}
|
1350
|
+
} else {
|
1351
|
+
if (widget.category == "container") {
|
1352
|
+
let itemField = itemFieldMap[widget.type];
|
1353
|
+
if (itemField) {
|
1354
|
+
if ("table" == widget.type) {
|
1355
|
+
widget[itemField].forEach(item => {
|
1356
|
+
loopDo(item.cols);
|
1357
|
+
})
|
1358
|
+
} else if ("h5-table" == widget.type) {
|
1359
|
+
widget[itemField].forEach(item => {
|
1360
|
+
loopDo(item.cols);
|
1361
|
+
})
|
1362
|
+
} else {
|
1363
|
+
loopDo(widget[itemField]);
|
1364
|
+
}
|
1365
|
+
}
|
1366
|
+
}
|
1367
|
+
}
|
1368
|
+
})
|
1369
|
+
}
|
1370
|
+
loopDo(fJson.widgetList);
|
1371
|
+
return fieldMap;
|
1372
|
+
},
|
1373
|
+
getFieldKeyName(widget) {
|
1374
|
+
let o = widget.options.name;
|
1375
|
+
return (
|
1376
|
+
(widget.options.keyNameEnabled
|
1377
|
+
&& widget.options.keyName)
|
1378
|
+
|| o
|
1379
|
+
);
|
1380
|
+
},
|
1381
|
+
getFormTemplateTableDTOs() {
|
1382
|
+
let formTemplateTableDTOs = [];
|
1383
|
+
let formCode = this.reportTemplate.formCode;
|
1384
|
+
let fields = [];
|
1385
|
+
let fJson = this.formJson;
|
1386
|
+
|
1387
|
+
let itemFieldMap = {
|
1388
|
+
grid: "cols",
|
1389
|
+
table: "rows",
|
1390
|
+
"table-cell": "widgetList",
|
1391
|
+
'h5-table': "rows",
|
1392
|
+
"h5-table-cell": "widgetList",
|
1393
|
+
tab: "tabs",
|
1394
|
+
"tab-pane": "widgetList",
|
1395
|
+
"grid-col": "widgetList",
|
1396
|
+
"vf-box": "widgetList",
|
1397
|
+
"card": "widgetList",
|
1398
|
+
"detail": "panes",
|
1399
|
+
"detail-pane": "widgetList",
|
1400
|
+
"detail-h5": "panes",
|
1401
|
+
"h5-card": "panes",
|
1402
|
+
"h5-card-pane": "widgetList",
|
1403
|
+
}
|
1404
|
+
let loopDo = (widgetList) => {
|
1405
|
+
if (!widgetList) return;
|
1406
|
+
widgetList.forEach(widget => {
|
1407
|
+
let submitFlag = widget.options.submitFlag || false;
|
1408
|
+
if (widget.formItemFlag || widget.type == 'data-table') {
|
1409
|
+
if (widget.options.submitFlag === void 0) {
|
1410
|
+
submitFlag = true;
|
1411
|
+
}
|
1412
|
+
}
|
1413
|
+
|
1414
|
+
let uniqueName = widget.options.name;
|
1415
|
+
let widgetName = this.getFieldKeyName(widget);
|
1416
|
+
let entityTableCode = widget.options.entityTableCode;
|
1417
|
+
if ((widget.type == 'data-table' || widget.type == 'list-h5')) {
|
1418
|
+
let isTreeTable = widget.options.isTreeTable || false;
|
1419
|
+
if (submitFlag) {
|
1420
|
+
let vailColumns = widget.options.tableColumns.filter(item => item.prop && item.label);
|
1421
|
+
let itemFields = [];
|
1422
|
+
vailColumns.forEach(item => {
|
1423
|
+
if (item.formatS == 'editSearch') {
|
1424
|
+
itemFields.push({
|
1425
|
+
fieldDesc: item.label + "ID",
|
1426
|
+
fieldName: item.prop
|
1427
|
+
});
|
1428
|
+
let vabSearchName = item?.columnOption?.vabSearchName;
|
1429
|
+
if (vabSearchName) {
|
1430
|
+
itemFields.push({
|
1431
|
+
fieldDesc: item.label,
|
1432
|
+
fieldName: vabSearchName
|
1433
|
+
});
|
1434
|
+
}
|
1435
|
+
} else {
|
1436
|
+
itemFields.push({
|
1437
|
+
fieldDesc: item.label,
|
1438
|
+
fieldName: item.prop
|
1439
|
+
});
|
1440
|
+
}
|
1441
|
+
});
|
1442
|
+
|
1443
|
+
if (itemFields.length) {
|
1444
|
+
let formTemplateTable = {
|
1445
|
+
tableAlias: widgetName,
|
1446
|
+
name: widgetName,
|
1447
|
+
formCode: formCode,
|
1448
|
+
tableType: 1,
|
1449
|
+
isTreeTable,
|
1450
|
+
uniqueName,
|
1451
|
+
formTemplateFieldDTOs: []
|
1452
|
+
};
|
1453
|
+
formTemplateTable.formTemplateFieldDTOs = itemFields;
|
1454
|
+
formTemplateTableDTOs.push(formTemplateTable);
|
1455
|
+
}
|
1456
|
+
}
|
1457
|
+
|
1458
|
+
} else if (widget.type == 'vabUpload') {
|
1459
|
+
if (submitFlag) {
|
1460
|
+
let formTemplateTable = {
|
1461
|
+
tableAlias: widgetName,
|
1462
|
+
name: widgetName,
|
1463
|
+
formCode: formCode,
|
1464
|
+
tableType: 2,
|
1465
|
+
uniqueName,
|
1466
|
+
};
|
1467
|
+
formTemplateTableDTOs.push(formTemplateTable);
|
1468
|
+
}
|
1469
|
+
} else if (widget.type == 'project-tag') {
|
1470
|
+
if (submitFlag) {
|
1471
|
+
let formTemplateTable = {
|
1472
|
+
tableAlias: widgetName,
|
1473
|
+
name: widgetName,
|
1474
|
+
formCode: formCode,
|
1475
|
+
tableType: 1,
|
1476
|
+
uniqueName,
|
1477
|
+
};
|
1478
|
+
formTemplateTableDTOs.push(formTemplateTable);
|
1479
|
+
}
|
1480
|
+
} else if (widget.type == 'table2') {
|
1481
|
+
if (submitFlag) {
|
1482
|
+
let formTemplateTable = {
|
1483
|
+
tableAlias: widgetName,
|
1484
|
+
name: widgetName,
|
1485
|
+
formCode: formCode,
|
1486
|
+
tableType: 2,
|
1487
|
+
uniqueName,
|
1488
|
+
};
|
1489
|
+
formTemplateTableDTOs.push(formTemplateTable);
|
1490
|
+
}
|
1491
|
+
} else if (widget.tableField && widget.type == 'vabsearch') {
|
1492
|
+
if (submitFlag) {
|
1493
|
+
fields.push({
|
1494
|
+
fieldDesc: widget.options.label + "ID",
|
1495
|
+
fieldName: widgetName
|
1496
|
+
})
|
1497
|
+
let vabSearchName = widget.options.vabSearchName;
|
1498
|
+
if (vabSearchName) {
|
1499
|
+
fields.push({
|
1500
|
+
fieldDesc: widget.options.label,
|
1501
|
+
fieldName: vabSearchName,
|
1502
|
+
name: vabSearchName
|
1503
|
+
});
|
1504
|
+
}
|
1505
|
+
}
|
1506
|
+
} else if (widget.tableField) {
|
1507
|
+
if (submitFlag) {
|
1508
|
+
fields.push({
|
1509
|
+
fieldDesc: widget.options.label,
|
1510
|
+
fieldName: widgetName,
|
1511
|
+
name: widget.options.name
|
1512
|
+
})
|
1513
|
+
}
|
1514
|
+
} else {
|
1515
|
+
if (widget.category == "container") {
|
1516
|
+
let itemField = itemFieldMap[widget.type];
|
1517
|
+
if (itemField) {
|
1518
|
+
if ("table" == widget.type) {
|
1519
|
+
widget[itemField].forEach(item => {
|
1520
|
+
loopDo(item.cols);
|
1521
|
+
})
|
1522
|
+
} else if ("h5-table" == widget.type) {
|
1523
|
+
widget[itemField].forEach(item => {
|
1524
|
+
loopDo(item.cols);
|
1525
|
+
})
|
1526
|
+
} else {
|
1527
|
+
loopDo(widget[itemField]);
|
1528
|
+
}
|
1529
|
+
}
|
1530
|
+
}
|
1531
|
+
}
|
1532
|
+
})
|
1533
|
+
}
|
1534
|
+
loopDo(fJson.widgetList);
|
1535
|
+
if (fields.length) {
|
1536
|
+
let formTemplateTable = {
|
1537
|
+
tableAlias: null,
|
1538
|
+
formCode: formCode,
|
1539
|
+
tableType: 0,
|
1540
|
+
formTemplateFieldDTOs: fields
|
1541
|
+
}
|
1542
|
+
formTemplateTableDTOs.push(formTemplateTable);
|
1543
|
+
}
|
1544
|
+
|
1545
|
+
return formTemplateTableDTOs;
|
1546
|
+
},
|
1547
|
+
getSubData() {
|
1548
|
+
let that = this;
|
1549
|
+
let formCode = this.reportTemplate.formCode;
|
1550
|
+
let tableFiledMap = this.getTableFiledMap();
|
1551
|
+
let formTemplateTableDTOs = this.getFormTemplateTableDTOs();
|
1552
|
+
let formDataModel = this.formDataModel;
|
1553
|
+
let formConfig = this.formConfig;
|
1554
|
+
return new Promise((resolve, reject) => {
|
1555
|
+
let res = {};
|
1556
|
+
this.getFormData().then((formData, b) => {
|
1557
|
+
for (let key in formData) {
|
1558
|
+
let tableField = tableFiledMap[key];
|
1559
|
+
if (tableField) {
|
1560
|
+
res[tableField] = formData[key];
|
1561
|
+
}
|
1562
|
+
}
|
1563
|
+
let newFormData = {};
|
1564
|
+
formTemplateTableDTOs.forEach(formTemplateTableDTO => {
|
1565
|
+
let tableAlias = formTemplateTableDTO.tableType == 0 ? formCode : formTemplateTableDTO.tableAlias;
|
1566
|
+
if (formTemplateTableDTO.tableType == 0) {
|
1567
|
+
let item = this.$baseLodash.cloneDeep(this.formData);
|
1568
|
+
Object.keys(item).forEach(key => {
|
1569
|
+
if (Array.isArray(item[key])) {
|
1570
|
+
delete item[key];
|
1571
|
+
}
|
1572
|
+
})
|
1573
|
+
formTemplateTableDTO.formTemplateFieldDTOs.forEach(formTemplateFieldDTO => {
|
1574
|
+
item[formTemplateFieldDTO.fieldName] = res[formTemplateFieldDTO.fieldName];
|
1575
|
+
})
|
1576
|
+
newFormData[tableAlias] = item;
|
1577
|
+
} else {
|
1578
|
+
newFormData[tableAlias] = formDataModel[formTemplateTableDTO.name]
|
1579
|
+
}
|
1580
|
+
|
1581
|
+
})
|
1582
|
+
/*if (formConfig.formType === 1) {
|
1583
|
+
newFormData = this.getSysFormData(newFormData);
|
1584
|
+
}*/
|
1585
|
+
resolve(newFormData);
|
1586
|
+
}).catch((msg) => {
|
1587
|
+
reject(msg)
|
1588
|
+
})
|
1589
|
+
})
|
1590
|
+
},
|
1591
|
+
getSubData2(flag) {
|
1592
|
+
let that = this;
|
1593
|
+
let formCode = this.reportTemplate.formCode;
|
1594
|
+
let tableFiledMap = this.getTableFiledMap();
|
1595
|
+
let formTemplateTableDTOs = this.getFormTemplateTableDTOs();
|
1596
|
+
let formDataModel = this.formDataModel;
|
1597
|
+
let formConfig = this.formConfig;
|
1598
|
+
|
1599
|
+
let res = {};
|
1600
|
+
let formData = formDataModel;
|
1601
|
+
|
1602
|
+
for (let key in formData) {
|
1603
|
+
let tableField = tableFiledMap[key];
|
1604
|
+
if (tableField) {
|
1605
|
+
res[tableField] = formData[key];
|
1606
|
+
}
|
1607
|
+
}
|
1608
|
+
|
1609
|
+
let newFormData = {};
|
1610
|
+
formTemplateTableDTOs.forEach(formTemplateTableDTO => {
|
1611
|
+
let tableAlias = formTemplateTableDTO.tableType == 0 ? formCode : formTemplateTableDTO.tableAlias;
|
1612
|
+
if (formTemplateTableDTO.tableType == 0) {
|
1613
|
+
let item = this.$baseLodash.cloneDeep(this.currentFormData);
|
1614
|
+
Object.keys(item).forEach(key => {
|
1615
|
+
if (Array.isArray(item[key])) {
|
1616
|
+
delete item[key];
|
1617
|
+
}
|
1618
|
+
})
|
1619
|
+
formTemplateTableDTO.formTemplateFieldDTOs.forEach(formTemplateFieldDTO => {
|
1620
|
+
item[formTemplateFieldDTO.fieldName] = res[formTemplateFieldDTO.fieldName];
|
1621
|
+
})
|
1622
|
+
newFormData[tableAlias] = item ?? null;
|
1623
|
+
} else {
|
1624
|
+
if (formTemplateTableDTO.isTreeTable) {
|
1625
|
+
let tableTarget = this.getWidgetRef(formTemplateTableDTO.uniqueName);
|
1626
|
+
let $grid = tableTarget.getGridTable()
|
1627
|
+
let parentField = $grid.treeConfig.parentField;
|
1628
|
+
let treeTaBm = newFormData.treeTaBm || [];
|
1629
|
+
treeTaBm.push(formTemplateTableDTO.tableAlias);
|
1630
|
+
newFormData.treeTaBm = treeTaBm;
|
1631
|
+
let tableDatas = this.$baseLodash.cloneDeep(formDataModel[formTemplateTableDTO.name] || []);
|
1632
|
+
tableDatas.forEach(tableData => {
|
1633
|
+
if (tableData.id && tableData.id.startsWith && tableData.id.startsWith("row_")) {
|
1634
|
+
tableData.id = null
|
1635
|
+
}
|
1636
|
+
if (tableData[parentField] && tableData[parentField].startsWith && tableData[parentField].startsWith("row_")) {
|
1637
|
+
tableData[parentField] = null;
|
1638
|
+
}
|
1639
|
+
if (tableData[parentField] === undefined) tableData[parentField] = null;
|
1640
|
+
})
|
1641
|
+
tableDatas = tableDatas.filter(item => {
|
1642
|
+
return item[parentField] === 0 || item[parentField] === null;
|
1643
|
+
})
|
1644
|
+
newFormData[tableAlias] = tableDatas;
|
1645
|
+
} else {
|
1646
|
+
newFormData[tableAlias] = formDataModel[formTemplateTableDTO.name] ?? null;
|
1647
|
+
}
|
1648
|
+
|
1649
|
+
}
|
1650
|
+
|
1651
|
+
})
|
1652
|
+
if (flag) {
|
1653
|
+
newFormData = this.getSysFormData(newFormData);
|
1654
|
+
}
|
1655
|
+
return newFormData;
|
1656
|
+
},
|
1657
|
+
getSysFormData(realFormData) {
|
1658
|
+
let formData0 = this.$baseLodash.cloneDeep(realFormData)
|
1659
|
+
let formConfig = this.formConfig;
|
1660
|
+
let reportTemplate = this.reportTemplate
|
1661
|
+
let formCode = reportTemplate.formCode;
|
1662
|
+
let formData = this.$baseLodash.cloneDeep(formData0[formCode])
|
1663
|
+
if (formData) {
|
1664
|
+
Object.keys(formData0).forEach(key => {
|
1665
|
+
if (key != formCode) {
|
1666
|
+
formData[key] = formData0[key];
|
1667
|
+
}
|
1668
|
+
});
|
1669
|
+
}
|
1670
|
+
|
1671
|
+
return formData;
|
1672
|
+
},
|
1673
|
+
getRealFormData(option) {
|
1674
|
+
let formCode = this.reportTemplate.formCode;
|
1675
|
+
let subData = this.getSubData2();
|
1676
|
+
let realFormData = {}
|
1677
|
+
if (option) {
|
1678
|
+
Object.keys(option).forEach(key => {
|
1679
|
+
realFormData[option[key]] = subData[key];
|
1680
|
+
})
|
1681
|
+
} else {
|
1682
|
+
realFormData = subData;
|
1683
|
+
}
|
1684
|
+
return realFormData;
|
1685
|
+
},
|
1686
|
+
reloadForm(option) {
|
1687
|
+
let target1 = this.$attrs['parent-target'];
|
1688
|
+
let target2 = target1?.$attrs['parent-target'];
|
1689
|
+
let target = !target2 ? this : target1;
|
1690
|
+
/* if (this.$attrs['reloadDialog'] !== true) {
|
1691
|
+
target = this.$attrs['parent-target'];
|
1692
|
+
}else{
|
1693
|
+
target = this;
|
1694
|
+
} */
|
1695
|
+
/*let updateParam= option && option.updateParam ? option.updateParam:{}
|
1696
|
+
for (let key in updateParam) {
|
1697
|
+
target.$emit("update:" + key, updateParam[key]);
|
1698
|
+
}*/
|
1699
|
+
target.$baseReload(option);
|
1700
|
+
},
|
1701
|
+
saveForm(callback) {
|
1702
|
+
this.validateForm(() => {
|
1703
|
+
this.getSubData().then(formData => {
|
1704
|
+
let reportTemplate = this.reportTemplate || {};
|
1705
|
+
let formConfig = this.formConfig;
|
1706
|
+
let realFormData = Object.assign({}, formData);
|
1707
|
+
|
1708
|
+
let reqData = {
|
1709
|
+
...this.$attrs.conditionParam,
|
1710
|
+
formTemplateId: reportTemplate.id,
|
1711
|
+
formCode: reportTemplate.formCode,
|
1712
|
+
formVersion: reportTemplate.formVersion,
|
1713
|
+
// insUuid: reportTemplate.insUuid,
|
1714
|
+
data: realFormData
|
1715
|
+
}
|
1716
|
+
|
1717
|
+
this.$baseConfirm('您确定要保存吗?').then(() => {
|
1718
|
+
let saveConfig = formConfig.saveConfig || {};
|
1719
|
+
this.formHttp({
|
1720
|
+
options: saveConfig,
|
1721
|
+
params: reqData,
|
1722
|
+
targetFormTemplate: reportTemplate,
|
1723
|
+
success: res => {
|
1724
|
+
this.$message({
|
1725
|
+
message: res.content,
|
1726
|
+
type: 'success',
|
1727
|
+
duration: 500,
|
1728
|
+
onClose: t => {
|
1729
|
+
callback && callback(res)
|
1730
|
+
this.$parent.$emit('update:object_foreign_id', res.objx)
|
1731
|
+
// this.$parent.$attrs.wfParam.submitCallback();
|
1732
|
+
this.$parent.$baseReload()
|
1733
|
+
}
|
1734
|
+
});
|
1735
|
+
}
|
1736
|
+
})
|
1737
|
+
|
1738
|
+
|
1739
|
+
/*let saveUrl = this.formConfig.saveUrl || (USER_PREFIX + `/form_ins/saveFormInsData`);
|
1740
|
+
this.$http({
|
1741
|
+
url: saveUrl,
|
1742
|
+
method: `post`,
|
1743
|
+
data: reqData,
|
1744
|
+
isLoading: true,
|
1745
|
+
loadingTarget: document.body,
|
1746
|
+
success: res => {
|
1747
|
+
this.$message({
|
1748
|
+
message: res.content,
|
1749
|
+
type: 'success',
|
1750
|
+
duration: 500,
|
1751
|
+
onClose: t => {
|
1752
|
+
callback && callback(res)
|
1753
|
+
this.$parent.$emit('update:object_foreign_id', res.objx)
|
1754
|
+
// this.$parent.$attrs.wfParam.submitCallback();
|
1755
|
+
this.$parent.$baseReload()
|
1756
|
+
}
|
1757
|
+
});
|
1758
|
+
|
1759
|
+
}
|
1760
|
+
});*/
|
1761
|
+
})
|
1762
|
+
});
|
1763
|
+
})
|
1764
|
+
},
|
1765
|
+
submitForm(callback) {
|
1766
|
+
let reportTemplate = this.reportTemplate || {};
|
1767
|
+
let insUuid = reportTemplate.insUuid;
|
1768
|
+
if (insUuid) {
|
1769
|
+
this.$baseConfirm('您确定要提交吗?').then(() => {
|
1770
|
+
this.$http({
|
1771
|
+
url: USER_PREFIX + `/form_ins/submit`,
|
1772
|
+
method: `post`,
|
1773
|
+
data: {stringOne: insUuid},
|
1774
|
+
isLoading: true,
|
1775
|
+
loadingTarget: document.body,
|
1776
|
+
success: res => {
|
1777
|
+
this.$message({
|
1778
|
+
message: res.content,
|
1779
|
+
type: 'success',
|
1780
|
+
duration: 500,
|
1781
|
+
onClose: t => {
|
1782
|
+
callback && callback(res);
|
1783
|
+
// this.$parent.$attrs.wfParam.submitCallback();
|
1784
|
+
this.$parent.$baseReload()
|
1785
|
+
}
|
1786
|
+
});
|
1787
|
+
|
1788
|
+
}
|
1789
|
+
});
|
1790
|
+
})
|
1791
|
+
}
|
1792
|
+
},
|
1793
|
+
async getInsFormData(insUuid) {
|
1794
|
+
let formData = {};
|
1795
|
+
let formTemplateTableDTOs = this.getFormTemplateTableDTOs();
|
1796
|
+
formTemplateTableDTOs.forEach(async (formTemplateTableDTO) => {
|
1797
|
+
let tableAlias = formTemplateTableDTO.tableAlias || formTemplateTableDTO.formCode;
|
1798
|
+
await this.getFormInsData({
|
1799
|
+
insUuid: insUuid,
|
1800
|
+
tableAlias: tableAlias
|
1801
|
+
}, (data) => {
|
1802
|
+
if (formTemplateTableDTO.tableType == 0) {
|
1803
|
+
Object.assign(formData, data)
|
1804
|
+
} else {
|
1805
|
+
let map = {};
|
1806
|
+
map[tableAlias] = data;
|
1807
|
+
Object.assign(formData, map)
|
1808
|
+
}
|
1809
|
+
})
|
1810
|
+
})
|
1811
|
+
},
|
1812
|
+
async getFormInsData(param, callback) {
|
1813
|
+
return this.$http({
|
1814
|
+
url: USER_PREFIX + `/form_ins/getFormInsData`,
|
1815
|
+
method: `post`,
|
1816
|
+
data: param,
|
1817
|
+
isLoading: true,
|
1818
|
+
loadingTarget: document.body,
|
1819
|
+
modalStrictly: true,
|
1820
|
+
success: res => {
|
1821
|
+
let formData = res.objx && res.objx.data ? res.objx.data : {};
|
1822
|
+
callback && callback(formData)
|
1823
|
+
}
|
1824
|
+
});
|
1825
|
+
},
|
1826
|
+
jumpFormView(row) {
|
1827
|
+
// let data = {};
|
1828
|
+
let data = this.getFormData2(row);
|
1829
|
+
this.setFormData(data);
|
1830
|
+
},
|
1831
|
+
getFormData2(data) {
|
1832
|
+
let tableFiledMap = this.getTableFiledMap(1);
|
1833
|
+
let res = {};
|
1834
|
+
for (let key in data) {
|
1835
|
+
let widget = tableFiledMap[key];
|
1836
|
+
if (widget) {
|
1837
|
+
res[widget.id] = data[key];
|
1838
|
+
} else {
|
1839
|
+
res[key] = data[key];
|
1840
|
+
}
|
1841
|
+
}
|
1842
|
+
return res;
|
1843
|
+
},
|
1844
|
+
getContainerByType(typeName) {
|
1845
|
+
let allWidgets = [...containers, ...basicFields, ...advancedFields, ...customFields];
|
1846
|
+
let foundCon = null;
|
1847
|
+
allWidgets.forEach(con => {
|
1848
|
+
if (!!con.category && !!con.type && (con.type === typeName)) {
|
1849
|
+
foundCon = con;
|
1850
|
+
}
|
1851
|
+
});
|
1852
|
+
|
1853
|
+
return foundCon;
|
1854
|
+
},
|
1855
|
+
getFieldWidgetByType(typeName) {
|
1856
|
+
let allWidgets = [...containers, ...basicFields, ...advancedFields, ...customFields];
|
1857
|
+
let foundWidget = null;
|
1858
|
+
allWidgets.forEach(widget => {
|
1859
|
+
if (!!!widget.category && !!widget.type && (widget.type === typeName)) {
|
1860
|
+
foundWidget = widget;
|
1861
|
+
}
|
1862
|
+
});
|
1863
|
+
|
1864
|
+
return foundWidget;
|
1865
|
+
},
|
1866
|
+
doScriptAccess(scriptUuid, callback) {
|
1867
|
+
if (scriptUuid) {
|
1868
|
+
let scripts = this.formJson.formConfig.scriptList || [];
|
1869
|
+
let item = scripts.find(item => item.scriptUuid == scriptUuid);
|
1870
|
+
if (item && item.enabled) {
|
1871
|
+
let path = "";
|
1872
|
+
let reportTemplate = this.getReportTemplate();
|
1873
|
+
let formCode = reportTemplate.formCode;
|
1874
|
+
let e = new Function('formCode', item.scriptParams);
|
1875
|
+
let params = e.call(this, formCode);
|
1876
|
+
this.$http({
|
1877
|
+
url: path,
|
1878
|
+
method: `post`,
|
1879
|
+
loadingTarget: document.body,
|
1880
|
+
data: {
|
1881
|
+
...params
|
1882
|
+
},
|
1883
|
+
isLoading: true,
|
1884
|
+
success: res => {
|
1885
|
+
let e1 = new Function('resultMsg', item.onScriptSuccess);
|
1886
|
+
e1.call(this, res);
|
1887
|
+
callback && callback(res && res.objx ? res.objx : []);
|
1888
|
+
}
|
1889
|
+
});
|
1890
|
+
}
|
1891
|
+
}
|
1892
|
+
},
|
1893
|
+
validate(callback) {
|
1894
|
+
this.$refs['renderForm'].$baseValidate(valid => {
|
1895
|
+
callback && callback(valid);
|
1896
|
+
})
|
1897
|
+
},
|
1898
|
+
openSearchDialog(option) {
|
1899
|
+
this.searchDialogOption = option;
|
1900
|
+
this.showSearchDialog = true;
|
1901
|
+
},
|
1902
|
+
confirmSearchDialog(rows) {
|
1903
|
+
this.searchDialogOption.confirm && this.searchDialogOption.confirm(rows)
|
1904
|
+
},
|
1905
|
+
openFormDialog(option) {
|
1906
|
+
this.formDialogOption = option;
|
1907
|
+
this.showFormDialog = true;
|
1908
|
+
},
|
1909
|
+
confirmFormDialog() {
|
1910
|
+
this.formDialogOption.confirm && this.formDialogOption.confirm()
|
1911
|
+
},
|
1912
|
+
addInterval(handler, timeout) {
|
1913
|
+
let timer = setInterval(handler, timeout);
|
1914
|
+
this.timerMap[timer] = timer;
|
1915
|
+
return timer;
|
1916
|
+
},
|
1917
|
+
clearAllInterval() {
|
1918
|
+
let timerMap = this.timerMap;
|
1919
|
+
for (let key in timerMap) {
|
1920
|
+
let timer = timerMap[key];
|
1921
|
+
clearInterval(timer);
|
1922
|
+
}
|
1923
|
+
this.timerMap = {};
|
1924
|
+
},
|
1925
|
+
getI18nLabel(label, path, param) {
|
1926
|
+
return !this.designState && label ? this.$t2(label, path, param) : label;
|
1927
|
+
},
|
1928
|
+
openImportDialog(option) {
|
1929
|
+
this.showImportDialog = true;
|
1930
|
+
this.importDialogOption = option;
|
1931
|
+
},
|
1932
|
+
openFormDrawer(option) {
|
1933
|
+
this.formDrawerOption = option;
|
1934
|
+
this.showFormDrawer = true;
|
1935
|
+
},
|
1936
|
+
confirmFormDrawer() {
|
1937
|
+
this.formDrawerOption.confirm && this.formDrawerOption.confirm()
|
1938
|
+
},
|
1939
|
+
|
1940
|
+
loopHandleWidget: function (e, callback) {
|
1941
|
+
let t = this;
|
1942
|
+
e
|
1943
|
+
&& e.length > 0
|
1944
|
+
&& e.forEach(function (e) {
|
1945
|
+
t.loopHandleWidgetItem(e, callback);
|
1946
|
+
});
|
1947
|
+
},
|
1948
|
+
loopHandleWidgetItem: function (e, callback) {
|
1949
|
+
let t = this;
|
1950
|
+
let dataId = this.dataId;
|
1951
|
+
let currentFormData = this.currentFormData;
|
1952
|
+
let fieldKeyName = this.getFieldKeyName(e)
|
1953
|
+
let defaultValue = e.options.defaultValue === undefined || e.options.defaultValue === "" ? null : e.options.defaultValue;
|
1954
|
+
if ('container' === e.category) {
|
1955
|
+
callback(e)
|
1956
|
+
if ('vf-dialog' === e.type || 'vf-drawer' === e.type) ;
|
1957
|
+
else if ('data-table' === e.type) {
|
1958
|
+
if (!!e.widgetList && (e.widgetList.length > 0)) {
|
1959
|
+
e.widgetList.forEach((childItem) => {
|
1960
|
+
this.loopHandleWidgetItem(childItem, callback);
|
1961
|
+
});
|
1962
|
+
}
|
1963
|
+
} else if ('list-h5' === e.type) {
|
1964
|
+
if (!!e.widgetList && (e.widgetList.length > 0)) {
|
1965
|
+
e.widgetList.forEach((childItem) => {
|
1966
|
+
this.loopHandleWidgetItem(childItem, callback);
|
1967
|
+
});
|
1968
|
+
}
|
1969
|
+
} else if ('grid' === e.type) {
|
1970
|
+
e.cols
|
1971
|
+
&& e.cols.length > 0
|
1972
|
+
&& e.cols.forEach(function (e) {
|
1973
|
+
t.loopHandleWidgetItem(e, callback);
|
1974
|
+
});
|
1975
|
+
} else if ('table' === e.type) {
|
1976
|
+
e.rows
|
1977
|
+
&& e.rows.length > 0
|
1978
|
+
&& e.rows.forEach(function (e) {
|
1979
|
+
e.cols
|
1980
|
+
&& e.cols.length > 0
|
1981
|
+
&& e.cols.forEach(function (e) {
|
1982
|
+
t.loopHandleWidgetItem(e, callback);
|
1983
|
+
});
|
1984
|
+
});
|
1985
|
+
} else if ('h5-table' === e.type) {
|
1986
|
+
e.rows
|
1987
|
+
&& e.rows.length > 0
|
1988
|
+
&& e.rows.forEach(function (e) {
|
1989
|
+
e.cols
|
1990
|
+
&& e.cols.length > 0
|
1991
|
+
&& e.cols.forEach(function (e) {
|
1992
|
+
t.loopHandleWidgetItem(e, callback);
|
1993
|
+
});
|
1994
|
+
});
|
1995
|
+
} else if ('tab' === e.type) {
|
1996
|
+
e.tabs
|
1997
|
+
&& e.tabs.length > 0
|
1998
|
+
&& e.tabs.forEach(function (e) {
|
1999
|
+
e.widgetList
|
2000
|
+
&& e.widgetList.length > 0
|
2001
|
+
&& e.widgetList.forEach(function (e) {
|
2002
|
+
t.loopHandleWidgetItem(e, callback);
|
2003
|
+
});
|
2004
|
+
});
|
2005
|
+
} else if ('detail' === e.type) {
|
2006
|
+
if (e.panes) {
|
2007
|
+
e.panes.forEach(function (e) {
|
2008
|
+
if (e.widgetList) {
|
2009
|
+
e.widgetList.forEach(function (e) {
|
2010
|
+
t.loopHandleWidgetItem(e, callback);
|
2011
|
+
});
|
2012
|
+
}
|
2013
|
+
});
|
2014
|
+
}
|
2015
|
+
} else if ('detail-pane' === e.type) {
|
2016
|
+
if (e.widgetList) {
|
2017
|
+
e.widgetList.forEach(function (e) {
|
2018
|
+
t.loopHandleWidgetItem(e, callback);
|
2019
|
+
});
|
2020
|
+
}
|
2021
|
+
if (e.buttonWidgetList) {
|
2022
|
+
e.buttonWidgetList.forEach(function (e) {
|
2023
|
+
t.loopHandleWidgetItem(e, callback);
|
2024
|
+
});
|
2025
|
+
}
|
2026
|
+
} else {
|
2027
|
+
'grid-col' === e.type || e.type,
|
2028
|
+
e.widgetList
|
2029
|
+
&& e.widgetList.length > 0
|
2030
|
+
&& e.widgetList.forEach(function (e) {
|
2031
|
+
t.loopHandleWidgetItem(e, callback);
|
2032
|
+
});
|
2033
|
+
}
|
2034
|
+
|
2035
|
+
} else {
|
2036
|
+
callback && callback(e)
|
2037
|
+
/*if (dataId || currentFormData.hasOwnProperty(fieldKeyName)) {
|
2038
|
+
let c = currentFormData[fieldKeyName] ?? null;
|
2039
|
+
this.$set(this.formDataModel, fieldKeyName, baseRefUtil.deepClone(c));
|
2040
|
+
} else {
|
2041
|
+
this.$set(this.formDataModel, fieldKeyName, defaultValue);
|
2042
|
+
}*/
|
2043
|
+
}
|
2044
|
+
},
|
2045
|
+
|
2046
|
+
}
|
2047
|
+
};
|
2048
|
+
|
2049
|
+
export default modules;
|