cloud-web-corejs 1.0.80 → 1.0.81

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/package.json +1 -1
  2. package/src/components/baseAttachment/index.vue +22 -13
  3. package/src/components/baseAttachment/mixins.js +1 -1
  4. package/src/components/fileLibrary/fileObjAuthEditDialog.vue +6 -0
  5. package/src/components/fileLibrary/mixins/fileObjAuthDialogMixin.js +328 -203
  6. package/src/components/fileLibrary/mixins/fileObjAuthEditDialogMixin.js +27 -23
  7. package/src/components/table/CellSlot.vue +1 -0
  8. package/src/components/table/vxeFilter/mixin.js +1 -1
  9. package/src/components/vb-tabs/x-tabs.vue +3 -2
  10. package/src/components/xform/form-designer/form-widget/dialog/formDialog.vue +11 -3
  11. package/src/components/xform/form-designer/form-widget/dialog/importDialog.vue +2 -1
  12. package/src/components/xform/form-designer/form-widget/dialog/importDialogMixin.js +1 -1
  13. package/src/components/xform/form-designer/form-widget/dialog/searchFormDialog.vue +12 -5
  14. package/src/components/xform/form-designer/form-widget/field-widget/baseAttachment-widget.vue +28 -3
  15. package/src/components/xform/form-designer/form-widget/field-widget/button-widget.vue +1 -1
  16. package/src/components/xform/form-designer/form-widget/field-widget/checkbox-widget.vue +5 -2
  17. package/src/components/xform/form-designer/form-widget/field-widget/fieldMixin.js +1 -1
  18. package/src/components/xform/form-designer/form-widget/field-widget/form-item-wrapper.vue +138 -6
  19. package/src/components/xform/form-designer/form-widget/field-widget/import-button-widget.vue +4 -7
  20. package/src/components/xform/form-designer/form-widget/field-widget/import2-button-widget.vue +80 -0
  21. package/src/components/xform/form-designer/form-widget/field-widget/radio-widget.vue +5 -2
  22. package/src/components/xform/form-designer/form-widget/field-widget/select-widget.vue +4 -1
  23. package/src/components/xform/form-designer/form-widget/field-widget/vabUpload-widget.vue +6 -0
  24. package/src/components/xform/form-designer/indexMixin.js +1 -1
  25. package/src/components/xform/form-designer/setting-panel/form-setting.vue +8 -0
  26. package/src/components/xform/form-designer/setting-panel/indexMixin.js +1 -1
  27. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/columnRenderDialog.vue +125 -0
  28. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/data-table-editor.vue +3 -0
  29. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/table-column-dialog.vue +415 -354
  30. package/src/components/xform/form-designer/setting-panel/property-editor/container-detail/detail-editor.vue +2 -2
  31. package/src/components/xform/form-designer/setting-panel/property-editor/container-grid-col/grid-col-offset-editor.vue +1 -1
  32. package/src/components/xform/form-designer/setting-panel/property-editor/container-grid-col/grid-col-pull-editor.vue +1 -1
  33. package/src/components/xform/form-designer/setting-panel/property-editor/container-grid-col/grid-col-push-editor.vue +1 -1
  34. package/src/components/xform/form-designer/setting-panel/property-editor/field-button/search-dialog-event-editor.vue +7 -1
  35. package/src/components/xform/form-designer/setting-panel/property-editor/field-import-button/import-button-editor.vue +16 -8
  36. package/src/components/xform/form-designer/setting-panel/property-editor/field-import-button/import2-button-editor.vue +80 -0
  37. package/src/components/xform/form-designer/setting-panel/property-editor/field-rate/rate-defaultValue-editor.vue +1 -1
  38. package/src/components/xform/form-designer/setting-panel/property-editor/field-vabUpload/field-vabUpload-editor.vue +30 -1
  39. package/src/components/xform/form-designer/setting-panel/property-editor/limit-editor.vue +1 -1
  40. package/src/components/xform/form-designer/setting-panel/property-editor/multipleLimit-editor.vue +1 -1
  41. package/src/components/xform/form-designer/setting-panel/property-editor/precision-editor.vue +1 -1
  42. package/src/components/xform/form-designer/setting-panel/property-editor/textFlag-editor.vue +170 -20
  43. package/src/components/xform/form-designer/setting-panel/propertyRegister.js +1 -0
  44. package/src/components/xform/form-designer/widget-panel/indexMixin.js +1 -1
  45. package/src/components/xform/form-designer/widget-panel/widgetsConfig.js +132 -110
  46. package/src/components/xform/form-render/container-item/containerItemMixin.js +1 -1
  47. package/src/components/xform/form-render/container-item/data-table-item.vue +42 -20
  48. package/src/components/xform/form-render/container-item/data-table-mixin.js +3 -3
  49. package/src/components/xform/form-render/container-item/grid-col-item.vue +10 -3
  50. package/src/components/xform/form-render/container-item/grid-item.vue +1 -1
  51. package/src/components/xform/form-render/container-item/tab-item.vue +11 -6
  52. package/src/components/xform/form-render/container-item/table-cell-item.vue +38 -32
  53. package/src/components/xform/form-render/container-item/table-item.vue +4 -2
  54. package/src/components/xform/form-render/indexMixin.js +1 -1
  55. package/src/components/xform/lang/zh-CN.js +1 -0
  56. package/src/components/xform/mixins/defaultHandle.js +1 -1
  57. package/src/components/xform/mixins/scriptHttp.js +3 -1
  58. package/src/components/xform/utils/util.js +1 -1
  59. package/src/store/modules/permission.js +1 -1
  60. package/src/views/bd/setting/table_model/edit.vue +835 -484
  61. package/src/views/bd/setting/table_model/mixins/edit.js +3 -3
  62. package/src/views/user/form/vform/designer.vue +772 -753
  63. package/src/views/user/form/view/list.vue +27 -9
