diff --git a/core/core-backend/src/main/resources/mybatis/ExtVisualizationTemplateMapper.xml b/core/core-backend/src/main/resources/mybatis/ExtVisualizationTemplateMapper.xml index 1971a6d26b..1746fdfea4 100644 --- a/core/core-backend/src/main/resources/mybatis/ExtVisualizationTemplateMapper.xml +++ b/core/core-backend/src/main/resources/mybatis/ExtVisualizationTemplateMapper.xml @@ -20,6 +20,7 @@ + @@ -50,10 +51,12 @@ vt.create_time, vt.template_type, vt.SNAPSHOT, - vtcm.category_id + vtcm.category_id, + cor.time as 'recent_use_time' FROM visualization_template vt LEFT JOIN visualization_template_category_map vtcm ON vt.id = vtcm.template_id + left JOIN core_opt_recent cor on cor.resource_type=6 and vt.id= cor.resource_name ORDER BY vt.create_time DESC diff --git a/core/core-frontend/src/views/dashboard/index.vue b/core/core-frontend/src/views/dashboard/index.vue index 51cd8ca0a2..f229923c55 100644 --- a/core/core-frontend/src/views/dashboard/index.vue +++ b/core/core-frontend/src/views/dashboard/index.vue @@ -71,6 +71,7 @@ onMounted(() => { if (createType === 'template') { const deTemplateDataStr = wsCache.get(`de-template-data`) const deTemplateData = JSON.parse(deTemplateDataStr) + wsCache.delete('de-template-data') dvMainStore.setComponentData(JSON.parse(deTemplateData['componentData'])) dvMainStore.setCanvasStyle(JSON.parse(deTemplateData['canvasStyleData'])) dvMainStore.setCanvasViewInfo(deTemplateData['canvasViewInfo']) diff --git a/core/core-frontend/src/views/data-visualization/index.vue b/core/core-frontend/src/views/data-visualization/index.vue index 08bbf38f94..960a6e282f 100644 --- a/core/core-frontend/src/views/data-visualization/index.vue +++ b/core/core-frontend/src/views/data-visualization/index.vue @@ -201,6 +201,7 @@ onMounted(() => { // 从模板新建 if (createType === 'template') { const deTemplateDataStr = wsCache.get(`de-template-data`) + wsCache.delete('de-template-data') const deTemplateData = JSON.parse(deTemplateDataStr) dvMainStore.setComponentData(JSON.parse(deTemplateData['componentData'])) dvMainStore.setCanvasStyle(JSON.parse(deTemplateData['canvasStyleData'])) diff --git a/core/core-frontend/src/views/template-market/index.vue b/core/core-frontend/src/views/template-market/index.vue index 6655b71054..6fcd01358c 100644 --- a/core/core-frontend/src/views/template-market/index.vue +++ b/core/core-frontend/src/views/template-market/index.vue @@ -405,6 +405,7 @@ const apply = () => { decompression(state.dvCreateForm) .then(response => { state.curApplyTemplate.recentUseTime = Date.now() + state.curApplyTemplate.categoryNames.push('最近使用') state.loading = false const templateData = response.data // do create 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 5e52f7bd71..33e36dd84d 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 @@ -46,11 +46,13 @@ public class TemplateMarketDTO implements Comparable { this.categories = manageDTO.getCategoryNames().stream().map(category->new MarketCategoryVO(category)).collect(Collectors.toList()); this.categoryNames = manageDTO.getCategoryNames(); this.metas = new MarketMetasVO(manageDTO.getSnapshot()); - this.templateType = "dataV".equalsIgnoreCase(manageDTO.getTemplateType()) ? "SCREEN" : "PANEL"; + this.templateType = "dataV".equalsIgnoreCase(manageDTO.getDvType()) ? "SCREEN" : "PANEL"; this.thumbnail = manageDTO.getSnapshot(); this.source = "manage"; if (manageDTO.getRecentUseTime() != null) { this.recentUseTime = manageDTO.getRecentUseTime(); + this.categories.add(new MarketCategoryVO("最近使用")); + this.categoryNames.add("最近使用"); } }