cloud-web-corejs 1.1.0-dev.6 → 1.1.0-dev.8

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