@@ -1,753 +1,772 @@
1
- <template>
2
- <div>
3
- <!-- <el-button type="primary" @click="test">Submit</el-button> -->
4
- <div class="designer-box" id="containt" style="margin-bottom: 0;">
5
- <v-form-designer
6
- ref="designer"
7
- :reportTemplate.sync="reportTemplate"
8
- :designer-config="designerConfig"
9
- :field-list-data="fieldListData"
10
- @field-widget-used="handleFWU"
11
- @field-widget-removed="handleFWR"
12
- @form-json-updated="handleFJU"
13
- @reflushTemplateList="reflushTemplateList"
14
- v-if="showDesinger"
15
- :readonly="readonly"
16
- />
17
- </div><!--
18
- <el-tabs v-model="activeName" class="tab-boxCard tabCard-sty1" v-if="showDesinger">
19
- <el-tab-pane label="设计器" name="first">
20
-
21
- </el-tab-pane>
22
- </el-tabs> -->
23
- </div>
24
- </template>
25
-
26
- <script>
27
- import {loadExtension} from '@base/components/xform/extension/extension-loader'
28
-
29
- loadExtension()
30
- import VFormDesigner from '@base/components/xform/form-designer/index.vue'
31
- import {deepClone, overwriteObj} from "@base/components/xform/utils/util";
32
- import {formFieldMapping} from "../../../../views/user/form/vform/formFieldMapping";
33
-
34
- export default {
35
- name: 'vform-designer:edit',
36
- props: {
37
- formCode: String,
38
- readonly: Boolean
39
- },
40
- components: {
41
- VFormDesigner
42
- },
43
- data() {
44
- return {
45
- formJson: {},
46
- formData: {},
47
- optionData: {},
48
- reportTemplate: {},
49
- showDesinger: false,
50
- activeName: 'first',
51
- showRequestaccessList: false,
52
- showFunctionScriptList: false,
53
- designerConfig: {
54
- componentLib: false,
55
- formTemplates: false,
56
- eventCollapse: true,
57
- metadataLib: true,
58
- logoHeader: false,
59
- exportCodeButton: false,
60
- generateSFCButton: false,
61
- toolbarMaxWidth: 300,
62
- },
63
- fieldListData: {},
64
- layoutId: null,
65
- formOptionData: {},
66
-
67
- meteFieldsResult: null,
68
- usedFieldNames: {},
69
- entity: null,
70
- entityLabel: null
71
- };
72
- },
73
- computed: {},
74
- watch: {
75
- activeName(val) {
76
- if (this.showRequestaccessList === false && val == "second") {
77
- this.showRequestaccessList = true;
78
- }
79
- }
80
- },
81
- mounted() {
82
- this.getTemplate();
83
- },
84
- methods: {
85
- test() {
86
- let that = this;
87
- let designer = this.$refs.designer;
88
- let json = designer.getFormJson();
89
- designer.setFormJson(this.formJson);
90
- },
91
- getTemplate() {
92
- /* this.showDesinger = true;
93
- return */
94
- this.$http({
95
- aes: true,
96
- url: USER_PREFIX + `/formTemplate/getByFormCode`,
97
- method: `post`,
98
- data: {
99
- stringOne: this.formCode
100
- },
101
- isLoading: true,
102
- modalStrictly: true,
103
- success: res => {
104
- let reportTemplate = res.objx || {};
105
- this.reportTemplate = reportTemplate;
106
- this.showDesinger = true;
107
- this.$nextTick(() => {
108
- this.$refs.designer.setFormJson(reportTemplate.formViewContent);
109
-
110
- // this.loadFieldListData();
111
-
112
- })
113
- }
114
- });
115
- },
116
- loadFieldListData(res) {
117
- this.entity = "User";
118
- this.entityLabel = "用户";
119
- /*res = {
120
- "code": 200, "error": null, "message": "success", "data": {
121
- "subFormList": [],
122
- "storageSetting": [{"cloudStorage": "false"}],
123
- "fieldList": [
124
- /!*{
125
- "name": "userId",
126
- "label": "用户Id主键",
127
- "type": "PrimaryKey",
128
- "required": "1"
129
- }, {"name": "createdOn", "label": "创建时间", "type": "DateTime", "required": "1"}, {
130
- "searchDialogWidth": "520px",
131
- "name": "createdBy",
132
- "label": "创建用户",
133
- "type": "Reference",
134
- "required": "1"
135
- },*!/ {
136
- "name": "modifiedOn",
137
- "label": "最近修改时间",
138
- "type": "DateTime",
139
- "required": "0"
140
- }, /!*{
141
- "searchDialogWidth": "520px",
142
- "name": "modifiedBy",
143
- "label": "修改用户",
144
- "type": "Reference",
145
- "required": "0"
146
- }, {
147
- "searchDialogWidth": "520px",
148
- "name": "ownerUser",
149
- "label": "所属用户",
150
- "type": "Reference",
151
- "required": "1"
152
- }, {
153
- "searchDialogWidth": "520px",
154
- "name": "ownerDepartment",
155
- "label": "所属部门",
156
- "type": "Reference",
157
- "required": "1"
158
- }, {
159
- "searchDialogWidth": "510px",
160
- "name": "departmentId",
161
- "label": "部门",
162
- "type": "Reference",
163
- "required": "1"
164
- },*!/ {"name": "userName", "label": "用户名称", "type": "Text", "required": "1"}, {
165
- "name": "loginPwd",
166
- "label": "登录密码",
167
- "type": "Password",
168
- "required": "1"
169
- }, {"name": "loginName", "label": "登录账号名", "type": "Text", "required": "1"}, {
170
- "name": "jobTitle",
171
- "label": "职务",
172
- "type": "Option",
173
- "required": "1"
174
- }, {"name": "roles", "label": "权限角色", "type": "ReferenceList", "required": "0"}, {
175
- "name": "disabled",
176
- "label": "是否禁用",
177
- "type": "Boolean",
178
- "required": "1"
179
- }, {"name": "mobilePhone", "label": "手机号", "type": "Text", "required": "0"}, {
180
- "name": "email",
181
- "label": "邮箱",
182
- "type": "Text",
183
- "required": "0"
184
- },/!* {"name": "ownerTeam", "label": "所属团队", "type": "ReferenceList", "required": "0"}, {
185
- "name": "avatar",
186
- "label": "头像",
187
- "type": "Picture",
188
- "required": "0"
189
- },*!/ {"name": "dingTalkUserId", "label": "钉钉用户ID", "type": "Text", "required": "0"}]
190
- }
191
- };*/
192
- res = {
193
- "code": 200, "error": null, "message": "success", "data": {
194
- "subFormList": [{"name": "Jinjilianxiren", "label": "员工-紧急联系人"}],
195
- "storageSetting": [{"cloudStorage": "false"}],
196
- "fieldList": [
197
- /*{
198
- "name": "yuangongdanganId",
199
- "label": "id主键",
200
- "type": "PrimaryKey",
201
- "required": "1"
202
- },*/ {"name": "createdOn", "label": "创建时间", "type": "DateTime", "required": "1"}, /*{
203
- "searchDialogWidth": "520px",
204
- "name": "createdBy",
205
- "label": "创建用户",
206
- "type": "Reference",
207
- "required": "1"
208
- },*/ {
209
- "name": "modifiedOn",
210
- "label": "最近修改时间",
211
- "type": "DateTime",
212
- "required": "0"
213
- }, /*{
214
- "searchDialogWidth": "520px",
215
- "name": "modifiedBy",
216
- "label": "修改用户",
217
- "type": "Reference",
218
- "required": "0"
219
- }, {
220
- "searchDialogWidth": "520px",
221
- "name": "ownerUser",
222
- "label": "所属用户",
223
- "type": "Reference",
224
- "required": "1"
225
- }, {
226
- "searchDialogWidth": "520px",
227
- "name": "ownerDepartment",
228
- "label": "所属部门",
229
- "type": "Reference",
230
- "required": "1"
231
- },*/ {
232
- "name": "gonghao",
233
- "label": "工号",
234
- "type": "Text",
235
- "required": "0",
236
- "maxLength": "200"
237
- }, {
238
- "name": "xingming",
239
- "label": "姓名",
240
- "type": "Text",
241
- "required": "1",
242
- "maxLength": "200"
243
- }, /*{
244
- "searchDialogWidth": "520px",
245
- "name": "bumen",
246
- "label": "部门",
247
- "type": "Reference",
248
- "required": "1"
249
- },*/ {
250
- "name": "gangwei",
251
- "label": "岗位",
252
- "type": "Text",
253
- "required": "1",
254
- "maxLength": "200"
255
- }, /*{
256
- "searchDialogWidth": "520px",
257
- "name": "yuangongchengyuan",
258
- "label": "员工成员",
259
- "type": "Reference",
260
- "required": "0"
261
- },*/ {
262
- "name": "shenfenzhenghao",
263
- "label": "身份证号",
264
- "type": "Text",
265
- "required": "0",
266
- "maxLength": "200"
267
- }, {"name": "xingbie", "label": "性别", "type": "Option", "required": "1"}, {
268
- "name": "chushengriqi",
269
- "label": "出生日期",
270
- "type": "Date",
271
- "required": "0"
272
- }, /*{
273
- "name": "jiguan",
274
- "label": "籍贯",
275
- "type": "AreaSelect",
276
- "areaDataType": "2",
277
- "required": "0"
278
- },*/ {
279
- "name": "hujisuozaidi",
280
- "label": "户籍所在地",
281
- "type": "Text",
282
- "required": "0",
283
- "maxLength": "200"
284
- }, {"name": "hujileixing", "label": "户籍类型", "type": "Option", "required": "0"}, {
285
- "name": "minzu",
286
- "label": "民族",
287
- "type": "Text",
288
- "required": "0",
289
- "maxLength": "200"
290
- }, {
291
- "name": "hunyinzhuangtai",
292
- "label": "婚姻状态",
293
- "type": "Option",
294
- "required": "0"
295
- }, {
296
- "name": "zhengzhimianmao",
297
- "label": "政治面貌",
298
- "type": "Option",
299
- "required": "0"
300
- }, /*{
301
- "name": "yuangongzhaopian",
302
- "label": "员工照片",
303
- "type": "Picture",
304
- "required": "0"
305
- },*/ {
306
- "name": "pinyongxingshi",
307
- "label": "聘用形式",
308
- "type": "Option",
309
- "required": "0"
310
- }, {
311
- "name": "yuangongzhuangtai",
312
- "label": "员工状态",
313
- "type": "Option",
314
- "required": "1"
315
- }, {"name": "canjiagongzuoriqi", "label": "参加工作日期", "type": "Date", "required": "0"}, {
316
- "name": "ruzhiriqi",
317
- "label": "入职日期",
318
- "type": "Date",
319
- "required": "1"
320
- }, {
321
- "name": "shiyongqitianshu",
322
- "label": "试用期天数(天)",
323
- "type": "Integer",
324
- "required": "1"
325
- }, {"name": "zhuanzhengriqi", "label": "转正日期", "type": "Date", "required": "0"}, {
326
- "min": "-999999999",
327
- "max": "999999999",
328
- "precision": "2",
329
- "name": "shiyongqixinzi",
330
- "label": "试用期薪资",
331
- "type": "Money",
332
- "required": "0"
333
- }, {
334
- "min": "-999999999",
335
- "max": "999999999",
336
- "precision": "2",
337
- "name": "zhengshixinzi",
338
- "label": "正式薪资",
339
- "type": "Money",
340
- "required": "0"
341
- }, /*{
342
- "searchDialogWidth": "520px",
343
- "name": "zhijieshangji",
344
- "label": "直接上级",
345
- "type": "Reference",
346
- "required": "0"
347
- }, {
348
- "searchDialogWidth": "520px",
349
- "name": "fuzeHR",
350
- "label": "负责HR",
351
- "type": "Reference",
352
- "required": "0"
353
- },*/ {
354
- "name": "shebaozhanghao",
355
- "label": "社保账号",
356
- "type": "Text",
357
- "required": "0",
358
- "maxLength": "200"
359
- }, {
360
- "name": "gongjijinzhanghao",
361
- "label": "公积金账号",
362
- "type": "Text",
363
- "required": "0",
364
- "maxLength": "200"
365
- }, {
366
- "name": "yinhangkahao",
367
- "label": "银行卡号",
368
- "type": "Text",
369
- "required": "0",
370
- "maxLength": "200"
371
- }, {
372
- "name": "kaihuxing",
373
- "label": "开户行",
374
- "type": "Text",
375
- "required": "0",
376
- "maxLength": "200"
377
- }, {
378
- "name": "shoujihao",
379
- "label": "手机号",
380
- "type": "Text",
381
- "required": "0",
382
- "maxLength": "200"
383
- }, /*{
384
- "name": "changzhudizhi",
385
- "label": "常住地址",
386
- "type": "AreaSelect",
387
- "areaDataType": "2",
388
- "required": "0"
389
- },*/ {
390
- "name": "jutidizhi",
391
- "label": "具体地址",
392
- "type": "Text",
393
- "required": "0",
394
- "maxLength": "200"
395
- }, {"name": "zuigaoxueli", "label": "最高学历", "type": "Option", "required": "0"}, {
396
- "name": "biyeshijian",
397
- "label": "毕业时间",
398
- "type": "Date",
399
- "required": "0"
400
- }, {"name": "aa", "label": "aa", "type": "Integer", "required": "1"}, /*{
401
- "detailEntity": "Jinjilianxiren",
402
- "name": "jinjilianxirenId",
403
- "label": "员工-紧急联系人.id主键",
404
- "type": "PrimaryKey",
405
- "required": "1"
406
- },*/ {
407
- "detailEntity": "Jinjilianxiren",
408
- "name": "createdOn",
409
- "label": "员工-紧急联系人.创建时间",
410
- "type": "DateTime",
411
- "required": "1"
412
- }, /*{
413
- "searchDialogWidth": "520px",
414
- "detailEntity": "Jinjilianxiren",
415
- "name": "createdBy",
416
- "label": "员工-紧急联系人.创建用户",
417
- "type": "Reference",
418
- "required": "1"
419
- },*/ {
420
- "detailEntity": "Jinjilianxiren",
421
- "name": "modifiedOn",
422
- "label": "员工-紧急联系人.最近修改时间",
423
- "type": "DateTime",
424
- "required": "0"
425
- }, /*{
426
- "searchDialogWidth": "520px",
427
- "detailEntity": "Jinjilianxiren",
428
- "name": "modifiedBy",
429
- "label": "员工-紧急联系人.修改用户",
430
- "type": "Reference",
431
- "required": "0"
432
- }, {
433
- "searchDialogWidth": "520px",
434
- "detailEntity": "Jinjilianxiren",
435
- "name": "mdYuangongdanganId",
436
- "label": "员工-紧急联系人.主从关联Id",
437
- "type": "Reference",
438
- "required": "1"
439
- },*/ {
440
- "detailEntity": "Jinjilianxiren",
441
- "name": "shouji",
442
- "label": "员工-紧急联系人.手机",
443
- "type": "Text",
444
- "required": "0",
445
- "maxLength": "200"
446
- }, {
447
- "detailEntity": "Jinjilianxiren",
448
- "name": "jinjilianxirenxingming",
449
- "label": "员工-紧急联系人.紧急联系人姓名",
450
- "type": "Text",
451
- "required": "0",
452
- "maxLength": "200"
453
- }]
454
- }
455
- };
456
- if (res.data.fieldList) {
457
- this.fieldListData.fieldList = res.data.fieldList;
458
- if (res.data.subFormList) {
459
- this.fieldListData.subFormList =
460
- res.data.subFormList;
461
- }
462
- this.meteFieldsResult = res;
463
- const metaFields = this.buildMetaFields(
464
- this.meteFieldsResult
465
- );
466
- this.$refs.designer.setFieldListData(
467
- this.fieldListData
468
- );
469
- this.$refs.designer.setMetaFields(metaFields);
470
- }
471
-
472
- },
473
-
474
- buildMetaFields(mdResult) {
475
- const result = {
476
- main: {
477
- entityName: this.entity,
478
- entityLabel: this.entityLabel,
479
- fieldList: [],
480
- },
481
- detail: [],
482
- };
483
-
484
- if (mdResult && mdResult.data?.fieldList) {
485
- mdResult.data.fieldList.forEach((fld) => {
486
- if (!fld.detailEntity && fld.type !== "PrimaryKey") {
487
- //跳过id主键
488
- if (fld.name === "loginPwd") {
489
- return;
490
- }
491
-
492
- if (
493
- fld.type === "AnyReference" ||
494
- fld.type === "ReferenceList"
495
- ) {
496
- return;
497
- }
498
-
499
- if (this.usedFieldNames.hasOwnProperty(fld.name)) {
500
- return; //跳过本次循环
501
- }
502
-
503
- const fieldNewProps = deepClone(
504
- formFieldMapping[fld.type]
505
- );
506
- const fieldSchema = deepClone(
507
- this.$refs.designer.designer.getFieldWidgetByType(
508
- fieldNewProps.type
509
- )
510
- );
511
- overwriteObj(
512
- fieldSchema.options,
513
- fieldNewProps.options
514
- );
515
-
516
- fieldSchema.displayName = fld.label;
517
- fieldSchema.nameReadonly = true;
518
- fieldSchema.options.name = fld.name;
519
- fieldSchema.options.label = fld.label;
520
- this.adjustFieldSchema(fieldSchema, fld, mdResult);
521
- result.main.fieldList.push(fieldSchema);
522
- }
523
- });
524
- }
525
-
526
- if (mdResult && mdResult.data?.subFormList) {
527
- mdResult.data.subFormList.forEach((sf) => {
528
- const deName = sf.name;
529
- const deLabel = sf.label;
530
- const detailDataItem = {
531
- entityName: deName,
532
- entityLabel: deLabel,
533
- fieldList: [],
534
- };
535
-
536
- mdResult.data.fieldList.forEach((fld) => {
537
- if (
538
- fld.detailEntity &&
539
- fld.detailEntity === deName &&
540
- fld.type !== "PrimaryKey"
541
- ) {
542
- //跳过id主键
543
- if (
544
- fld.type === "AnyReference" ||
545
- fld.type === "ReferenceList"
546
- ) {
547
- return;
548
- }
549
-
550
- if (this.usedFieldNames.hasOwnProperty(fld.name)) {
551
- return; //跳过本次循环
552
- }
553
-
554
- const fieldNewProps = deepClone(
555
- formFieldMapping[fld.type]
556
- );
557
- const fieldSchema = deepClone(
558
- this.$refs.designer.designer.getFieldWidgetByType(
559
- fieldNewProps.type
560
- )
561
- );
562
- overwriteObj(
563
- fieldSchema.options,
564
- fieldNewProps.options
565
- );
566
-
567
- fieldSchema.displayName = fld.label;
568
- fieldSchema.nameReadonly = true;
569
- fieldSchema.options.name = fld.name;
570
- fieldSchema.options.label = fld.label;
571
- this.adjustFieldSchema(fieldSchema, fld, mdResult);
572
- detailDataItem.fieldList.push(fieldSchema);
573
- }
574
- });
575
-
576
- result.detail.push(detailDataItem);
577
- });
578
- }
579
-
580
- return result;
581
- },
582
-
583
- adjustFieldSchema(fieldSchema, fldObj, mdResult) {
584
- // 处理图片、文件上传字段!!
585
- let cloudStorageFlag = false;
586
- let cloudStorageType = "";
587
- if (mdResult.data.storageSetting) {
588
- cloudStorageFlag =
589
- mdResult.data.storageSetting[0].cloudStorage === "true";
590
- if (cloudStorageFlag) {
591
- cloudStorageType =
592
- mdResult.data.storageSetting[0].cloudStorageType;
593
- }
594
- }
595
-
596
- if (fldObj.type === "Picture" || fldObj.type === "File") {
597
- if (cloudStorageFlag) {
598
- //设置withCredentials
599
- fieldSchema.options.withCredentials = false;
600
-
601
- //设置onBeforeUpload事件代码(还需要生成uuid新文件名)
602
- fieldSchema.options.onBeforeUpload =
603
- "const gDSV = this.getGlobalDsv();\nconst wType = this.field.type;\nif (wType === 'picture-upload') {\n this.field.options.uploadURL = gDSV.picUploadURL;\n} else if (wType === 'file-upload') {\n this.field.options.uploadURL = gDSV.fileUploadURL;\n}\n\nconst cloudStorage = gDSV.cloudStorage;\nif (cloudStorage === \"true\") {\n this.field.options.withCredentials = false\n const token = gDSV.cloudUploadToken;\n this.setUploadData('token', token);\n \n const randomNum = Math.floor(Math.random() * 100);\n const newFileName = new Date().getTime() + randomNum+ '_' + file.name;\n this.setUploadData('key', newFileName);\n} else {\n //this.field.options.withCredentials = true\n}\n";
604
-
605
- //设置onUploadSuccess事件代码(上传返回结果需要设置QiNiu=前缀)
606
- fieldSchema.options.onUploadSuccess =
607
- "const gDSV = this.getGlobalDsv();\nconst cloudStorage = gDSV.cloudStorage;\nif (cloudStorage === \"true\") {\n const wType = this.field.type;\n let downloadPrefix = \"\"\n if (wType === 'picture-upload') {\n downloadPrefix = gDSV.picDownloadPrefix;\n } else if (wType === 'file-upload') {\n downloadPrefix = gDSV.fileDownloadPrefix;\n }\n \n let downUrl = downloadPrefix + result.key;\n const paramName = (downUrl.indexOf(\"?\") === -1) ? '?fileName=' : '&fileName=';\n return {\n name: file.name,\n url: downUrl + paramName + file.name\n }\n} else {\n const paramName = (result.url.indexOf(\"?\") === -1) ? '?fileName=' : '&fileName=';\n return {\n name: file.name,\n url: result.url + paramName + file.name\n }\n}\n";
608
- }
609
- }
610
- // 处理图片、文件上传字段 -- 结束
611
-
612
- /* 处理文本、长文本字段 */
613
- if (fldObj.type === "Text" || fldObj.type === "TextArea") {
614
- fieldSchema.options.maxLength = !fldObj.maxLength
615
- ? fieldSchema.options.maxLength
616
- : fldObj.maxLength * 1;
617
- }
618
-
619
- /* 处理精度小数字段 */
620
- if (
621
- fldObj.type === "Integer" ||
622
- fldObj.type === "Percent" ||
623
- fldObj.type === "Money" ||
624
- fldObj.type === "Decimal"
625
- ) {
626
- fieldSchema.options.precision = !fldObj.precision
627
- ? fieldSchema.options.precision
628
- : fldObj.precision * 1;
629
- fieldSchema.options.min = !fldObj.min
630
- ? fieldSchema.options.min
631
- : fldObj.min * 1;
632
- fieldSchema.options.max = !fldObj.max
633
- ? fieldSchema.options.max
634
- : fldObj.max * 1;
635
- }
636
-
637
- /* 处理地区选择字段 */
638
- if (fldObj.type === "AreaSelect") {
639
- fieldSchema.optionItemsReadonly = true;
640
- fieldSchema.options.areaDataType = !fldObj.areaDataType
641
- ? fieldSchema.options.areaDataType
642
- : fldObj.areaDataType * 1;
643
- }
644
-
645
- /* 处理一对一字段 */
646
- if (fldObj.type === "Reference") {
647
- fieldSchema.options.searchDialogWidth =
648
- !fldObj.searchDialogWidth
649
- ? fieldSchema.options.searchDialogWidth
650
- : fldObj.searchDialogWidth;
651
- }
652
-
653
- /* 处理单选项字段 */
654
- if (fieldSchema.options.hasOwnProperty("optionItems")) {
655
- if (
656
- this.formOptionData.hasOwnProperty(fieldSchema.options.name)
657
- ) {
658
- fieldSchema.options.optionItems = deepClone(
659
- this.formOptionData[fieldSchema.options.name]
660
- );
661
- }
662
-
663
- if (fldObj.type === "Boolean") {
664
- fieldSchema.options.optionItems = [
665
- {value: true, label: "是"},
666
- {value: false, label: "否"},
667
- ];
668
- }
669
-
670
- fieldSchema.optionItemsReadonly = true;
671
- }
672
-
673
- /* 设置字段必填校验 */
674
- if (fldObj.hasOwnProperty("required")) {
675
- fieldSchema.options.required = fldObj["required"] === "1";
676
- }
677
-
678
- /* 取消系统字段的必填校验 */
679
- if (fieldSchema.options.name === "createdOn" || fieldSchema.options.name === "createdBy"
680
- || fieldSchema.options.name === "modifiedOn" || fieldSchema.options.name === "modifiedBy"
681
- || fieldSchema.options.name === "ownerUser" || fieldSchema.options.name === "ownerDepartment"
682
- || fieldSchema.options.name === "approvalConfigId" || fieldSchema.options.name === "approvalStatus"
683
- || fieldSchema.options.name === "lastApprovedBy" || fieldSchema.options.name === "lastApprovedOn") {
684
- fieldSchema.options.required = false;
685
- }
686
-
687
- //
688
- },
689
-
690
- handleFWU(fwName) {
691
- this.usedFieldNames[fwName] = 1;
692
-
693
- /* 必须延时处理,否则draggable会报错 */
694
- setTimeout(() => {
695
- const metaFields = this.buildMetaFields(this.meteFieldsResult);
696
- this.$refs.designer.setMetaFields(metaFields);
697
- }, 800);
698
- },
699
-
700
- handleFWR(fwName) {
701
- delete this.usedFieldNames[fwName];
702
-
703
- /* 必须延时处理,否则draggable会报错 */
704
- setTimeout(() => {
705
- const metaFields = this.buildMetaFields(this.meteFieldsResult);
706
- this.$refs.designer.setMetaFields(metaFields);
707
- }, 800);
708
- },
709
-
710
- handleFJU() {
711
- this.handleUsedFields();
712
- setTimeout(() => {
713
- const metaFields = this.buildMetaFields(this.meteFieldsResult);
714
- this.$refs.designer.setMetaFields(metaFields);
715
- }, 300);
716
- },
717
-
718
- /**
719
- * 过滤已使用字段组件
720
- */
721
- handleUsedFields() {
722
- this.usedFieldNames = {};
723
- const allFieldWidgets = this.$refs.designer.getFieldWidgets();
724
- allFieldWidgets.forEach((fwItem) => {
725
- this.usedFieldNames[fwItem.name] = 1;
726
- });
727
- },
728
- initField() {
729
- this.$http({
730
- aes: true,
731
- url: USER_PREFIX + "/szTaMb/listPage",
732
- data: {},
733
- success: res => {
734
-
735
- }
736
- });
737
- },
738
- reflushTemplateList() {
739
- this.$emit("reflushTemplateList");
740
- }
741
- }
742
- };
743
- </script>
744
-
745
- <style lang="scss" scoped>
746
- body {
747
- margin: 0; /* 如果页面出现垂直滚动条,则加入此行CSS以消除之 */
748
- }
749
-
750
- #app .main-container {
751
- margin-left: 0px;
752
- }
753
- </style>
1
+ <template>
2
+ <div>
3
+ <!-- <el-button type="primary" @click="test">Submit</el-button> -->
4
+ <div class="designer-box" id="containt" style="margin-bottom: 0;">
5
+ <v-form-designer
6
+ ref="designer"
7
+ :reportTemplate.sync="reportTemplate"
8
+ :designer-config="designerConfig"
9
+ :field-list-data="fieldListData"
10
+ @field-widget-used="handleFWU"
11
+ @field-widget-removed="handleFWR"
12
+ @form-json-updated="handleFJU"
13
+ @reflushTemplateList="reflushTemplateList"
14
+ v-if="showDesinger"
15
+ :readonly="readonly"
16
+ :columnFlag="columnFlag"
17
+ @customConfirm="customConfirm"
18
+ />
19
+ </div><!--
20
+ <el-tabs v-model="activeName" class="tab-boxCard tabCard-sty1" v-if="showDesinger">
21
+ <el-tab-pane label="设计器" name="first">
22
+
23
+ </el-tab-pane>
24
+ </el-tabs> -->
25
+ </div>
26
+ </template>
27
+
28
+ <script>
29
+ import {loadExtension} from '@base/components/xform/extension/extension-loader'
30
+
31
+ loadExtension()
32
+ import VFormDesigner from '@base/components/xform/form-designer/index.vue'
33
+ import {deepClone, overwriteObj} from "@base/components/xform/utils/util";
34
+ import {formFieldMapping} from "./formFieldMapping";
35
+
36
+ export default {
37
+ name: 'vform-designer:edit',
38
+ props: {
39
+ formCode: String,
40
+ readonly: Boolean,
41
+ formTemplate: Object,
42
+ widgetList: Array,
43
+ columnFlag: Boolean,
44
+ },
45
+ components: {
46
+ VFormDesigner
47
+ },
48
+ data() {
49
+ return {
50
+ formJson: {},
51
+ formData: {},
52
+ optionData: {},
53
+ reportTemplate: {},
54
+ showDesinger: false,
55
+ activeName: 'first',
56
+ showRequestaccessList: false,
57
+ showFunctionScriptList: false,
58
+ designerConfig: {
59
+ componentLib: false,
60
+ formTemplates: false,
61
+ eventCollapse: true,
62
+ metadataLib: true,
63
+ logoHeader: false,
64
+ exportCodeButton: false,
65
+ generateSFCButton: false,
66
+ toolbarMaxWidth: 300,
67
+ },
68
+ fieldListData: {},
69
+ layoutId: null,
70
+ formOptionData: {},
71
+
72
+ meteFieldsResult: null,
73
+ usedFieldNames: {},
74
+ entity: null,
75
+ entityLabel: null
76
+ };
77
+ },
78
+ computed: {},
79
+ watch: {
80
+ activeName(val) {
81
+ if (this.showRequestaccessList === false && val == "second") {
82
+ this.showRequestaccessList = true;
83
+ }
84
+ }
85
+ },
86
+ mounted() {
87
+ this.getTemplate();
88
+ },
89
+ methods: {
90
+ test() {
91
+ let that = this;
92
+ let designer = this.$refs.designer;
93
+ let json = designer.getFormJson();
94
+ designer.setFormJson(this.formJson);
95
+ },
96
+ getTemplate() {
97
+ /* this.showDesinger = true;
98
+ return */
99
+ if (this.columnFlag) {
100
+ this.reportTemplate = this.formTemplate;
101
+ this.showDesinger = true;
102
+ this.$nextTick(() => {
103
+ let formJson = this.$baseLodash.cloneDeep({
104
+ widgetList: this.widgetList
105
+ });
106
+ this.$refs.designer.setFormJson(formJson);
107
+ })
108
+ return
109
+ }
110
+ this.$http({
111
+ aes: true,
112
+ url: USER_PREFIX + `/formTemplate/getByFormCode`,
113
+ method: `post`,
114
+ data: {
115
+ stringOne: this.formCode
116
+ },
117
+ isLoading: true,
118
+ modalStrictly: true,
119
+ success: res => {
120
+ let reportTemplate = res.objx || {};
121
+ this.reportTemplate = reportTemplate;
122
+ this.showDesinger = true;
123
+ this.$nextTick(() => {
124
+ this.$refs.designer.setFormJson(reportTemplate.formViewContent);
125
+
126
+ // this.loadFieldListData();
127
+
128
+ })
129
+ }
130
+ });
131
+ },
132
+ loadFieldListData(res) {
133
+ this.entity = "User";
134
+ this.entityLabel = "用户";
135
+ /*res = {
136
+ "code": 200, "error": null, "message": "success", "data": {
137
+ "subFormList": [],
138
+ "storageSetting": [{"cloudStorage": "false"}],
139
+ "fieldList": [
140
+ /!*{
141
+ "name": "userId",
142
+ "label": "用户Id主键",
143
+ "type": "PrimaryKey",
144
+ "required": "1"
145
+ }, {"name": "createdOn", "label": "创建时间", "type": "DateTime", "required": "1"}, {
146
+ "searchDialogWidth": "520px",
147
+ "name": "createdBy",
148
+ "label": "创建用户",
149
+ "type": "Reference",
150
+ "required": "1"
151
+ },*!/ {
152
+ "name": "modifiedOn",
153
+ "label": "最近修改时间",
154
+ "type": "DateTime",
155
+ "required": "0"
156
+ }, /!*{
157
+ "searchDialogWidth": "520px",
158
+ "name": "modifiedBy",
159
+ "label": "修改用户",
160
+ "type": "Reference",
161
+ "required": "0"
162
+ }, {
163
+ "searchDialogWidth": "520px",
164
+ "name": "ownerUser",
165
+ "label": "所属用户",
166
+ "type": "Reference",
167
+ "required": "1"
168
+ }, {
169
+ "searchDialogWidth": "520px",
170
+ "name": "ownerDepartment",
171
+ "label": "所属部门",
172
+ "type": "Reference",
173
+ "required": "1"
174
+ }, {
175
+ "searchDialogWidth": "510px",
176
+ "name": "departmentId",
177
+ "label": "部门",
178
+ "type": "Reference",
179
+ "required": "1"
180
+ },*!/ {"name": "userName", "label": "用户名称", "type": "Text", "required": "1"}, {
181
+ "name": "loginPwd",
182
+ "label": "登录密码",
183
+ "type": "Password",
184
+ "required": "1"
185
+ }, {"name": "loginName", "label": "登录账号名", "type": "Text", "required": "1"}, {
186
+ "name": "jobTitle",
187
+ "label": "职务",
188
+ "type": "Option",
189
+ "required": "1"
190
+ }, {"name": "roles", "label": "权限角色", "type": "ReferenceList", "required": "0"}, {
191
+ "name": "disabled",
192
+ "label": "是否禁用",
193
+ "type": "Boolean",
194
+ "required": "1"
195
+ }, {"name": "mobilePhone", "label": "手机号", "type": "Text", "required": "0"}, {
196
+ "name": "email",
197
+ "label": "邮箱",
198
+ "type": "Text",
199
+ "required": "0"
200
+ },/!* {"name": "ownerTeam", "label": "所属团队", "type": "ReferenceList", "required": "0"}, {
201
+ "name": "avatar",
202
+ "label": "头像",
203
+ "type": "Picture",
204
+ "required": "0"
205
+ },*!/ {"name": "dingTalkUserId", "label": "钉钉用户ID", "type": "Text", "required": "0"}]
206
+ }
207
+ };*/
208
+ res = {
209
+ "code": 200, "error": null, "message": "success", "data": {
210
+ "subFormList": [{"name": "Jinjilianxiren", "label": "员工-紧急联系人"}],
211
+ "storageSetting": [{"cloudStorage": "false"}],
212
+ "fieldList": [
213
+ /*{
214
+ "name": "yuangongdanganId",
215
+ "label": "id主键",
216
+ "type": "PrimaryKey",
217
+ "required": "1"
218
+ },*/ {"name": "createdOn", "label": "创建时间", "type": "DateTime", "required": "1"}, /*{
219
+ "searchDialogWidth": "520px",
220
+ "name": "createdBy",
221
+ "label": "创建用户",
222
+ "type": "Reference",
223
+ "required": "1"
224
+ },*/ {
225
+ "name": "modifiedOn",
226
+ "label": "最近修改时间",
227
+ "type": "DateTime",
228
+ "required": "0"
229
+ }, /*{
230
+ "searchDialogWidth": "520px",
231
+ "name": "modifiedBy",
232
+ "label": "修改用户",
233
+ "type": "Reference",
234
+ "required": "0"
235
+ }, {
236
+ "searchDialogWidth": "520px",
237
+ "name": "ownerUser",
238
+ "label": "所属用户",
239
+ "type": "Reference",
240
+ "required": "1"
241
+ }, {
242
+ "searchDialogWidth": "520px",
243
+ "name": "ownerDepartment",
244
+ "label": "所属部门",
245
+ "type": "Reference",
246
+ "required": "1"
247
+ },*/ {
248
+ "name": "gonghao",
249
+ "label": "工号",
250
+ "type": "Text",
251
+ "required": "0",
252
+ "maxLength": "200"
253
+ }, {
254
+ "name": "xingming",
255
+ "label": "姓名",
256
+ "type": "Text",
257
+ "required": "1",
258
+ "maxLength": "200"
259
+ }, /*{
260
+ "searchDialogWidth": "520px",
261
+ "name": "bumen",
262
+ "label": "部门",
263
+ "type": "Reference",
264
+ "required": "1"
265
+ },*/ {
266
+ "name": "gangwei",
267
+ "label": "岗位",
268
+ "type": "Text",
269
+ "required": "1",
270
+ "maxLength": "200"
271
+ }, /*{
272
+ "searchDialogWidth": "520px",
273
+ "name": "yuangongchengyuan",
274
+ "label": "员工成员",
275
+ "type": "Reference",
276
+ "required": "0"
277
+ },*/ {
278
+ "name": "shenfenzhenghao",
279
+ "label": "身份证号",
280
+ "type": "Text",
281
+ "required": "0",
282
+ "maxLength": "200"
283
+ }, {"name": "xingbie", "label": "性别", "type": "Option", "required": "1"}, {
284
+ "name": "chushengriqi",
285
+ "label": "出生日期",
286
+ "type": "Date",
287
+ "required": "0"
288
+ }, /*{
289
+ "name": "jiguan",
290
+ "label": "籍贯",
291
+ "type": "AreaSelect",
292
+ "areaDataType": "2",
293
+ "required": "0"
294
+ },*/ {
295
+ "name": "hujisuozaidi",
296
+ "label": "户籍所在地",
297
+ "type": "Text",
298
+ "required": "0",
299
+ "maxLength": "200"
300
+ }, {"name": "hujileixing", "label": "户籍类型", "type": "Option", "required": "0"}, {
301
+ "name": "minzu",
302
+ "label": "民族",
303
+ "type": "Text",
304
+ "required": "0",
305
+ "maxLength": "200"
306
+ }, {
307
+ "name": "hunyinzhuangtai",
308
+ "label": "婚姻状态",
309
+ "type": "Option",
310
+ "required": "0"
311
+ }, {
312
+ "name": "zhengzhimianmao",
313
+ "label": "政治面貌",
314
+ "type": "Option",
315
+ "required": "0"
316
+ }, /*{
317
+ "name": "yuangongzhaopian",
318
+ "label": "员工照片",
319
+ "type": "Picture",
320
+ "required": "0"
321
+ },*/ {
322
+ "name": "pinyongxingshi",
323
+ "label": "聘用形式",
324
+ "type": "Option",
325
+ "required": "0"
326
+ }, {
327
+ "name": "yuangongzhuangtai",
328
+ "label": "员工状态",
329
+ "type": "Option",
330
+ "required": "1"
331
+ }, {"name": "canjiagongzuoriqi", "label": "参加工作日期", "type": "Date", "required": "0"}, {
332
+ "name": "ruzhiriqi",
333
+ "label": "入职日期",
334
+ "type": "Date",
335
+ "required": "1"
336
+ }, {
337
+ "name": "shiyongqitianshu",
338
+ "label": "试用期天数(天)",
339
+ "type": "Integer",
340
+ "required": "1"
341
+ }, {"name": "zhuanzhengriqi", "label": "转正日期", "type": "Date", "required": "0"}, {
342
+ "min": "-999999999",
343
+ "max": "999999999",
344
+ "precision": "2",
345
+ "name": "shiyongqixinzi",
346
+ "label": "试用期薪资",
347
+ "type": "Money",
348
+ "required": "0"
349
+ }, {
350
+ "min": "-999999999",
351
+ "max": "999999999",
352
+ "precision": "2",
353
+ "name": "zhengshixinzi",
354
+ "label": "正式薪资",
355
+ "type": "Money",
356
+ "required": "0"
357
+ }, /*{
358
+ "searchDialogWidth": "520px",
359
+ "name": "zhijieshangji",
360
+ "label": "直接上级",
361
+ "type": "Reference",
362
+ "required": "0"
363
+ }, {
364
+ "searchDialogWidth": "520px",
365
+ "name": "fuzeHR",
366
+ "label": "负责HR",
367
+ "type": "Reference",
368
+ "required": "0"
369
+ },*/ {
370
+ "name": "shebaozhanghao",
371
+ "label": "社保账号",
372
+ "type": "Text",
373
+ "required": "0",
374
+ "maxLength": "200"
375
+ }, {
376
+ "name": "gongjijinzhanghao",
377
+ "label": "公积金账号",
378
+ "type": "Text",
379
+ "required": "0",
380
+ "maxLength": "200"
381
+ }, {
382
+ "name": "yinhangkahao",
383
+ "label": "银行卡号",
384
+ "type": "Text",
385
+ "required": "0",
386
+ "maxLength": "200"
387
+ }, {
388
+ "name": "kaihuxing",
389
+ "label": "开户行",
390
+ "type": "Text",
391
+ "required": "0",
392
+ "maxLength": "200"
393
+ }, {
394
+ "name": "shoujihao",
395
+ "label": "手机号",
396
+ "type": "Text",
397
+ "required": "0",
398
+ "maxLength": "200"
399
+ }, /*{
400
+ "name": "changzhudizhi",
401
+ "label": "常住地址",
402
+ "type": "AreaSelect",
403
+ "areaDataType": "2",
404
+ "required": "0"
405
+ },*/ {
406
+ "name": "jutidizhi",
407
+ "label": "具体地址",
408
+ "type": "Text",
409
+ "required": "0",
410
+ "maxLength": "200"
411
+ }, {"name": "zuigaoxueli", "label": "最高学历", "type": "Option", "required": "0"}, {
412
+ "name": "biyeshijian",
413
+ "label": "毕业时间",
414
+ "type": "Date",
415
+ "required": "0"
416
+ }, {"name": "aa", "label": "aa", "type": "Integer", "required": "1"}, /*{
417
+ "detailEntity": "Jinjilianxiren",
418
+ "name": "jinjilianxirenId",
419
+ "label": "员工-紧急联系人.id主键",
420
+ "type": "PrimaryKey",
421
+ "required": "1"
422
+ },*/ {
423
+ "detailEntity": "Jinjilianxiren",
424
+ "name": "createdOn",
425
+ "label": "员工-紧急联系人.创建时间",
426
+ "type": "DateTime",
427
+ "required": "1"
428
+ }, /*{
429
+ "searchDialogWidth": "520px",
430
+ "detailEntity": "Jinjilianxiren",
431
+ "name": "createdBy",
432
+ "label": "员工-紧急联系人.创建用户",
433
+ "type": "Reference",
434
+ "required": "1"
435
+ },*/ {
436
+ "detailEntity": "Jinjilianxiren",
437
+ "name": "modifiedOn",
438
+ "label": "员工-紧急联系人.最近修改时间",
439
+ "type": "DateTime",
440
+ "required": "0"
441
+ }, /*{
442
+ "searchDialogWidth": "520px",
443
+ "detailEntity": "Jinjilianxiren",
444
+ "name": "modifiedBy",
445
+ "label": "员工-紧急联系人.修改用户",
446
+ "type": "Reference",
447
+ "required": "0"
448
+ }, {
449
+ "searchDialogWidth": "520px",
450
+ "detailEntity": "Jinjilianxiren",
451
+ "name": "mdYuangongdanganId",
452
+ "label": "员工-紧急联系人.主从关联Id",
453
+ "type": "Reference",
454
+ "required": "1"
455
+ },*/ {
456
+ "detailEntity": "Jinjilianxiren",
457
+ "name": "shouji",
458
+ "label": "员工-紧急联系人.手机",
459
+ "type": "Text",
460
+ "required": "0",
461
+ "maxLength": "200"
462
+ }, {
463
+ "detailEntity": "Jinjilianxiren",
464
+ "name": "jinjilianxirenxingming",
465
+ "label": "员工-紧急联系人.紧急联系人姓名",
466
+ "type": "Text",
467
+ "required": "0",
468
+ "maxLength": "200"
469
+ }]
470
+ }
471
+ };
472
+ if (res.data.fieldList) {
473
+ this.fieldListData.fieldList = res.data.fieldList;
474
+ if (res.data.subFormList) {
475
+ this.fieldListData.subFormList =
476
+ res.data.subFormList;
477
+ }
478
+ this.meteFieldsResult = res;
479
+ const metaFields = this.buildMetaFields(
480
+ this.meteFieldsResult
481
+ );
482
+ this.$refs.designer.setFieldListData(
483
+ this.fieldListData
484
+ );
485
+ this.$refs.designer.setMetaFields(metaFields);
486
+ }
487
+
488
+ },
489
+
490
+ buildMetaFields(mdResult) {
491
+ const result = {
492
+ main: {
493
+ entityName: this.entity,
494
+ entityLabel: this.entityLabel,
495
+ fieldList: [],
496
+ },
497
+ detail: [],
498
+ };
499
+
500
+ if (mdResult && mdResult.data?.fieldList) {
501
+ mdResult.data.fieldList.forEach((fld) => {
502
+ if (!fld.detailEntity && fld.type !== "PrimaryKey") {
503
+ //跳过id主键
504
+ if (fld.name === "loginPwd") {
505
+ return;
506
+ }
507
+
508
+ if (
509
+ fld.type === "AnyReference" ||
510
+ fld.type === "ReferenceList"
511
+ ) {
512
+ return;
513
+ }
514
+
515
+ if (this.usedFieldNames.hasOwnProperty(fld.name)) {
516
+ return; //跳过本次循环
517
+ }
518
+
519
+ const fieldNewProps = deepClone(
520
+ formFieldMapping[fld.type]
521
+ );
522
+ const fieldSchema = deepClone(
523
+ this.$refs.designer.designer.getFieldWidgetByType(
524
+ fieldNewProps.type
525
+ )
526
+ );
527
+ overwriteObj(
528
+ fieldSchema.options,
529
+ fieldNewProps.options
530
+ );
531
+
532
+ fieldSchema.displayName = fld.label;
533
+ fieldSchema.nameReadonly = true;
534
+ fieldSchema.options.name = fld.name;
535
+ fieldSchema.options.label = fld.label;
536
+ this.adjustFieldSchema(fieldSchema, fld, mdResult);
537
+ result.main.fieldList.push(fieldSchema);
538
+ }
539
+ });
540
+ }
541
+
542
+ if (mdResult && mdResult.data?.subFormList) {
543
+ mdResult.data.subFormList.forEach((sf) => {
544
+ const deName = sf.name;
545
+ const deLabel = sf.label;
546
+ const detailDataItem = {
547
+ entityName: deName,
548
+ entityLabel: deLabel,
549
+ fieldList: [],
550
+ };
551
+
552
+ mdResult.data.fieldList.forEach((fld) => {
553
+ if (
554
+ fld.detailEntity &&
555
+ fld.detailEntity === deName &&
556
+ fld.type !== "PrimaryKey"
557
+ ) {
558
+ //跳过id主键
559
+ if (
560
+ fld.type === "AnyReference" ||
561
+ fld.type === "ReferenceList"
562
+ ) {
563
+ return;
564
+ }
565
+
566
+ if (this.usedFieldNames.hasOwnProperty(fld.name)) {
567
+ return; //跳过本次循环
568
+ }
569
+
570
+ const fieldNewProps = deepClone(
571
+ formFieldMapping[fld.type]
572
+ );
573
+ const fieldSchema = deepClone(
574
+ this.$refs.designer.designer.getFieldWidgetByType(
575
+ fieldNewProps.type
576
+ )
577
+ );
578
+ overwriteObj(
579
+ fieldSchema.options,
580
+ fieldNewProps.options
581
+ );
582
+
583
+ fieldSchema.displayName = fld.label;
584
+ fieldSchema.nameReadonly = true;
585
+ fieldSchema.options.name = fld.name;
586
+ fieldSchema.options.label = fld.label;
587
+ this.adjustFieldSchema(fieldSchema, fld, mdResult);
588
+ detailDataItem.fieldList.push(fieldSchema);
589
+ }
590
+ });
591
+
592
+ result.detail.push(detailDataItem);
593
+ });
594
+ }
595
+
596
+ return result;
597
+ },
598
+
599
+ adjustFieldSchema(fieldSchema, fldObj, mdResult) {
600
+ // 处理图片、文件上传字段!!
601
+ let cloudStorageFlag = false;
602
+ let cloudStorageType = "";
603
+ if (mdResult.data.storageSetting) {
604
+ cloudStorageFlag =
605
+ mdResult.data.storageSetting[0].cloudStorage === "true";
606
+ if (cloudStorageFlag) {
607
+ cloudStorageType =
608
+ mdResult.data.storageSetting[0].cloudStorageType;
609
+ }
610
+ }
611
+
612
+ if (fldObj.type === "Picture" || fldObj.type === "File") {
613
+ if (cloudStorageFlag) {
614
+ //设置withCredentials
615
+ fieldSchema.options.withCredentials = false;
616
+
617
+ //设置onBeforeUpload事件代码(还需要生成uuid新文件名)
618
+ fieldSchema.options.onBeforeUpload =
619
+ "const gDSV = this.getGlobalDsv();\nconst wType = this.field.type;\nif (wType === 'picture-upload') {\n this.field.options.uploadURL = gDSV.picUploadURL;\n} else if (wType === 'file-upload') {\n this.field.options.uploadURL = gDSV.fileUploadURL;\n}\n\nconst cloudStorage = gDSV.cloudStorage;\nif (cloudStorage === \"true\") {\n this.field.options.withCredentials = false\n const token = gDSV.cloudUploadToken;\n this.setUploadData('token', token);\n \n const randomNum = Math.floor(Math.random() * 100);\n const newFileName = new Date().getTime() + randomNum+ '_' + file.name;\n this.setUploadData('key', newFileName);\n} else {\n //this.field.options.withCredentials = true\n}\n";
620
+
621
+ //设置onUploadSuccess事件代码(上传返回结果需要设置QiNiu=前缀)
622
+ fieldSchema.options.onUploadSuccess =
623
+ "const gDSV = this.getGlobalDsv();\nconst cloudStorage = gDSV.cloudStorage;\nif (cloudStorage === \"true\") {\n const wType = this.field.type;\n let downloadPrefix = \"\"\n if (wType === 'picture-upload') {\n downloadPrefix = gDSV.picDownloadPrefix;\n } else if (wType === 'file-upload') {\n downloadPrefix = gDSV.fileDownloadPrefix;\n }\n \n let downUrl = downloadPrefix + result.key;\n const paramName = (downUrl.indexOf(\"?\") === -1) ? '?fileName=' : '&fileName=';\n return {\n name: file.name,\n url: downUrl + paramName + file.name\n }\n} else {\n const paramName = (result.url.indexOf(\"?\") === -1) ? '?fileName=' : '&fileName=';\n return {\n name: file.name,\n url: result.url + paramName + file.name\n }\n}\n";
624
+ }
625
+ }
626
+ // 处理图片、文件上传字段 -- 结束
627
+
628
+ /* 处理文本、长文本字段 */
629
+ if (fldObj.type === "Text" || fldObj.type === "TextArea") {
630
+ fieldSchema.options.maxLength = !fldObj.maxLength
631
+ ? fieldSchema.options.maxLength
632
+ : fldObj.maxLength * 1;
633
+ }
634
+
635
+ /* 处理精度小数字段 */
636
+ if (
637
+ fldObj.type === "Integer" ||
638
+ fldObj.type === "Percent" ||
639
+ fldObj.type === "Money" ||
640
+ fldObj.type === "Decimal"
641
+ ) {
642
+ fieldSchema.options.precision = !fldObj.precision
643
+ ? fieldSchema.options.precision
644
+ : fldObj.precision * 1;
645
+ fieldSchema.options.min = !fldObj.min
646
+ ? fieldSchema.options.min
647
+ : fldObj.min * 1;
648
+ fieldSchema.options.max = !fldObj.max
649
+ ? fieldSchema.options.max
650
+ : fldObj.max * 1;
651
+ }
652
+
653
+ /* 处理地区选择字段 */
654
+ if (fldObj.type === "AreaSelect") {
655
+ fieldSchema.optionItemsReadonly = true;
656
+ fieldSchema.options.areaDataType = !fldObj.areaDataType
657
+ ? fieldSchema.options.areaDataType
658
+ : fldObj.areaDataType * 1;
659
+ }
660
+
661
+ /* 处理一对一字段 */
662
+ if (fldObj.type === "Reference") {
663
+ fieldSchema.options.searchDialogWidth =
664
+ !fldObj.searchDialogWidth
665
+ ? fieldSchema.options.searchDialogWidth
666
+ : fldObj.searchDialogWidth;
667
+ }
668
+
669
+ /* 处理单选项字段 */
670
+ if (fieldSchema.options.hasOwnProperty("optionItems")) {
671
+ if (
672
+ this.formOptionData.hasOwnProperty(fieldSchema.options.name)
673
+ ) {
674
+ fieldSchema.options.optionItems = deepClone(
675
+ this.formOptionData[fieldSchema.options.name]
676
+ );
677
+ }
678
+
679
+ if (fldObj.type === "Boolean") {
680
+ fieldSchema.options.optionItems = [
681
+ {value: true, label: ""},
682
+ {value: false, label: ""},
683
+ ];
684
+ }
685
+
686
+ fieldSchema.optionItemsReadonly = true;
687
+ }
688
+
689
+ /* 设置字段必填校验 */
690
+ if (fldObj.hasOwnProperty("required")) {
691
+ fieldSchema.options.required = fldObj["required"] === "1";
692
+ }
693
+
694
+ /* 取消系统字段的必填校验 */
695
+ if (fieldSchema.options.name === "createdOn" || fieldSchema.options.name === "createdBy"
696
+ || fieldSchema.options.name === "modifiedOn" || fieldSchema.options.name === "modifiedBy"
697
+ || fieldSchema.options.name === "ownerUser" || fieldSchema.options.name === "ownerDepartment"
698
+ || fieldSchema.options.name === "approvalConfigId" || fieldSchema.options.name === "approvalStatus"
699
+ || fieldSchema.options.name === "lastApprovedBy" || fieldSchema.options.name === "lastApprovedOn") {
700
+ fieldSchema.options.required = false;
701
+ }
702
+
703
+ //
704
+ },
705
+
706
+ handleFWU(fwName) {
707
+ this.usedFieldNames[fwName] = 1;
708
+
709
+ /* 必须延时处理,否则draggable会报错 */
710
+ setTimeout(() => {
711
+ const metaFields = this.buildMetaFields(this.meteFieldsResult);
712
+ this.$refs.designer.setMetaFields(metaFields);
713
+ }, 800);
714
+ },
715
+
716
+ handleFWR(fwName) {
717
+ delete this.usedFieldNames[fwName];
718
+
719
+ /* 必须延时处理,否则draggable会报错 */
720
+ setTimeout(() => {
721
+ const metaFields = this.buildMetaFields(this.meteFieldsResult);
722
+ this.$refs.designer.setMetaFields(metaFields);
723
+ }, 800);
724
+ },
725
+
726
+ handleFJU() {
727
+ this.handleUsedFields();
728
+ setTimeout(() => {
729
+ const metaFields = this.buildMetaFields(this.meteFieldsResult);
730
+ this.$refs.designer.setMetaFields(metaFields);
731
+ }, 300);
732
+ },
733
+
734
+ /**
735
+ * 过滤已使用字段组件
736
+ */
737
+ handleUsedFields() {
738
+ this.usedFieldNames = {};
739
+ const allFieldWidgets = this.$refs.designer.getFieldWidgets();
740
+ allFieldWidgets.forEach((fwItem) => {
741
+ this.usedFieldNames[fwItem.name] = 1;
742
+ });
743
+ },
744
+ initField() {
745
+ this.$http({
746
+ aes: true,
747
+ url: USER_PREFIX + "/szTaMb/listPage",
748
+ data: {},
749
+ success: res => {
750
+
751
+ }
752
+ });
753
+ },
754
+ reflushTemplateList() {
755
+ this.$emit("reflushTemplateList");
756
+ },
757
+ customConfirm(json) {
758
+ this.$emit("customConfirm", json);
759
+ }
760
+ }
761
+ };
762
+ </script>
763
+
764
+ <style lang="scss" scoped>
765
+ body {
766
+ margin: 0; /* 如果页面出现垂直滚动条,则加入此行CSS以消除之 */
767
+ }
768
+
769
+ #app .main-container {
770
+ margin-left: 0px;
771
+ }
772
+ </style>