From acb504c50871f5c2fef6fdc4dfc532e8df8f2df7 Mon Sep 17 00:00:00 2001
From: wangjiahao <1522128093@qq.com>
Date: Mon, 18 Dec 2023 20:27:24 +0800
Subject: [PATCH 1/2] =?UTF-8?q?refactor:=20=E6=89=B9=E9=87=8F=E6=93=8D?=
=?UTF-8?q?=E4=BD=9C=E6=97=B6=EF=BC=8C=E9=9C=80=E8=A6=81=E5=B1=8F=E8=94=BD?=
=?UTF-8?q?=E5=85=B6=E4=BB=96=E6=97=A0=E5=85=B3=E6=93=8D=E4=BD=9C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../data-visualization/canvas/Shape.vue | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/core/core-frontend/src/components/data-visualization/canvas/Shape.vue b/core/core-frontend/src/components/data-visualization/canvas/Shape.vue
index 9f3a7e84c7..17f32fea59 100644
--- a/core/core-frontend/src/components/data-visualization/canvas/Shape.vue
+++ b/core/core-frontend/src/components/data-visualization/canvas/Shape.vue
@@ -49,6 +49,7 @@
:style="getPointStyle(item)"
@mousedown="handleMouseDownOnPoint(item, $event)"
>
+
{
}
}
+const batchSelected = e => {
+ if (dvMainStore.batchOptStatus) {
+ componentEditBarRef.value.batchOptCheckOut()
+ e.stopPropagation()
+ e.preventDefault()
+ return
+ }
+}
+
const handleMouseDownOnPoint = (point, e) => {
dashboardActive.value && emit('onStartResize', e)
dvMainStore.setInEditorStatus(true)
@@ -833,6 +843,15 @@ onMounted(() => {
position: absolute;
}
+.shape-shadow {
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ position: absolute;
+ background-size: 100% 100% !important;
+}
+
.shape-inner {
width: 100%;
height: 100%;
From 3ebeb687cabb70d05df76030d624a02d1dd88423 Mon Sep 17 00:00:00 2001
From: wangjiahao <1522128093@qq.com>
Date: Thu, 21 Dec 2023 16:43:13 +0800
Subject: [PATCH 2/2] =?UTF-8?q?refactor:=20=E4=BC=98=E5=8C=96=E6=A8=A1?=
=?UTF-8?q?=E7=89=88=E7=AE=A1=E7=90=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../ext/ExtVisualizationTemplateMapper.java | 10 ++
.../service/TemplateManageService.java | 109 +++++++++----
.../ExtVisualizationTemplateMapper.xml | 152 ++++++++++++------
core/core-frontend/src/api/template.ts | 11 +-
.../src/views/common/DeResourceTree.vue | 6 -
.../template/component/DeTemplateImport.vue | 106 ++++++++----
.../template/component/DeTemplateItem.vue | 13 +-
.../template/component/DeTemplateList.vue | 2 +-
.../src/views/template/index.vue | 68 +++++---
.../api/template/TemplateManageApi.java | 9 +-
.../template/vo/VisualizationTemplateVO.java | 7 +
11 files changed, 337 insertions(+), 156 deletions(-)
diff --git a/core/core-backend/src/main/java/io/dataease/template/dao/ext/ExtVisualizationTemplateMapper.java b/core/core-backend/src/main/java/io/dataease/template/dao/ext/ExtVisualizationTemplateMapper.java
index aab0d1be59..2aaf531330 100644
--- a/core/core-backend/src/main/java/io/dataease/template/dao/ext/ExtVisualizationTemplateMapper.java
+++ b/core/core-backend/src/main/java/io/dataease/template/dao/ext/ExtVisualizationTemplateMapper.java
@@ -17,4 +17,14 @@ public interface ExtVisualizationTemplateMapper{
List findBaseTemplateList();
+ Long checkCategoryMap(@Param("categoryId") String categoryId);
+
+ Long checkRepeatTemplateId(@Param("categoryId") String categoryId, @Param("templateId") String templateId);
+
+ void deleteCategoryMapByTemplate(@Param("templateName") String templateName, @Param("templateId") String templateId);
+
+ Long checkCategoryTemplateName(@Param("templateName") String templateName,@Param("categories") List categories);
+
+ List findTemplateCategories(@Param("templateId") String templateId);
+
}
diff --git a/core/core-backend/src/main/java/io/dataease/template/service/TemplateManageService.java b/core/core-backend/src/main/java/io/dataease/template/service/TemplateManageService.java
index 295f0ff262..1bcbedd637 100644
--- a/core/core-backend/src/main/java/io/dataease/template/service/TemplateManageService.java
+++ b/core/core-backend/src/main/java/io/dataease/template/service/TemplateManageService.java
@@ -17,6 +17,7 @@ import io.dataease.template.dao.ext.ExtVisualizationTemplateMapper;
import io.dataease.utils.AuthUtils;
import io.dataease.utils.BeanUtils;
import io.dataease.visualization.server.StaticResourceServer;
+import io.dataease.xpack.base.settings.dao.entity.BaseSetting;
import jakarta.annotation.Resource;
import org.apache.commons.lang3.StringUtils;
import org.springframework.transaction.annotation.Transactional;
@@ -56,16 +57,16 @@ public class TemplateManageService implements TemplateManageApi {
request.setWithBlobs("N");
List templateList = extTemplateMapper.findTemplateList(request);
if (request.getWithChildren()) {
- getTreeChildren(templateList,request.getLeafDvType());
+ getTreeChildren(templateList, request.getLeafDvType());
}
return templateList;
}
- public void getTreeChildren(List parentTemplateList,String dvType) {
+ public void getTreeChildren(List parentTemplateList, String dvType) {
Optional.ofNullable(parentTemplateList).ifPresent(parent -> parent.forEach(parentTemplate -> {
- List panelTemplateDTOChildren = extTemplateMapper.findTemplateList(new TemplateManageRequest(parentTemplate.getId(),dvType));
+ List panelTemplateDTOChildren = extTemplateMapper.findTemplateList(new TemplateManageRequest(parentTemplate.getId(), dvType));
parentTemplate.setChildren(panelTemplateDTOChildren);
- getTreeChildren(panelTemplateDTOChildren,dvType);
+ getTreeChildren(panelTemplateDTOChildren, dvType);
}));
}
@@ -96,17 +97,21 @@ public class TemplateManageService implements TemplateManageApi {
DEException.throwException("名称已存在");
}
VisualizationTemplateCategory templateCategory = new VisualizationTemplateCategory();
- BeanUtils.copyBean(templateCategory,request);
+ BeanUtils.copyBean(templateCategory, request);
templateCategoryMapper.insert(templateCategory);
} else {//模板插入 同名的模板进行覆盖(先删除)
+ // 分类映射删除
+ extTemplateMapper.deleteCategoryMapByTemplate(request.getName(),null);
+ // 模版删除
QueryWrapper wrapper = new QueryWrapper<>();
- wrapper.eq("name",request.getName());
+ wrapper.eq("name", request.getName());
templateMapper.delete(wrapper);
+
VisualizationTemplate template = new VisualizationTemplate();
- BeanUtils.copyBean(template,request);
+ BeanUtils.copyBean(template, request);
templateMapper.insert(template);
// 插入分类关系
- request.getCategories().forEach(categoryId ->{
+ request.getCategories().forEach(categoryId -> {
VisualizationTemplateCategoryMap categoryMap = new VisualizationTemplateCategoryMap();
categoryMap.setId(UUID.randomUUID().toString());
categoryMap.setCategoryId(categoryId);
@@ -122,16 +127,27 @@ public class TemplateManageService implements TemplateManageApi {
DEException.throwException("名称已存在");
}
VisualizationTemplateCategory templateCategory = new VisualizationTemplateCategory();
- BeanUtils.copyBean(templateCategory,request);
+ BeanUtils.copyBean(templateCategory, request);
templateCategoryMapper.updateById(templateCategory);
- }else{
+ } else {
String nameCheckResult = this.nameCheck(CommonConstants.OPT_TYPE.UPDATE, request.getName(), request.getId());
if (CommonConstants.CHECK_RESULT.EXIST_ALL.equals(nameCheckResult)) {
DEException.throwException("名称已存在");
}
VisualizationTemplate template = new VisualizationTemplate();
- BeanUtils.copyBean(template,request);
+ BeanUtils.copyBean(template, request);
templateMapper.updateById(template);
+ //更新分类
+ // 分类映射删除
+ extTemplateMapper.deleteCategoryMapByTemplate(null,request.getId());
+ // 插入分类关系
+ request.getCategories().forEach(categoryId -> {
+ VisualizationTemplateCategoryMap categoryMap = new VisualizationTemplateCategoryMap();
+ categoryMap.setId(UUID.randomUUID().toString());
+ categoryMap.setCategoryId(categoryId);
+ categoryMap.setTemplateId(request.getId());
+ categoryMapMapper.insert(categoryMap);
+ });
}
}
@@ -141,14 +157,14 @@ public class TemplateManageService implements TemplateManageApi {
return templateManageDTO;
}
- //名称检查
- public String nameCheck(String optType, String name,String id) {
+ //模版名称检查
+ public String nameCheck(String optType, String name, String id) {
QueryWrapper wrapper = new QueryWrapper<>();
if (CommonConstants.OPT_TYPE.INSERT.equals(optType)) {
- wrapper.eq("name",name);
+ wrapper.eq("name", name);
} else if (CommonConstants.OPT_TYPE.UPDATE.equals(optType)) {
- wrapper.eq("name",name);
- wrapper.ne("id",id);
+ wrapper.eq("name", name);
+ wrapper.ne("id", id);
}
List templateList = templateMapper.selectList(wrapper);
if (CollectionUtils.isEmpty(templateList)) {
@@ -158,14 +174,25 @@ public class TemplateManageService implements TemplateManageApi {
}
}
- //名称检查
+ //分类下模版名称检查
+ @Override
+ public String categoryTemplateNameCheck(TemplateManageRequest request) {
+ Long result = extTemplateMapper.checkCategoryTemplateName(request.getName(), request.getCategories());
+ if (result == 0) {
+ return CommonConstants.CHECK_RESULT.NONE;
+ } else {
+ return CommonConstants.CHECK_RESULT.EXIST_ALL;
+ }
+ }
+
+ //分类名称检查
public String categoryNameCheck(String optType, String name, String id) {
QueryWrapper wrapper = new QueryWrapper<>();
if (CommonConstants.OPT_TYPE.INSERT.equals(optType)) {
- wrapper.eq("name",name);
+ wrapper.eq("name", name);
} else if (CommonConstants.OPT_TYPE.UPDATE.equals(optType)) {
- wrapper.eq("name",name);
- wrapper.ne("id",id);
+ wrapper.eq("name", name);
+ wrapper.ne("id", id);
}
List templateList = templateCategoryMapper.selectList(wrapper);
if (CollectionUtils.isEmpty(templateList)) {
@@ -174,31 +201,59 @@ public class TemplateManageService implements TemplateManageApi {
return CommonConstants.CHECK_RESULT.EXIST_ALL;
}
}
+
@Override
public String nameCheck(TemplateManageRequest request) {
return nameCheck(request.getOptType(), request.getName(), request.getId());
}
+
@Override
- public void delete(String id) {
+ public void delete(String id, String categoryId) {
Assert.notNull(id, "id cannot be null");
- templateMapper.deleteById(id);
+ Assert.notNull(categoryId, "categoryId cannot be null");
+ QueryWrapper queryWrapper = new QueryWrapper<>();
+ queryWrapper.eq("template_id", id);
+ queryWrapper.eq("category_id", categoryId);
+ categoryMapMapper.delete(queryWrapper);
+ // 如何是最后一个 则实际模版需要删除
+ Long result = extTemplateMapper.checkRepeatTemplateId(categoryId, id);
+ if (result == 0) {
+ templateMapper.deleteById(id);
+ }
}
+
@Override
- public void deleteCategory(String id) {
+ public String deleteCategory(String id) {
Assert.notNull(id, "id cannot be null");
- templateCategoryMapper.deleteById(id);
+ // 该分类下是否有其他分类公用的模版
+
+ Long checkResult = extTemplateMapper.checkCategoryMap(id);
+ if (checkResult == 0) {
+ templateCategoryMapper.deleteById(id);
+ QueryWrapper queryWrapper = new QueryWrapper<>();
+ queryWrapper.eq("category_id", id);
+ categoryMapMapper.delete(queryWrapper);
+ return "success";
+ } else {
+ return "repeat";
+ }
}
+
@Override
public VisualizationTemplateVO findOne(String templateId) {
VisualizationTemplate template = templateMapper.selectById(templateId);
- if(template != null){
+ if (template != null) {
VisualizationTemplateVO templateVO = new VisualizationTemplateVO();
- BeanUtils.copyBean(templateVO,template);
+ BeanUtils.copyBean(templateVO, template);
+ //查找分类
+ List categories = extTemplateMapper.findTemplateCategories(templateId);
+ templateVO.setCategories(categories);
return templateVO;
- }else{
+ } else {
return null;
}
}
+
@Override
public List find(TemplateManageRequest request) {
return extTemplateMapper.findTemplateList(request);
diff --git a/core/core-backend/src/main/resources/mybatis/ExtVisualizationTemplateMapper.xml b/core/core-backend/src/main/resources/mybatis/ExtVisualizationTemplateMapper.xml
index 1746fdfea4..2c0591a1f6 100644
--- a/core/core-backend/src/main/resources/mybatis/ExtVisualizationTemplateMapper.xml
+++ b/core/core-backend/src/main/resources/mybatis/ExtVisualizationTemplateMapper.xml
@@ -3,24 +3,24 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -33,57 +33,55 @@
- vt.id, vt.`name`, vt.pid, vt.`level`,vt.`dv_type`, vt.node_type, vt.create_by, vt.create_time, vt.template_type, vt.snapshot
-
+ vt
+ .
+ id
+ , vt.`name`, vt.pid, vt.`level`,vt.`dv_type`, vt.node_type, vt.create_by, vt.create_time, vt.template_type, vt.snapshot
+
- ,vt.template_style, vt.template_data, vt.dynamic_data
-
+ ,vt.template_style, vt.template_data, vt.dynamic_data
+
+
+
+
+
+
+
+
+
+ delete from visualization_template_category_map tcm where tcm.template_id in (
+ select id from visualization_template vt
+
+
+ and vt.name = #{templateName}
+
+
+ and vt.template_id = #{templateId}
+
+
+
+ )
+
+
+
diff --git a/core/core-frontend/src/api/template.ts b/core/core-frontend/src/api/template.ts
index a9f48b0fe9..d1b0033400 100644
--- a/core/core-frontend/src/api/template.ts
+++ b/core/core-frontend/src/api/template.ts
@@ -7,9 +7,9 @@ export function save(data) {
loading: true
})
}
-export function templateDelete(id) {
+export function templateDelete(id, categoryId) {
return request.post({
- url: '/templateManage/delete/' + id
+ url: '/templateManage/delete/' + id + '/' + categoryId
})
}
@@ -54,3 +54,10 @@ export function nameCheck(data) {
data: data
})
}
+
+export function categoryTemplateNameCheck(data) {
+ return request.post({
+ url: '/templateManage/categoryTemplateNameCheck',
+ data: data
+ })
+}
diff --git a/core/core-frontend/src/views/common/DeResourceTree.vue b/core/core-frontend/src/views/common/DeResourceTree.vue
index 7e16495c8d..a5cad77784 100644
--- a/core/core-frontend/src/views/common/DeResourceTree.vue
+++ b/core/core-frontend/src/views/common/DeResourceTree.vue
@@ -467,12 +467,6 @@ defineExpose({
@finish="resourceOptFinish"
ref="resourceGroupOpt"
/>
-
-
-
-
-
-
-
+