@lee576/vue3-gantt 1.0.0

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/README.md ADDED
@@ -0,0 +1,730 @@
1
+ # Vue3 Gantt 甘特图组件
2
+
3
+ **Languages / 语言选择:** [English](#english-documentation) | [简体中文](#chinese-documentation) | [View Separate Files](.)
4
+
5
+ > 💡 **提示**: GitHub 上也可查看独立语言版本文件:[README.md](README.md) (默认中文) | [README.en-US.md](README.en-US.md) (English)
6
+
7
+ ---
8
+
9
+ <div id="chinese-documentation"></div>
10
+
11
+ <details open>
12
+ <summary><h2>🇨🇳 简体中文文档</h2></summary>
13
+
14
+ 一个功能丰富、高度可定制的 Vue 3 甘特图组件,支持任务管理、依赖关系、多种视图模式和主题切换。
15
+
16
+ <div align="center">
17
+ <img src="https://img.shields.io/badge/Vue-3.5.13-4FC08D?style=for-the-badge&logo=vue.js&logoColor=white" alt="Vue 3">
18
+ <img src="https://img.shields.io/badge/TypeScript-5.7.2-3178C6?style=for-the-badge&logo=typescript&logoColor=white" alt="TypeScript">
19
+ <img src="https://img.shields.io/badge/Vite-6.2.0-646CFF?style=for-the-badge&logo=vite&logoColor=white" alt="Vite">
20
+ </div>
21
+
22
+ ## 界面预览
23
+
24
+ ```
25
+ ┌─────────────────────────────────────────────────────────────────────────────┐
26
+ │ Vue3 Gantt 专业组件 │
27
+ ├─────────────────┬───────────────────────────────────────────────────────────┤
28
+ │ 任务名称 │ 12/01 12/02 12/03 12/04 12/05 12/06 12/07 12/08 │
29
+ ├─────────────────┼───────────────────────────────────────────────────────────┤
30
+ │ 主任务1 - 项目规划│ ████████████████████████████████████████████ 85% │
31
+ │ 子任务1.1 - 需求│ ████████████ 100% │
32
+ │ 主任务2 - 开发阶段│ ████████████████████████████ 60% │
33
+ │ 主任务3 - 测试阶段│ ████████████████ 45% │
34
+ │ 主任务4 - 部署上线│ ████████ 30% │
35
+ │ 主任务5 - 维护优化│ ████ 0% │
36
+ └─────────────────┴───────────────────────────────────────────────────────────┘
37
+ ```
38
+
39
+ **主要特点:**
40
+ - 🎯 左侧任务列表 + 右侧甘特图时间轴
41
+ - 📊 可视化进度条显示任务完成度
42
+ - 🔗 任务间依赖关系连线
43
+ - 🎨 多主题支持(浅色/深色/彩色等)
44
+ - 🖱️ 拖拽调整任务时间和进度
45
+ - 🌍 多语言支持(中文/English/日本語/한국어/Français/Deutsch/Español/Русский)
46
+
47
+ ## 特性
48
+
49
+ - **多视图模式** - 支持月、日、周、时四种时间粒度视图
50
+ - **任务依赖关系** - 支持 FS、SS、FF、SF 四种依赖类型
51
+ - **主题系统** - 内置 5 种主题,支持自定义主题
52
+ - **国际化支持** - 内置 8 种语言,可扩展更多语言
53
+ - **进度管理** - 可视化进度条,支持拖拽调整进度
54
+ - **交互操作** - 支持任务拖拽、调整大小、父子任务联动
55
+ - **响应式设计** - 可调整分割面板比例
56
+ - **高性能** - 虚拟滚动优化,支持大量任务数据
57
+
58
+ ## 安装
59
+
60
+ ```bash
61
+ # 克隆项目
62
+ git clone <repository-url>
63
+
64
+ # 安装依赖
65
+ npm install
66
+
67
+ # 启动开发服务器
68
+ npm run dev
69
+ ```
70
+
71
+ ## 依赖项
72
+
73
+ - @vueuse/core ^13.0.0
74
+ - dayjs ^1.11.13
75
+ - interactjs ^1.10.27
76
+ - svg.js ^2.7.1
77
+ - vue ^3.5.13
78
+ - zod ^3.24.2
79
+
80
+ ## 基本使用
81
+
82
+ ```vue
83
+ <template>
84
+ <gantt
85
+ :styleConfig="styleConfig"
86
+ :dataConfig="dataConfig"
87
+ :eventConfig="eventConfig"
88
+ />
89
+ </template>
90
+ ```
91
+
92
+
93
+ ```typescript
94
+ import { ref, onMounted } from 'vue';
95
+ import dayjs from 'dayjs';
96
+ import Gantt, {
97
+ type DataConfig,
98
+ type StyleConfig,
99
+ type EventConfig
100
+ } from './components/gantt/Gantt.vue';
101
+ import { LinkType } from './components/gantt/Types';
102
+
103
+ // 样式配置
104
+ const styleConfig = ref<StyleConfig>({
105
+ headersHeight: 100, // 表头高度
106
+ rowHeight: 60, // 行高
107
+ setBarColor: (row) => {
108
+ // 自定义任务条颜色
109
+ const colorMap = {
110
+ '紧急': 'red',
111
+ '重要': 'blue',
112
+ '一般': 'gray'
113
+ };
114
+ return colorMap[row.level] ?? 'black';
115
+ }
116
+ });
117
+
118
+ // 数据配置
119
+ const dataConfig = ref<DataConfig>({
120
+ queryStartDate: '',
121
+ queryEndDate: '',
122
+ dataSource: [],
123
+ dependencies: [],
124
+ mapFields: {
125
+ id: 'id',
126
+ parentId: 'pid',
127
+ task: 'taskNo',
128
+ priority: 'level',
129
+ startdate: 'start_date',
130
+ enddate: 'end_date',
131
+ takestime: 'spend_time',
132
+ progress: 'job_progress'
133
+ },
134
+ taskHeaders: [
135
+ { title: '序号', width: 80, property: 'no', show: true },
136
+ { title: '任务名称', width: 190, property: 'task', show: true },
137
+ { title: '优先级', width: 90, property: 'priority', show: true },
138
+ { title: '开始时间', width: 150, property: 'startdate', show: true },
139
+ { title: '结束时间', width: 150, property: 'enddate', show: true },
140
+ { title: '耗时', width: 90, property: 'takestime', show: true }
141
+ ]
142
+ });
143
+
144
+ // 事件配置
145
+ const eventConfig = ref<EventConfig>({
146
+ addRootTask: (row) => console.log('添加根任务', row),
147
+ addSubTask: (task) => console.log('添加子任务', task),
148
+ removeTask: (task) => console.log('删除任务', task),
149
+ editTask: (task) => console.log('编辑任务', task),
150
+ queryTask: async (startDate, endDate, mode) => {
151
+ // 查询任务数据
152
+ dataConfig.value.dataSource = await fetchTasks(startDate, endDate);
153
+ },
154
+ barDate: (id, startDate, endDate) => {
155
+ console.log('任务日期变更', id, startDate, endDate);
156
+ },
157
+ allowChangeTaskDate: (allow) => {
158
+ console.log('允许修改日期', allow);
159
+ },
160
+ updateProgress: (detail) => {
161
+ console.log('进度更新', detail);
162
+ }
163
+ });
164
+
165
+ onMounted(() => {
166
+ const startDate = dayjs().startOf('month').format('YYYY-MM-DD');
167
+ const endDate = dayjs().endOf('month').format('YYYY-MM-DD');
168
+ eventConfig.value.queryTask(startDate, endDate, '月');
169
+ });
170
+ ```
171
+
172
+ ## 配置详解
173
+
174
+ ### StyleConfig 样式配置
175
+
176
+ | 属性 | 类型 | 默认值 | 说明 |
177
+ |------|------|--------|------|
178
+ | headersHeight | number | 100 | 表头区域高度(像素) |
179
+ | rowHeight | number | 60 | 每行任务的高度(像素) |
180
+ | setBarColor | function | - | 自定义任务条颜色的回调函数 |
181
+
182
+ ### DataConfig 数据配置
183
+
184
+ | 属性 | 类型 | 说明 |
185
+ |------|------|------|
186
+ | queryStartDate | string | 查询开始日期 (YYYY-MM-DD) |
187
+ | queryEndDate | string | 查询结束日期 (YYYY-MM-DD) |
188
+ | dataSource | array | 任务数据源 |
189
+ | dependencies | array | 任务依赖关系 |
190
+ | mapFields | object | 字段映射配置 |
191
+ | taskHeaders | array | 左侧任务表格列配置 |
192
+
193
+ #### mapFields 字段映射
194
+
195
+ ```typescript
196
+ {
197
+ id: 'id', // 任务ID字段
198
+ parentId: 'pid', // 父任务ID字段(用于层级结构)
199
+ task: 'taskNo', // 任务名称字段
200
+ priority: 'level', // 优先级字段
201
+ startdate: 'start_date', // 开始日期字段
202
+ enddate: 'end_date', // 结束日期字段
203
+ takestime: 'spend_time', // 耗时字段
204
+ progress: 'job_progress' // 进度字段 (0-1)
205
+ }
206
+ ```
207
+
208
+ #### taskHeaders 表头配置
209
+
210
+ ```typescript
211
+ {
212
+ title: string; // 列标题
213
+ width: number; // 列宽度
214
+ property: string; // 对应 mapFields 中的属性名
215
+ show: boolean; // 是否显示
216
+ }
217
+ ```
218
+
219
+
220
+ ### EventConfig 事件配置
221
+
222
+ | 事件 | 参数 | 说明 |
223
+ |------|------|------|
224
+ | addRootTask | (row) | 添加根任务时触发 |
225
+ | addSubTask | (task) | 添加子任务时触发 |
226
+ | removeTask | (task) | 删除任务时触发 |
227
+ | editTask | (task) | 编辑任务时触发 |
228
+ | queryTask | (startDate, endDate, mode) | 查询任务时触发 |
229
+ | barDate | (id, startDate, endDate) | 任务日期变更时触发 |
230
+ | allowChangeTaskDate | (allow) | 任务日期是否允许修改 |
231
+ | updateProgress | (detail) | 进度更新时触发 |
232
+
233
+ #### updateProgress 事件详情
234
+
235
+ ```typescript
236
+ interface ProgressUpdateDetail {
237
+ taskId: any; // 任务ID
238
+ oldProgress: number; // 原进度值 (0-1)
239
+ newProgress: number; // 新进度值 (0-1)
240
+ task: object; // 完整任务对象
241
+ }
242
+ ```
243
+
244
+ ## 任务数据格式
245
+
246
+ ```typescript
247
+ {
248
+ id: '1', // 任务ID
249
+ pid: '0', // 父任务ID,'0'表示根任务
250
+ taskNo: '项目规划阶段', // 任务名称
251
+ level: '重要', // 优先级
252
+ start_date: '2024-12-01 08:00:00', // 开始时间
253
+ end_date: '2024-12-06 18:00:00', // 结束时间
254
+ job_progress: '0.85', // 进度 (0-1)
255
+ spend_time: null // 耗时(自动计算)
256
+ }
257
+ ```
258
+
259
+ ## 任务依赖关系
260
+
261
+ ```
262
+ 完成-开始 (FS) 开始-开始 (SS) 完成-完成 (FF) 开始-完成 (SF)
263
+ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐
264
+ │ 任务 A │──┐ │ 任务 A │──┐ │ 任务 A │──┐ │ 任务 A │◄─┐
265
+ └─────────┘ │ └─────────┘ │ └─────────┘ │ └─────────┘ │
266
+ ▼ ▼ ▼ │
267
+ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐
268
+ │ 任务 B │ │ 任务 B │ │ 任务 B │ │ 任务 B │
269
+ └─────────┘ └─────────┘ └─────────┘ └─────────┘
270
+ A完成后B开始 A和B同时开始 A和B同时完成 B开始后A完成
271
+ ```
272
+
273
+ ### 依赖类型
274
+
275
+ | 类型 | 枚举值 | 说明 |
276
+ |------|--------|------|
277
+ | 完成-开始 (FS) | FINISH_TO_START | 前置任务完成后,后续任务才能开始 |
278
+ | 开始-开始 (SS) | START_TO_START | 两个任务同时开始 |
279
+ | 完成-完成 (FF) | FINISH_TO_FINISH | 两个任务同时完成 |
280
+ | 开始-完成 (SF) | START_TO_FINISH | 后续任务开始后,前置任务才能完成 |
281
+
282
+ ### 配置示例
283
+
284
+ ```typescript
285
+ import { LinkType } from './components/gantt/Types';
286
+
287
+ dependencies: [
288
+ // 任务1完成后,任务2才能开始
289
+ { sourceTaskId: '1', targetTaskId: '2', type: LinkType.FINISH_TO_START },
290
+
291
+ // 任务3和任务4同时开始
292
+ { sourceTaskId: '3', targetTaskId: '4', type: LinkType.START_TO_START },
293
+
294
+ // 任务5和任务6必须同时完成
295
+ { sourceTaskId: '5', targetTaskId: '6', type: LinkType.FINISH_TO_FINISH },
296
+ ]
297
+ ```
298
+
299
+ ## 视图模式
300
+
301
+ | 模式 | 时间单位 | 表头示例 | 适用场景 |
302
+ |------|----------|----------|----------|
303
+ | 🗓️ **月视图** | 天 | `01 02 03 04 05 ...` | 长期项目规划 |
304
+ | 📅 **日视图** | 天 | `周一 周二 周三 ...` | 短期任务管理 |
305
+ | 📊 **周视图** | 周 | `W50 W51 W52 ...` | 中期项目跟踪 |
306
+ | ⏰ **时视图** | 小时 | `08 09 10 11 12 ...` | 精细任务调度 |
307
+
308
+ 组件支持四种时间粒度视图:
309
+
310
+ | 模式 | 说明 | 适用场景 |
311
+ |------|------|----------|
312
+ | 月 | 按天显示,月份为单位 | 长期项目规划 |
313
+ | 日 | 按天显示,精确到天 | 短期任务管理 |
314
+ | 周 | 按周显示 | 中期项目跟踪 |
315
+ | 时 | 按小时显示 | 精细任务调度 |
316
+
317
+ ## 主题系统
318
+
319
+ | 主题 | 主色调 | 风格特点 |
320
+ |------|--------|----------|
321
+ | 🔷 **Metro 金属** | `#0078d4` | Microsoft Metro 设计语言,专业金属质感 |
322
+ | 🌙 **深色模式** | `#00d4ff` | 护眼深色主题,适合长时间使用 |
323
+ | ✨ **现代简约** | `#6366f1` | 简洁现代设计,清爽舒适 |
324
+ | 💼 **经典商务** | `#2563eb` | 传统商务风格,稳重大方 |
325
+ | 🎨 **彩色活力** | `#f59e0b` | 活泼彩色主题,充满活力 |
326
+
327
+ ### 内置主题
328
+
329
+ | 主题ID | 名称 | 说明 |
330
+ |--------|------|------|
331
+ | metro | Metro 金属 | Microsoft Metro 设计语言 |
332
+ | dark | 深色模式 | 护眼深色主题 |
333
+ | modern | 现代简约 | 简洁现代设计 |
334
+ | classic | 经典商务 | 传统商务风格 |
335
+ | colorful | 彩色活力 | 活泼彩色主题 |
336
+
337
+ ### 切换主题
338
+
339
+ 组件右上角提供主题选择器,点击即可切换主题。主题设置会自动保存到 localStorage。
340
+
341
+ ### 自定义主题 CSS 变量
342
+
343
+ ```css
344
+ :root {
345
+ --primary: #0078d4; /* 主色调 */
346
+ --primary-dark: #106ebe; /* 主色调深色 */
347
+ --primary-light: #1084d8; /* 主色调浅色 */
348
+ --bg-content: #ffffff; /* 内容背景色 */
349
+ --bg-metal-light: linear-gradient(145deg, #ffffff, #f5f5f5);
350
+ --bg-metal-normal: linear-gradient(145deg, #f5f5f5, #e8e8e8);
351
+ --border: #d0d0d0; /* 边框颜色 */
352
+ --text-primary: #333333; /* 主文字颜色 */
353
+ --text-secondary: #666666; /* 次要文字颜色 */
354
+ --row-hover: #FFF3A1; /* 行悬停颜色 */
355
+ --font-family: 'Segoe UI', sans-serif;
356
+ }
357
+ ```
358
+
359
+ ## 国际化支持
360
+
361
+ 组件内置完整的国际化(i18n)系统,支持中英文双语切换,并可轻松扩展更多语言。
362
+
363
+ ### 支持的语言
364
+
365
+ | 语言 | 代码 | 状态 |
366
+ |------|------|------|
367
+ | 🇨🇳 简体中文 | zh-CN | ✅ 完整支持 |
368
+ | 🇺🇸 English | en-US | ✅ 完整支持 |
369
+ | 🇯🇵 日本語 | ja-JP | ✅ 完整支持 |
370
+ | 🇰🇷 한국어 | ko-KR | ✅ 完整支持 |
371
+ | 🇫🇷 Français | fr-FR | ✅ 完整支持 |
372
+ | 🇩🇪 Deutsch | de-DE | ✅ 完整支持 |
373
+ | 🇪🇸 Español | es-ES | ✅ 完整支持 |
374
+ | 🇷🇺 Русский | ru-RU | ✅ 完整支持 |
375
+
376
+ ### 使用方法
377
+
378
+ #### 1. 切换语言
379
+
380
+ 在甘特图工具栏右上角,点击语言选择器即可切换界面语言:
381
+
382
+ ```typescript
383
+ import { setLocale } from './components/gantt/i18n';
384
+
385
+ // 切换到英文
386
+ setLocale('en-US');
387
+
388
+ // 切换到中文
389
+ setLocale('zh-CN');
390
+ ```
391
+
392
+ #### 2. 获取当前语言
393
+
394
+ ```typescript
395
+ import { getLocale } from './components/gantt/i18n';
396
+
397
+ const currentLang = getLocale(); // 'zh-CN' 或 'en-US'
398
+ ```
399
+
400
+ #### 3. 在组件中使用翻译
401
+
402
+ ```vue
403
+ <script setup lang="ts">
404
+ import { useI18n } from './components/gantt/i18n';
405
+
406
+ const { t, locale } = useI18n();
407
+ </script>
408
+
409
+ <template>
410
+ <div>
411
+ <h1>{{ t('common.title') }}</h1>
412
+ <button>{{ t('common.confirm') }}</button>
413
+ <p>{{ t('task.name') }}</p>
414
+ </div>
415
+ </template>
416
+ ```
417
+
418
+ ### 国际化功能特性
419
+
420
+ - ✅ **即时切换** - 无需刷新页面即可切换语言
421
+ - ✅ **自动保存** - 语言选择自动保存到浏览器 localStorage
422
+ - ✅ **完整覆盖** - 所有界面文本均已翻译
423
+ - ✅ **动态表头** - 时间轴表头(月份、星期等)根据语言自动格式化
424
+ - ✅ **类型安全** - TypeScript 提供完整类型支持
425
+ - ✅ **易于扩展** - 可轻松添加新语言支持
426
+
427
+ ### 已翻译的界面元素
428
+
429
+ #### 工具栏
430
+ - 日期选择器分隔符("至" / "to")
431
+ - 视图模式按钮(月/周/日/时)
432
+ - 连线图例标题和所有连线类型
433
+
434
+ #### 任务表头
435
+ - 序号 (No.)
436
+ - 任务名称 (Task Name)
437
+ - 优先级 (Priority)
438
+ - 开始时间 (Start Date)
439
+ - 结束时间 (End Date)
440
+ - 耗时 (Duration)
441
+ - 进度 (Progress)
442
+
443
+ #### 时间轴表头
444
+ - 月份名称(一月/January、二月/February...)
445
+ - 星期名称(星期一/Monday、星期二/Tuesday...)
446
+ - 日期格式(01日/01、02日/02...)
447
+ - 小时格式(0点/0:00、1点/1:00...)
448
+ - 周标题(第1周/Week 1)
449
+
450
+ #### 配置面板
451
+ - 甘特图配置标题
452
+ - 主题设置选项
453
+ - 连线配置所有选项
454
+ - 所有按钮和标签
455
+
456
+ ### 添加新语言
457
+
458
+ 如需添加新语言支持,请按以下步骤操作:
459
+
460
+ 1. 在 `src/components/gantt/i18n/locales/` 目录下创建新语言文件(如 `ja-JP.ts`)
461
+ 2. 复制 `zh-CN.ts` 或 `en-US.ts` 的结构
462
+ 3. 翻译所有文本
463
+ 4. 在 `src/components/gantt/i18n/index.ts` 中导入并注册新语言:
464
+
465
+ ```typescript
466
+ import jaJP from './locales/ja-JP';
467
+ import koKR from './locales/ko-KR';
468
+ import frFR from './locales/fr-FR';
469
+ import deDE from './locales/de-DE';
470
+ import esES from './locales/es-ES';
471
+ import ruRU from './locales/ru-RU';
472
+
473
+ const messages: Record<Locale, Messages> = {
474
+ 'zh-CN': zhCN,
475
+ 'en-US': enUS,
476
+ 'ja-JP': jaJP, // 新增日语
477
+ 'ko-KR': koKR, // 新增韩语
478
+ 'fr-FR': frFR, // 新增法语
479
+ 'de-DE': deDE, // 新增德语
480
+ 'es-ES': esES, // 新增西班牙语
481
+ 'ru-RU': ruRU // 新增俄语
482
+ };
483
+ ```
484
+
485
+ 5. 更新 `getLocales()` 函数添加新语言选项
486
+
487
+ ### 语言包结构
488
+
489
+ ```typescript
490
+ export default {
491
+ common: { // 通用文本
492
+ confirm: '确定',
493
+ cancel: '取消',
494
+ // ...
495
+ },
496
+ date: { // 日期时间
497
+ year: '年',
498
+ month: '月',
499
+ // ...
500
+ },
501
+ viewMode: { // 视图模式
502
+ month: '月',
503
+ week: '周',
504
+ // ...
505
+ },
506
+ task: { // 任务相关
507
+ name: '任务名称',
508
+ priority: '优先级',
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
+ ```typescript
547
+ interface LinkConfig {
548
+ color: string; // 连线颜色
549
+ width: number; // 连线宽度
550
+ dashArray?: string; // 虚线样式
551
+ showArrow: boolean; // 是否显示箭头
552
+ arrowSize: number; // 箭头大小
553
+ showLabels: boolean; // 是否显示标签
554
+ pathType: LinkPathType; // 路径类型
555
+ cornerRadius: number; // 圆角半径
556
+ smoothCorners: boolean; // 平滑圆角
557
+ }
558
+ ```
559
+
560
+ ### 路径类型
561
+
562
+ ```
563
+ 直线连接 贝塞尔曲线 直角连线
564
+ ┌─────┐ ┌─────┐ ┌─────┐
565
+ │任务A│ ────────▶│任务A│ ╭───────▶ │任务A│ ┐
566
+ └─────┘ └─────┘ ╰─┐ └─────┘ │
567
+ │ │
568
+ ┌─────┐ ┌─────┐
569
+ │任务B│ │任务B│
570
+ └─────┘ └─────┘
571
+ ```
572
+
573
+ | 类型 | 枚举值 | 说明 |
574
+ |------|--------|------|
575
+ | 直线 | STRAIGHT | 直接连接 |
576
+ | 贝塞尔曲线 | BEZIER | 平滑曲线 |
577
+ | 直角连线 | RIGHT_ANGLE | 直角折线 |
578
+
579
+ ## 性能优化
580
+
581
+ 组件内置多项性能优化:
582
+
583
+ - **虚拟滚动** - 只渲染可见区域的任务
584
+ - **节流更新** - 数据变化时使用节流避免频繁渲染
585
+ - **缓存计算** - 使用 computed 缓存复杂计算结果
586
+ - **按需渲染** - 连线等元素按需计算和渲染
587
+
588
+ ## 目录结构
589
+
590
+ ```
591
+ src/
592
+ ├── components/
593
+ │ └── gantt/
594
+ │ ├── Gantt.vue # 主组件
595
+ │ ├── Bar.vue # 任务条组件
596
+ │ ├── BarRecursionRow.vue # 递归行组件
597
+ │ ├── TaskLinks.vue # 连线组件
598
+ │ ├── TimelineHeader.vue # 时间轴表头
599
+ │ ├── TableContent.vue # 表格内容
600
+ │ ├── RightTable.vue # 右侧甘特图区域
601
+ │ ├── SplitPane.vue # 分割面板
602
+ │ ├── DatePicker.vue # 日期选择器
603
+ │ ├── GanttConfigPanel.vue # 配置面板
604
+ │ ├── GanttThemeSelector.vue # 主题选择器
605
+ │ ├── LanguageSelector.vue # 语言选择器
606
+ │ ├── LinkConfigPanel.vue # 连线配置面板
607
+ │ ├── Types.ts # 类型定义
608
+ │ ├── Store.ts # 状态管理
609
+ │ ├── ShareState.ts # 共享状态
610
+ │ ├── LinkConfig.ts # 连线配置
611
+ │ ├── Symbols.ts # 注入符号
612
+ │ ├── ZodSchema.ts # 数据验证
613
+ │ ├── i18n/ # 国际化系统
614
+ │ │ ├── index.ts # i18n 核心
615
+ │ │ └── locales/ # 语言包
616
+ │ │ ├── zh-CN.ts # 中文语言包
617
+ │ │ ├── en-US.ts # 英文语言包
618
+ │ │ ├── ja-JP.ts # 日语语言包
619
+ │ │ ├── ko-KR.ts # 韩语语言包
620
+ │ │ ├── fr-FR.ts # 法语语言包
621
+ │ │ ├── de-DE.ts # 德语语言包
622
+ │ │ ├── es-ES.ts # 西班牙语语言包
623
+ │ │ └── ru-RU.ts # 俄语语言包
624
+ │ ├── task/ # 任务相关组件
625
+ │ │ ├── TaskTable.vue
626
+ │ │ ├── TaskHeader.vue
627
+ │ │ ├── TaskContent.vue
628
+ │ │ └── TaskRow.vue
629
+ │ └── themes/ # 主题配置
630
+ │ └── GanttThemes.ts
631
+ ├── App.vue # 示例应用
632
+ ├── main.ts # 入口文件
633
+ └── style.css # 全局样式
634
+ ```
635
+
636
+ ## 完整示例
637
+
638
+ 参考 `src/App.vue` 获取完整的使用示例,包含:
639
+
640
+ - 多层级任务结构
641
+ - 各种依赖关系配置
642
+ - 自定义颜色映射
643
+ - 事件处理
644
+ - 国际化功能集成
645
+
646
+ ## 浏览器支持
647
+
648
+ - Chrome (推荐)
649
+ - Firefox
650
+ - Safari
651
+ - Edge
652
+
653
+ ## License
654
+
655
+ MIT
656
+
657
+ </details>
658
+
659
+ ---
660
+
661
+ <div id="english-documentation"></div>
662
+
663
+ <details>
664
+ <summary><h2>🇺🇸 English Documentation</h2></summary>
665
+
666
+ A feature-rich, highly customizable Vue 3 Gantt chart component that supports task management, dependency relationships, multiple view modes, and theme switching.
667
+
668
+ <div align="center">
669
+ <img src="https://img.shields.io/badge/Vue-3.5.13-4FC08D?style=for-the-badge&logo=vue.js&logoColor=white" alt="Vue 3">
670
+ <img src="https://img.shields.io/badge/TypeScript-5.7.2-3178C6?style=for-the-badge&logo=typescript&logoColor=white" alt="TypeScript">
671
+ <img src="https://img.shields.io/badge/Vite-6.2.0-646CFF?style=for-the-badge&logo=vite&logoColor=white" alt="Vite">
672
+ </div>
673
+
674
+ **Note**: For better reading experience, you can also view the [separate English README file](README.en-US.md).
675
+
676
+ ## Interface Preview
677
+
678
+ ```
679
+ ┌─────────────────────────────────────────────────────────────────────────────┐
680
+ │ Vue3 Gantt Professional Component │
681
+ ├─────────────────┬───────────────────────────────────────────────────────────┤
682
+ │ Task Name │ 12/01 12/02 12/03 12/04 12/05 12/06 12/07 12/08 │
683
+ ├─────────────────┼───────────────────────────────────────────────────────────┤
684
+ │ Main Task 1 - Planning│ ████████████████████████████████████████████ 85% │
685
+ │ Subtask 1.1 - Requirements│ ████████████ 100% │
686
+ │ Main Task 2 - Development│ ████████████████████████████ 60% │
687
+ │ Main Task 3 - Testing│ ████████████████ 45% │
688
+ │ Main Task 4 - Deployment│ ████████ 30% │
689
+ │ Main Task 5 - Maintenance│ ████ 0% │
690
+ └─────────────────┴───────────────────────────────────────────────────────────┘
691
+ ```
692
+
693
+ **Key Features:**
694
+ - 🎯 Left task list + Right Gantt chart timeline
695
+ - 📊 Visual progress bars showing task completion
696
+ - 🔗 Task dependency relationship lines
697
+ - 🎨 Multi-theme support (Light/Dark/Colorful, etc.)
698
+ - 🖱️ Drag to adjust task time and progress
699
+ - 🌍 Multi-language support (Chinese/English/Japanese/Korean/French/German/Spanish/Russian)
700
+
701
+ ## Features
702
+
703
+ - **Multiple View Modes** - Month, Day, Week, and Hour time granularity views
704
+ - **Task Dependencies** - Support for FS, SS, FF, SF dependency types
705
+ - **Theme System** - 5 built-in themes with custom theme support
706
+ - **Internationalization** - Built-in 8 languages, easily extensible
707
+ - **Progress Management** - Visual progress bars with drag-to-adjust
708
+ - **Interactive Operations** - Task dragging, resizing, parent-child linkage
709
+ - **Responsive Design** - Adjustable split panel ratio
710
+ - **High Performance** - Virtual scrolling optimization for large datasets
711
+
712
+ ### For complete English documentation including:
713
+ - ✅ Detailed configuration guide
714
+ - ✅ Task data format
715
+ - ✅ Dependency relationships
716
+ - ✅ View modes
717
+ - ✅ Theme system
718
+ - ✅ Internationalization
719
+ - ✅ Interactive features
720
+ - ✅ Link configuration
721
+ - ✅ Performance optimization
722
+ - ✅ Project structure
723
+
724
+ **Please visit**: [README.en-US.md](README.en-US.md) for the full English documentation.
725
+
726
+ ## License
727
+
728
+ MIT
729
+
730
+ </details>