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 @@
-
-
-
-