cloud-web-corejs 1.0.163 → 1.0.164

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/package.json +2 -1
  2. package/src/components/vb-tabs/x-tabs.vue +30 -13
  3. package/src/components/xform/form-designer/designer.js +1 -1
  4. package/src/components/xform/form-designer/form-widget/components/gantt/index.vue +419 -0
  5. package/src/components/xform/form-designer/form-widget/container-widget/data-table-mixin.js +1 -1
  6. package/src/components/xform/form-designer/form-widget/dialog/baseFormulaDialog copy.vue +971 -0
  7. package/src/components/xform/form-designer/form-widget/dialog/baseFormulaDialog.vue +971 -0
  8. package/src/components/xform/form-designer/form-widget/dialog/formDialog.vue +71 -50
  9. package/src/components/xform/form-designer/form-widget/dialog/formulaDialog.vue +799 -0
  10. package/src/components/xform/form-designer/form-widget/dialog/importDialogMixin - /345/211/257/346/234/254.js" +1639 -0
  11. package/src/components/xform/form-designer/form-widget/dialog/searchFormDialog.vue +102 -73
  12. package/src/components/xform/form-designer/form-widget/field-widget/cascader-widget.vue +19 -1
  13. package/src/components/xform/form-designer/form-widget/field-widget/census-widget.vue +41 -27
  14. package/src/components/xform/form-designer/form-widget/field-widget/checkbox-widget.vue +4 -1
  15. package/src/components/xform/form-designer/form-widget/field-widget/color-widget.vue +4 -1
  16. package/src/components/xform/form-designer/form-widget/field-widget/date-range-widget.vue +13 -2
  17. package/src/components/xform/form-designer/form-widget/field-widget/date-widget.vue +9 -2
  18. package/src/components/xform/form-designer/form-widget/field-widget/download-button-widget.vue +133 -0
  19. package/src/components/xform/form-designer/form-widget/field-widget/fieldMixin.js +2 -1
  20. package/src/components/xform/form-designer/form-widget/field-widget/gantt-widget.vue +962 -0
  21. package/src/components/xform/form-designer/form-widget/field-widget/input-widget.vue +7 -2
  22. package/src/components/xform/form-designer/form-widget/field-widget/multiSearch-widget.vue +1 -1
  23. package/src/components/xform/form-designer/form-widget/field-widget/number-widget.vue +7 -0
  24. package/src/components/xform/form-designer/form-widget/field-widget/oplog-widget.vue +1 -0
  25. package/src/components/xform/form-designer/form-widget/field-widget/print-button-widget.vue +44 -27
  26. package/src/components/xform/form-designer/form-widget/field-widget/print-detail-button-widget.vue +19 -11
  27. package/src/components/xform/form-designer/form-widget/field-widget/project-tag-widget.vue +19 -1
  28. package/src/components/xform/form-designer/form-widget/field-widget/radio-widget.vue +11 -7
  29. package/src/components/xform/form-designer/form-widget/field-widget/select-widget.vue +11 -8
  30. package/src/components/xform/form-designer/form-widget/field-widget/singerSearch-widget.vue +1 -1
  31. package/src/components/xform/form-designer/form-widget/field-widget/table-export-button-widget.vue +1 -1
  32. package/src/components/xform/form-designer/form-widget/field-widget/vabSearch-widget.vue +1 -1
  33. package/src/components/xform/form-designer/setting-panel/form-setting.vue +106 -76
  34. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/data-table-editor.vue +13 -263
  35. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/table-column-dialog.vue +47 -81
  36. package/src/components/xform/form-designer/setting-panel/property-editor/downloadButtonFlag-editor.vue +32 -0
  37. package/src/components/xform/form-designer/setting-panel/property-editor/event-handler/onClick-editor.vue +14 -7
  38. package/src/components/xform/form-designer/setting-panel/property-editor/field-gantt/gantt-editor.vue +36 -0
  39. package/src/components/xform/form-designer/setting-panel/property-editor/field-print-button/print-button-editor.vue +37 -16
  40. package/src/components/xform/form-designer/setting-panel/property-editor/field-print-button/print-detail-button-editor.vue +42 -18
  41. package/src/components/xform/form-designer/setting-panel/property-editor/field-vabUpload/field-vabUpload-editor.vue +2 -2
  42. package/src/components/xform/form-designer/setting-panel/property-editor/formScriptEnabled-editor.vue +57 -34
  43. package/src/components/xform/form-designer/setting-panel/property-editor/project-tag-editor.vue +84 -53
  44. package/src/components/xform/form-designer/setting-panel/property-editor/wfFlag-editor.vue +35 -44
  45. package/src/components/xform/form-designer/setting-panel/propertyRegister.js +2 -0
  46. package/src/components/xform/form-designer/widget-panel/widgetsConfig.js +68 -3
  47. package/src/components/xform/form-render/container-item/containerItemMixin.js +2 -2
  48. package/src/components/xform/form-render/container-item/data-table-mixin.js +1 -1
  49. package/src/components/xform/form-render/container-item/tab-item.vue +64 -32
  50. package/src/components/xform/form-render/index.vue +69 -23
  51. package/src/components/xform/form-render/indexMixin.js +18 -17
  52. package/src/components/xform/lang/zh-CN.js +8 -2
  53. package/src/components/xform/utils/formula-util.js +306 -5
  54. package/src/components/xform/utils/util.js +1 -1
  55. package/src/components/xform/utils/vue2js-generator.js +2 -2
  56. package/src/utils/request.js +1 -1
  57. package/src/utils/vab.js +1 -1
  58. package/src/views/user/form/vform/render.vue +54 -36
  59. package/src/views/user/form/view/list.vue +103 -10
  60. package/src/views/user/menu/list.vue +24 -1
  61. package/src/views/user/role/authConfig.vue +89 -0
  62. package/src/views/user/role/dialog.vue +70 -48
  63. package/src/views/user/role/edit.vue +114 -4
