From 622cddbf7f517fcf9343b1d640b046ab08760911 Mon Sep 17 00:00:00 2001
From: wangjiahao <1522128093@qq.com>
Date: Fri, 19 Jul 2024 09:44:39 +0800
Subject: [PATCH] =?UTF-8?q?refactor:=20=E5=A2=9E=E5=8A=A0=E6=A8=A1?=
=?UTF-8?q?=E6=9D=BF=E5=B8=82=E5=9C=BA=E5=88=86=E7=B1=BB=EF=BC=8C=E5=A2=9E?=
=?UTF-8?q?=E5=8A=A0=E5=BA=94=E7=94=A8=E6=A8=A1=E6=9D=BF=E5=88=86=E7=B1=BB?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/components/dashboard/DbToolbar.vue | 2 +
.../data-visualization/DvToolbar.vue | 2 +
.../modules/data-visualization/snapshot.ts | 12 +++++
.../src/views/template-market/index.vue | 50 +++++++++++++++++--
.../api/template/dto/TemplateMarketDTO.java | 4 ++
5 files changed, 66 insertions(+), 4 deletions(-)
diff --git a/core/core-frontend/src/components/dashboard/DbToolbar.vue b/core/core-frontend/src/components/dashboard/DbToolbar.vue
index 059639c726..264ce39973 100644
--- a/core/core-frontend/src/components/dashboard/DbToolbar.vue
+++ b/core/core-frontend/src/components/dashboard/DbToolbar.vue
@@ -193,6 +193,8 @@ const saveResource = () => {
initCanvasData(dvInfo.value.id, 'dashboard', () => {
useEmitt().emitter.emit('refresh-dataset-selector')
resourceAppOpt.value.close()
+ dvMainStore.setAppDataInfo(null)
+ snapshotStore.resetSnapshot()
})
}
})
diff --git a/core/core-frontend/src/components/data-visualization/DvToolbar.vue b/core/core-frontend/src/components/data-visualization/DvToolbar.vue
index 389b8ceeda..75eae70f68 100644
--- a/core/core-frontend/src/components/data-visualization/DvToolbar.vue
+++ b/core/core-frontend/src/components/data-visualization/DvToolbar.vue
@@ -137,6 +137,8 @@ const saveResource = () => {
initCanvasData(dvInfo.value.id, 'dataV', () => {
useEmitt().emitter.emit('refresh-dataset-selector')
resourceAppOpt.value.close()
+ dvMainStore.setAppDataInfo(null)
+ snapshotStore.resetSnapshot()
})
}
})
diff --git a/core/core-frontend/src/store/modules/data-visualization/snapshot.ts b/core/core-frontend/src/store/modules/data-visualization/snapshot.ts
index e4d9ec3cfa..ea9e798e46 100644
--- a/core/core-frontend/src/store/modules/data-visualization/snapshot.ts
+++ b/core/core-frontend/src/store/modules/data-visualization/snapshot.ts
@@ -138,6 +138,18 @@ export const snapshotStore = defineStore('snapshot', {
resetStyleChangeTimes() {
this.styleChangeTimes = 0
},
+ resetSnapshot() {
+ this.styleChangeTimes = -1
+ this.cacheStyleChangeTimes = 0
+ this.snapshotCacheTimes = 0
+ this.cacheViewIdInfo = {
+ snapshotCacheViewCalc: [],
+ snapshotCacheViewRender: []
+ }
+ this.snapshotData = []
+ this.snapshotIndex = -1
+ this.recordSnapshot()
+ },
recordSnapshot() {
this.styleChangeTimes = ++this.styleChangeTimes
diff --git a/core/core-frontend/src/views/template-market/index.vue b/core/core-frontend/src/views/template-market/index.vue
index d3527f2a99..10767ca7f9 100644
--- a/core/core-frontend/src/views/template-market/index.vue
+++ b/core/core-frontend/src/views/template-market/index.vue
@@ -81,6 +81,14 @@
:value="item.value"
/>
+
+
+
@@ -203,9 +211,24 @@ const state = reactive({
value: 'label',
label: 'label'
},
- templateType: 'all',
- templateSourceType: 'all',
+ templateType: 'all', // 模板类型 仪表板 数据大屏
+ templateSourceType: 'all', // 模板来源 模板市场 模板管理
+ templateClassifyType: 'all', // 模板分类 样式模板 应用模板
treeShow: true,
+ templateClassifyOptions: [
+ {
+ value: 'all',
+ label: '全部分类'
+ },
+ {
+ value: 'app',
+ label: '应用模板'
+ },
+ {
+ value: 'template',
+ label: '样式模板'
+ }
+ ],
templateSourceOptions: [
{
value: 'all',
@@ -231,7 +254,7 @@ const state = reactive({
},
{
value: 'SCREEN',
- label: '大屏'
+ label: '数据大屏'
}
],
loading: false,
@@ -353,6 +376,17 @@ watch(
})
}
)
+watch(
+ () => state.templateClassifyType,
+ () => {
+ state.treeShow = false
+ initTemplateShow()
+ nextTick(() => {
+ state.treeShow = true
+ initStyle()
+ })
+ }
+)
const nodeClick = data => {
state.marketActiveTab = data.label
@@ -497,6 +531,7 @@ const templateShow = templateItem => {
let searchMarch = false
let templateTypeMarch = false
let templateSourceTypeMarch = false
+ let templateClassifyTypeMarch = false
if (!state.searchText || templateItem.title.indexOf(state.searchText) > -1) {
searchMarch = true
}
@@ -508,7 +543,14 @@ const templateShow = templateItem => {
if (state.templateSourceType === 'all' || templateItem.source === state.templateSourceType) {
templateSourceTypeMarch = true
}
- return searchMarch && templateTypeMarch && templateSourceTypeMarch
+
+ if (
+ state.templateClassifyType === 'all' ||
+ templateItem.classify === state.templateClassifyType
+ ) {
+ templateClassifyTypeMarch = true
+ }
+ return searchMarch && templateTypeMarch && templateSourceTypeMarch && templateClassifyTypeMarch
}
const templatePreview = previewId => {
diff --git a/sdk/api/api-base/src/main/java/io/dataease/api/template/dto/TemplateMarketDTO.java b/sdk/api/api-base/src/main/java/io/dataease/api/template/dto/TemplateMarketDTO.java
index 33e36dd84d..0001c6169c 100644
--- a/sdk/api/api-base/src/main/java/io/dataease/api/template/dto/TemplateMarketDTO.java
+++ b/sdk/api/api-base/src/main/java/io/dataease/api/template/dto/TemplateMarketDTO.java
@@ -31,6 +31,9 @@ public class TemplateMarketDTO implements Comparable {
// 模板来源 market = 模板市场;manage=模板管理
private String source = "market";
+
+ // 模板分类 app = 应用模板;manage=样式模板
+ private String classify = "template";
private List categories;
private List categoryNames;
@@ -49,6 +52,7 @@ public class TemplateMarketDTO implements Comparable {
this.templateType = "dataV".equalsIgnoreCase(manageDTO.getDvType()) ? "SCREEN" : "PANEL";
this.thumbnail = manageDTO.getSnapshot();
this.source = "manage";
+ this.classify = manageDTO.getNodeType();
if (manageDTO.getRecentUseTime() != null) {
this.recentUseTime = manageDTO.getRecentUseTime();
this.categories.add(new MarketCategoryVO("最近使用"));