cloud-web-corejs 1.0.54-dev.675 → 1.0.54-dev.677
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/fieldMixin.js +463 -317
- package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/data-table-editor.vue +135 -58
- package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/table-column-dialog.vue +1 -0
- package/src/components/xform/form-designer/setting-panel/propertyRegister.js +0 -1
- package/src/components/xform/form-designer/widget-panel/widgetsConfig.js +2 -2
- package/src/components/xform/form-render/container-item/data-table-mixin.js +137 -77
- package/src/components/xform/form-render/indexMixin.js +15 -9
- package/src/components/xform/mixins/scriptHttp.js +176 -5
- package/src/components/xform/utils/util.js +11 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/data-table-editor copy.vue +0 -988
- package/src/components/xform/form-designer/setting-panel/property-editor/event-handler/onDynamicColumns-editor.vue +0 -44
|
@@ -7,16 +7,20 @@ import {
|
|
|
7
7
|
getReportGlobalMap,
|
|
8
8
|
getAccessUrl,
|
|
9
9
|
generateId,
|
|
10
|
-
trim
|
|
10
|
+
trim,
|
|
11
11
|
} from "../../../../../components/xform/utils/util";
|
|
12
|
-
import FormValidators, {
|
|
12
|
+
import FormValidators, {
|
|
13
|
+
getRegExp,
|
|
14
|
+
} from "../../../../../components/xform/utils/validators";
|
|
13
15
|
import scriptHttpMixin from "../../../../../components/xform/mixins/scriptHttp";
|
|
14
16
|
import defaultHandleMixin from "../../../../../components/xform/mixins/defaultHandle";
|
|
15
17
|
|
|
16
18
|
import {
|
|
17
|
-
fieldIsUsedInFormula,
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
fieldIsUsedInFormula,
|
|
20
|
+
calculateFormula,
|
|
21
|
+
recalculateFormulaOnSubFormRowDelete,
|
|
22
|
+
} from "@base/components/xform/utils/formula-util";
|
|
23
|
+
import * as formulajs from "@formulajs/formulajs";
|
|
20
24
|
import settingConfig from "@/settings.js";
|
|
21
25
|
|
|
22
26
|
let modules = {};
|
|
@@ -45,7 +49,7 @@ modules = {
|
|
|
45
49
|
formItemProp: {
|
|
46
50
|
type: String,
|
|
47
51
|
default: null,
|
|
48
|
-
}
|
|
52
|
+
},
|
|
49
53
|
},
|
|
50
54
|
provide() {
|
|
51
55
|
return {
|
|
@@ -77,7 +81,7 @@ modules = {
|
|
|
77
81
|
|
|
78
82
|
disabled: false,
|
|
79
83
|
hidden: false,
|
|
80
|
-
readonly: false
|
|
84
|
+
readonly: false,
|
|
81
85
|
};
|
|
82
86
|
},
|
|
83
87
|
beforeDestroy() {
|
|
@@ -105,8 +109,7 @@ modules = {
|
|
|
105
109
|
}
|
|
106
110
|
}
|
|
107
111
|
},
|
|
108
|
-
mounted() {
|
|
109
|
-
},
|
|
112
|
+
mounted() {},
|
|
110
113
|
/*watch: {
|
|
111
114
|
currentValue(val) {
|
|
112
115
|
this.initFieldModel(true);
|
|
@@ -162,44 +165,81 @@ modules = {
|
|
|
162
165
|
let currentValue = currentData[this.fieldKeyName];
|
|
163
166
|
return currentValue;
|
|
164
167
|
},
|
|
165
|
-
setFormScriptEnabled(value){
|
|
166
|
-
this.field.options.formScriptEnabled = value || false
|
|
168
|
+
setFormScriptEnabled(value) {
|
|
169
|
+
this.field.options.formScriptEnabled = value || false;
|
|
167
170
|
},
|
|
168
|
-
getOptionLabel(){
|
|
171
|
+
getOptionLabel() {
|
|
169
172
|
if (this.fieldModel === null) {
|
|
170
|
-
return null
|
|
171
|
-
} else {
|
|
172
|
-
let resultList = []
|
|
173
|
-
let labelField = this.getOptionItemLabelKey();
|
|
174
|
-
let valueField = this.getOptionItemValueKey();
|
|
175
|
-
this.field.options.optionItems.forEach(oItem => {
|
|
176
|
-
if ((oItem[valueField] === this.fieldModel) || (this.findInArray(this.fieldModel, oItem[valueField])) !== -1) {
|
|
177
|
-
resultList.push(this.$t1(oItem[labelField]))
|
|
178
|
-
// resultContent = resultContent === '--' ? oItem.label : resultContent + ' ' + oItem.label
|
|
179
|
-
}
|
|
180
|
-
})
|
|
181
|
-
return resultList.join(",")
|
|
173
|
+
return null;
|
|
182
174
|
}
|
|
175
|
+
const selectedItems = this.getSelectedOptionItems();
|
|
176
|
+
const items =
|
|
177
|
+
selectedItems == null
|
|
178
|
+
? []
|
|
179
|
+
: Array.isArray(selectedItems)
|
|
180
|
+
? selectedItems
|
|
181
|
+
: [selectedItems];
|
|
182
|
+
const labelField = this.getOptionItemLabelKey();
|
|
183
|
+
return items.map((item) => this.$t1(item[labelField])).join(",");
|
|
184
|
+
},
|
|
185
|
+
getSelectedOptionItems() {
|
|
186
|
+
const fieldType = this.field.type;
|
|
187
|
+
const isOptionField =
|
|
188
|
+
fieldType === "select" ||
|
|
189
|
+
fieldType === "radio" ||
|
|
190
|
+
fieldType === "checkbox";
|
|
191
|
+
if (!isOptionField) {
|
|
192
|
+
return null;
|
|
193
|
+
}
|
|
194
|
+
const isMultiple =
|
|
195
|
+
fieldType === "checkbox" ||
|
|
196
|
+
(fieldType === "select" && this.field.options.multiple);
|
|
197
|
+
if (
|
|
198
|
+
this.fieldModel === null ||
|
|
199
|
+
this.fieldModel === undefined ||
|
|
200
|
+
this.fieldModel === ""
|
|
201
|
+
) {
|
|
202
|
+
return isMultiple ? [] : null;
|
|
203
|
+
}
|
|
204
|
+
let resultList = [];
|
|
205
|
+
let valueField = this.getOptionItemValueKey();
|
|
206
|
+
this.field.options.optionItems.forEach((oItem) => {
|
|
207
|
+
if (
|
|
208
|
+
oItem[valueField] === this.fieldModel ||
|
|
209
|
+
this.findInArray(this.fieldModel, oItem[valueField]) !== -1
|
|
210
|
+
) {
|
|
211
|
+
resultList.push(oItem);
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
return isMultiple
|
|
215
|
+
? resultList
|
|
216
|
+
: resultList.length > 0
|
|
217
|
+
? resultList[0]
|
|
218
|
+
: null;
|
|
183
219
|
},
|
|
184
220
|
initValueWatchEvent() {
|
|
185
221
|
if (!this.designer) {
|
|
186
|
-
this.$watch(
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
222
|
+
this.$watch(
|
|
223
|
+
() => {
|
|
224
|
+
let currentData =
|
|
225
|
+
this.tableParam && this.tableParam.row
|
|
226
|
+
? this.tableParam.row
|
|
227
|
+
: this.formModel;
|
|
228
|
+
let currentValue = currentData[this.fieldKeyName];
|
|
229
|
+
return currentValue;
|
|
230
|
+
},
|
|
231
|
+
(newValue, oldValue) => {
|
|
232
|
+
if (oldValue !== undefined) {
|
|
233
|
+
this.initFieldModel(true);
|
|
234
|
+
}
|
|
195
235
|
}
|
|
196
|
-
|
|
236
|
+
);
|
|
197
237
|
}
|
|
198
238
|
},
|
|
199
239
|
initFieldAttrs() {
|
|
200
|
-
this.setDisabled(this.field.options.disabled)
|
|
201
|
-
this.setHidden(this.field.options.hidden)
|
|
202
|
-
this.setReadonly(this.field.options.readonly)
|
|
240
|
+
this.setDisabled(this.field.options.disabled);
|
|
241
|
+
this.setHidden(this.field.options.hidden);
|
|
242
|
+
this.setReadonly(this.field.options.readonly);
|
|
203
243
|
},
|
|
204
244
|
initConfig() {
|
|
205
245
|
/*if (this.designState) {
|
|
@@ -220,7 +260,6 @@ modules = {
|
|
|
220
260
|
}
|
|
221
261
|
|
|
222
262
|
}*/
|
|
223
|
-
|
|
224
263
|
/*this.field.options = Object.assign(
|
|
225
264
|
{},
|
|
226
265
|
config.options,
|
|
@@ -234,7 +273,7 @@ modules = {
|
|
|
234
273
|
e.forEach(function (e, n) {
|
|
235
274
|
e === t && (i = n);
|
|
236
275
|
}),
|
|
237
|
-
|
|
276
|
+
i
|
|
238
277
|
);
|
|
239
278
|
},
|
|
240
279
|
getPropName: function () {
|
|
@@ -243,13 +282,13 @@ modules = {
|
|
|
243
282
|
} else {
|
|
244
283
|
return this.subFormItemFlag && !this.designState
|
|
245
284
|
? this.subFormName +
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
285
|
+
"." +
|
|
286
|
+
this.subFormRowIndex +
|
|
287
|
+
"." +
|
|
288
|
+
this.fieldKeyName
|
|
250
289
|
: this.getObjectFieldFlag() && !this.designState
|
|
251
|
-
|
|
252
|
-
|
|
290
|
+
? this.getObjectName() + "." + this.fieldKeyName
|
|
291
|
+
: this.fieldKeyName;
|
|
253
292
|
}
|
|
254
293
|
},
|
|
255
294
|
initFieldModel: function (flag) {
|
|
@@ -283,9 +322,16 @@ modules = {
|
|
|
283
322
|
let widgetType = this.field.type;
|
|
284
323
|
if (widgetType === "number") {
|
|
285
324
|
nullValue = undefined;
|
|
286
|
-
} else if (
|
|
325
|
+
} else if (
|
|
326
|
+
widgetType === "checkbox" ||
|
|
327
|
+
(widgetType === "select" && this.field.options.multiple)
|
|
328
|
+
) {
|
|
287
329
|
nullValue = [];
|
|
288
|
-
} else if (
|
|
330
|
+
} else if (
|
|
331
|
+
widgetType === "time-range" ||
|
|
332
|
+
widgetType === "date-range" ||
|
|
333
|
+
(widgetType === "date" && this.field.options.type === "dates")
|
|
334
|
+
) {
|
|
289
335
|
nullValue = [];
|
|
290
336
|
}
|
|
291
337
|
if (void 0 === currentData[this.fieldKeyName]) {
|
|
@@ -298,15 +344,22 @@ modules = {
|
|
|
298
344
|
} else {
|
|
299
345
|
if (!dataId) {
|
|
300
346
|
//新增
|
|
301
|
-
if (
|
|
302
|
-
|
|
347
|
+
if (
|
|
348
|
+
!this.designState &&
|
|
349
|
+
this.hasVabsearchFlag() &&
|
|
350
|
+
!this.field.options.multipleChoices
|
|
351
|
+
) {
|
|
352
|
+
let searchDialogConfig =
|
|
353
|
+
this.field.options.searchDialogConfig || {};
|
|
303
354
|
if (this.field.options.userDefaultVabSearch) {
|
|
304
355
|
let userInfo = this.getFormRef().getUserInfo();
|
|
305
356
|
let valueSourceField = "id";
|
|
306
357
|
let labelSourceField = "nick_name";
|
|
307
358
|
if (this.field.options.clickBindEvent === "1") {
|
|
308
|
-
if (searchDialogConfig.valueSourceField)
|
|
309
|
-
|
|
359
|
+
if (searchDialogConfig.valueSourceField)
|
|
360
|
+
valueSourceField = searchDialogConfig.valueSourceField;
|
|
361
|
+
if (searchDialogConfig.labelSourceField)
|
|
362
|
+
labelSourceField = searchDialogConfig.labelSourceField;
|
|
310
363
|
}
|
|
311
364
|
this.initValue(userInfo[valueSourceField] ?? null);
|
|
312
365
|
this.setShowValue(userInfo[labelSourceField] ?? null);
|
|
@@ -316,8 +369,10 @@ modules = {
|
|
|
316
369
|
let valueSourceField = "id";
|
|
317
370
|
let labelSourceField = "name";
|
|
318
371
|
if (this.field.options.clickBindEvent === "1") {
|
|
319
|
-
if (searchDialogConfig.valueSourceField)
|
|
320
|
-
|
|
372
|
+
if (searchDialogConfig.valueSourceField)
|
|
373
|
+
valueSourceField = searchDialogConfig.valueSourceField;
|
|
374
|
+
if (searchDialogConfig.labelSourceField)
|
|
375
|
+
labelSourceField = searchDialogConfig.labelSourceField;
|
|
321
376
|
}
|
|
322
377
|
this.initValue(saleOrgDTO[valueSourceField] ?? null);
|
|
323
378
|
this.setShowValue(saleOrgDTO[labelSourceField] ?? null);
|
|
@@ -365,23 +420,23 @@ modules = {
|
|
|
365
420
|
initFileList: function () {
|
|
366
421
|
("picture-upload" !== this.field.type &&
|
|
367
422
|
"file-upload" !== this.field.type) ||
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
423
|
+
!0 === this.designState ||
|
|
424
|
+
(this.fieldModel &&
|
|
425
|
+
(Array.isArray(this.fieldModel)
|
|
426
|
+
? (this.fileList = baseRefUtil.deepClone(this.fieldModel))
|
|
427
|
+
: this.fileList.splice(
|
|
428
|
+
0,
|
|
429
|
+
0,
|
|
430
|
+
baseRefUtil.deepClone(this.fieldModel)
|
|
431
|
+
)));
|
|
377
432
|
},
|
|
378
433
|
handleCreatedEnterEvent() {
|
|
379
434
|
this.handleCustomEvent(this.field.options.onCreatedEnter);
|
|
380
435
|
},
|
|
381
436
|
initEventHandler() {
|
|
382
437
|
this.designState ||
|
|
383
|
-
|
|
384
|
-
|
|
438
|
+
(this.$on("setFormData", (o) => {
|
|
439
|
+
/*if (!this.subFormItemFlag)
|
|
385
440
|
if (
|
|
386
441
|
!!this.getObjectFieldFlag()
|
|
387
442
|
&& !this.designState
|
|
@@ -393,8 +448,8 @@ modules = {
|
|
|
393
448
|
: e[this.fieldKeyName]
|
|
394
449
|
);
|
|
395
450
|
} else this.setValue(o[this.fieldKeyName]);*/
|
|
396
|
-
|
|
397
|
-
|
|
451
|
+
this.subFormItemFlag || this.setValue(o[this.fieldKeyName]);
|
|
452
|
+
}),
|
|
398
453
|
this.$on("field-value-changed", (o) => {
|
|
399
454
|
if (this.subFormItemFlag) {
|
|
400
455
|
let e = this.formModel[this.subFormName];
|
|
@@ -426,44 +481,73 @@ modules = {
|
|
|
426
481
|
!this.subFormName && !s
|
|
427
482
|
? this.setValue(u, !0)
|
|
428
483
|
: this.subFormName === s &&
|
|
429
|
-
|
|
430
|
-
|
|
484
|
+
this.subFormRowId === c &&
|
|
485
|
+
this.setValue(u, !0);
|
|
431
486
|
}),
|
|
432
|
-
|
|
433
487
|
/* 执行计算公式运算 */
|
|
434
|
-
this.$on(
|
|
435
|
-
if (
|
|
436
|
-
|
|
437
|
-
|
|
488
|
+
this.$on("calculate-formula", (newValue, sourceWidget) => {
|
|
489
|
+
if (
|
|
490
|
+
!!this.field.options.formulaEnabled &&
|
|
491
|
+
!!this.field.options.formula
|
|
492
|
+
) {
|
|
493
|
+
let changedFieldRef = sourceWidget;
|
|
494
|
+
const changedFieldName = sourceWidget.field.options.name;
|
|
438
495
|
//检查计算公式是否包含当前修改字段
|
|
439
|
-
if (
|
|
440
|
-
|
|
496
|
+
if (
|
|
497
|
+
fieldIsUsedInFormula(
|
|
498
|
+
changedFieldName,
|
|
499
|
+
this.field.options.formula,
|
|
500
|
+
this.getFormRef(),
|
|
501
|
+
this
|
|
502
|
+
)
|
|
503
|
+
) {
|
|
441
504
|
/* 计算公式的计算改成延时执行,否则当子表单开启默认创建新行后,子表单字段的计算公式中使用到主表单字段则会出现计算错误!! */
|
|
442
505
|
//calculateFormula(this.getFormRef(), this.getGlobalDsv(), formulajs, this, changedFieldRef)
|
|
443
506
|
|
|
444
507
|
setTimeout(() => {
|
|
445
|
-
calculateFormula(
|
|
446
|
-
|
|
508
|
+
calculateFormula(
|
|
509
|
+
this.getFormRef(),
|
|
510
|
+
this.getGlobalDsv(),
|
|
511
|
+
formulajs,
|
|
512
|
+
this,
|
|
513
|
+
changedFieldRef
|
|
514
|
+
);
|
|
515
|
+
}, 200);
|
|
447
516
|
}
|
|
448
517
|
}
|
|
449
518
|
}),
|
|
450
|
-
|
|
451
519
|
/* 删除子表单行后重新执行计算公式运算 */
|
|
452
|
-
this.$on(
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
if (
|
|
456
|
-
|
|
520
|
+
this.$on(
|
|
521
|
+
"calculate-formula-sfRowDeleted",
|
|
522
|
+
(newValue, deletedFieldName) => {
|
|
523
|
+
if (
|
|
524
|
+
!!this.field.options.formulaEnabled &&
|
|
525
|
+
!!this.field.options.formula
|
|
526
|
+
) {
|
|
527
|
+
//检查计算公式是否包含当前修改字段
|
|
528
|
+
if (
|
|
529
|
+
fieldIsUsedInFormula(
|
|
530
|
+
deletedFieldName,
|
|
531
|
+
this.field.options.formula,
|
|
532
|
+
this.getFormRef()
|
|
533
|
+
)
|
|
534
|
+
) {
|
|
535
|
+
recalculateFormulaOnSubFormRowDelete(
|
|
536
|
+
this.getFormRef(),
|
|
537
|
+
this.getGlobalDsv(),
|
|
538
|
+
formulajs,
|
|
539
|
+
this
|
|
540
|
+
);
|
|
541
|
+
}
|
|
457
542
|
}
|
|
458
543
|
}
|
|
459
|
-
|
|
460
|
-
|
|
544
|
+
),
|
|
461
545
|
this.$on("loadOptionItemsFromDataSet", (o) => {
|
|
462
546
|
this.loadOptionItemsFromDataSet(o), (this.dataSetLoadedFlag = !0);
|
|
463
547
|
}),
|
|
464
548
|
this.$on("reloadOptionItems", (o) => {
|
|
465
549
|
(o.length === 0 || o.indexOf(this.field.options.name) > -1) &&
|
|
466
|
-
|
|
550
|
+
this.initOptionItems(!0);
|
|
467
551
|
}));
|
|
468
552
|
},
|
|
469
553
|
getEventParam() {
|
|
@@ -484,20 +568,20 @@ modules = {
|
|
|
484
568
|
funtionStr
|
|
485
569
|
);
|
|
486
570
|
let that = this;
|
|
487
|
-
try{
|
|
571
|
+
try {
|
|
488
572
|
return e.call(
|
|
489
573
|
this,
|
|
490
574
|
...eventParam.eventParamValues,
|
|
491
575
|
...eventParamValues
|
|
492
576
|
);
|
|
493
|
-
}catch(error){
|
|
494
|
-
if(settingConfig.fontErrorTipEnabled){
|
|
577
|
+
} catch (error) {
|
|
578
|
+
if (settingConfig.fontErrorTipEnabled) {
|
|
495
579
|
that.$errorMsg({
|
|
496
580
|
rmid: that.$t1("前端脚本异常"),
|
|
497
581
|
content: error.message,
|
|
498
|
-
type:
|
|
499
|
-
_errorMsg: error.stack
|
|
500
|
-
})
|
|
582
|
+
type: "error",
|
|
583
|
+
_errorMsg: error.stack,
|
|
584
|
+
});
|
|
501
585
|
}
|
|
502
586
|
throw error;
|
|
503
587
|
}
|
|
@@ -520,7 +604,7 @@ modules = {
|
|
|
520
604
|
if (this.tableParam && !this.designState) {
|
|
521
605
|
let row = this.tableParam.row;
|
|
522
606
|
if (!row._X_ROW_KEY) {
|
|
523
|
-
row._X_ROW_KEY = "row_" + generateId()
|
|
607
|
+
row._X_ROW_KEY = "row_" + generateId();
|
|
524
608
|
}
|
|
525
609
|
let keyVal = row._X_ROW_KEY;
|
|
526
610
|
e && delete this.refList[e + "_" + keyVal];
|
|
@@ -536,21 +620,25 @@ modules = {
|
|
|
536
620
|
this.refList[this.field.options.name] = this;
|
|
537
621
|
if (this.widgetKeyNameMap) {
|
|
538
622
|
if (!this.widgetKeyNameMap[this.fieldKeyName]) {
|
|
539
|
-
this.widgetKeyNameMap[this.fieldKeyName] = [
|
|
623
|
+
this.widgetKeyNameMap[this.fieldKeyName] = [
|
|
624
|
+
this.field.options.name,
|
|
625
|
+
];
|
|
540
626
|
} else {
|
|
541
|
-
this.widgetKeyNameMap[this.fieldKeyName].push(
|
|
627
|
+
this.widgetKeyNameMap[this.fieldKeyName].push(
|
|
628
|
+
this.field.options.name
|
|
629
|
+
);
|
|
542
630
|
}
|
|
543
631
|
}
|
|
544
632
|
}
|
|
545
633
|
}
|
|
546
634
|
},
|
|
547
635
|
getTableRef() {
|
|
548
|
-
let tableRef = this.getWidgetRef(this.parentWidget.options.name)
|
|
636
|
+
let tableRef = this.getWidgetRef(this.parentWidget.options.name);
|
|
549
637
|
return tableRef;
|
|
550
638
|
},
|
|
551
639
|
getWidgetRefByTableRow(index, name) {
|
|
552
640
|
let tableRef = this.getTableRef();
|
|
553
|
-
return tableRef.getWidgetRefByTableRow(index, name)
|
|
641
|
+
return tableRef.getWidgetRefByTableRow(index, name);
|
|
554
642
|
},
|
|
555
643
|
getWidgetRefByTableParam(param) {
|
|
556
644
|
let tableParam = param || this.tableParam;
|
|
@@ -566,13 +654,11 @@ modules = {
|
|
|
566
654
|
}
|
|
567
655
|
},
|
|
568
656
|
initOptionItemsHandle() {
|
|
569
|
-
if(this.tableParam){
|
|
570
|
-
if(this.field._syncInited){
|
|
571
|
-
this.handleCustomEvent(
|
|
572
|
-
this.field.options.formScriptSuccess
|
|
573
|
-
);
|
|
657
|
+
if (this.tableParam) {
|
|
658
|
+
if (this.field._syncInited) {
|
|
659
|
+
this.handleCustomEvent(this.field.options.formScriptSuccess);
|
|
574
660
|
}
|
|
575
|
-
return
|
|
661
|
+
return;
|
|
576
662
|
}
|
|
577
663
|
this.initGloatOptionItems(true);
|
|
578
664
|
},
|
|
@@ -602,11 +688,11 @@ modules = {
|
|
|
602
688
|
let tableParam = this.tableParam;
|
|
603
689
|
if (formScriptEnabled) {
|
|
604
690
|
if (initFlag && tableParam) {
|
|
605
|
-
let optionItems = this.getOptionItemsFlag()
|
|
691
|
+
let optionItems = this.getOptionItemsFlag();
|
|
606
692
|
if (optionItems !== undefined) {
|
|
607
|
-
return
|
|
693
|
+
return;
|
|
608
694
|
}
|
|
609
|
-
this.setOptionItemsFlag(null)
|
|
695
|
+
this.setOptionItemsFlag(null);
|
|
610
696
|
}
|
|
611
697
|
let accessParam = this.handleCustomEvent(
|
|
612
698
|
this.field.options.formScriptParam
|
|
@@ -637,19 +723,19 @@ modules = {
|
|
|
637
723
|
if (initFlag && tableParam) {
|
|
638
724
|
let optionItems = this.getOptionItemsFlag();
|
|
639
725
|
if (optionItems !== undefined) {
|
|
640
|
-
return
|
|
726
|
+
return;
|
|
641
727
|
}
|
|
642
|
-
this.setOptionItemsFlag(null)
|
|
728
|
+
this.setOptionItemsFlag(null);
|
|
643
729
|
}
|
|
644
730
|
let accessParam = this.handleCustomEvent(
|
|
645
731
|
this.field.options.formScriptParam
|
|
646
732
|
);
|
|
647
733
|
this.$getBaseDicts({
|
|
648
734
|
code: commonAttributeCode,
|
|
649
|
-
data:{
|
|
650
|
-
...accessParam
|
|
735
|
+
data: {
|
|
736
|
+
...accessParam,
|
|
651
737
|
},
|
|
652
|
-
success: ({dicts, dictMap}) => {
|
|
738
|
+
success: ({ dicts, dictMap }) => {
|
|
653
739
|
this.loadGloatOptions(dicts, initFlag);
|
|
654
740
|
this.handleCustomEvent(
|
|
655
741
|
this.field.options.formScriptSuccess,
|
|
@@ -671,21 +757,21 @@ modules = {
|
|
|
671
757
|
this.getOptionItemValueKey()
|
|
672
758
|
);
|
|
673
759
|
// this.field.options.optionItems = optionItems
|
|
674
|
-
this.setOptionItems(optionItems)
|
|
760
|
+
this.setOptionItems(optionItems);
|
|
675
761
|
let tableParam = this.tableParam;
|
|
676
762
|
if (tableParam) {
|
|
677
763
|
if (initFlag) {
|
|
678
|
-
this.setOptionItemsFlag(true)
|
|
764
|
+
this.setOptionItemsFlag(true);
|
|
679
765
|
}
|
|
680
|
-
this.loadTableOtions(optionItems)
|
|
766
|
+
this.loadTableOtions(optionItems);
|
|
681
767
|
}
|
|
682
768
|
},
|
|
683
|
-
setOptionItems(rows){
|
|
684
|
-
let formScriptEnabledTypes = [
|
|
769
|
+
setOptionItems(rows) {
|
|
770
|
+
let formScriptEnabledTypes = ["select", "checkbox", "radio", "cascader"];
|
|
685
771
|
let widgetType = this.field.type;
|
|
686
|
-
if(formScriptEnabledTypes.includes(widgetType)){
|
|
772
|
+
if (formScriptEnabledTypes.includes(widgetType)) {
|
|
687
773
|
this.field.options.optionItems = rows || [];
|
|
688
|
-
}else if(widgetType=="status"){
|
|
774
|
+
} else if (widgetType == "status") {
|
|
689
775
|
this.field.options.statusParam = rows || [];
|
|
690
776
|
}
|
|
691
777
|
},
|
|
@@ -699,31 +785,37 @@ modules = {
|
|
|
699
785
|
this.getOptionItemValueKey()
|
|
700
786
|
);
|
|
701
787
|
let widgetName = this.field.options.name;
|
|
702
|
-
let tableWidgetName = tableParam.column.params.tableWidgetName
|
|
788
|
+
let tableWidgetName = tableParam.column.params.tableWidgetName;
|
|
703
789
|
let tableTarget = this.getWidgetRef(tableWidgetName);
|
|
704
|
-
tableTarget.loopHandleWidgetByName(
|
|
705
|
-
|
|
706
|
-
|
|
790
|
+
tableTarget.loopHandleWidgetByName(
|
|
791
|
+
widgetName,
|
|
792
|
+
(row, widget, target) => {
|
|
793
|
+
widget.options.optionItems = optionItems;
|
|
794
|
+
}
|
|
795
|
+
);
|
|
707
796
|
if (tableParam.column.params.widget) {
|
|
708
797
|
if (tableParam.column.params.widget.options.name === widgetName) {
|
|
709
|
-
tableParam.column.params.widget.options.optionItems = optionItems
|
|
798
|
+
tableParam.column.params.widget.options.optionItems = optionItems;
|
|
710
799
|
}
|
|
711
|
-
|
|
712
800
|
}
|
|
713
801
|
if (tableParam.column.params.editWidget) {
|
|
714
802
|
if (tableParam.column.params.editWidget.options.name === widgetName) {
|
|
715
|
-
tableParam.column.params.editWidget.options.optionItems =
|
|
803
|
+
tableParam.column.params.editWidget.options.optionItems =
|
|
804
|
+
optionItems;
|
|
716
805
|
}
|
|
717
806
|
}
|
|
718
807
|
if (tableParam.column.params.widgetList?.length) {
|
|
719
|
-
this.loopHandleWidget(
|
|
720
|
-
|
|
721
|
-
|
|
808
|
+
this.loopHandleWidget(
|
|
809
|
+
tableParam.column.params.widgetList,
|
|
810
|
+
(item1) => {
|
|
811
|
+
if (item1.options.name === widgetName) {
|
|
812
|
+
item1.options.optionItems = optionItems;
|
|
813
|
+
}
|
|
722
814
|
}
|
|
723
|
-
|
|
815
|
+
);
|
|
724
816
|
}
|
|
725
817
|
|
|
726
|
-
delete tableParam.column.params[widgetName]
|
|
818
|
+
delete tableParam.column.params[widgetName];
|
|
727
819
|
}
|
|
728
820
|
},
|
|
729
821
|
async initOptionItems(gloatFlag) {
|
|
@@ -772,7 +864,7 @@ modules = {
|
|
|
772
864
|
if (!commonAttributeCode) return;
|
|
773
865
|
this.$getBaseDicts({
|
|
774
866
|
code: commonAttributeCode,
|
|
775
|
-
success: ({dicts, dictMap}) => {
|
|
867
|
+
success: ({ dicts, dictMap }) => {
|
|
776
868
|
this.loadOptions(dicts);
|
|
777
869
|
this.handleCustomEvent(
|
|
778
870
|
this.field.options.formScriptSuccess,
|
|
@@ -788,16 +880,16 @@ modules = {
|
|
|
788
880
|
},
|
|
789
881
|
refreshDefaultValue: function () {
|
|
790
882
|
!0 === this.designState &&
|
|
791
|
-
|
|
792
|
-
|
|
883
|
+
void 0 !== this.field.options.defaultValue &&
|
|
884
|
+
(this.fieldModel = this.field.options.defaultValue);
|
|
793
885
|
},
|
|
794
886
|
|
|
795
887
|
clearFieldRules() {
|
|
796
888
|
if (!this.field.formItemFlag) {
|
|
797
|
-
return
|
|
889
|
+
return;
|
|
798
890
|
}
|
|
799
891
|
|
|
800
|
-
this.rules && this.rules.splice(0, this.rules.length)
|
|
892
|
+
this.rules && this.rules.splice(0, this.rules.length); //清空已有
|
|
801
893
|
},
|
|
802
894
|
|
|
803
895
|
getValidateDefaultMsg(labelCode, vldName) {
|
|
@@ -812,78 +904,85 @@ modules = {
|
|
|
812
904
|
chinese: "[{label}]只能输入中文字符",
|
|
813
905
|
email: "[{label}]邮箱格式有误",
|
|
814
906
|
url: "[{label}]URL格式有误",
|
|
815
|
-
required: "[{label}]不能为空"
|
|
816
|
-
}
|
|
817
|
-
let result = null
|
|
818
|
-
let value = map[vldName]
|
|
907
|
+
required: "[{label}]不能为空",
|
|
908
|
+
};
|
|
909
|
+
let result = null;
|
|
910
|
+
let value = map[vldName];
|
|
819
911
|
if (!value) {
|
|
820
|
-
value = "[{label}]invalid value"
|
|
912
|
+
value = "[{label}]invalid value";
|
|
821
913
|
}
|
|
822
|
-
result = this.$t1(value, {label});
|
|
823
|
-
return result
|
|
914
|
+
result = this.$t1(value, { label });
|
|
915
|
+
return result;
|
|
824
916
|
},
|
|
825
917
|
getValidationHintMsg() {
|
|
826
|
-
let vldName = this.field.options.validation
|
|
918
|
+
let vldName = this.field.options.validation;
|
|
827
919
|
if (this.field.options.validationHint) {
|
|
828
|
-
return this.$t1(this.field.options.validationHint)
|
|
920
|
+
return this.$t1(this.field.options.validationHint);
|
|
829
921
|
} else {
|
|
830
|
-
return this.getValidateDefaultMsg(this.field.options.label, vldName)
|
|
922
|
+
return this.getValidateDefaultMsg(this.field.options.label, vldName);
|
|
831
923
|
}
|
|
832
924
|
},
|
|
833
925
|
getRequiredHintMsg() {
|
|
834
926
|
if (this.field.options.requiredHint) {
|
|
835
|
-
return this.$t1(this.field.options.requiredHint)
|
|
927
|
+
return this.$t1(this.field.options.requiredHint);
|
|
836
928
|
} else {
|
|
837
|
-
return this.getValidateDefaultMsg(this.field.options.label, "required")
|
|
929
|
+
return this.getValidateDefaultMsg(this.field.options.label, "required");
|
|
838
930
|
}
|
|
839
931
|
},
|
|
840
932
|
buildFieldRules() {
|
|
841
933
|
if (!this.field.formItemFlag || this.field.options.hidden) {
|
|
842
|
-
return
|
|
934
|
+
return;
|
|
843
935
|
}
|
|
844
936
|
|
|
845
|
-
this.rules.splice(0, this.rules.length)
|
|
937
|
+
this.rules.splice(0, this.rules.length); //清空已有
|
|
846
938
|
if (!!this.field.options.required) {
|
|
847
939
|
this.rules.push({
|
|
848
940
|
required: true,
|
|
849
941
|
//trigger: ['blur', 'change'],
|
|
850
|
-
trigger: [
|
|
851
|
-
|
|
852
|
-
|
|
942
|
+
trigger: [
|
|
943
|
+
"blur",
|
|
944
|
+
] /* 去掉change事件触发校验,change事件触发时formModel数据尚未更新,导致radio/checkbox必填校验出错!! */,
|
|
945
|
+
message: this.getRequiredHintMsg(),
|
|
946
|
+
});
|
|
853
947
|
}
|
|
854
948
|
|
|
855
949
|
if (!!this.field.options.validation) {
|
|
856
|
-
let vldName = this.field.options.validation
|
|
950
|
+
let vldName = this.field.options.validation;
|
|
857
951
|
if (!!FormValidators[vldName]) {
|
|
858
952
|
this.rules.push({
|
|
859
953
|
validator: FormValidators[vldName],
|
|
860
|
-
trigger: [
|
|
954
|
+
trigger: ["blur", "change"],
|
|
861
955
|
label: this.field.options.label,
|
|
862
956
|
// errorMsg: this.field.options.validationHint
|
|
863
|
-
errorMsg: this.getValidationHintMsg()
|
|
864
|
-
})
|
|
957
|
+
errorMsg: this.getValidationHintMsg(),
|
|
958
|
+
});
|
|
865
959
|
} else {
|
|
866
960
|
this.rules.push({
|
|
867
|
-
validator: FormValidators[
|
|
868
|
-
trigger: [
|
|
961
|
+
validator: FormValidators["regExp"],
|
|
962
|
+
trigger: ["blur", "change"],
|
|
869
963
|
regExp: vldName,
|
|
870
964
|
label: this.field.options.label,
|
|
871
965
|
// errorMsg: this.field.options.validationHint
|
|
872
|
-
errorMsg: this.getValidationHintMsg()
|
|
873
|
-
})
|
|
966
|
+
errorMsg: this.getValidationHintMsg(),
|
|
967
|
+
});
|
|
874
968
|
}
|
|
875
969
|
}
|
|
876
970
|
|
|
877
971
|
if (!!this.field.options.onValidate) {
|
|
878
972
|
let customFn = (rule, value, callback) => {
|
|
879
|
-
let tmpFunc = new Function(
|
|
880
|
-
|
|
881
|
-
|
|
973
|
+
let tmpFunc = new Function(
|
|
974
|
+
"rule",
|
|
975
|
+
"value",
|
|
976
|
+
"callback",
|
|
977
|
+
this.field.options.onValidate
|
|
978
|
+
);
|
|
979
|
+
return tmpFunc.call(this, rule, value, callback);
|
|
980
|
+
};
|
|
882
981
|
this.rules.push({
|
|
883
982
|
validator: customFn,
|
|
884
|
-
trigger: [
|
|
885
|
-
label: this.field.options.label
|
|
886
|
-
})
|
|
983
|
+
trigger: ["blur", "change"],
|
|
984
|
+
label: this.field.options.label,
|
|
985
|
+
});
|
|
887
986
|
}
|
|
888
987
|
},
|
|
889
988
|
|
|
@@ -892,14 +991,14 @@ modules = {
|
|
|
892
991
|
*/
|
|
893
992
|
disableChangeValidate() {
|
|
894
993
|
if (!this.rules) {
|
|
895
|
-
return
|
|
994
|
+
return;
|
|
896
995
|
}
|
|
897
996
|
|
|
898
|
-
this.rules.forEach(rule => {
|
|
997
|
+
this.rules.forEach((rule) => {
|
|
899
998
|
if (!!rule.trigger) {
|
|
900
|
-
rule.trigger.splice(0, rule.trigger.length)
|
|
999
|
+
rule.trigger.splice(0, rule.trigger.length);
|
|
901
1000
|
}
|
|
902
|
-
})
|
|
1001
|
+
});
|
|
903
1002
|
},
|
|
904
1003
|
|
|
905
1004
|
/**
|
|
@@ -907,72 +1006,89 @@ modules = {
|
|
|
907
1006
|
*/
|
|
908
1007
|
enableChangeValidate() {
|
|
909
1008
|
if (!this.rules) {
|
|
910
|
-
return
|
|
1009
|
+
return;
|
|
911
1010
|
}
|
|
912
1011
|
|
|
913
|
-
this.rules.forEach(rule => {
|
|
1012
|
+
this.rules.forEach((rule) => {
|
|
914
1013
|
if (!!rule.trigger) {
|
|
915
|
-
rule.trigger.push(
|
|
916
|
-
rule.trigger.push(
|
|
1014
|
+
rule.trigger.push("blur");
|
|
1015
|
+
rule.trigger.push("change");
|
|
917
1016
|
}
|
|
918
|
-
})
|
|
1017
|
+
});
|
|
919
1018
|
},
|
|
920
1019
|
|
|
921
1020
|
disableOptionOfList(optionList, optionValue) {
|
|
922
|
-
if (!!optionList &&
|
|
1021
|
+
if (!!optionList && optionList.length > 0) {
|
|
923
1022
|
let valueKey = this.getOptionItemValueKey();
|
|
924
|
-
optionList.forEach(opt => {
|
|
1023
|
+
optionList.forEach((opt) => {
|
|
925
1024
|
if (opt[valueKey] === optionValue) {
|
|
926
|
-
opt.disabled = true
|
|
1025
|
+
opt.disabled = true;
|
|
927
1026
|
}
|
|
928
1027
|
|
|
929
1028
|
if (opt.children && Array.isArray(opt.children)) {
|
|
930
|
-
this.disableOptionOfList(opt.children, optionValue)
|
|
1029
|
+
this.disableOptionOfList(opt.children, optionValue);
|
|
931
1030
|
}
|
|
932
|
-
})
|
|
933
|
-
this.$forceUpdate()
|
|
1031
|
+
});
|
|
1032
|
+
this.$forceUpdate();
|
|
934
1033
|
}
|
|
935
1034
|
},
|
|
936
1035
|
|
|
937
1036
|
enableOptionOfList(optionList, optionValue) {
|
|
938
|
-
if (!!optionList &&
|
|
1037
|
+
if (!!optionList && optionList.length > 0) {
|
|
939
1038
|
let valueKey = this.getOptionItemValueKey();
|
|
940
|
-
optionList.forEach(opt => {
|
|
1039
|
+
optionList.forEach((opt) => {
|
|
941
1040
|
if (opt[valueKey] === optionValue) {
|
|
942
|
-
opt.disabled = false
|
|
1041
|
+
opt.disabled = false;
|
|
943
1042
|
}
|
|
944
1043
|
|
|
945
1044
|
if (opt.children && Array.isArray(opt.children)) {
|
|
946
|
-
this.enableOptionOfList(opt.children, optionValue)
|
|
1045
|
+
this.enableOptionOfList(opt.children, optionValue);
|
|
947
1046
|
}
|
|
948
|
-
})
|
|
949
|
-
this.$forceUpdate()
|
|
1047
|
+
});
|
|
1048
|
+
this.$forceUpdate();
|
|
950
1049
|
}
|
|
951
1050
|
},
|
|
952
1051
|
|
|
953
|
-
|
|
954
1052
|
emitFieldDataChange(newValue, oldValue) {
|
|
955
|
-
if (this.designState) return
|
|
956
|
-
this.$emit(
|
|
1053
|
+
if (this.designState) return;
|
|
1054
|
+
this.$emit("field-value-changed", [newValue, oldValue]);
|
|
957
1055
|
|
|
958
1056
|
/* 同步更新keyName属性一致的字段组件值!! */
|
|
959
1057
|
if (this.field.options.keyNameEnabled) {
|
|
960
|
-
this.getFormRef().broadcast(
|
|
961
|
-
|
|
962
|
-
|
|
1058
|
+
this.getFormRef().broadcast("FieldWidget", "sync-field-value", [
|
|
1059
|
+
this.field.options.name,
|
|
1060
|
+
this.field.options.keyName,
|
|
1061
|
+
this.subFormName,
|
|
1062
|
+
this.subFormRowId,
|
|
1063
|
+
newValue,
|
|
1064
|
+
this.getObjectName(),
|
|
1065
|
+
]);
|
|
963
1066
|
} else {
|
|
964
|
-
this.getFormRef().broadcast(
|
|
965
|
-
|
|
966
|
-
|
|
1067
|
+
this.getFormRef().broadcast("FieldWidget", "sync-field-value", [
|
|
1068
|
+
this.field.options.name,
|
|
1069
|
+
this.field.options.name,
|
|
1070
|
+
this.subFormName,
|
|
1071
|
+
this.subFormRowId,
|
|
1072
|
+
newValue,
|
|
1073
|
+
this.getObjectName(),
|
|
1074
|
+
]);
|
|
967
1075
|
}
|
|
968
1076
|
|
|
969
|
-
if (this.field.type ===
|
|
970
|
-
this.getFormRef().broadcast(
|
|
1077
|
+
if (this.field.type === "number") {
|
|
1078
|
+
this.getFormRef().broadcast("FieldWidget", "calculate-formula", [
|
|
1079
|
+
newValue,
|
|
1080
|
+
this,
|
|
1081
|
+
]); //触发计算公式计算
|
|
971
1082
|
}
|
|
972
1083
|
|
|
973
1084
|
/* 必须用dispatch向指定父组件派发消息!! */
|
|
974
|
-
this.dispatch(
|
|
975
|
-
|
|
1085
|
+
this.dispatch("VFormRender", "fieldChange", [
|
|
1086
|
+
this.field.options.name,
|
|
1087
|
+
newValue,
|
|
1088
|
+
oldValue,
|
|
1089
|
+
this.subFormName,
|
|
1090
|
+
this.subFormRowIndex,
|
|
1091
|
+
]);
|
|
976
1092
|
},
|
|
977
1093
|
syncUpdateFormModel: function (e) {
|
|
978
1094
|
if (!this.designState)
|
|
@@ -986,15 +1102,15 @@ modules = {
|
|
|
986
1102
|
},
|
|
987
1103
|
handleChangeEvent: function (e) {
|
|
988
1104
|
let widgetType = this.field.type;
|
|
989
|
-
if(widgetType === "select"){
|
|
990
|
-
if(e===""){
|
|
991
|
-
|
|
992
|
-
|
|
1105
|
+
if (widgetType === "select") {
|
|
1106
|
+
if (e === "") {
|
|
1107
|
+
e = this.field.options.multiple ? [] : null;
|
|
1108
|
+
this.fieldModel = e;
|
|
993
1109
|
}
|
|
994
|
-
}else if(widgetType === "number"){
|
|
995
|
-
if(e===undefined){
|
|
996
|
-
|
|
997
|
-
|
|
1110
|
+
} else if (widgetType === "number") {
|
|
1111
|
+
if (e === undefined) {
|
|
1112
|
+
e = null;
|
|
1113
|
+
this.fieldModel = e;
|
|
998
1114
|
}
|
|
999
1115
|
}
|
|
1000
1116
|
|
|
@@ -1006,7 +1122,7 @@ modules = {
|
|
|
1006
1122
|
handleFocusCustomEvent: function (e) {
|
|
1007
1123
|
if (
|
|
1008
1124
|
((this.oldFieldValue = baseRefUtil.deepClone(this.fieldModel)),
|
|
1009
|
-
|
|
1125
|
+
this.field.options.onFocus)
|
|
1010
1126
|
) {
|
|
1011
1127
|
let t = new Function("event", this.field.options.onFocus);
|
|
1012
1128
|
t.call(this, e);
|
|
@@ -1021,8 +1137,8 @@ modules = {
|
|
|
1021
1137
|
handleInputCustomEvent: function (e) {
|
|
1022
1138
|
if (
|
|
1023
1139
|
(this.syncUpdateFormModel(e),
|
|
1024
|
-
|
|
1025
|
-
|
|
1140
|
+
this.dispatch("VFormRender", "fieldValidation", [this.getPropName()]),
|
|
1141
|
+
this.field.options.onInput)
|
|
1026
1142
|
) {
|
|
1027
1143
|
let t = new Function("value", this.field.options.onInput);
|
|
1028
1144
|
t.call(this, e);
|
|
@@ -1054,7 +1170,9 @@ modules = {
|
|
|
1054
1170
|
},
|
|
1055
1171
|
handleCustomClickEvent: function (flag) {
|
|
1056
1172
|
let tableParam = this.tableParam;
|
|
1057
|
-
let clickBindEvent = !flag
|
|
1173
|
+
let clickBindEvent = !flag
|
|
1174
|
+
? this.field.options.clickBindEvent
|
|
1175
|
+
: this.field.options.widgetTextLinkConfig?.options?.clickBindEvent;
|
|
1058
1176
|
|
|
1059
1177
|
const done = () => {
|
|
1060
1178
|
if (clickBindEvent === "1") {
|
|
@@ -1064,9 +1182,15 @@ modules = {
|
|
|
1064
1182
|
//列表插入数据
|
|
1065
1183
|
this.handleAddTableDataEvent(flag);
|
|
1066
1184
|
}
|
|
1067
|
-
}
|
|
1185
|
+
};
|
|
1068
1186
|
if (clickBindEvent && this.field.options.onBeforeClickButton) {
|
|
1069
|
-
if (
|
|
1187
|
+
if (
|
|
1188
|
+
this.handleCustomEvent(
|
|
1189
|
+
this.field.options.onBeforeClickButton,
|
|
1190
|
+
["done"],
|
|
1191
|
+
[done]
|
|
1192
|
+
) !== false
|
|
1193
|
+
) {
|
|
1070
1194
|
done();
|
|
1071
1195
|
}
|
|
1072
1196
|
} else {
|
|
@@ -1074,7 +1198,9 @@ modules = {
|
|
|
1074
1198
|
}
|
|
1075
1199
|
},
|
|
1076
1200
|
handleAddTableDataEvent(flag) {
|
|
1077
|
-
let optionModel = !flag
|
|
1201
|
+
let optionModel = !flag
|
|
1202
|
+
? this.field.options
|
|
1203
|
+
: this.field.options.widgetTextLinkConfig?.options || {};
|
|
1078
1204
|
|
|
1079
1205
|
let addTableDataConfig = optionModel.addTableDataConfig || {};
|
|
1080
1206
|
if (!addTableDataConfig.tableRef) return;
|
|
@@ -1101,7 +1227,9 @@ modules = {
|
|
|
1101
1227
|
},
|
|
1102
1228
|
handleButtonWidgetClick: function (event, flag) {
|
|
1103
1229
|
if (!this.designState) {
|
|
1104
|
-
let onClick = !flag
|
|
1230
|
+
let onClick = !flag
|
|
1231
|
+
? this.field.options.onClick
|
|
1232
|
+
: this.field.options.widgetTextLinkConfig?.options?.onClick;
|
|
1105
1233
|
if (onClick) {
|
|
1106
1234
|
let tableParam = this.tableParam;
|
|
1107
1235
|
let eventParamNames = ["event"];
|
|
@@ -1110,11 +1238,7 @@ modules = {
|
|
|
1110
1238
|
eventParamNames = ["row", "rowIndex", "event"];
|
|
1111
1239
|
eventParamValues = [tableParam.row, tableParam.rowIndex, event];
|
|
1112
1240
|
}
|
|
1113
|
-
this.handleCustomEvent(
|
|
1114
|
-
onClick,
|
|
1115
|
-
eventParamNames,
|
|
1116
|
-
eventParamValues
|
|
1117
|
-
);
|
|
1241
|
+
this.handleCustomEvent(onClick, eventParamNames, eventParamValues);
|
|
1118
1242
|
} else {
|
|
1119
1243
|
if (!flag) this.dispatch("VFormRender", "buttonClick", [this]);
|
|
1120
1244
|
}
|
|
@@ -1126,7 +1250,9 @@ modules = {
|
|
|
1126
1250
|
let tableData = searchDialogConfig.tableData || [];
|
|
1127
1251
|
},
|
|
1128
1252
|
openSearchDialog(tableParam, flag) {
|
|
1129
|
-
let optionModel = !flag
|
|
1253
|
+
let optionModel = !flag
|
|
1254
|
+
? this.field.options
|
|
1255
|
+
: this.field.options.widgetTextLinkConfig?.options || {};
|
|
1130
1256
|
let searchDialogConfig = optionModel.searchDialogConfig || {};
|
|
1131
1257
|
let formCode = searchDialogConfig.formCode;
|
|
1132
1258
|
let tableData = searchDialogConfig.tableData || [];
|
|
@@ -1137,9 +1263,11 @@ modules = {
|
|
|
1137
1263
|
if (this.field.options.multipleChoices) {
|
|
1138
1264
|
let fieldKeyName = this.fieldKeyName;
|
|
1139
1265
|
let valueField = trim(this.field.options.valueField || fieldKeyName);
|
|
1140
|
-
let vabSearchName = trim(
|
|
1141
|
-
|
|
1142
|
-
|
|
1266
|
+
let vabSearchName = trim(
|
|
1267
|
+
this.field.options.vabSearchName || fieldKeyName
|
|
1268
|
+
);
|
|
1269
|
+
let valueSourceField = trim(searchDialogConfig.valueSourceField);
|
|
1270
|
+
let labelSourceField = trim(searchDialogConfig.labelSourceField);
|
|
1143
1271
|
|
|
1144
1272
|
rows = (this.fieldModel || []).map((row) => {
|
|
1145
1273
|
return {
|
|
@@ -1153,21 +1281,27 @@ modules = {
|
|
|
1153
1281
|
// dialogQueryParam.
|
|
1154
1282
|
let queryParam = null;
|
|
1155
1283
|
if (searchDialogConfig.dialogQueryParam) {
|
|
1156
|
-
queryParam = this.handleCustomEvent(
|
|
1284
|
+
queryParam = this.handleCustomEvent(
|
|
1285
|
+
searchDialogConfig.dialogQueryParam
|
|
1286
|
+
);
|
|
1157
1287
|
}
|
|
1158
1288
|
let dialogCustomParam = {};
|
|
1159
1289
|
if (searchDialogConfig.dialogCustomParam) {
|
|
1160
|
-
dialogCustomParam =
|
|
1290
|
+
dialogCustomParam =
|
|
1291
|
+
this.handleCustomEvent(searchDialogConfig.dialogCustomParam) || {};
|
|
1161
1292
|
}
|
|
1162
|
-
let dialogParam = Object.assign(
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1293
|
+
let dialogParam = Object.assign(
|
|
1294
|
+
{
|
|
1295
|
+
formCode: formCode,
|
|
1296
|
+
rows,
|
|
1297
|
+
queryParam,
|
|
1298
|
+
multiple: searchDialogConfig.multipleChoices || false,
|
|
1299
|
+
confirm: (rows) => {
|
|
1300
|
+
this.handleConfirmSearchDialog(rows, false, flag);
|
|
1301
|
+
},
|
|
1169
1302
|
},
|
|
1170
|
-
|
|
1303
|
+
dialogCustomParam
|
|
1304
|
+
);
|
|
1171
1305
|
this.getFormRef().openSearchDialog(dialogParam);
|
|
1172
1306
|
},
|
|
1173
1307
|
handleClearSearchDialog() {
|
|
@@ -1181,11 +1315,17 @@ modules = {
|
|
|
1181
1315
|
return multipleChoices;
|
|
1182
1316
|
},
|
|
1183
1317
|
hasVabsearchFlag() {
|
|
1184
|
-
return
|
|
1318
|
+
return (
|
|
1319
|
+
this.field.type === "vabsearch" ||
|
|
1320
|
+
this.field.type === "singerSearch" ||
|
|
1321
|
+
this.field.type === "multiSearch"
|
|
1322
|
+
);
|
|
1185
1323
|
},
|
|
1186
1324
|
handleConfirmSearchDialog(rows, isClear, flag) {
|
|
1187
1325
|
if (!isClear && !rows.length) return;
|
|
1188
|
-
let optionModel = !flag
|
|
1326
|
+
let optionModel = !flag
|
|
1327
|
+
? this.field.options
|
|
1328
|
+
: this.field.options.widgetTextLinkConfig?.options || {};
|
|
1189
1329
|
|
|
1190
1330
|
let tableParam = this.tableParam;
|
|
1191
1331
|
let searchDialogConfig = optionModel.searchDialogConfig || {};
|
|
@@ -1196,12 +1336,14 @@ modules = {
|
|
|
1196
1336
|
let multipleChoices =
|
|
1197
1337
|
optionModel.searchDialogConfig.multipleChoices || false;
|
|
1198
1338
|
|
|
1199
|
-
let valueSourceField = trim(searchDialogConfig.valueSourceField)
|
|
1200
|
-
let labelSourceField = trim(searchDialogConfig.labelSourceField)
|
|
1339
|
+
let valueSourceField = trim(searchDialogConfig.valueSourceField);
|
|
1340
|
+
let labelSourceField = trim(searchDialogConfig.labelSourceField);
|
|
1201
1341
|
if (this.hasVabsearchFlag()) {
|
|
1202
1342
|
let fieldKeyName = this.fieldKeyName;
|
|
1203
1343
|
let valueField = trim(this.field.options.valueField || fieldKeyName);
|
|
1204
|
-
let vabSearchName = trim(
|
|
1344
|
+
let vabSearchName = trim(
|
|
1345
|
+
this.field.options.vabSearchName || fieldKeyName
|
|
1346
|
+
);
|
|
1205
1347
|
if (tableParam) {
|
|
1206
1348
|
let rowData = tableParam.row;
|
|
1207
1349
|
if (this.getMultipleChoices()) {
|
|
@@ -1210,29 +1352,27 @@ modules = {
|
|
|
1210
1352
|
} else {
|
|
1211
1353
|
rowData[fieldKeyName] = rows.map((item) => {
|
|
1212
1354
|
let newData = {};
|
|
1213
|
-
newData[valueField] =
|
|
1214
|
-
|
|
1215
|
-
newData[vabSearchName] =
|
|
1216
|
-
item[labelSourceField] ?? null;
|
|
1355
|
+
newData[valueField] = item[valueSourceField] ?? null;
|
|
1356
|
+
newData[vabSearchName] = item[labelSourceField] ?? null;
|
|
1217
1357
|
tableData.forEach((item1) => {
|
|
1218
|
-
let targetFormField = trim(
|
|
1219
|
-
|
|
1358
|
+
let targetFormField = trim(
|
|
1359
|
+
item1.targetFormField || item1.targetField
|
|
1360
|
+
);
|
|
1361
|
+
let sourceField = trim(item1.sourceField);
|
|
1220
1362
|
newData[targetFormField] = item[sourceField];
|
|
1221
1363
|
});
|
|
1222
1364
|
return newData;
|
|
1223
1365
|
});
|
|
1224
1366
|
}
|
|
1225
1367
|
} else {
|
|
1226
|
-
rowData[fieldKeyName] = !isClear
|
|
1227
|
-
? row[valueSourceField]
|
|
1228
|
-
: null;
|
|
1368
|
+
rowData[fieldKeyName] = !isClear ? row[valueSourceField] : null;
|
|
1229
1369
|
if (labelSourceField)
|
|
1230
|
-
rowData[vabSearchName] = !isClear
|
|
1231
|
-
? row[labelSourceField]
|
|
1232
|
-
: null;
|
|
1370
|
+
rowData[vabSearchName] = !isClear ? row[labelSourceField] : null;
|
|
1233
1371
|
tableData.forEach((item) => {
|
|
1234
|
-
let targetFormField = trim(
|
|
1235
|
-
|
|
1372
|
+
let targetFormField = trim(
|
|
1373
|
+
item.targetFormField || item.targetField
|
|
1374
|
+
);
|
|
1375
|
+
let sourceField = trim(item.sourceField);
|
|
1236
1376
|
if (!isClear) {
|
|
1237
1377
|
rowData[targetFormField] = row[sourceField];
|
|
1238
1378
|
} else {
|
|
@@ -1248,13 +1388,13 @@ modules = {
|
|
|
1248
1388
|
} else {
|
|
1249
1389
|
rowData = rows.map((item) => {
|
|
1250
1390
|
let newData = {};
|
|
1251
|
-
newData[valueField] =
|
|
1252
|
-
|
|
1253
|
-
newData[vabSearchName] =
|
|
1254
|
-
item[labelSourceField] ?? null;
|
|
1391
|
+
newData[valueField] = item[valueSourceField] ?? null;
|
|
1392
|
+
newData[vabSearchName] = item[labelSourceField] ?? null;
|
|
1255
1393
|
tableData.forEach((item1) => {
|
|
1256
|
-
let targetFormField = trim(
|
|
1257
|
-
|
|
1394
|
+
let targetFormField = trim(
|
|
1395
|
+
item1.targetFormField || item1.targetField
|
|
1396
|
+
);
|
|
1397
|
+
let sourceField = trim(item1.sourceField);
|
|
1258
1398
|
newData[targetFormField] = item[sourceField];
|
|
1259
1399
|
});
|
|
1260
1400
|
return newData;
|
|
@@ -1265,20 +1405,16 @@ modules = {
|
|
|
1265
1405
|
/* this.fieldModel = !isClear
|
|
1266
1406
|
? row[valueSourceField]
|
|
1267
1407
|
: null; */
|
|
1268
|
-
let value = !isClear
|
|
1269
|
-
|
|
1270
|
-
: null
|
|
1271
|
-
this.setValue(value)
|
|
1408
|
+
let value = !isClear ? row[valueSourceField] : null;
|
|
1409
|
+
this.setValue(value);
|
|
1272
1410
|
if (labelSourceField) {
|
|
1273
|
-
this.setShowValue(
|
|
1274
|
-
!isClear ? row[labelSourceField] : null
|
|
1275
|
-
);
|
|
1411
|
+
this.setShowValue(!isClear ? row[labelSourceField] : null);
|
|
1276
1412
|
}
|
|
1277
1413
|
tableData.forEach((item) => {
|
|
1278
1414
|
// formModel[item.targetField] = row[item.sourceField]
|
|
1279
1415
|
let value = !isClear ? row[item.sourceField] ?? null : null;
|
|
1280
|
-
let targetField = trim(item.targetField)
|
|
1281
|
-
let targetFormField = trim(item.targetFormField)
|
|
1416
|
+
let targetField = trim(item.targetField);
|
|
1417
|
+
let targetFormField = trim(item.targetFormField);
|
|
1282
1418
|
if (targetField) {
|
|
1283
1419
|
this.getWidgetRef(targetField).setValue(value);
|
|
1284
1420
|
} else if (targetFormField) {
|
|
@@ -1293,8 +1429,10 @@ modules = {
|
|
|
1293
1429
|
let addRows = rows.map((rowData) => {
|
|
1294
1430
|
let itemData = {};
|
|
1295
1431
|
tableData.forEach((item) => {
|
|
1296
|
-
let targetFormField = trim(
|
|
1297
|
-
|
|
1432
|
+
let targetFormField = trim(
|
|
1433
|
+
item.targetFormField || item.targetField
|
|
1434
|
+
);
|
|
1435
|
+
let sourceField = trim(item.sourceField);
|
|
1298
1436
|
itemData[targetFormField] = rowData[sourceField];
|
|
1299
1437
|
});
|
|
1300
1438
|
return itemData;
|
|
@@ -1309,15 +1447,13 @@ modules = {
|
|
|
1309
1447
|
let value = row[item.sourceField] ?? null;
|
|
1310
1448
|
// formModel[item.targetField] = value
|
|
1311
1449
|
// this.getWidgetRef(item.targetField).setValue(value);
|
|
1312
|
-
let targetField = trim(item.targetField)
|
|
1313
|
-
let targetFormField = trim(item.targetFormField)
|
|
1450
|
+
let targetField = trim(item.targetField);
|
|
1451
|
+
let targetFormField = trim(item.targetFormField);
|
|
1314
1452
|
if (targetField) {
|
|
1315
1453
|
this.getWidgetRef(targetField).setValue(value);
|
|
1316
1454
|
} else if (targetFormField) {
|
|
1317
1455
|
formModel[targetFormField] = value;
|
|
1318
1456
|
}
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
1457
|
});
|
|
1322
1458
|
// this.$forceUpdate();
|
|
1323
1459
|
}
|
|
@@ -1346,26 +1482,26 @@ modules = {
|
|
|
1346
1482
|
let i = this.refList[e];
|
|
1347
1483
|
return (
|
|
1348
1484
|
!i &&
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1485
|
+
t &&
|
|
1486
|
+
this.$message.error(this.i18nt("render.hint.refNotFound") + e),
|
|
1487
|
+
i
|
|
1352
1488
|
);
|
|
1353
1489
|
},
|
|
1354
1490
|
getFieldEditor: function () {
|
|
1355
1491
|
return this.$refs["fieldEditor"];
|
|
1356
1492
|
},
|
|
1357
1493
|
initValue: function (e) {
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1494
|
+
let value = e ?? null;
|
|
1495
|
+
let currentData =
|
|
1496
|
+
this.tableParam && this.tableParam.row
|
|
1497
|
+
? this.tableParam.row
|
|
1498
|
+
: this.formModel;
|
|
1499
|
+
if (void 0 === currentData[this.fieldKeyName]) {
|
|
1500
|
+
this.$set(currentData, this.fieldKeyName, null);
|
|
1501
|
+
}
|
|
1502
|
+
this.fieldModel = value;
|
|
1503
|
+
this.initFileList();
|
|
1504
|
+
this.syncUpdateFormModel(value);
|
|
1369
1505
|
},
|
|
1370
1506
|
setValue: function (e) {
|
|
1371
1507
|
if (this.field.formItemFlag) {
|
|
@@ -1393,10 +1529,10 @@ modules = {
|
|
|
1393
1529
|
if (!this.subFormItemFlag) {
|
|
1394
1530
|
let e = this.field.options.defaultValue;
|
|
1395
1531
|
this.setValue(e),
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1532
|
+
("picture-upload" !== this.field.type &&
|
|
1533
|
+
"file-upload" !== this.field.type) ||
|
|
1534
|
+
(this.$refs["fieldEditor"].clearFiles(),
|
|
1535
|
+
this.fileList.splice(0, this.fileList.length));
|
|
1400
1536
|
}
|
|
1401
1537
|
},
|
|
1402
1538
|
setWidgetOption: function (e, t) {
|
|
@@ -1429,23 +1565,23 @@ modules = {
|
|
|
1429
1565
|
},
|
|
1430
1566
|
focus: function () {
|
|
1431
1567
|
this.getFieldEditor() &&
|
|
1432
|
-
|
|
1433
|
-
|
|
1568
|
+
this.getFieldEditor().focus &&
|
|
1569
|
+
this.getFieldEditor().focus();
|
|
1434
1570
|
},
|
|
1435
1571
|
clearSelectedOptions: function () {
|
|
1436
1572
|
("checkbox" !== this.field.type &&
|
|
1437
1573
|
"radio" !== this.field.type &&
|
|
1438
1574
|
"select" !== this.field.type) ||
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1575
|
+
("checkbox" === this.field.type ||
|
|
1576
|
+
("select" === this.field.type && this.field.options.multiple)
|
|
1577
|
+
? (this.fieldModel = [])
|
|
1578
|
+
: (this.fieldModel = ""));
|
|
1443
1579
|
},
|
|
1444
|
-
getOptionItemValueKey(){
|
|
1445
|
-
return this.field.options.valueKey || "value"
|
|
1580
|
+
getOptionItemValueKey() {
|
|
1581
|
+
return this.field.options.valueKey || "value";
|
|
1446
1582
|
},
|
|
1447
|
-
getOptionItemLabelKey(){
|
|
1448
|
-
return this.field.options.labelKey || "label"
|
|
1583
|
+
getOptionItemLabelKey() {
|
|
1584
|
+
return this.field.options.labelKey || "label";
|
|
1449
1585
|
},
|
|
1450
1586
|
loadRowGloatOptions: function (e) {
|
|
1451
1587
|
let optionItems = baseRefUtil.translateOptionItems(
|
|
@@ -1455,7 +1591,7 @@ modules = {
|
|
|
1455
1591
|
this.getOptionItemValueKey()()
|
|
1456
1592
|
);
|
|
1457
1593
|
// this.field.options.optionItems = optionItems
|
|
1458
|
-
this.setOptionItems(optionItems)
|
|
1594
|
+
this.setOptionItems(optionItems);
|
|
1459
1595
|
},
|
|
1460
1596
|
loadOptions: function (e, rowOptionFlag) {
|
|
1461
1597
|
let optionItems = baseRefUtil.translateOptionItems(
|
|
@@ -1465,18 +1601,18 @@ modules = {
|
|
|
1465
1601
|
this.getOptionItemValueKey()
|
|
1466
1602
|
);
|
|
1467
1603
|
// this.field.options.optionItems = optionItems
|
|
1468
|
-
this.setOptionItems(optionItems)
|
|
1604
|
+
this.setOptionItems(optionItems);
|
|
1469
1605
|
},
|
|
1470
1606
|
getOptionKey() {
|
|
1471
|
-
let key = "optionItems-" + this.field.options.name
|
|
1607
|
+
let key = "optionItems-" + this.field.options.name;
|
|
1472
1608
|
return key;
|
|
1473
1609
|
},
|
|
1474
1610
|
getOptionItemsFlag: function () {
|
|
1475
|
-
let key = this.getOptionKey()
|
|
1611
|
+
let key = this.getOptionKey();
|
|
1476
1612
|
return this.getGlobalParam(key);
|
|
1477
1613
|
},
|
|
1478
1614
|
setOptionItemsFlag: function (flag) {
|
|
1479
|
-
let key = this.getOptionKey()
|
|
1615
|
+
let key = this.getOptionKey();
|
|
1480
1616
|
return this.setGlobalParam(key, flag);
|
|
1481
1617
|
},
|
|
1482
1618
|
reloadOptions: function (e) {
|
|
@@ -1487,7 +1623,7 @@ modules = {
|
|
|
1487
1623
|
this.getOptionItemValueKey()
|
|
1488
1624
|
);
|
|
1489
1625
|
// this.field.options.optionItems = optionItems;
|
|
1490
|
-
this.setOptionItems(optionItems)
|
|
1626
|
+
this.setOptionItems(optionItems);
|
|
1491
1627
|
},
|
|
1492
1628
|
getOptions: function () {
|
|
1493
1629
|
return this.getOptionItems();
|
|
@@ -1533,7 +1669,7 @@ modules = {
|
|
|
1533
1669
|
this.field.options.customClass.map(function (i, n) {
|
|
1534
1670
|
i === e && (t = n);
|
|
1535
1671
|
}),
|
|
1536
|
-
|
|
1672
|
+
t > -1 && this.field.options.customClass.splice(t, 1);
|
|
1537
1673
|
}
|
|
1538
1674
|
},
|
|
1539
1675
|
async initAccess() {
|
|
@@ -1556,10 +1692,21 @@ modules = {
|
|
|
1556
1692
|
if (!dsModel.headers) dsModel.headers = [];
|
|
1557
1693
|
if (!dsModel.params) dsModel.params = [];
|
|
1558
1694
|
if (!dsModel.data) dsModel.data = [];
|
|
1559
|
-
if (
|
|
1560
|
-
|
|
1695
|
+
if (
|
|
1696
|
+
dsModel.dataHandlerCode === null ||
|
|
1697
|
+
dsModel.dataHandlerCode === undefined
|
|
1698
|
+
)
|
|
1699
|
+
dsModel.dataHandlerCode = "";
|
|
1700
|
+
if (
|
|
1701
|
+
dsModel.configHandlerCode === null ||
|
|
1702
|
+
dsModel.configHandlerCode === undefined
|
|
1703
|
+
)
|
|
1561
1704
|
dsModel.configHandlerCode = "";
|
|
1562
|
-
if (
|
|
1705
|
+
if (
|
|
1706
|
+
dsModel.errorHandlerCode === null ||
|
|
1707
|
+
dsModel.errorHandlerCode === undefined
|
|
1708
|
+
)
|
|
1709
|
+
dsModel.errorHandlerCode = "";
|
|
1563
1710
|
|
|
1564
1711
|
requestAccess.dsModel = dsModel;
|
|
1565
1712
|
this.requestAccess = requestAccess;
|
|
@@ -1641,13 +1788,12 @@ modules = {
|
|
|
1641
1788
|
showAText() {
|
|
1642
1789
|
this.widgetTextFlag = 3;
|
|
1643
1790
|
},
|
|
1644
|
-
getAuthCode(){
|
|
1791
|
+
getAuthCode() {
|
|
1645
1792
|
let formRef = this.getFormRef();
|
|
1646
|
-
if(formRef){
|
|
1793
|
+
if (formRef) {
|
|
1647
1794
|
return formRef.reportTemplate.formCode + ":" + this.field.options.name;
|
|
1648
1795
|
}
|
|
1649
|
-
|
|
1650
|
-
}
|
|
1796
|
+
},
|
|
1651
1797
|
},
|
|
1652
1798
|
};
|
|
1653
1799
|
|