@@ -0,0 +1,962 @@
1
+ <template>
2
+ <static-content-wrapper
3
+ :designer="designer"
4
+ :field="field"
5
+ :design-state="designState"
6
+ :display-style="field.options.displayStyle"
7
+ :parent-widget="parentWidget"
8
+ :parent-list="parentList"
9
+ :index-of-parent-list="indexOfParentList"
10
+ :sub-form-row-index="subFormRowIndex"
11
+ :sub-form-col-index="subFormColIndex"
12
+ :sub-form-row-id="subFormRowId"
13
+ >
14
+ <gantt
15
+ v-if="showGantt"
16
+ ref="gantt"
17
+ :ganttData.sync="fieldModel"
18
+ :dateType="searchform.DataType"
19
+ :option="ganttConfig.config"
20
+ @rowDbClick="ganttDbClick"
21
+ ></gantt>
22
+ </static-content-wrapper>
23
+ </template>
24
+
25
+ <script>
26
+ import StaticContentWrapper from "./static-content-wrapper";
27
+ import emitter from "../../../utils/emitter";
28
+ import i18n from "../../../utils/i18n";
29
+ import fieldMixin from "./fieldMixin";
30
+
31
+ import gantt from "../components/gantt/index.vue";
32
+
33
+ export default {
34
+ name: "gantt-widget",
35
+ componentName: "FieldWidget", //必须固定为FieldWidget,用于接收父级组件的broadcast事件
36
+ mixins: [emitter, fieldMixin, i18n],
37
+ props: {
38
+ field: Object,
39
+ parentWidget: Object,
40
+ parentList: Array,
41
+ indexOfParentList: Number,
42
+ designer: Object,
43
+
44
+ designState: {
45
+ type: Boolean,
46
+ default: false,
47
+ },
48
+
49
+ subFormRowIndex: {
50
+ /* 子表单组件行索引,从0开始计数 */ type: Number,
51
+ default: -1,
52
+ },
53
+ subFormColIndex: {
54
+ /* 子表单组件列索引,从0开始计数 */ type: Number,
55
+ default: -1,
56
+ },
57
+ subFormRowId: {
58
+ /* 子表单组件行Id,唯一id且不可变 */ type: String,
59
+ default: "",
60
+ },
61
+ },
62
+ components: {
63
+ StaticContentWrapper,
64
+ gantt,
65
+ },
66
+ computed: {},
67
+ beforeCreate() {
68
+ /* 这里不能访问方法和属性!! */
69
+ },
70
+ data() {
71
+ return {
72
+ // 甘特图配置
73
+ tasks: {
74
+ data: [
75
+ // {
76
+ // id: 11,
77
+ // text: 'Project #1',
78
+ // // type: gantt.config.types.project,
79
+ // progress: 0.5,//完成度
80
+ // open: true,//默认打开
81
+ // number: '20240227',//显示字段
82
+ // },
83
+ // {
84
+ // toolTipsTxt: '任务#101-001',
85
+ // id: 12,//任务id
86
+ // text: '任务#1',//任务名称
87
+ // start_date: '03-04-2022',//开始时间 日月年
88
+ // duration: '5',//任务时常
89
+ // parent: '11',//父级id
90
+ // progress: 1,//完成度
91
+ // open: true,//默认打开
92
+ // },
93
+ // {
94
+ // id: 13,
95
+ // text: '任务#2',
96
+ // start_date: '03-04-2022',
97
+ // // type: gantt.config.types.project,
98
+ // parent: '11',
99
+ // progress: 0.255,
100
+ // open: true,
101
+ // },
102
+ // {
103
+ // id: 14,
104
+ // text: '任务#3',
105
+ // start_date: '01-04-2022',
106
+ // duration: '6',
107
+ // parent: '11',
108
+ // progress: 0.8,
109
+ // open: true,
110
+ // },
111
+ // {
112
+ // id: 15,
113
+ // text: '任务#4',
114
+ // // type: gantt.config.types.project,
115
+ // parent: '11',
116
+ // progress: 0.2,
117
+ // open: true,
118
+ // },
119
+ // {
120
+ // id: 16,
121
+ // text: 'Final milestone',
122
+ // start_date: '15-04-2022',
123
+ // // type: gantt.config.types.milestone,
124
+ // parent: '11',
125
+ // progress: 0,
126
+ // open: true,
127
+ // },
128
+ // {
129
+ // id: 17,
130
+ // text: '任务#2.1',
131
+ // start_date: '03-04-2022',
132
+ // duration: '2',
133
+ // parent: '13',
134
+ // progress: 1,
135
+ // open: true,
136
+ // },
137
+ // {
138
+ // id: 18,
139
+ // text: '任务#2.2',
140
+ // start_date: '06-04-2022',
141
+ // duration: '3',
142
+ // parent: '13',
143
+ // progress: 0.8,
144
+ // open: true,
145
+ // },
146
+ // {
147
+ // id: 19,
148
+ // text: '任务#2.3',
149
+ // start_date: '10-04-2022',
150
+ // duration: '4',
151
+ // parent: '13',
152
+ // progress: 0.2,
153
+ // open: true,
154
+ // },
155
+ // {
156
+ // id: 20,
157
+ // text: '任务#2.4',
158
+ // start_date: '10-04-2022',
159
+ // duration: '4',
160
+ // parent: '13',
161
+ // progress: 0,
162
+ // open: true,
163
+ // },
164
+ // {
165
+ // id: 21,
166
+ // text: '任务#4.1',
167
+ // start_date: '03-04-2022',
168
+ // duration: '4',
169
+ // parent: '15',
170
+ // progress: 0.5,
171
+ // open: true,
172
+ // },
173
+ // {
174
+ // id: 22,
175
+ // text: '任务#4.2',
176
+ // start_date: '03-04-2022',
177
+ // duration: '4',
178
+ // parent: '15',
179
+ // progress: 0.1,
180
+ // open: true,
181
+ // },
182
+ // {
183
+ // id: 23,
184
+ // text: 'Mediate milestone',
185
+ // start_date: '14-04-2022',
186
+ // // type: gantt.config.types.milestone,
187
+ // parent: '15',
188
+ // progress: 0,
189
+ // open: true,
190
+ // },
191
+ ],
192
+ // #字段解释
193
+ // 格式 id:数据id
194
+ // source:开始链接的项目id ----为tasks.data中数据的id
195
+ // target:要链接项目的id ----为tasks.data中数据的id
196
+ // type: 0--进行-开始 `尾部链接头部`
197
+ // 1--开始-开始 `头部链接头部`
198
+ // 2--进行-进行 `尾部链接尾部`
199
+ // 3--开始-进行 `头部链接尾部`
200
+ // 任务之间连接
201
+ links: [
202
+ { id: "10", source: "11", target: "12", type: "1" },
203
+ { id: "11", source: "11", target: "13", type: "1" },
204
+ { id: "12", source: "11", target: "14", type: "1" },
205
+ { id: "13", source: "11", target: "15", type: "1" },
206
+ { id: "14", source: "23", target: "16", type: "0" },
207
+ { id: "15", source: "13", target: "17", type: "1" },
208
+ { id: "16", source: "17", target: "18", type: "0" },
209
+ { id: "17", source: "18", target: "19", type: "0" },
210
+ { id: "18", source: "19", target: "20", type: "0" },
211
+ { id: "19", source: "15", target: "21", type: "2" },
212
+ { id: "20", source: "15", target: "22", type: "2" },
213
+ { id: "21", source: "15", target: "23", type: "0" },
214
+ ],
215
+ },
216
+ ganttConfig: {},
217
+ ganttInstance: null,
218
+ fieldModel: [],
219
+ searchform: {
220
+ DataType: "day",
221
+ Date: [],
222
+ ProjectId: "",
223
+ PersonId: "",
224
+ PostName: "",
225
+ DepartmentName: "",
226
+ },
227
+ showGantt: false,
228
+ };
229
+ },
230
+
231
+ created() {
232
+ /* 注意:子组件mounted在父组件created之后、父组件mounted之前触发,故子组件mounted需要用到的prop
233
+ 需要在父组件created中初始化!! */
234
+ this.registerToRefList();
235
+ this.initEventHandler();
236
+
237
+ this.handleOnCreated();
238
+ },
239
+
240
+ mounted() {
241
+ this.init();
242
+ this.handleOnMounted();
243
+ },
244
+
245
+ beforeDestroy() {
246
+ this.unregisterFromRefList();
247
+ // gantt.destroy();
248
+ },
249
+
250
+ methods: {
251
+ ganttDbClick(id) {
252
+ /* console.log('接收到', id);
253
+ let clickRow = this.ganttData.filter((item) => {
254
+ return item.id === id;
255
+ });
256
+ console.log('点击了', clickRow);
257
+ this.detailData = clickRow[0];
258
+ if(!this.detailData.project) return
259
+ this.leftDialogVisible = true; */
260
+ },
261
+
262
+ // 初始化
263
+ getDefaultData() {
264
+ return [
265
+ { id: 11, text: "Project #1", type: "project", progress: 0.6, open: true },
266
+
267
+ {
268
+ id: 12,
269
+ text: "Task #1",
270
+ start_date: "03-04-2023",
271
+ duration: 5,
272
+ parent: 11,
273
+ progress: 1,
274
+ open: true,
275
+ },
276
+ {
277
+ id: 13,
278
+ text: "Task #2",
279
+ start_date: "03-04-2023",
280
+ type: "project",
281
+ parent: 11,
282
+ progress: 0.5,
283
+ open: true,
284
+ },
285
+ {
286
+ id: 14,
287
+ text: "Task #3",
288
+ start_date: "02-04-2023",
289
+ duration: 6,
290
+ parent: 11,
291
+ progress: 0.8,
292
+ open: true,
293
+ },
294
+ {
295
+ id: 15,
296
+ text: "Task #4",
297
+ type: "project",
298
+ parent: 11,
299
+ progress: 0.2,
300
+ open: true,
301
+ },
302
+ {
303
+ id: 16,
304
+ text: "Final milestone",
305
+ start_date: "15-04-2023",
306
+ type: "milestone",
307
+ parent: 11,
308
+ progress: 0,
309
+ open: true,
310
+ },
311
+
312
+ {
313
+ id: 17,
314
+ text: "Task #2.1",
315
+ start_date: "03-04-2023",
316
+ duration: 2,
317
+ parent: 13,
318
+ progress: 1,
319
+ open: true,
320
+ },
321
+ {
322
+ id: 18,
323
+ text: "Task #2.2",
324
+ start_date: "06-04-2023",
325
+ duration: 3,
326
+ parent: 13,
327
+ progress: 0.8,
328
+ open: true,
329
+ },
330
+ {
331
+ id: 19,
332
+ text: "Task #2.3",
333
+ start_date: "10-04-2023",
334
+ duration: 4,
335
+ parent: 13,
336
+ progress: 0.2,
337
+ open: true,
338
+ },
339
+ {
340
+ id: 20,
341
+ text: "Task #2.4",
342
+ start_date: "10-04-2023",
343
+ duration: 4,
344
+ parent: 13,
345
+ progress: 0,
346
+ open: true,
347
+ },
348
+ {
349
+ id: 21,
350
+ text: "Task #4.1",
351
+ start_date: "03-04-2023",
352
+ duration: 4,
353
+ parent: 15,
354
+ progress: 0.5,
355
+ open: true,
356
+ },
357
+ {
358
+ id: 22,
359
+ text: "Task #4.2",
360
+ start_date: "03-04-2023",
361
+ duration: 4,
362
+ parent: 15,
363
+ progress: 0.1,
364
+ open: true,
365
+ },
366
+ {
367
+ id: 23,
368
+ text: "Mediate milestone",
369
+ start_date: "14-04-2023",
370
+ type: "milestone",
371
+ parent: 15,
372
+ progress: 0,
373
+ open: true,
374
+ },
375
+ ];
376
+ let resultData = [
377
+ {
378
+ id: 11,
379
+ text: "Project #1",
380
+ // type: gantt.config.types.project,
381
+ progress: 0.5, //完成度
382
+ open: true, //默认打开
383
+ number: "20240227", //显示字段
384
+ },
385
+ {
386
+ toolTipsTxt: "任务#101-001",
387
+ id: 12, //任务id
388
+ text: "任务#1", //任务名称
389
+ start_date: "03-04-2022", //开始时间 日月年
390
+ duration: "5", //任务时常
391
+ parent: "11", //父级id
392
+ progress: 1, //完成度
393
+ open: true, //默认打开
394
+ },
395
+ {
396
+ id: 13,
397
+ text: "任务#2",
398
+ start_date: "03-04-2022",
399
+ // type: gantt.config.types.project,
400
+ parent: "11",
401
+ progress: 0.255,
402
+ open: true,
403
+ },
404
+ {
405
+ id: 14,
406
+ text: "任务#3",
407
+ start_date: "01-04-2022",
408
+ duration: "6",
409
+ parent: "11",
410
+ progress: 0.8,
411
+ open: true,
412
+ },
413
+ {
414
+ id: 15,
415
+ text: "任务#4",
416
+ // type: gantt.config.types.project,
417
+ parent: "11",
418
+ progress: 0.2,
419
+ open: true,
420
+ },
421
+ {
422
+ id: 16,
423
+ text: "Final milestone",
424
+ start_date: "15-04-2022",
425
+ // type: gantt.config.types.milestone,
426
+ parent: "11",
427
+ progress: 0,
428
+ open: true,
429
+ },
430
+ {
431
+ id: 17,
432
+ text: "任务#2.1",
433
+ start_date: "03-04-2022",
434
+ duration: "2",
435
+ parent: "13",
436
+ progress: 1,
437
+ open: true,
438
+ },
439
+ {
440
+ id: 18,
441
+ text: "任务#2.2",
442
+ start_date: "06-04-2022",
443
+ duration: "3",
444
+ parent: "13",
445
+ progress: 0.8,
446
+ open: true,
447
+ },
448
+ {
449
+ id: 19,
450
+ text: "任务#2.3",
451
+ start_date: "10-04-2022",
452
+ duration: "4",
453
+ parent: "13",
454
+ progress: 0.2,
455
+ open: true,
456
+ },
457
+ {
458
+ id: 20,
459
+ text: "任务#2.4",
460
+ start_date: "10-04-2022",
461
+ duration: "4",
462
+ parent: "13",
463
+ progress: 0,
464
+ open: true,
465
+ },
466
+ {
467
+ id: 21,
468
+ text: "任务#4.1",
469
+ start_date: "03-04-2022",
470
+ duration: "4",
471
+ parent: "15",
472
+ progress: 0.5,
473
+ open: true,
474
+ },
475
+ {
476
+ id: 22,
477
+ text: "任务#4.2",
478
+ start_date: "03-04-2022",
479
+ duration: "4",
480
+ parent: "15",
481
+ progress: 0.1,
482
+ open: true,
483
+ },
484
+ {
485
+ id: 23,
486
+ text: "Mediate milestone",
487
+ start_date: "14-04-2022",
488
+ // type: gantt.config.types.milestone,
489
+ parent: "15",
490
+ progress: 0,
491
+ open: true,
492
+ },
493
+ ];
494
+ return resultData;
495
+ },
496
+ initDefaultConfig() {
497
+ // 格式化日期
498
+ gantt.locale.date = {
499
+ month_full: [
500
+ "1月",
501
+ "2月",
502
+ "3月",
503
+ "4月",
504
+ "5月",
505
+ "6月",
506
+ "7月",
507
+ "8月",
508
+ "9月",
509
+ "10月",
510
+ "11月",
511
+ "12月",
512
+ ],
513
+ month_short: [
514
+ "1月",
515
+ "2月",
516
+ "3月",
517
+ "4月",
518
+ "5月",
519
+ "6月",
520
+ "7月",
521
+ "8月",
522
+ "9月",
523
+ "10月",
524
+ "11月",
525
+ "12月",
526
+ ],
527
+ day_full: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"],
528
+ day_short: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"],
529
+ };
530
+
531
+ gantt.locale.labels = {
532
+ dhx_cal_today_button: "今天",
533
+ day_tab: "日",
534
+ week_tab: "周",
535
+ month_tab: "月",
536
+ new_event: "新建日程",
537
+ icon_save: "保存",
538
+ icon_cancel: "关闭",
539
+ icon_details: "详细",
540
+ icon_edit: "编辑",
541
+ icon_delete: "删除",
542
+ confirm_closing: "请确认是否撤销修改!", //Your changes will be lost, are your sure?
543
+ confirm_deleting: "是否删除计划?",
544
+ section_description: "描述:",
545
+ section_time: "时间范围:",
546
+ section_type: "类型:",
547
+ section_text: "计划名称:",
548
+ section_test: "测试:",
549
+ section_projectClass: "项目类型:",
550
+ taskProjectType_0: "项目任务",
551
+ taskProjectType_1: "普通任务",
552
+ section_head: "负责人:",
553
+ section_priority: "优先级:",
554
+ taskProgress: "任务状态",
555
+ taskProgress_0: "未开始",
556
+ taskProgress_1: "进行中",
557
+ taskProgress_2: "已完成",
558
+ taskProgress_3: "已延期",
559
+ taskProgress_4: "搁置中",
560
+ section_template: "Details",
561
+ /* grid columns */
562
+ column_text: "计划名称",
563
+ column_start_date: "开始时间",
564
+ column_duration: "持续时间",
565
+ column_add: "",
566
+ column_priority: "难度",
567
+ /* link confirmation */
568
+ link: "关联",
569
+ confirm_link_deleting: "将被删除",
570
+ message_ok: "确定",
571
+ message_cancel: "取消",
572
+ link_start: " (开始)",
573
+ link_end: " (结束)",
574
+
575
+ type_task: "任务",
576
+ type_project: "项目",
577
+ type_milestone: "里程碑",
578
+ minutes: "分钟",
579
+ hours: "小时",
580
+ days: "天",
581
+ weeks: "周",
582
+ months: "月",
583
+ years: "年",
584
+ };
585
+
586
+ console.log(gantt);
587
+ //自适应甘特图的尺寸大小, 使得在不出现滚动条的情况下, 显示全部任务
588
+ gantt.config.autosize = true;
589
+ //只读模式
590
+ gantt.config.readonly = false;
591
+ //是否显示左侧树表格
592
+ gantt.config.show_grid = true;
593
+ },
594
+ initDefaultGantt() {
595
+ //加载默认数据
596
+ this.tasks.data = this.getDefaultData();
597
+
598
+ // 格式化日期
599
+ gantt.locale.date = {
600
+ month_full: [
601
+ "1月",
602
+ "2月",
603
+ "3月",
604
+ "4月",
605
+ "5月",
606
+ "6月",
607
+ "7月",
608
+ "8月",
609
+ "9月",
610
+ "10月",
611
+ "11月",
612
+ "12月",
613
+ ],
614
+ month_short: [
615
+ "1月",
616
+ "2月",
617
+ "3月",
618
+ "4月",
619
+ "5月",
620
+ "6月",
621
+ "7月",
622
+ "8月",
623
+ "9月",
624
+ "10月",
625
+ "11月",
626
+ "12月",
627
+ ],
628
+ day_full: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"],
629
+ day_short: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"],
630
+ };
631
+
632
+ gantt.locale.labels = {
633
+ dhx_cal_today_button: "今天",
634
+ day_tab: "日",
635
+ week_tab: "周",
636
+ month_tab: "月",
637
+ new_event: "新建日程",
638
+ icon_save: "保存",
639
+ icon_cancel: "关闭",
640
+ icon_details: "详细",
641
+ icon_edit: "编辑",
642
+ icon_delete: "删除",
643
+ confirm_closing: "请确认是否撤销修改!", //Your changes will be lost, are your sure?
644
+ confirm_deleting: "是否删除计划?",
645
+ section_description: "描述:",
646
+ section_time: "时间范围:",
647
+ section_type: "类型:",
648
+ section_text: "计划名称:",
649
+ section_test: "测试:",
650
+ section_projectClass: "项目类型:",
651
+ taskProjectType_0: "项目任务",
652
+ taskProjectType_1: "普通任务",
653
+ section_head: "负责人:",
654
+ section_priority: "优先级:",
655
+ taskProgress: "任务状态",
656
+ taskProgress_0: "未开始",
657
+ taskProgress_1: "进行中",
658
+ taskProgress_2: "已完成",
659
+ taskProgress_3: "已延期",
660
+ taskProgress_4: "搁置中",
661
+ section_template: "Details",
662
+ /* grid columns */
663
+ column_text: "计划名称",
664
+ column_start_date: "开始时间",
665
+ column_duration: "持续时间",
666
+ column_add: "",
667
+ column_priority: "难度",
668
+ /* link confirmation */
669
+ link: "关联",
670
+ confirm_link_deleting: "将被删除",
671
+ message_ok: "确定",
672
+ message_cancel: "取消",
673
+ link_start: " (开始)",
674
+ link_end: " (结束)",
675
+
676
+ type_task: "任务",
677
+ type_project: "项目",
678
+ type_milestone: "里程碑",
679
+ minutes: "分钟",
680
+ hours: "小时",
681
+ days: "天",
682
+ weeks: "周",
683
+ months: "月",
684
+ years: "年",
685
+ };
686
+
687
+ console.log(gantt);
688
+ //自适应甘特图的尺寸大小, 使得在不出现滚动条的情况下, 显示全部任务
689
+ gantt.config.autosize = true;
690
+ //只读模式
691
+ gantt.config.readonly = false;
692
+ //是否显示左侧树表格
693
+ gantt.config.show_grid = true;
694
+ // //表格列设置
695
+ gantt.config.columns = [
696
+ {
697
+ name: "text",
698
+ label: "阶段名字",
699
+ tree: true,
700
+ width: "150",
701
+ align: "center",
702
+ },
703
+ // { name: 'number', label: '工单号', tree: false, width: '120', align: 'center', },
704
+ {
705
+ name: "duration",
706
+ label: "工时",
707
+ align: "center",
708
+ template: function (obj) {
709
+ return obj.duration + "天";
710
+ },
711
+ },
712
+ /*{name:"start_date", label:"开始时间", align: "center" },
713
+
714
+ {name:"end_date", label:"结束时间", align: "center" },*/
715
+ ];
716
+ // 自动延长时间刻度
717
+ gantt.config.fit_tasks = true;
718
+ // 允许拖放
719
+ gantt.config.drag_project = true;
720
+ // 定义时间格式
721
+ gantt.config.scales = [
722
+ { unit: "month", step: 1, date: " %Y,%F" },
723
+ { unit: "day", step: 1, date: " %D ,%j" },
724
+ ];
725
+ // //当task的长度改变时,自动调整图表坐标轴区间用于适配task的长度
726
+ gantt.config.fit_tasks = true;
727
+ // 添加弹窗属性
728
+ gantt.config.lightbox.sections = [
729
+ {
730
+ name: "description",
731
+ height: 70,
732
+ map_to: "text",
733
+ type: "textarea",
734
+ focus: true,
735
+ },
736
+ { name: "type", type: "typeselect", map_to: "type" },
737
+ { name: "time", type: "duration", map_to: "auto" },
738
+ ];
739
+ console.log(this.tasks.data, "检查任务数据"); // 检查任务数据
740
+ // 初始化
741
+ gantt.init(this.$refs.gantt);
742
+ /* *******重点******* */
743
+ gantt.clearAll(); // 清空旧数据
744
+ /* ****************** */
745
+ // 数据解析
746
+ gantt.parse(this.tasks);
747
+ },
748
+ initGantt() {
749
+ // 配置国内日期格式(示例 1:YYYY-MM-DD)
750
+ gantt.config.date_format = "%Y-%m-%d";
751
+
752
+ // 可选:配置中文语言包(解决月份/星期显示为英文的问题)
753
+ gantt.locale.labels.section_task = "任务"; // 任务列标题
754
+ gantt.locale.labels.section_project = "阶段"; // 阶段列标题
755
+ gantt.locale.date.months = [
756
+ "01月",
757
+ "02月",
758
+ "03月",
759
+ "04月",
760
+ "05月",
761
+ "06月",
762
+ "07月",
763
+ "08月",
764
+ "09月",
765
+ "10月",
766
+ "11月",
767
+ "12月",
768
+ ];
769
+ gantt.locale.date.days = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"];
770
+ gantt.locale.date.daysShort = ["日", "一", "二", "三", "四", "五", "六"];
771
+
772
+ // 若使用格式 2(YYYY年MM月DD日),只需修改 date_format:
773
+ // gantt.config.date_format = '%Y年%m月%d日';
774
+
775
+ gantt.clearAll(); // 清空旧数据
776
+
777
+ this.initConfig();
778
+ // 初始化
779
+ gantt.init(this.$refs.gantt);
780
+ /* *******重点******* */
781
+ /*
782
+ // 数据解析
783
+ gantt.parse(this.tasks); */
784
+ },
785
+ extendDeeply(result, child) {
786
+ for (var prop in child) {
787
+ // 如果属性本身,就是一个数组或者Json对象,进行深拷贝
788
+ if (child[prop]?.constructor === Object) {
789
+ if (!result[prop]) result[prop] = {};
790
+ // 实现深拷贝
791
+ extendDeeply(result[prop], child[prop]);
792
+ } else {
793
+ result[prop] = child[prop];
794
+ }
795
+ }
796
+ return result;
797
+ },
798
+ initConfig() {
799
+ // this.initDefaultConfig();
800
+ this.ganttConfig = this.handleCustomEvent(this.field.options.ganttConfig) || {};
801
+ /* if (ganttConfig && ganttConfig.config) {
802
+ this.ganttConfig = {};
803
+ this.extendDeeply(gantt, ganttConfig.config);
804
+ } */
805
+ },
806
+ init() {
807
+ if (this.designState) {
808
+ // this.initDefaultGantt();
809
+ this.fieldModel = this.getDefaultData();
810
+ this.showGantt = true;
811
+ return;
812
+ }
813
+
814
+ this.initConfig();
815
+ this.showGantt = true;
816
+ // this.initGantt();
817
+ // this.initData();
818
+ },
819
+ /* setValue(value) {
820
+ this.tasks.data = value || [];
821
+ // this.initGantt();
822
+ }, */
823
+ loadData(value) {
824
+ this.showGantt = false;
825
+
826
+ // this.setValue(value);
827
+ this.fieldModel = value;
828
+ this.$nextTick(() => {
829
+ this.showGantt = true;
830
+ });
831
+ },
832
+ initData() {
833
+ let reportTemplate = this.getFormRef().reportTemplate;
834
+ let formCode = reportTemplate.formCode;
835
+ let scriptCode = this.field.options.formScriptCode;
836
+ let formScriptEnabled = this.field.options.formScriptEnabled;
837
+ if (!scriptCode || !formScriptEnabled) return;
838
+
839
+ this.loading = true;
840
+ this.tasks.data = [];
841
+
842
+ this.formHttp({
843
+ scriptCode: scriptCode,
844
+ data: {
845
+ formCode: formCode,
846
+ formVersion: reportTemplate.formVersion,
847
+ data: {
848
+ log_type: oplogTypeCode,
849
+ business_code: business_code,
850
+ },
851
+ },
852
+ addCreateInfo: true,
853
+ queryCreateInfo: true,
854
+ callback: (res) => {
855
+ let rows = res.objx || [];
856
+
857
+ this.loadData(rows);
858
+ this.loading = false;
859
+ },
860
+ });
861
+ },
862
+ getGanttRef() {
863
+ return this.$refs.gantt;
864
+ },
865
+ getGanttTarget() {
866
+ return this.$refs.gantt.getGanttTarget();
867
+ },
868
+ getGanttInstance() {
869
+ return this.$refs.gantt.getGanttInstance();
870
+ },
871
+ },
872
+ };
873
+ </script>
874
+
875
+ <style lang="less" scoped>
876
+ .firstLevelTask {
877
+ border: none;
878
+
879
+ .gantt_task_content {
880
+ // font-weight: bold;
881
+ font-size: 13px;
882
+ }
883
+ }
884
+
885
+ .secondLevelTask {
886
+ border: none;
887
+ }
888
+
889
+ .thirdLevelTask {
890
+ border: 2px solid #da645d;
891
+ color: #da645d;
892
+ background: #da645d;
893
+ }
894
+
895
+ .milestone-default {
896
+ border: none;
897
+ background: rgba(0, 0, 0, 0.45);
898
+ }
899
+
900
+ .milestone-unfinished {
901
+ border: none;
902
+ background: #5692f0;
903
+ }
904
+
905
+ .milestone-finished {
906
+ border: none;
907
+ background: #84bd54;
908
+ }
909
+
910
+ .milestone-canceled {
911
+ border: none;
912
+ background: #da645d;
913
+ }
914
+
915
+ html,
916
+ body {
917
+ margin: 0px;
918
+ padding: 0px;
919
+ height: 100%;
920
+ overflow: hidden;
921
+ }
922
+
923
+ .container {
924
+ height: 900px;
925
+
926
+ .left-container {
927
+ height: 100%;
928
+ }
929
+ }
930
+
931
+ .left-container {
932
+ height: 600px;
933
+ }
934
+
935
+ .gantt_scale_line {
936
+ border-top: 0;
937
+ }
938
+
939
+ .weekend {
940
+ //background:#f4f7f4!important;
941
+ color: #000000 !important;
942
+ }
943
+
944
+ .gantt_selected .weekend {
945
+ background: #f7eb91 !important;
946
+ }
947
+
948
+ .gantt_task_content {
949
+ text-align: left;
950
+ padding-left: 10px;
951
+ }
952
+
953
+ //上面任务条样式
954
+ .gantt_task_scale {
955
+ height: 45px !important;
956
+ }
957
+
958
+ .gantt_task .gantt_task_scale .gantt_scale_cell {
959
+ line-height: 30px !important;
960
+ height: 28px !important;
961
+ }
962
+ </style>