From f86bca063aa6d13a5b8a9b94b2f218003a6f5ebb Mon Sep 17 00:00:00 2001 From: Ohh <155351881+mufeng889@users.noreply.github.com> Date: Mon, 5 Aug 2024 10:26:32 +0800 Subject: [PATCH] feat(projects): add plugin gantt preview (#578) --- package.json | 1 + src/locales/langs/en-us.ts | 3 +- src/locales/langs/zh-cn.ts | 3 +- src/router/elegant/imports.ts | 1 + src/router/elegant/routes.ts | 10 ++ src/router/elegant/transform.ts | 1 + src/typings/elegant-router.d.ts | 2 + src/views/plugin/gantt/ganntData.ts | 173 +++++++++++++++++++ src/views/plugin/gantt/index.vue | 258 ++++++++++++++++++++++++++++ 9 files changed, 450 insertions(+), 2 deletions(-) create mode 100644 src/views/plugin/gantt/ganntData.ts create mode 100644 src/views/plugin/gantt/index.vue diff --git a/package.json b/package.json index 78edd162..29cdde4a 100644 --- a/package.json +++ b/package.json @@ -59,6 +59,7 @@ "@vueuse/core": "10.11.0", "clipboard": "2.0.11", "dayjs": "1.11.12", + "dhtmlx-gantt": "8.0.9", "dompurify": "3.1.6", "echarts": "5.5.1", "jsbarcode": "3.11.6", diff --git a/src/locales/langs/en-us.ts b/src/locales/langs/en-us.ts index 43c98826..cbdbc608 100644 --- a/src/locales/langs/en-us.ts +++ b/src/locales/langs/en-us.ts @@ -205,7 +205,8 @@ const local: App.I18n.Schema = { plugin_barcode: 'Barcode', plugin_pinyin: 'pinyin', plugin_excel: 'Excel', - plugin_pdf: 'PDF preview' + plugin_pdf: 'PDF preview', + plugin_gantt: 'Gantt Chart' }, page: { login: { diff --git a/src/locales/langs/zh-cn.ts b/src/locales/langs/zh-cn.ts index 1e31ccae..b86f8a9d 100644 --- a/src/locales/langs/zh-cn.ts +++ b/src/locales/langs/zh-cn.ts @@ -205,7 +205,8 @@ const local: App.I18n.Schema = { plugin_barcode: '条形码', plugin_pinyin: '拼音', plugin_excel: 'Excel', - plugin_pdf: 'PDF 预览' + plugin_pdf: 'PDF 预览', + plugin_gantt: '甘特图' }, page: { login: { diff --git a/src/router/elegant/imports.ts b/src/router/elegant/imports.ts index 0fc93d6f..01c341a1 100644 --- a/src/router/elegant/imports.ts +++ b/src/router/elegant/imports.ts @@ -42,6 +42,7 @@ export const views: Record Promise import("@/views/plugin/editor/markdown/index.vue"), plugin_editor_quill: () => import("@/views/plugin/editor/quill/index.vue"), plugin_excel: () => import("@/views/plugin/excel/index.vue"), + plugin_gantt: () => import("@/views/plugin/gantt/index.vue"), plugin_icon: () => import("@/views/plugin/icon/index.vue"), plugin_map: () => import("@/views/plugin/map/index.vue"), plugin_pdf: () => import("@/views/plugin/pdf/index.vue"), diff --git a/src/router/elegant/routes.ts b/src/router/elegant/routes.ts index 7401ae57..ddda0a17 100644 --- a/src/router/elegant/routes.ts +++ b/src/router/elegant/routes.ts @@ -424,6 +424,16 @@ export const generatedRoutes: GeneratedRoute[] = [ keepAlive: true } }, + { + name: 'plugin_gantt', + path: '/plugin/gantt', + component: 'view.plugin_gantt', + meta: { + title: 'plugin_gantt', + i18nKey: 'route.plugin_gantt', + icon: 'ant-design:bar-chart-outlined' + } + }, { name: 'plugin_icon', path: '/plugin/icon', diff --git a/src/router/elegant/transform.ts b/src/router/elegant/transform.ts index d02fa468..05ca5566 100644 --- a/src/router/elegant/transform.ts +++ b/src/router/elegant/transform.ts @@ -212,6 +212,7 @@ const routeMap: RouteMap = { "plugin_editor_markdown": "/plugin/editor/markdown", "plugin_editor_quill": "/plugin/editor/quill", "plugin_excel": "/plugin/excel", + "plugin_gantt": "/plugin/gantt", "plugin_icon": "/plugin/icon", "plugin_map": "/plugin/map", "plugin_pdf": "/plugin/pdf", diff --git a/src/typings/elegant-router.d.ts b/src/typings/elegant-router.d.ts index ff6d7e73..6f5447d1 100644 --- a/src/typings/elegant-router.d.ts +++ b/src/typings/elegant-router.d.ts @@ -66,6 +66,7 @@ declare module "@elegant-router/types" { "plugin_editor_markdown": "/plugin/editor/markdown"; "plugin_editor_quill": "/plugin/editor/quill"; "plugin_excel": "/plugin/excel"; + "plugin_gantt": "/plugin/gantt"; "plugin_icon": "/plugin/icon"; "plugin_map": "/plugin/map"; "plugin_pdf": "/plugin/pdf"; @@ -174,6 +175,7 @@ declare module "@elegant-router/types" { | "plugin_editor_markdown" | "plugin_editor_quill" | "plugin_excel" + | "plugin_gantt" | "plugin_icon" | "plugin_map" | "plugin_pdf" diff --git a/src/views/plugin/gantt/ganntData.ts b/src/views/plugin/gantt/ganntData.ts new file mode 100644 index 00000000..42b48f0b --- /dev/null +++ b/src/views/plugin/gantt/ganntData.ts @@ -0,0 +1,173 @@ +export const demoData = { + data: [ + { + id: 11, + text: 'Soybean 架构设计', + type: 'project', + progress: 0, + open: true, + start_date: '2024-01-10 00:00', + duration: 12, + parent: 0 + }, + { + id: 12, + text: '测试版本', + start_date: '2024-03-20 00:00', + type: 'project', + duration: 5, + render: 'split', + parent: '11', + progress: 0, + open: true + }, + { + id: 99, + text: '测试版本1 发布', + start_date: '2024-03-20 00:00', + end_date: '2024-03-25 00:00', + parent: '12', + progress: 0, + open: true + }, + { + id: 98, + text: '测试版本2 发布', + start_date: '2024-03-26 00:00', + duration: 4, + parent: '12', + progress: 0, + open: true + }, + { + id: 97, + text: '测试版本3 发布', + start_date: '2024-03-31 00:00', + duration: 10, + parent: '12', + progress: 0, + open: true + }, + { + id: 13, + text: '1.0 版本', + start_date: '2024-03-31 00:00', + type: 'project', + render: 'split', + parent: '11', + progress: 0.5, + open: false, + duration: 11 + }, + { + id: 17, + text: '1.0正式发布', + start_date: '2024-03-31 00:00', + end_date: '2024-04-03 00:00', + parent: '13', + progress: 0, + open: true + }, + { + id: 18, + text: '1.0.1 版本', + start_date: '2024-04-03 00:00', + duration: 5, + parent: '13', + progress: 0, + open: true + }, + { + id: 19, + text: '1.0.2 版本', + start_date: '2024-04-08 00:00', + duration: 6, + parent: '13', + progress: 0, + open: true + }, + { + id: 20, + text: '1.0.3 版本', + start_date: '2024-04-16 00:00', + duration: 8, + parent: '13', + progress: 0, + open: true + }, + { + id: 31, + text: '1.0.4 版本', + start_date: '2024-04-17 00:00', + duration: 8, + parent: '13', + progress: 0, + open: true + }, + { + id: 32, + text: '1.0.5 版本', + start_date: '2024-04-26 00:00', + duration: 9, + parent: '13', + progress: 0, + open: true + }, + { + id: 33, + text: '1.0.9 版本', + start_date: '2024-05-05 00:00', + duration: 2, + parent: '13', + progress: 0, + open: true + }, + { + id: 14, + text: '1.1 版本', + start_date: '2024-05-07 00:00', + duration: 30, + parent: '11', + progress: 0, + open: true + }, + { + id: 15, + text: '1.2 版本', + start_date: '2024-06-06 00:00', + duration: 46, + parent: '11', + progress: 0, + open: true + }, + { + id: 16, + text: '1.3版本', + type: 'project', + render: 'split', + parent: '11', + progress: 0, + open: true, + start_date: '2024-07-22 00:00', + duration: 11 + }, + { + id: 21, + text: '1.3.1版本', + start_date: '2024-07-22 00:00', + duration: 7, + parent: '16', + progress: 0, + open: true + }, + { + id: 22, + text: '1.3.2版本', + start_date: '2024-07-29 00:00', + duration: 7, + parent: '16', + progress: 0, + open: true + } + ] +}; diff --git a/src/views/plugin/gantt/index.vue b/src/views/plugin/gantt/index.vue new file mode 100644 index 00000000..cfbd3eb2 --- /dev/null +++ b/src/views/plugin/gantt/index.vue @@ -0,0 +1,258 @@ + + + + +