From 8e85bd90eb3b4ae383f76f2f80d4dba486fcb93d Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Tue, 27 May 2025 18:35:14 +0800 Subject: [PATCH] feat: dashboard tab --- frontend/components.d.ts | 1 + frontend/src/utils/canvas.ts | 15 +- .../src/views/dashboard/DashboardEditor.vue | 69 ---------- .../src/views/dashboard/canvas/CanvasCore.vue | 130 ++++++++++++------ .../dashboard/components/component-list.ts | 7 + .../dashboard/components/sq-tab/index.vue | 76 ++++++++-- .../src/views/dashboard/css/CanvasStyle.less | 10 +- .../dashboard/editor/DashboardEditor.vue | 75 +++++----- frontend/src/views/dashboard/editor/index.vue | 39 +++++- 9 files changed, 257 insertions(+), 165 deletions(-) delete mode 100644 frontend/src/views/dashboard/DashboardEditor.vue diff --git a/frontend/components.d.ts b/frontend/components.d.ts index 540e3917..de27aad6 100644 --- a/frontend/components.d.ts +++ b/frontend/components.d.ts @@ -41,6 +41,7 @@ declare module '@vue/runtime-core' { ElTable: typeof import('element-plus-secondary/es')['ElTable'] ElTableColumn: typeof import('element-plus-secondary/es')['ElTableColumn'] ElTabPane: typeof import('element-plus-secondary/es')['ElTabPane'] + ElTabPanel: typeof import('element-plus-secondary/es')['ElTabPanel'] ElTabs: typeof import('element-plus-secondary/es')['ElTabs'] ElTooltip: typeof import('element-plus-secondary/es')['ElTooltip'] ElUpload: typeof import('element-plus-secondary/es')['ElUpload'] diff --git a/frontend/src/utils/canvas.ts b/frontend/src/utils/canvas.ts index 058ee9e1..ceaa1d1f 100644 --- a/frontend/src/utils/canvas.ts +++ b/frontend/src/utils/canvas.ts @@ -1,13 +1,17 @@ - // @ts-ignore +// @ts-ignore import SnowflakeID from 'snowflake-id'; const snowflake = new SnowflakeID({ - mid: 42, - offset: (2010 - 1970) * 365 * 24 * 3600 * 1000 + mid: 42, + offset: (2010 - 1970) * 365 * 24 * 3600 * 1000 }); -export const guid = () => { - return snowflake.generate(); +export const guid = (prefix?: string) => { + if (prefix) { + return `${prefix}_${snowflake.generate()}`; + } else { + return snowflake.generate() + } } export interface CanvasItem { @@ -16,6 +20,7 @@ export interface CanvasItem { y: number sizeX: number sizeY: number + [key: string]: any } diff --git a/frontend/src/views/dashboard/DashboardEditor.vue b/frontend/src/views/dashboard/DashboardEditor.vue deleted file mode 100644 index 87d69bb4..00000000 --- a/frontend/src/views/dashboard/DashboardEditor.vue +++ /dev/null @@ -1,69 +0,0 @@ - - - - - diff --git a/frontend/src/views/dashboard/canvas/CanvasCore.vue b/frontend/src/views/dashboard/canvas/CanvasCore.vue index cbdc027b..05488ac4 100644 --- a/frontend/src/views/dashboard/canvas/CanvasCore.vue +++ b/frontend/src/views/dashboard/canvas/CanvasCore.vue @@ -1,20 +1,25 @@ -
- this is a tab +
+ +
@@ -160,8 +208,14 @@ const isEditMode = computed(() => true) \ No newline at end of file diff --git a/frontend/src/views/dashboard/css/CanvasStyle.less b/frontend/src/views/dashboard/css/CanvasStyle.less index 68076dce..19007df5 100644 --- a/frontend/src/views/dashboard/css/CanvasStyle.less +++ b/frontend/src/views/dashboard/css/CanvasStyle.less @@ -15,7 +15,7 @@ width: 100px; height: 100px; cursor: move; - border: 1px solid #59c7f9; + border: 1px solid #59c7f9; background-color: #fff; .resizeHandle { @@ -27,6 +27,10 @@ border-radius: 50%; z-index: 5; } + .sql-component { + width: 100%; + height: 100%; + } } .moveAnimation { @@ -39,7 +43,7 @@ .cloneNode { - z-index: 3; + z-index: 100; transition: none; @@ -98,4 +102,4 @@ border: 1px solid; } -} +} \ No newline at end of file diff --git a/frontend/src/views/dashboard/editor/DashboardEditor.vue b/frontend/src/views/dashboard/editor/DashboardEditor.vue index d2887aa5..a06fa3dd 100644 --- a/frontend/src/views/dashboard/editor/DashboardEditor.vue +++ b/frontend/src/views/dashboard/editor/DashboardEditor.vue @@ -1,6 +1,6 @@