diff --git a/backend/src/main/java/io/dataease/base/mapper/ext/ExtChartViewMapper.java b/backend/src/main/java/io/dataease/base/mapper/ext/ExtChartViewMapper.java
index 357f159a17..fd3e2cb602 100644
--- a/backend/src/main/java/io/dataease/base/mapper/ext/ExtChartViewMapper.java
+++ b/backend/src/main/java/io/dataease/base/mapper/ext/ExtChartViewMapper.java
@@ -26,4 +26,8 @@ public interface ExtChartViewMapper {
ChartViewDTO searchOneWithPrivileges(@Param("userId") String userId,@Param("id") String id );
void chartCopyWithPanel(@Param("copyId") String copyId);
+
+ void deleteCircleView(@Param("pid") String pid);
+
+ void deleteCircleGroup(@Param("pid") String pid);
}
diff --git a/backend/src/main/java/io/dataease/base/mapper/ext/ExtChartViewMapper.xml b/backend/src/main/java/io/dataease/base/mapper/ext/ExtChartViewMapper.xml
index 836ce186be..01c0c1d3eb 100644
--- a/backend/src/main/java/io/dataease/base/mapper/ext/ExtChartViewMapper.xml
+++ b/backend/src/main/java/io/dataease/base/mapper/ext/ExtChartViewMapper.xml
@@ -228,4 +228,12 @@
) pv_copy
LEFT JOIN chart_view ON chart_view.id = pv_copy.copy_from_view
+
+
+ delete chart_view from (select GET_CHART_GROUP_WITH_CHILDREN(#{pid}) cids) t,chart_view where FIND_IN_SET(chart_view.id,cids) and chart_type='public'
+
+
+
+ delete chart_group from (select GET_CHART_GROUP_WITH_CHILDREN(#{pid}) cids) t,chart_group where FIND_IN_SET(chart_group.id,cids)
+
diff --git a/backend/src/main/java/io/dataease/base/mapper/ext/ExtVAuthModelMapper.xml b/backend/src/main/java/io/dataease/base/mapper/ext/ExtVAuthModelMapper.xml
index d29e8d7e1f..47196419f4 100644
--- a/backend/src/main/java/io/dataease/base/mapper/ext/ExtVAuthModelMapper.xml
+++ b/backend/src/main/java/io/dataease/base/mapper/ext/ExtVAuthModelMapper.xml
@@ -135,43 +135,10 @@
diff --git a/backend/src/main/java/io/dataease/controller/chart/ChartGroupController.java b/backend/src/main/java/io/dataease/controller/chart/ChartGroupController.java
index 6c7a1c234b..b48d14f6ed 100644
--- a/backend/src/main/java/io/dataease/controller/chart/ChartGroupController.java
+++ b/backend/src/main/java/io/dataease/controller/chart/ChartGroupController.java
@@ -44,9 +44,9 @@ public class ChartGroupController {
@ApiIgnore
@ApiOperation("删除")
- @PostMapping("/delete/{id}")
+ @PostMapping("/deleteCircle/{id}")
public void tree(@PathVariable String id) {
- chartGroupService.delete(id);
+ chartGroupService.deleteCircle(id);
}
@ApiIgnore
diff --git a/backend/src/main/java/io/dataease/service/chart/ChartGroupService.java b/backend/src/main/java/io/dataease/service/chart/ChartGroupService.java
index 2ab6043ee2..c9d83bbff9 100644
--- a/backend/src/main/java/io/dataease/service/chart/ChartGroupService.java
+++ b/backend/src/main/java/io/dataease/service/chart/ChartGroupService.java
@@ -3,6 +3,7 @@ package io.dataease.service.chart;
import io.dataease.base.domain.*;
import io.dataease.base.mapper.ChartGroupMapper;
import io.dataease.base.mapper.ext.ExtChartGroupMapper;
+import io.dataease.base.mapper.ext.ExtChartViewMapper;
import io.dataease.base.mapper.ext.ExtDataSetGroupMapper;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.BeanUtils;
@@ -15,6 +16,7 @@ import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import javax.annotation.Resource;
@@ -36,6 +38,8 @@ public class ChartGroupService {
private ExtDataSetGroupMapper extDataSetGroupMapper;
@Resource
private SysAuthService sysAuthService;
+ @Resource
+ private ExtChartViewMapper extChartViewMapper;
public ChartGroupDTO save(ChartGroup chartGroup) {
checkName(chartGroup);
@@ -53,26 +57,13 @@ public class ChartGroupService {
return ChartGroupDTO;
}
- public void delete(String id) {
+ @Transactional
+ public void deleteCircle(String id) {
Assert.notNull(id, "id cannot be null");
- sysAuthService.checkTreeNoManageCount("chart",id);
-
- ChartGroup cg = chartGroupMapper.selectByPrimaryKey(id);
- ChartGroupRequest ChartGroup = new ChartGroupRequest();
- BeanUtils.copyBean(ChartGroup, cg);
- Map stringStringMap = extDataSetGroupMapper.searchIds(id, "chart");
- String[] split = stringStringMap.get("ids").split(",");
- List ids = new ArrayList<>();
- for (String dsId : split) {
- if (StringUtils.isNotEmpty(dsId)) {
- ids.add(dsId);
- }
- }
- ChartGroupExample ChartGroupExample = new ChartGroupExample();
- ChartGroupExample.createCriteria().andIdIn(ids);
- chartGroupMapper.deleteByExample(ChartGroupExample);
- // 删除所有chart
- deleteChart(ids);
+ //存量视图删除
+ extChartViewMapper.deleteCircleView(id);
+ //存量分组删除
+ extChartViewMapper.deleteCircleGroup(id);
}
public void deleteChart(List sceneIds) {
diff --git a/backend/src/main/resources/db/migration/V32__1.8.sql b/backend/src/main/resources/db/migration/V32__1.8.sql
index 9e223defdd..47226bade3 100644
--- a/backend/src/main/resources/db/migration/V32__1.8.sql
+++ b/backend/src/main/resources/db/migration/V32__1.8.sql
@@ -6,7 +6,7 @@ INSERT INTO `chart_group` (`id`, `name`, `pid`, `level`, `type`, `create_by`, `c
ALTER TABLE `chart_view`
MODIFY COLUMN `scene_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '场景ID chart_type为private的时候 是仪表板id' AFTER `title`,
-ADD COLUMN `chart_type` varchar(255) NULL DEFAULT 'public' COMMENT '视图类型 public 公共 历史可复用的视图,private 私有 专属某个仪表板' AFTER `style_priority`;
+ADD COLUMN `chart_type` varchar(255) NULL DEFAULT 'private' COMMENT '视图类型 public 公共 历史可复用的视图,private 私有 专属某个仪表板' AFTER `style_priority`;
delete from sys_auth_detail where auth_id in(select id from sys_auth where auth_source_type = 'chart');
delete from sys_auth where auth_source_type = 'chart';
@@ -248,7 +248,7 @@ delete from panel_view where id in (
);
INSERT INTO `panel_view` VALUES ('5dafcf9b-8e0a-11ec-8e4b-0242ac130002', '117f679e-8355-4645-a692-47e2009cbc0d', '84b444e1-0088-44f9-acdc-cc39018413bc', NULL, NULL, NULL, NULL, NULL), ('5dafd1d1-8e0a-11ec-8e4b-0242ac130002', '117f679e-8355-4645-a692-47e2009cbc0d', 'c68db172-2df2-4aa2-aad6-077cf1684e14', NULL, NULL, NULL, NULL, NULL), ('5dafd224-8e0a-11ec-8e4b-0242ac130002', '117f679e-8355-4645-a692-47e2009cbc0d', 'f8d62b2b-b99a-4b6c-8378-d7c2ec4ea766', NULL, NULL, NULL, NULL, NULL), ('5dafd26e-8e0a-11ec-8e4b-0242ac130002', '117f679e-8355-4645-a692-47e2009cbc0d', 'c4943403-4960-4ad8-a9c5-12c46c538c34', NULL, NULL, NULL, NULL, NULL), ('5dafd2ac-8e0a-11ec-8e4b-0242ac130002', '117f679e-8355-4645-a692-47e2009cbc0d', 'f257452d-6fc1-4499-bdce-bd10b3e1c520', NULL, NULL, NULL, NULL, NULL), ('5dafd2f1-8e0a-11ec-8e4b-0242ac130002', '117f679e-8355-4645-a692-47e2009cbc0d', '8271c4e4-43ab-48c6-b7b4-67ccaba3f80b', NULL, NULL, NULL, NULL, NULL), ('5dafd32e-8e0a-11ec-8e4b-0242ac130002', '117f679e-8355-4645-a692-47e2009cbc0d', 'a0058881-b29f-4b5c-911f-7f1480b07eb0', NULL, NULL, NULL, NULL, NULL), ('5dafd363-8e0a-11ec-8e4b-0242ac130002', '117f679e-8355-4645-a692-47e2009cbc0d', 'c36cd358-0501-4f83-a323-f754485d00b1', NULL, NULL, NULL, NULL, NULL), ('6c200051-8e0a-11ec-8e4b-0242ac130002', 'c8d4c4b4-2293-417f-b76d-3632cc217bb1', '95f8e3a2-62a5-48a7-a719-fcf53746da8d', NULL, NULL, NULL, NULL, NULL), ('6c2002c2-8e0a-11ec-8e4b-0242ac130002', 'c8d4c4b4-2293-417f-b76d-3632cc217bb1', '8a26a936-89bf-45a8-b1ce-d5ef1719465d', NULL, NULL, NULL, NULL, NULL), ('6c20030f-8e0a-11ec-8e4b-0242ac130002', 'c8d4c4b4-2293-417f-b76d-3632cc217bb1', '8d1c3f30-0639-452e-9883-164f37353324', NULL, NULL, NULL, NULL, NULL), ('6c2003ca-8e0a-11ec-8e4b-0242ac130002', 'c8d4c4b4-2293-417f-b76d-3632cc217bb1', '175b25df-1939-4582-a9c5-d9e8ed3ea2b1', NULL, NULL, NULL, NULL, NULL), ('6c20040d-8e0a-11ec-8e4b-0242ac130002', 'c8d4c4b4-2293-417f-b76d-3632cc217bb1', 'c3da496f-073c-413a-bebd-e7f1a4a00ba7', NULL, NULL, NULL, NULL, NULL), ('6c200442-8e0a-11ec-8e4b-0242ac130002', 'c8d4c4b4-2293-417f-b76d-3632cc217bb1', 'da18eecd-feff-4140-a291-cce4abf1afaa', NULL, NULL, NULL, NULL, NULL), ('6c200478-8e0a-11ec-8e4b-0242ac130002', 'c8d4c4b4-2293-417f-b76d-3632cc217bb1', '3f201733-bbb3-485e-a1d6-0fe4f00b5304', NULL, NULL, NULL, NULL, NULL), ('6c2004a9-8e0a-11ec-8e4b-0242ac130002', 'c8d4c4b4-2293-417f-b76d-3632cc217bb1', '692d5bdc-aa70-4fce-b830-b8d6620539c6', NULL, NULL, NULL, NULL, NULL), ('6c2004e4-8e0a-11ec-8e4b-0242ac130002', 'c8d4c4b4-2293-417f-b76d-3632cc217bb1', 'aff5be0c-f195-4fce-bd2b-b8d0e63764de', NULL, NULL, NULL, NULL, NULL), ('6c200530-8e0a-11ec-8e4b-0242ac130002', 'c8d4c4b4-2293-417f-b76d-3632cc217bb1', 'cb66836d-a34c-40c6-87e7-0db0375ec19e', NULL, NULL, NULL, NULL, NULL), ('6c200568-8e0a-11ec-8e4b-0242ac130002', 'c8d4c4b4-2293-417f-b76d-3632cc217bb1', '1d06e2a0-d936-4192-b523-2eb1e8cebd51', NULL, NULL, NULL, NULL, NULL), ('6c200598-8e0a-11ec-8e4b-0242ac130002', 'c8d4c4b4-2293-417f-b76d-3632cc217bb1', '0de1d446-8300-4ab3-a4ef-4e8f8579cb2e', NULL, NULL, NULL, NULL, NULL), ('7611e439-8e0a-11ec-8e4b-0242ac130002', 'd2bda4c3-3c25-40c6-bed3-994ffe2949df', 'ebac2821-d1a0-4f26-b5d9-cd5c60ac75ab', NULL, NULL, NULL, NULL, NULL), ('7611e678-8e0a-11ec-8e4b-0242ac130002', 'd2bda4c3-3c25-40c6-bed3-994ffe2949df', '5ad64afc-132c-40ea-8f69-2f8bfe6b31d4', NULL, NULL, NULL, NULL, NULL), ('7611e6c4-8e0a-11ec-8e4b-0242ac130002', 'd2bda4c3-3c25-40c6-bed3-994ffe2949df', '4242cbb0-fca4-4b27-b2a7-ca576a18815e', NULL, NULL, NULL, NULL, NULL), ('7611e700-8e0a-11ec-8e4b-0242ac130002', 'd2bda4c3-3c25-40c6-bed3-994ffe2949df', 'c52b6d95-b404-4130-8635-5903cb8d0e84', NULL, NULL, NULL, NULL, NULL), ('7611e7d0-8e0a-11ec-8e4b-0242ac130002', 'd2bda4c3-3c25-40c6-bed3-994ffe2949df', '2e6f8b45-116d-46c4-a287-f3054e798556', NULL, NULL, NULL, NULL, NULL), ('7611e80a-8e0a-11ec-8e4b-0242ac130002', 'd2bda4c3-3c25-40c6-bed3-994ffe2949df', '504c0abd-7d31-4771-8ef9-a3494c7bb33c', NULL, NULL, NULL, NULL, NULL), ('7611e844-8e0a-11ec-8e4b-0242ac130002', 'd2bda4c3-3c25-40c6-bed3-994ffe2949df', '02136575-effb-4a0c-b5be-9886d20259b3', NULL, NULL, NULL, NULL, NULL), ('7611e87d-8e0a-11ec-8e4b-0242ac130002', 'd2bda4c3-3c25-40c6-bed3-994ffe2949df', '8412d80d-1830-4128-bc6a-019cf32afc7f', NULL, NULL, NULL, NULL, NULL), ('7611e8b5-8e0a-11ec-8e4b-0242ac130002', 'd2bda4c3-3c25-40c6-bed3-994ffe2949df', '0f9cd623-f319-4bb5-9751-7478abee3bd2', NULL, NULL, NULL, NULL, NULL), ('7611e8ed-8e0a-11ec-8e4b-0242ac130002', 'd2bda4c3-3c25-40c6-bed3-994ffe2949df', 'a1d7bfef-f20c-4739-bfe4-cc55ed0b3fc8', NULL, NULL, NULL, NULL, NULL), ('7611e923-8e0a-11ec-8e4b-0242ac130002', 'd2bda4c3-3c25-40c6-bed3-994ffe2949df', '68fc74f2-1790-427a-ac22-49fb20edbe9a', NULL, NULL, NULL, NULL, NULL), ('7611e957-8e0a-11ec-8e4b-0242ac130002', 'd2bda4c3-3c25-40c6-bed3-994ffe2949df', '97400660-27a5-4502-a7cd-274190953a6c', NULL, NULL, NULL, NULL, NULL), ('7611e98f-8e0a-11ec-8e4b-0242ac130002', 'd2bda4c3-3c25-40c6-bed3-994ffe2949df', '07ece816-f983-493e-b25d-7bfb467d787d', NULL, NULL, NULL, NULL, NULL), ('7611e9c9-8e0a-11ec-8e4b-0242ac130002', 'd2bda4c3-3c25-40c6-bed3-994ffe2949df', 'c124c0f3-3f1f-4635-bac7-f3e1f5503099', NULL, NULL, NULL, NULL, NULL), ('7611ea05-8e0a-11ec-8e4b-0242ac130002', 'd2bda4c3-3c25-40c6-bed3-994ffe2949df', '984059ca-3f9d-4ee4-9616-e409dd11991e', NULL, NULL, NULL, NULL, NULL), ('7611ea46-8e0a-11ec-8e4b-0242ac130002', 'd2bda4c3-3c25-40c6-bed3-994ffe2949df', '2de7c3d3-e642-4509-aff1-b2520ebfe85e', NULL, NULL, NULL, NULL, NULL), ('805b082d-8e0a-11ec-8e4b-0242ac130002', 'ceb6cd6c-531e-4a23-a467-caa5ef7218cc', '3a5e4081-4cd5-427f-bd3a-ff7815efaf25', NULL, NULL, NULL, NULL, NULL), ('805b0a85-8e0a-11ec-8e4b-0242ac130002', 'ceb6cd6c-531e-4a23-a467-caa5ef7218cc', '57760693-15db-4de9-9170-55ee7d1eb0eb', NULL, NULL, NULL, NULL, NULL), ('805b0abb-8e0a-11ec-8e4b-0242ac130002', 'ceb6cd6c-531e-4a23-a467-caa5ef7218cc', '0d8bc9d7-b76b-4ec5-96e7-0df1c3426205', NULL, NULL, NULL, NULL, NULL), ('805b0ae0-8e0a-11ec-8e4b-0242ac130002', 'ceb6cd6c-531e-4a23-a467-caa5ef7218cc', '03410ec1-1bd0-4afd-ac37-9306e00e328c', NULL, NULL, NULL, NULL, NULL), ('805b0b0f-8e0a-11ec-8e4b-0242ac130002', 'ceb6cd6c-531e-4a23-a467-caa5ef7218cc', 'eaa8947b-d9e7-4ca4-ba65-08965dfa620c', NULL, NULL, NULL, NULL, NULL), ('805b0b2d-8e0a-11ec-8e4b-0242ac130002', 'ceb6cd6c-531e-4a23-a467-caa5ef7218cc', '93a58625-3730-4a07-99bd-75f174ff428d', NULL, NULL, NULL, NULL, NULL), ('805b0bdb-8e0a-11ec-8e4b-0242ac130002', 'ceb6cd6c-531e-4a23-a467-caa5ef7218cc', '2f9bf4d5-b1d3-4cac-9df2-2c8827d65bbf', NULL, NULL, NULL, NULL, NULL), ('805b0cc1-8e0a-11ec-8e4b-0242ac130002', 'ceb6cd6c-531e-4a23-a467-caa5ef7218cc', '1aad98e5-3f99-4c0a-aa75-ca9236de0f09', NULL, NULL, NULL, NULL, NULL), ('805b0cf8-8e0a-11ec-8e4b-0242ac130002', 'ceb6cd6c-531e-4a23-a467-caa5ef7218cc', '5f694f25-b0fd-45f6-acbd-9dd338e196ce', NULL, NULL, NULL, NULL, NULL), ('805b0d31-8e0a-11ec-8e4b-0242ac130002', 'ceb6cd6c-531e-4a23-a467-caa5ef7218cc', '9ecb6827-f47f-4b19-b788-81a6b55940af', NULL, NULL, NULL, NULL, NULL);
-
+update chart_view set chart_type ='public';
update chart_view set chart_type ='private'
where id in (
'84b444e1-0088-44f9-acdc-cc39018413bc',
@@ -406,4 +406,45 @@ INSERT INTO `dataease_code_version` VALUES (0, 'init', NULL, 1);
COMMIT;
DELETE FROM `sys_menu` WHERE pid=34;
-UPDATE `sys_menu` SET `sub_count` = '0' WHERE (`menu_id` = '34');
\ No newline at end of file
+UPDATE `sys_menu` SET `sub_count` = '0' WHERE (`menu_id` = '34');
+
+-- ----------------------------
+-- View structure for v_history_chart_view
+-- ----------------------------
+CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `v_history_chart_view` AS select `chart_group`.`id` AS `id`,`chart_group`.`id` AS `inner_id`,`chart_group`.`name` AS `NAME`,`chart_group`.`name` AS `label`,`chart_group`.`pid` AS `pid`,`chart_group`.`type` AS `model_inner_type`,'spine' AS `node_type`,'view' AS `model_type`,1 AS `mode` from `chart_group` union all select distinct `chart_view`.`id` AS `id`,`chart_view`.`id` AS `inner_id`,`chart_view`.`name` AS `NAME`,`chart_view`.`name` AS `label`,`chart_view`.`scene_id` AS `pid`,`chart_view`.`type` AS `model_inner_type`,'leaf' AS `node_type`,'view' AS `model_type`,1 AS `mode` from `chart_view` where (`chart_view`.`chart_type` = 'public');
+
+
+
+-- ----------------------------
+-- Function structure for GET_CHART_GROUP_WITH_CHILDREN
+-- ----------------------------
+DROP FUNCTION IF EXISTS `GET_CHART_GROUP_WITH_CHILDREN`;
+delimiter ;;
+CREATE FUNCTION `GET_CHART_GROUP_WITH_CHILDREN`(parentId varchar(8000))
+ RETURNS LONGTEXT CHARSET utf8
+ READS SQL DATA
+BEGIN
+
+DECLARE oTemp LONGTEXT;
+
+DECLARE oTempChild LONGTEXT;
+
+SET oTemp = '';
+
+SET oTempChild = CAST(parentId AS CHAR);
+
+WHILE oTempChild IS NOT NULL
+
+DO
+
+SET oTemp = CONCAT(oTemp,',',oTempChild);
+
+SELECT GROUP_CONCAT(id) INTO oTempChild FROM v_history_chart_view WHERE FIND_IN_SET(pid,oTempChild) > 0;
+
+END WHILE;
+
+RETURN oTemp;
+
+END
+;;
+delimiter ;
diff --git a/frontend/src/api/chart/chart.js b/frontend/src/api/chart/chart.js
index 396284c29e..5d9a956c7e 100644
--- a/frontend/src/api/chart/chart.js
+++ b/frontend/src/api/chart/chart.js
@@ -66,3 +66,12 @@ export function pluginTypes() {
method: 'post'
})
}
+
+export function deleteCircle(id) {
+ return request({
+ url: '/chart/group/deleteCircle/' + id,
+ method: 'post',
+ loading: true
+ })
+}
+
diff --git a/frontend/src/views/panel/ViewSelect/index.vue b/frontend/src/views/panel/ViewSelect/index.vue
index c246762728..aedf7e0c26 100644
--- a/frontend/src/views/panel/ViewSelect/index.vue
+++ b/frontend/src/views/panel/ViewSelect/index.vue
@@ -34,8 +34,8 @@
@check="checkChanged"
@node-drag-end="dragEnd"
>
-
-
+
+
@@ -48,7 +48,17 @@
- {{ data.name }}
+ {{ data.name }}
+
+
+
+
+
@@ -63,6 +73,8 @@ import { deepCopy } from '@/components/canvas/utils/utils'
import eventBus from '@/components/canvas/utils/eventBus'
import { mapState } from 'vuex'
import { queryPanelViewTree } from '@/api/panel/panel'
+import { deleteCircle } from '@/api/chart/chart'
+import { delUser } from '@/api/system/user'
export default {
name: 'ViewSelect',
@@ -176,8 +188,20 @@ export default {
component.auxiliaryMatrix = this.canvasStyleData.auxiliaryMatrix
component.moveStatus = 'start'
return component
+ },
+ deleteHistory(data, node) {
+ deleteCircle(data.id).then(() => {
+ this.$success(this.$t('commons.delete_success'))
+ this.remove(node, data)
+ // this.loadData()
+ })
+ },
+ remove(node, data) {
+ const parent = node.parent
+ const children = parent.data.children || parent.data
+ const index = children.findIndex(d => d.id === data.id)
+ children.splice(index, 1)
}
-
}
}
@@ -198,4 +222,22 @@ export default {
width: 100%;
height: 100%;
}
+
+ .father .child {
+ /*display: none;*/
+ visibility: hidden;
+ }
+ .father:hover .child {
+ /*display: inline;*/
+ visibility: visible;
+ }
+
+ .custom-tree-node-list {
+ flex: 1;
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ font-size: 14px;
+ padding:0 8px;
+ }