-
Notifications
You must be signed in to change notification settings - Fork 41
/
debug.vue
170 lines (162 loc) · 3.94 KB
/
debug.vue
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
<template>
<div>
<x-gantt
ref="ganttRef"
data-id="index"
:data="dataList"
:body-style="bodyStyle"
:border="0"
:header-height="40"
style="height: 100vh"
:header-style="headerStyle"
:level-color="['#ffffff']"
locale="zh-cn"
primary-color="#F1F2FF"
row-height="40"
show-today
format-gantt-header="Q Do"
:gantt-column-size="{
day: 100
}"
>
<x-gantt-column prop="index">
<template #title>
<div></div>
</template>
</x-gantt-column>
<x-gantt-column prop="name">
<template #title> 任务 </template>
<template #default="{ row }">
{{ row.name }}
</template>
</x-gantt-column>
<x-gantt-column prop="status" label="状态" width="150">
<template #default="{ row }">
<el-tag>{{ row.status }}</el-tag>
</template>
</x-gantt-column>
<x-gantt-column
prop="priority"
label="优先级"
width="150"
></x-gantt-column>
<x-gantt-slider
move
move-by-unit
linked-resize
resize-left
resize-right
/>
</x-gantt>
</div>
</template>
<script lang="ts" setup>
import { onMounted, reactive, ref } from 'vue';
import type { XGanttComponent } from '../types';
const ganttRef = ref<XGanttComponent>();
const dataList = reactive<any>([]);
const bodyStyle = {
bgColor: '#F8F8F8',
hoverColor: '#e42411',
selectColor: '#9ea2ff',
textColor: '#999999'
};
const headerStyle = {
bgColor: '#F1F2FF',
textColor: '#333333'
};
const onAdd = () => {
// let index = 0;
// for (let i = 0; i < 10; i++) {
// dataList.push({
// index: ++index,
// name: `task${index}`,
// status: `status${index}`,
// priority: `priority${index}`,
// startDate: new Date(2024, 2, index),
// endDate: new Date(2024, 2, index + 5)
// });
// }
dataList.push({
index: 1,
name: 'task1',
status: 'status1',
priority: 'priority1',
startDate: new Date(2024, 2, 1),
endDate: new Date(2024, 2, 6, 23, 59, 59),
children: [
{
index: 11,
name: 'task11',
status: 'status11',
priority: 'priority11',
startDate: new Date(2024, 2, 1, 12, 0, 0),
endDate: new Date(2024, 2, 3, 11, 59, 59)
},
{
index: 12,
name: 'task12',
status: 'status12',
priority: 'priority12',
startDate: new Date(2024, 2, 4),
endDate: new Date(2024, 2, 6, 23, 59, 59)
}
]
});
dataList.push({
index: 2,
name: 'task2',
status: 'status2',
priority: 'priority2',
startDate: new Date(2024, 2, 2),
endDate: new Date(2024, 2, 7, 23, 59, 59),
children: [
{
index: 21,
name: 'task21',
status: 'status21',
priority: 'priority21',
startDate: new Date(2024, 2, 2),
endDate: new Date(2024, 2, 4, 23, 59, 59)
},
{
index: 22,
name: 'task22',
status: 'status22',
priority: 'priority22',
startDate: new Date(2024, 2, 5),
endDate: new Date(2024, 2, 7, 23, 59, 59)
},
{
index: 23,
name: 'task23',
status: 'status23',
priority: 'priority23',
startDate: new Date(2024, 2, 6),
endDate: new Date(2024, 2, 7, 23, 59, 59),
children: [
{
index: 231,
name: 'task231',
status: 'status231',
priority: 'priority231',
startDate: new Date(2024, 2, 6),
endDate: new Date(2024, 2, 7, 23, 59, 59)
},
{
index: 232,
name: 'task232',
status: 'status232',
priority: 'priority232',
startDate: new Date(2024, 2, 6),
endDate: new Date(2024, 2, 7, 23, 59, 59)
}
]
}
]
});
};
onMounted(() => {
onAdd();
});
</script>