From 0cb6078456f38df041aa9115a2cd673b28d41da8 Mon Sep 17 00:00:00 2001
From: wangjiahao <1522128093@qq.com>
Date: Fri, 6 Sep 2024 10:29:17 +0800
Subject: [PATCH] =?UTF-8?q?feat(=E4=BB=AA=E8=A1=A8=E6=9D=BF=E3=80=81?=
=?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=A4=A7=E5=B1=8F):=20Tab=E6=89=B9=E9=87=8F?=
=?UTF-8?q?=E5=A4=8D=E5=88=B6=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
core/core-backend/pom.xml | 15 +++++++++++++++
.../src/custom-component/de-tabs/Component.vue | 18 ++++++++++++------
.../store/modules/data-visualization/copy.ts | 15 ++++++---------
.../store/modules/data-visualization/dvMain.ts | 4 ++++
4 files changed, 37 insertions(+), 15 deletions(-)
diff --git a/core/core-backend/pom.xml b/core/core-backend/pom.xml
index 0c2596d5a1..1511dd600b 100644
--- a/core/core-backend/pom.xml
+++ b/core/core-backend/pom.xml
@@ -131,6 +131,21 @@
flexmark-all
${flexmark.version}
+
+ io.dataease
+ xpack-permissions
+ ${project.version}
+
+
+ io.dataease
+ xpack-sync
+ ${project.version}
+
+
+ io.dataease
+ xpack-base
+ ${project.version}
+
diff --git a/core/core-frontend/src/custom-component/de-tabs/Component.vue b/core/core-frontend/src/custom-component/de-tabs/Component.vue
index 78e3b8b8d9..d5d2603979 100644
--- a/core/core-frontend/src/custom-component/de-tabs/Component.vue
+++ b/core/core-frontend/src/custom-component/de-tabs/Component.vue
@@ -40,16 +40,15 @@
编辑标题
-
+
+ 复制
+
删除
-
- 复制
-
@@ -265,8 +264,12 @@ function deleteCur(param) {
}
}
function copyCur(param) {
- state.curItem = param
- element.value.propValue.push(deepCopyTabItemHelper(element.value.id, param))
+ addTab()
+ const newTabItem = element.value.propValue[element.value.propValue.length - 1]
+ const idMap = {}
+ const newCanvasId = element.value.id + '--' + newTabItem.name
+ newTabItem.componentData = deepCopyTabItemHelper(newCanvasId, param.componentData, idMap)
+ dvMainStore.updateCopyCanvasView(idMap)
}
function editCurTitle(param) {
@@ -284,6 +287,9 @@ function handleCommand(command) {
case 'deleteCur':
deleteCur(command.param)
break
+ case 'copyCur':
+ copyCur(command.param)
+ break
}
}
diff --git a/core/core-frontend/src/store/modules/data-visualization/copy.ts b/core/core-frontend/src/store/modules/data-visualization/copy.ts
index 4cb9cdaf73..48bfcb8825 100644
--- a/core/core-frontend/src/store/modules/data-visualization/copy.ts
+++ b/core/core-frontend/src/store/modules/data-visualization/copy.ts
@@ -184,17 +184,14 @@ export const copyStore = defineStore('copy', {
}
})
-export function deepCopyTabItemHelper(tabId, tabItem, idMap) {
- const result = deepCopy(tabItem)
- const newComponentId = generateID()
- result.id = newComponentId
- result.componentData = []
- tabItem.componentData.forEach(item => {
+export function deepCopyTabItemHelper(newCanvasId, tabComponentData, idMap) {
+ const resultComponentData = []
+ tabComponentData.forEach(item => {
const newItem = deepCopyHelper(item, idMap)
- newItem.canvasId = tabId + '--' + newComponentId
- result.componentData.push(deepCopyHelper(item, idMap))
+ newItem.canvasId = newCanvasId
+ resultComponentData.push(newItem)
})
- return result
+ return resultComponentData
}
function deepCopyHelper(data, idMap) {
diff --git a/core/core-frontend/src/store/modules/data-visualization/dvMain.ts b/core/core-frontend/src/store/modules/data-visualization/dvMain.ts
index d1ef18a1b9..5a2f9c766d 100644
--- a/core/core-frontend/src/store/modules/data-visualization/dvMain.ts
+++ b/core/core-frontend/src/store/modules/data-visualization/dvMain.ts
@@ -380,6 +380,10 @@ export const dvMainStore = defineStore('dataVisualization', {
}
})
}
+ //组件组内部可能还有多个图表
+ this.updateCopyCanvasView(idMap, canvasViewInfoPre)
+ },
+ updateCopyCanvasView(idMap, canvasViewInfoPre = this.canvasViewInfo) {
// eslint-disable-next-line @typescript-eslint/no-this-alias
const _this = this
//组件组内部可能还有多个图表