ProjectRate.vue
13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
<template>
<div>
<div class="table-page-search-wrapper">
<a-form layout="inline">
<a-row :gutter="10">
<a-col :md="4" :sm="24">
<a-form-item>
<a-input v-model="queryParam.keyword" placeholder="关键字" />
</a-form-item>
</a-col>
<a-col :md="6" :sm="24">
<a-button type="primary" @click="()=>(getDataList())">查询</a-button>
<a-button style="margin-left: 8px" @click="() => (queryParam = {})">重置</a-button>
</a-col>
</a-row>
</a-form>
</div>
<gantt-elastic
:options="options"
:tasks="tasks"
@tasks-changed="tasksUpdate"
@options-changed="optionsUpdate"
@dynamic-style-changed="styleUpdate"
>
<gantt-header slot="header" :options="options"></gantt-header>
</gantt-elastic>
<div class="q-mt-md" />
</div>
</template>
<script>
import GanttElastic from 'gantt-elastic'
import GanttHeader from 'gantt-elastic-header'
import moment from 'moment'
import dayjs from 'dayjs'
function getDate(hours) {
const currentDate = new Date()
const currentYear = currentDate.getFullYear()
const currentMonth = currentDate.getMonth()
const currentDay = currentDate.getDate()
const timeStamp = new Date(
currentYear,
currentMonth,
currentDay,
0,
0,
0
).getTime()
return new Date(timeStamp + hours * 60 * 60 * 1000).getTime()
}
let that
let tasks = [
{
"duration": 15267159000,
"end": 1616575959000,
"id": "HHCS-L-2020-0123",
"isOnTime": false,
"start": 1601308800000,
"taskPoint": "支腿输送线项目",
"type": "task",
"style": {
"base": {
"fill": "#BABABA",
"stroke": "#BABABA"
}
}
},
{
"duration": 86400000,
"end": 1601395200000,
"id": "1",
"isOnTime": false,
"opinion": "\r\n 吴乐\r\n\r\n\r\n 黄何嵘",
"parentId": "HHCS-L-2020-0123",
"principal": "-4266017801783787060",
"responsible": "9024998056131579524",
"start": 1601308800000,
"taskPoint": "电气设计计划",
"type": "task"
},
{
"duration": 86400000,
"end": 1601395200000,
"id": "2",
"isOnTime": false,
"opinion": "\r\n 吴乐\r\n\r\n\r\n 黄何嵘",
"parentId": "HHCS-L-2020-0123",
"principal": "-4266017801783787060",
"responsible": "9024998056131579524",
"start": 1601308800000,
"taskPoint": "电气设计实际",
"type": "task",
"style": {
"base": {
"fill": "#1EBC61",
"stroke": "#0EAC51"
}
}
},
{
"duration": 86400000,
"end": 1601395200000,
"id": "3",
"isOnTime": false,
"opinion": "\r\n 冷师红\r\n\r\n\r\n 文禄强",
"parentId": "HHCS-L-2020-0123",
"principal": "-4127252952202197745",
"responsible": "2457865889357907883",
"start": 1601308800000,
"taskPoint": "机械设计计划",
"type": "task"
},
{
"duration": 86400000,
"end": 1601395200000,
"id": "4",
"isOnTime": false,
"opinion": "\r\n 冷师红\r\n\r\n\r\n 文禄强",
"parentId": "HHCS-L-2020-0123",
"principal": "-4127252952202197745",
"responsible": "2457865889357907883",
"start": 1601308800000,
"taskPoint": "机械设计实际",
"type": "task",
"style": {
"base": {
"fill": "#1EBC61",
"stroke": "#0EAC51"
}
}
},
{
"duration": 15267159000,
"end": 1616575959000,
"id": "5",
"isOnTime": false,
"opinion": "",
"parentId": "HHCS-L-2020-0123",
"principal": "",
"responsible": "",
"start": 1601308800000,
"taskPoint": "软件设计计划",
"type": "task"
},
{
"duration": 15267159000,
"end": 1616575959000,
"id": "6",
"isOnTime": false,
"opinion": "",
"parentId": "HHCS-L-2020-0123",
"principal": "",
"responsible": "",
"start": 1601308800000,
"taskPoint": "软件设计实际",
"type": "task",
"style": {
"base": {
"fill": "#1EBC61",
"stroke": "#0EAC51"
}
}
},
{
"duration": 1728000000,
"end": 1603123200000,
"id": "7",
"isOnTime": true,
"opinion": "\r\n 肖萍\r\n\r\n\r\n 肖萍",
"parentId": "HHCS-L-2020-0123",
"principal": "-5629229241258588009",
"responsible": "-5629229241258588009",
"start": 1601395200000,
"taskPoint": "物资采购计划",
"type": "task"
},
{
"duration": 10195200000,
"end": 1611590400000,
"id": "8",
"isOnTime": true,
"opinion": "\r\n 肖萍\r\n\r\n\r\n 肖萍",
"parentId": "HHCS-L-2020-0123",
"principal": "-5629229241258588009",
"responsible": "-5629229241258588009",
"start": 1601395200000,
"taskPoint": "物资采购实际",
"type": "task",
"style": {
"base": {
"fill": '#E6A987',
"stroke": '#E6A987'
}
}
},
{
"duration": 1555200000,
"end": 1602950400000,
"id": "9",
"isOnTime": false,
"opinion": "\r\n 王启太\r\n\r\n\r\n 彭志明",
"parentId": "HHCS-L-2020-0123",
"principal": "-260560139759761334",
"responsible": "-4737041461688647253",
"start": 1601395200000,
"taskPoint": "生产外协计划",
"type": "task"
},
{
"duration": 1555200000,
"end": 1602950400000,
"id": "10",
"isOnTime": false,
"opinion": "\r\n 王启太\r\n\r\n\r\n 彭志明",
"parentId": "HHCS-L-2020-0123",
"principal": "-260560139759761334",
"responsible": "-4737041461688647253",
"start": 1601395200000,
"taskPoint": "生产外协实际",
"type": "task",
"style": {
"base": {
"fill": "#1EBC61",
"stroke": "#0EAC51"
}
}
},
{
"duration": 1296000000,
"end": 1602691200000,
"id": "11",
"isOnTime": true,
"opinion": "",
"parentId": "HHCS-L-2020-0123",
"principal": "",
"responsible": "",
"start": 1601395200000,
"taskPoint": "生产自制计划",
"type": "task"
},
{
"duration": 15180759000,
"end": 1616575959000,
"id": "12",
"isOnTime": true,
"opinion": "",
"parentId": "HHCS-L-2020-0123",
"principal": "",
"responsible": "",
"start": 1601395200000,
"taskPoint": "生产自制实际",
"type": "task",
"style": {
"base": {
"fill": '#E6A987',
"stroke": '#E6A987'
}
}
},
{
"duration": 15180759000,
"end": 1616575959000,
"id": "13",
"isOnTime": false,
"opinion": "",
"parentId": "HHCS-L-2020-0123",
"principal": "",
"responsible": "",
"start": 1601395200000,
"taskPoint": "场内装配计划",
"type": "task"
},
{
"duration": 15180759000,
"end": 1616575959000,
"id": "14",
"isOnTime": false,
"parentId": "HHCS-L-2020-0123",
"start": 1601395200000,
"taskPoint": "场内装配实际",
"type": "task",
"style": {
"base": {
"fill": "#1EBC61",
"stroke": "#0EAC51"
}
}
},
{
"duration": 15180759000,
"end": 1616575959000,
"id": "17",
"isOnTime": false,
"opinion": "",
"parentId": "HHCS-L-2020-0123",
"principal": "",
"responsible": "",
"start": 1601395200000,
"taskPoint": "发货计划",
"type": "task"
},
{
"duration": 15180759000,
"end": 1616575959000,
"id": "18",
"isOnTime": false,
"opinion": "",
"parentId": "HHCS-L-2020-0123",
"principal": "",
"responsible": "",
"start": 1601395200000,
"taskPoint": "发货实际",
"type": "task",
"style": {
"base": {
"fill": "#1EBC61",
"stroke": "#0EAC51"
}
}
},
{
"duration": 0,
"end": 1616575959000,
"id": "19",
"isOnTime": false,
"opinion": "",
"parentId": "HHCS-L-2020-0123",
"principal": "",
"responsible": "",
"start": 1616575959000,
"taskPoint": "客户现场安装计划",
"type": "task"
},
{
"duration": 0,
"end": 1616575959000,
"id": "20",
"isOnTime": false,
"opinion": "",
"parentId": "HHCS-L-2020-0123",
"principal": "",
"responsible": "",
"start": 1616575959000,
"taskPoint": "客户现场安装实际",
"type": "task",
"style": {
"base": {
"fill": "#1EBC61",
"stroke": "#0EAC51"
}
}
},
{
"duration": 15180759000,
"end": 1616575959000,
"id": "15",
"isOnTime": false,
"opinion": "",
"parentId": "HHCS-L-2020-0123",
"principal": "",
"responsible": "",
"start": 1601395200000,
"taskPoint": "场内调试计划",
"type": "task"
},
{
"duration": 15180759000,
"end": 1616575959000,
"id": "16",
"isOnTime": false,
"opinion": "",
"parentId": "HHCS-L-2020-0123",
"principal": "",
"responsible": "",
"start": 1601395200000,
"taskPoint": "生产自制实际",
"type": "task",
"style": {
"base": {
"fill": "#1EBC61",
"stroke": "#0EAC51"
}
}
},
{
"duration": 0,
"end": 1616575959000,
"id": "21",
"isOnTime": false,
"opinion": "",
"parentId": "HHCS-L-2020-0123",
"principal": "",
"responsible": "",
"start": 1616575959000,
"taskPoint": "客户现场调试计划",
"type": "task"
},
{
"duration": 0,
"end": 1616575959000,
"isOnTime": false,
"opinion": "",
"parentId": "HHCS-L-2020-0123",
"principal": "",
"responsible": "",
"start": 1616575959000,
"taskPoint": "客户现场调试实际",
"type": "task",
"style": {
"base": {
"fill": "#1EBC61",
"stroke": "#0EAC51"
}
}
},
{
"duration": 0,
"end": 1616575959000,
"isOnTime": false,
"opinion": "",
"parentId": "HHCS-L-2020-0123",
"principal": "",
"responsible": "",
"start": 1616575959000,
"taskPoint": "预验收计划",
"type": "task"
},
{
"duration": 0,
"end": 1616575959000,
"isOnTime": false,
"opinion": "",
"parentId": "HHCS-L-2020-0123",
"principal": "",
"responsible": "",
"start": 1616575959000,
"taskPoint": "预验收实际",
"type": "task",
"style": {
"base": {
"fill": "#1EBC61",
"stroke": "#0EAC51"
}
}
}
];
let options = {
taskMapping: {
progress: "percent"
},
maxRows: 100,
maxHeight: 500,
title: {
label: "Your project title as html",
html: false
},
row: {
height: 24
},
calendar: {
hour: {
display: false
}
},
chart: {
progress: {
bar: false
},
expander: {
display: false
}
},
taskList: {
expander: {
straight: false
},
columns: [
{
id: 1,
label: "ID",
value: "id",
width: 50
},
{
id: 2,
label: "任务戳点",
value: "taskPoint",
width: 150,
expander: true
},
{
id: 3,
label: "开始时间",
value: task => dayjs(task.start).format("YYYY-MM-DD"),
width: 130
},
{
id: 4,
label: "完成日期",
value: task => dayjs(task.end).format("YYYY-MM-DD"),
width: 100,
},
{
id: 9,
label: "意见",
value: "opinion",
width: 60
},
{
id: 9,
label: "完成",
value: "isOnTime",
width: 60
}
]
},
locale: {
name: "zh-cn",
Now: "Now",
"X-Scale": "Zoom-X",
"Y-Scale": "Zoom-Y",
"Task list width": "列头宽度",
"Before/After": "Expand",
"Display task list": "Task list",
weekdays:["周日","周一","周二","周三","周四","周五","周六"],
months:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],
},
};
let doingStyle = {
base: {
fill: '#BFEFFF',
stroke: '#BFEFFF'
}
}
let warnStyle = {
base: {
fill: '#FF6A6A',
stroke: '#FF6A6A'
}
}
let finishStyle = {
base: {
fill: '#C1FFC1',
stroke: '#C1FFC1'
}
}
let cancelStyle = {
base: {
fill: '#BABABA',
stroke: '#BABABA'
}
}
export default {
name: 'ProjectRate',
components: {
GanttElastic,
GanttHeader
},
mounted() {
that = this
},
data() {
return {
tasks,
options,
dynamicStyle: {},
lastId: 16,
queryParam: []
}
},
methods: {
moment,
addTask() {
this.tasks.push({
id: this.lastId++,
label:
'<a href="https://images.pexels.com/photos/423364/pexels-photo-423364.jpeg?auto=compress&cs=tinysrgb&h=650&w=940" target="_blank" style="color:#0077c0;">Yeaahh! you have added a task bro!</a>',
projectCode:
'<a href="https://images.pexels.com/photos/423364/pexels-photo-423364.jpeg?auto=compress&cs=tinysrgb&h=650&w=940" target="_blank" style="color:#0077c0;">Awesome!</a>',
start: getDate(24 * 3),
duration: 1 * 24 * 60 * 60 * 1000,
percent: 50,
type: 'project'
})
},
tasksUpdate(tasks) {
this.tasks = tasks
},
optionsUpdate(options) {
this.options = options
},
styleUpdate(style) {
this.dynamicStyle = style
}
}
}
</script>
<style scoped>
</style>