cloud-web-corejs 1.0.54-dev.380 → 1.0.54-dev.381

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cloud-web-corejs",
3
3
  "private": false,
4
- "version": "1.0.54-dev.380",
4
+ "version": "1.0.54-dev.381",
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
7
7
  "lint": "eslint --ext .js,.vue src",
@@ -25,12 +25,13 @@
25
25
  "copy-webpack-plugin": "5.1.2",
26
26
  "core-js": "^3.8.3",
27
27
  "dayjs": "^1.11.13",
28
+ "dhtmlx-gantt": "^7.1.13",
28
29
  "element-ui": "^2.15.14",
29
30
  "html2canvas": "^1.4.1",
30
31
  "js-base64": "^3.7.7",
31
32
  "js-cookie": "2.2.0",
32
- "jsqr": "^1.4.0",
33
33
  "jspdf": "^3.0.1",
34
+ "jsqr": "^1.4.0",
34
35
  "less": "^4.2.0",
35
36
  "less-loader": "^7.0.1",
36
37
  "lodash": "4.17.21",
@@ -0,0 +1,419 @@
1
+ <template>
2
+ <div>
3
+ <div ref="gantt" :style="'height:' + (tabheight - 80) + 'px'" />
4
+ </div>
5
+ </template>
6
+
7
+ <script>
8
+ import { gantt } from "dhtmlx-gantt";
9
+ import "dhtmlx-gantt/codebase/dhtmlxgantt.css";
10
+ import { extendDeeply } from "@base/utils/index.js";
11
+ // import { JeecgListMixin } from '@/mixins/JeecgListMixin'
12
+ // import { getAction, putAction } from '@/api/manage'
13
+ export default {
14
+ name: "ganttPerson",
15
+ props: ["ganttData", "dateType", "option"],
16
+ watch: {
17
+ ganttData: {
18
+ handler(val) {
19
+ /* this.tasks = {
20
+ data: val,
21
+ };
22
+ this.init(); */
23
+ this.loadData(val);
24
+ },
25
+ deep: true,
26
+ },
27
+ },
28
+ mounted() {
29
+ let h =
30
+ window.innerHeight ||
31
+ document.documentElement.clientHeight ||
32
+ document.body.clientHeight;
33
+ this.tabheight = h - 170;
34
+ if (this.height) {
35
+ this.tabheight = this.height;
36
+ }
37
+ this.tasks = {
38
+ data: this.$baseLodash.cloneDeep(this.ganttData),
39
+ };
40
+ this.init();
41
+ },
42
+ beforeDestroy() {
43
+ this.destroyGantt();
44
+ },
45
+ // mixins: [JeecgListMixin],
46
+ data() {
47
+ return {
48
+ ganttInstance: null,
49
+ // 注册事件拦截
50
+ onTaskDblClick: null,
51
+ // 甘特图配置
52
+ tasks: {
53
+ data: [
54
+ // 把父节点的开始结束设置为同一天,就可以实现隐藏父节点的bar
55
+ // # 字段解释
56
+ // id: 数据id 必须是唯一值,父子也不能重复
57
+ // text: 会显示在bar上的字段,如不显示就设为 ''
58
+ // progress: 完成度, 0 - 1
59
+ // start_date: 开始的日期,格式在js里设置,
60
+ // end_date: 结束的日期 要时分秒! 只给日期会视为日期的 00:00:00 要特殊处理一下!!
61
+ // open: 如果是父节点,是否默认展开
62
+ // parent: 子节点必须有,设置为父节点的id,会自动处理,数据顺序无所谓
63
+ // #=================================================================
64
+ ],
65
+ // #字段解释
66
+ // 格式 id:数据id
67
+ // source:开始链接的项目id ----为tasks.data中数据的id
68
+ // target:要链接项目的id ----为tasks.data中数据的id
69
+ // type: 0--进行-开始 `尾部链接头部`
70
+ // 1--开始-开始 `头部链接头部`
71
+ // 2--进行-进行 `尾部链接尾部`
72
+ // 3--开始-进行 `头部链接尾部`
73
+ // 任务之间连接线,目前注释掉了,需要的话打开
74
+ // links: [
75
+ // { id: '10', source: '11', target: '12', type: '1' },
76
+ // { id: '11', source: '11', target: '13', type: '1' },
77
+ // { id: '12', source: '11', target: '14', type: '1' },
78
+ // { id: '13', source: '11', target: '15', type: '1' },
79
+ // { id: '14', source: '23', target: '16', type: '0' },
80
+ // { id: '15', source: '13', target: '17', type: '1' },
81
+ // { id: '16', source: '17', target: '18', type: '0' },
82
+ // { id: '17', source: '18', target: '19', type: '0' },
83
+ // { id: '18', source: '19', target: '20', type: '0' },
84
+ // { id: '19', source: '15', target: '21', type: '2' },
85
+ // { id: '20', source: '15', target: '22', type: '2' },
86
+ // { id: '21', source: '15', target: '23', type: '0' }
87
+ // ]
88
+ },
89
+
90
+ url: {
91
+ // list: "/projectManage/projectPlan/queryProjectPlanGTT",
92
+ // delete: "/projectManage/projectModule/delete",
93
+ // deleteBatch: "/projectManage/projectModule/deleteBatch",
94
+ // exportXlsUrl: "/projectManage/projectModule/exportXls",
95
+ // importExcelUrl: "/projectManage/projectModule/importExcel",
96
+ // budgetExportXlsUrl: "/projectManage/projectModule/budgetExportXls",
97
+ // budgetImportUrl: "/projectManage/projectModule/budgetImportExcel",
98
+ },
99
+ tabheight: 0,
100
+ };
101
+ },
102
+ methods: {
103
+ loadData(rows) {
104
+ gantt.clearAll();
105
+ this.tasks = {
106
+ data: rows || [],
107
+ };
108
+ gantt.parse(this.tasks);
109
+ },
110
+ destroyGantt() {
111
+ gantt.destroy();
112
+ // gantt.destructor();
113
+ },
114
+ // 初始化
115
+ init() {
116
+ gantt.i18n.setLocale("cn"); // 汉化 - 默认是英文
117
+ // 格式化日期
118
+ gantt.locale.date = {
119
+ month_full: [
120
+ "1月",
121
+ "2月",
122
+ "3月",
123
+ "4月",
124
+ "5月",
125
+ "6月",
126
+ "7月",
127
+ "8月",
128
+ "9月",
129
+ "10月",
130
+ "11月",
131
+ "12月",
132
+ ],
133
+ month_short: [
134
+ "1月",
135
+ "2月",
136
+ "3月",
137
+ "4月",
138
+ "5月",
139
+ "6月",
140
+ "7月",
141
+ "8月",
142
+ "9月",
143
+ "10月",
144
+ "11月",
145
+ "12月",
146
+ ],
147
+ day_full: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"],
148
+ day_short: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"],
149
+ };
150
+
151
+ gantt.locale.labels = {
152
+ dhx_cal_today_button: "今天",
153
+ day_tab: "日",
154
+ week_tab: "周",
155
+ month_tab: "月",
156
+ new_event: "新建日程",
157
+ icon_save: "保存",
158
+ icon_cancel: "关闭",
159
+ icon_details: "详细",
160
+ icon_edit: "编辑",
161
+ icon_delete: "删除",
162
+ confirm_closing: "请确认是否撤销修改!", //Your changes will be lost, are your sure?
163
+ confirm_deleting: "是否删除计划?",
164
+ section_description: "描述:",
165
+ section_time: "时间范围:",
166
+ section_type: "类型:",
167
+ section_text: "计划名称:",
168
+ section_test: "测试:",
169
+ section_projectClass: "项目类型:",
170
+ taskProjectType_0: "项目任务",
171
+ taskProjectType_1: "普通任务",
172
+ section_head: "负责人:",
173
+ section_priority: "优先级:",
174
+ taskProgress: "任务状态",
175
+ taskProgress_0: "未开始",
176
+ taskProgress_1: "进行中",
177
+ taskProgress_2: "已完成",
178
+ taskProgress_3: "已延期",
179
+ taskProgress_4: "搁置中",
180
+ section_template: "Details",
181
+ /* grid columns */
182
+ column_text: "计划名称",
183
+ column_start_date: "开始时间",
184
+ column_duration: "持续时间",
185
+ column_add: "",
186
+ column_priority: "难度",
187
+ /* link confirmation */
188
+ link: "关联",
189
+ confirm_link_deleting: "将被删除",
190
+ message_ok: "确定",
191
+ message_cancel: "取消",
192
+ link_start: " (开始)",
193
+ link_end: " (结束)",
194
+
195
+ type_task: "任务",
196
+ type_project: "项目",
197
+ type_milestone: "里程碑",
198
+ minutes: "分钟",
199
+ hours: "小时",
200
+ days: "天",
201
+ weeks: "周",
202
+ months: "月",
203
+ years: "年",
204
+ };
205
+
206
+ //自适应甘特图的尺寸大小, 使得在不出现滚动条的情况下, 显示全部任务
207
+ gantt.config.autosize = false;
208
+ //只读模式
209
+ gantt.config.readonly = true;
210
+ //是否显示左侧树表格
211
+ gantt.config.show_grid = true;
212
+ // 设置表头高度
213
+ gantt.config.scale_height = 50;
214
+ // 设置bar的高度
215
+ gantt.config.bar_height = 26;
216
+ // 设置行的高度
217
+ gantt.config.row_height = 32;
218
+ // 设置时间识别格式
219
+ gantt.config.xml_date = "%Y-%m-%d %H:%i";
220
+ // //表格列设置
221
+ /* gantt.config.columns = [
222
+ {
223
+ name: "text",
224
+ label: "项目名称",
225
+ tree: true,
226
+ width: "200",
227
+ align: "left",
228
+ template: (task) => {
229
+ if (task.parent) {
230
+ return task.text;
231
+ } else {
232
+ return `<div style="font-weight: 700">${task.text}</div>`;
233
+ }
234
+ },
235
+ },
236
+ { name: "person", label: "项目成员", width: "100", align: "center" },
237
+ // { name: 'post', label: '岗位名称', width: '100', align: 'center' },
238
+ // { name: 'department', label: '部门名称', width: '100', align: 'center' },
239
+ { name: "task", label: "项目任务", width: "100", align: "center" },
240
+ // { name: 'number', label: '工单号', tree: false, width: '120', align: 'center', },
241
+ // {
242
+ // name: 'duration',
243
+ // label: '工期',
244
+ // align: 'center',
245
+ // template: function(obj) {
246
+ // return obj.duration + '天';
247
+ // }
248
+ // }
249
+ // {name:"start_date", label:"开始时间", align: "center" },
250
+ // {name:"end_date", label:"结束时间", align: "center" },
251
+ ];
252
+ // 为每个bar增加class
253
+ gantt.templates.task_class = function (start, end, item) {
254
+ switch (item.status) {
255
+ case "400": // 已完成
256
+ return "gantt_success";
257
+ case "100": // 未开始
258
+ return "gantt_begined";
259
+ case "200": // 进行中
260
+ return "gantt_primary";
261
+ case "300": // 暂停
262
+ return "gantt_warning";
263
+ default:
264
+ // 已终止 500
265
+ return "gantt_info";
266
+ }
267
+ }; */
268
+ // 自动延长时间刻度
269
+ gantt.config.fit_tasks = true;
270
+ // 允许拖放
271
+ gantt.config.drag_project = true;
272
+ // 定义时间格式
273
+ if (this.dateType === "year") {
274
+ // 年 格式
275
+ gantt.config.scales = [{ unit: "year", step: 1, date: " %Y 年" }];
276
+ } else if (this.dateType === "month") {
277
+ // 月 格式
278
+ gantt.config.scales = [
279
+ { unit: "year", step: 1, date: " %Y 年" },
280
+ { unit: "month", step: 1, date: "%F" },
281
+ ];
282
+ } else {
283
+ // 日 格式
284
+ gantt.config.scales = [
285
+ { unit: "month", step: 1, date: " %Y 年 %F" },
286
+ { unit: "day", step: 1, date: "%d" },
287
+ ];
288
+ }
289
+ // //当task的长度改变时,自动调整图表坐标轴区间用于适配task的长度
290
+ gantt.config.fit_tasks = true;
291
+ /*
292
+ // 添加弹窗属性
293
+ gantt.config.lightbox.sections = [
294
+ {
295
+ name: "description",
296
+ height: 70,
297
+ map_to: "text",
298
+ type: "textarea",
299
+ focus: true,
300
+ },
301
+ { name: "type", type: "typeselect", map_to: "type" },
302
+ { name: "time", type: "duration", map_to: "auto" },
303
+ ];
304
+
305
+ // 给每行增加双击事件 ,亲测事件会重复注册,用这个方法拦截一下
306
+ if (this.onTaskDblClick) gantt.detachEvent(this.onTaskDblClick);
307
+ // 双击bar任务事件(单击会有问题,点击展开时也会触发)
308
+ this.onTaskDblClick = gantt.attachEvent(
309
+ "onTaskDblClick",
310
+ (id, e) => {
311
+ this.$emit("rowDbClick", id);
312
+ return true;
313
+ },
314
+ { id: "onTaskDblClick" }
315
+ );*/
316
+
317
+ // this.initConfig();
318
+ // 清空旧数据
319
+ gantt.clearAll();
320
+ // 销毁gantt实例 按需开启
321
+ // gantt.destructor()
322
+ // 初始化
323
+ this.ganttInstance = gantt.init(this.$refs.gantt);
324
+ // 数据解析
325
+ gantt.parse(this.tasks);
326
+ },
327
+ extendDeeply(result, child) {
328
+ for (var prop in child) {
329
+ // 如果属性本身,就是一个数组或者Json对象,进行深拷贝
330
+ if (child[prop]?.constructor === Object) {
331
+ if (!result[prop]) result[prop] = {};
332
+ // 实现深拷贝
333
+ this.extendDeeply(result[prop], child[prop]);
334
+ } else {
335
+ result[prop] = child[prop];
336
+ }
337
+ }
338
+ return result;
339
+ },
340
+ initConfig() {
341
+ if (this.option) {
342
+ this.extendDeeply(gantt, this.option);
343
+ }
344
+ },
345
+ getGanttTarget() {
346
+ return gantt
347
+ },
348
+ getGanttInstance() {
349
+ return this.ganttInstance
350
+ },
351
+ },
352
+ };
353
+ </script>
354
+
355
+ <style lang="less" scoped>
356
+ ::v-deep .gantt_row.gantt_row_project:hover {
357
+ background: #e4e4e4 !important;
358
+ }
359
+
360
+ ::v-deep .gantt_row.gantt_row_task:hover {
361
+ background: #e4e4e4 !important;
362
+ }
363
+ ::v-deep .gantt_selected {
364
+ background: #ececec !important;
365
+ }
366
+ ::v-deep .gantt_task_row.gantt_selected .gantt_task_cell {
367
+ background: #ececec !important;
368
+ border-right-color: #ebebeb !important;
369
+ }
370
+
371
+ ::v-deep .gantt_grid_head_cell {
372
+ background-color: #f7f7f7;
373
+ font-weight: 700;
374
+ font-size: 13px;
375
+ color: #000000;
376
+ }
377
+ ::v-deep .gantt_scale_cell {
378
+ background-color: #f7f7f7;
379
+ font-weight: 700;
380
+ color: #000000 !important;
381
+ border-bottom: 1px solid #ebebeb;
382
+ }
383
+ ::v-deep .gantt_task_line {
384
+ border: none !important;
385
+ box-shadow: none !important;
386
+ }
387
+ ::v-deep .gantt_task_progress_wrapper {
388
+ border: none !important;
389
+ background-color: #e1e1e1;
390
+ border-radius: 8px;
391
+ }
392
+ ::v-deep .gantt_task_content {
393
+ }
394
+ ::v-deep .gantt_task_line {
395
+ border: none;
396
+ border-radius: 8px;
397
+ background-color: transparent;
398
+ }
399
+ ::v-deep .gantt_success .gantt_task_progress {
400
+ background: #13c400 !important;
401
+ border: none !important;
402
+ }
403
+ ::v-deep .gantt_primary .gantt_task_progress {
404
+ background: #3a84ff !important;
405
+ border: none !important;
406
+ }
407
+ ::v-deep .gantt_begined .gantt_task_progress {
408
+ background: #9a9a9a !important;
409
+ border: none !important;
410
+ }
411
+ ::v-deep .gantt_info .gantt_task_progress {
412
+ background: #fe0000 !important;
413
+ border: none !important;
414
+ }
415
+ ::v-deep .gantt_warning .gantt_task_progress {
416
+ background: #ff7700 !important;
417
+ border: none !important;
418
+ }
419
+ </style>