From 769b7bc271d9805231f74d0828e3350395c2140e Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Mon, 14 Feb 2022 18:57:35 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=A7=86=E5=9B=BE=E5=BD=92=E5=B1=9E?= =?UTF-8?q?=E4=BA=8E=E4=BB=AA=E8=A1=A8=E6=9D=BF=EF=BC=8C=E5=8E=BB=E6=8E=89?= =?UTF-8?q?=E8=A7=86=E5=9B=BE=E8=8F=9C=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base/mapper/ext/ExtChartViewMapper.java | 2 +- .../base/mapper/ext/ExtChartViewMapper.xml | 8 +- .../base/mapper/ext/ExtPanelGroupMapper.java | 2 + .../base/mapper/ext/ExtPanelGroupMapper.xml | 17 ++ .../base/mapper/ext/ExtVAuthModelMapper.java | 5 +- .../base/mapper/ext/ExtVAuthModelMapper.xml | 265 +++++++++++------- .../io/dataease/commons/utils/TreeUtils.java | 4 + .../controller/chart/ChartViewController.java | 6 +- .../panel/PanelGroupController.java | 7 + .../request/authModel/VAuthModelRequest.java | 6 + .../dataease/dto/authModel/VAuthModelDTO.java | 8 + .../service/chart/ChartViewService.java | 4 +- .../service/panel/PanelGroupService.java | 40 ++- .../main/resources/db/migration/V32__1.8.sql | 199 ++++++++++++- .../resources/i18n/messages_en_US.properties | 3 +- .../resources/i18n/messages_zh_CN.properties | 1 + .../resources/i18n/messages_zh_TW.properties | 1 + frontend/src/api/chart/chart.js | 6 +- frontend/src/api/panel/panel.js | 8 + frontend/src/components/canvas/store/copy.js | 2 +- frontend/src/views/panel/ViewSelect/index.vue | 39 +-- frontend/src/views/panel/edit/index.vue | 33 ++- 22 files changed, 519 insertions(+), 147 deletions(-) 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 38493a9e63..e2f7104248 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 @@ -14,7 +14,7 @@ public interface ExtChartViewMapper { ChartViewDTO searchOne(ChartViewRequest request); - void chartCopy(@Param("newChartId")String newChartId,@Param("oldChartId")String oldChartId); + void chartCopy(@Param("newChartId")String newChartId,@Param("oldChartId")String oldChartId,@Param("panelId")String panelId); @Select("select id from chart_view where table_id = #{tableId}") List allViewIds(@Param("tableId") String tableId); 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 e3ae63638c..e17913ef66 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 @@ -109,11 +109,12 @@ `y_axis_ext`, `render`, `result_count`, - `result_mode` + `result_mode`, + `chart_type` ) SELECT #{newChartId}, GET_CHART_VIEW_COPY_NAME ( #{oldChartId} ), - `scene_id`, + #{panelId}, `table_id`, `type`, GET_CHART_VIEW_COPY_NAME ( #{oldChartId} ), @@ -133,7 +134,8 @@ `y_axis_ext`, `render`, `result_count`, - `result_mode` + `result_mode`, + 'private' FROM chart_view WHERE diff --git a/backend/src/main/java/io/dataease/base/mapper/ext/ExtPanelGroupMapper.java b/backend/src/main/java/io/dataease/base/mapper/ext/ExtPanelGroupMapper.java index c9e9a9fe44..1abad5be54 100644 --- a/backend/src/main/java/io/dataease/base/mapper/ext/ExtPanelGroupMapper.java +++ b/backend/src/main/java/io/dataease/base/mapper/ext/ExtPanelGroupMapper.java @@ -19,5 +19,7 @@ public interface ExtPanelGroupMapper { void copyPanelView(@Param("pid") String panelId); + //移除未使用的视图 + void removeUselessViews(@Param("panelId") String panelId); } diff --git a/backend/src/main/java/io/dataease/base/mapper/ext/ExtPanelGroupMapper.xml b/backend/src/main/java/io/dataease/base/mapper/ext/ExtPanelGroupMapper.xml index fb26c568f1..756ff29ef4 100644 --- a/backend/src/main/java/io/dataease/base/mapper/ext/ExtPanelGroupMapper.xml +++ b/backend/src/main/java/io/dataease/base/mapper/ext/ExtPanelGroupMapper.xml @@ -178,4 +178,21 @@ panel_id = #{panelId} + + DELETE + FROM + chart_view + WHERE + chart_view.chart_type = 'private' + AND chart_view.scene_id = #{panelId} + AND id NOT IN ( + SELECT + panel_view.chart_view_id + FROM + panel_view + WHERE + panel_view.panel_id = #{panelId} + ) + + diff --git a/backend/src/main/java/io/dataease/base/mapper/ext/ExtVAuthModelMapper.java b/backend/src/main/java/io/dataease/base/mapper/ext/ExtVAuthModelMapper.java index d74b1044e4..cb0fd05188 100644 --- a/backend/src/main/java/io/dataease/base/mapper/ext/ExtVAuthModelMapper.java +++ b/backend/src/main/java/io/dataease/base/mapper/ext/ExtVAuthModelMapper.java @@ -8,6 +8,9 @@ import java.util.List; public interface ExtVAuthModelMapper { - List queryAuthModel (@Param("record") VAuthModelRequest record); + List queryAuthModel(@Param("record") VAuthModelRequest record); + List queryAuthModelViews (@Param("record") VAuthModelRequest record); + + List queryAuthViewsOriginal (@Param("record") VAuthModelRequest record); } 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 912b404ae0..c99b4a0d0e 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 @@ -4,106 +4,175 @@ + + SELECT + v_auth_model.id, + v_auth_model.name, + v_auth_model.label, + v_auth_model.pid, + v_auth_model.node_type, + v_auth_model.model_type, + v_auth_model.model_inner_type, + v_auth_model.auth_type, + v_auth_model.create_by, + v_auth_model.level, + v_auth_model.mode, + v_auth_model.data_source_id, + authInfo.PRIVILEGES AS `privileges` + FROM + ( SELECT GET_V_AUTH_MODEL_ID_P_USE ( #{record.userId}, #{record.modelType} ) cids ) t, + v_auth_model + LEFT JOIN ( + SELECT + auth_source, + group_concat( DISTINCT sys_auth_detail.privilege_extend ) AS `privileges` + FROM + ( + `sys_auth` + LEFT JOIN `sys_auth_detail` ON (( + `sys_auth`.`id` = `sys_auth_detail`.`auth_id` + ))) + WHERE + sys_auth_detail.privilege_value = 1 + AND sys_auth.auth_source_type = #{record.modelType} + AND ( + ( + sys_auth.auth_target_type = 'dept' + AND sys_auth.auth_target IN ( SELECT dept_id FROM sys_user WHERE user_id = #{record.userId} ) + ) + OR ( + sys_auth.auth_target_type = 'user' + AND sys_auth.auth_target = #{record.userId} + ) + OR ( + sys_auth.auth_target_type = 'role' + AND sys_auth.auth_target IN ( SELECT role_id FROM sys_users_roles WHERE user_id = #{record.userId} ) + ) + ) + GROUP BY + `sys_auth`.`auth_source` + ) authInfo ON v_auth_model.id = authInfo.auth_source + WHERE + FIND_IN_SET( v_auth_model.id, cids ) + + and v_auth_model.id = #{record.id,jdbcType=VARCHAR} + + + and v_auth_model.pid = #{record.pid,jdbcType=VARCHAR} + + + and v_auth_model.node_type = #{record.nodeType,jdbcType=VARCHAR} + + + and v_auth_model.model_type = #{record.modelType,jdbcType=VARCHAR} + + + and v_auth_model.model_inner_type = #{record.modelInnerType,jdbcType=VARCHAR} + + + and v_auth_model.auth_type = #{record.authType,jdbcType=VARCHAR} + + + and v_auth_model.create_by = #{record.createBy,jdbcType=VARCHAR} + + + and v_auth_model.`level` = #{record.level,jdbcType=BIGINT} + + + + and v_auth_model.`mode` = 0 + + + and (v_auth_model.`mode` = 1 or (v_auth_model.`model_inner_type` = 'group' and v_auth_model.model_type = + 'dataset')) + + + + and v_auth_model.data_source_id = #{record.dataSourceId,jdbcType=VARCHAR} + + + and v_auth_model.`name` = #{record.name,jdbcType=LONGVARCHAR} + + + and v_auth_model.`label` = #{record.label,jdbcType=LONGVARCHAR} + + + and v_auth_model.model_inner_type in + + #{item} + + + ORDER BY v_auth_model.node_type desc, CONVERT(v_auth_model.label using gbk) asc + + + + + + diff --git a/backend/src/main/java/io/dataease/commons/utils/TreeUtils.java b/backend/src/main/java/io/dataease/commons/utils/TreeUtils.java index 13796111b9..d5cf0d96b3 100644 --- a/backend/src/main/java/io/dataease/commons/utils/TreeUtils.java +++ b/backend/src/main/java/io/dataease/commons/utils/TreeUtils.java @@ -2,6 +2,7 @@ package io.dataease.commons.utils; import io.dataease.commons.model.ITreeBase; import org.springframework.util.Assert; +import org.springframework.util.CollectionUtils; import java.util.*; import java.util.stream.Collectors; @@ -18,6 +19,9 @@ public class TreeUtils{ */ public static List mergeTree(List tree,String ... rootPid) { Assert.notNull(rootPid, "Root Pid cannot be null"); + if(CollectionUtils.isEmpty(tree)){ + return null; + } List result = new ArrayList<>(); // 构建id-节点map映射 Map treePidMap = tree.stream().collect(Collectors.toMap(T::getId, t -> t)); diff --git a/backend/src/main/java/io/dataease/controller/chart/ChartViewController.java b/backend/src/main/java/io/dataease/controller/chart/ChartViewController.java index 714edd2007..d55cf8be57 100644 --- a/backend/src/main/java/io/dataease/controller/chart/ChartViewController.java +++ b/backend/src/main/java/io/dataease/controller/chart/ChartViewController.java @@ -72,9 +72,9 @@ public class ChartViewController { } @ApiOperation("复制") - @PostMapping("chartCopy/{id}") - public String chartCopy(@PathVariable String id) { - return chartViewService.chartCopy(id); + @PostMapping("chartCopy/{id}/{panelId}") + public String chartCopy(@PathVariable String id, @PathVariable String panelId) { + return chartViewService.chartCopy(id,panelId); } @ApiIgnore diff --git a/backend/src/main/java/io/dataease/controller/panel/PanelGroupController.java b/backend/src/main/java/io/dataease/controller/panel/PanelGroupController.java index 62383c6c02..e059975190 100644 --- a/backend/src/main/java/io/dataease/controller/panel/PanelGroupController.java +++ b/backend/src/main/java/io/dataease/controller/panel/PanelGroupController.java @@ -9,6 +9,7 @@ import io.dataease.commons.constants.DePermissionType; import io.dataease.commons.constants.ResourceAuthLevel; import io.dataease.controller.handler.annotation.I18n; import io.dataease.controller.request.panel.PanelGroupRequest; +import io.dataease.dto.authModel.VAuthModelDTO; import io.dataease.dto.panel.PanelGroupDTO; import io.dataease.service.panel.PanelGroupService; import io.swagger.annotations.Api; @@ -70,5 +71,11 @@ public class PanelGroupController { return panelGroupService.findOne(id); } + @ApiOperation("仪表板视图信息") + @PostMapping("/queryPanelViewTree") + @I18n + public List queryPanelViewTree(){ + return panelGroupService.queryPanelViewTree(); + } } diff --git a/backend/src/main/java/io/dataease/controller/request/authModel/VAuthModelRequest.java b/backend/src/main/java/io/dataease/controller/request/authModel/VAuthModelRequest.java index 223859b936..5ec7201638 100644 --- a/backend/src/main/java/io/dataease/controller/request/authModel/VAuthModelRequest.java +++ b/backend/src/main/java/io/dataease/controller/request/authModel/VAuthModelRequest.java @@ -14,9 +14,15 @@ import java.util.List; public class VAuthModelRequest extends VAuthModelDTO { private String userId; + private String privileges; + private Integer datasetMode; + private boolean clearEmptyDir; + private List modelInnerTypeArray; + private List pids; + } diff --git a/backend/src/main/java/io/dataease/dto/authModel/VAuthModelDTO.java b/backend/src/main/java/io/dataease/dto/authModel/VAuthModelDTO.java index a3ce5a3978..53b4bf5135 100644 --- a/backend/src/main/java/io/dataease/dto/authModel/VAuthModelDTO.java +++ b/backend/src/main/java/io/dataease/dto/authModel/VAuthModelDTO.java @@ -17,5 +17,13 @@ public class VAuthModelDTO extends VAuthModelWithBLOBs implements ITreeBase children; + private long allLeafs = 0l; + + private String innerId; + + public String toString(){ + return this.getId(); + } + } diff --git a/backend/src/main/java/io/dataease/service/chart/ChartViewService.java b/backend/src/main/java/io/dataease/service/chart/ChartViewService.java index 6a2266c442..eaab61bbab 100644 --- a/backend/src/main/java/io/dataease/service/chart/ChartViewService.java +++ b/backend/src/main/java/io/dataease/service/chart/ChartViewService.java @@ -1684,9 +1684,9 @@ public class ChartViewService { return chartViewMapper.selectByPrimaryKey(id); } - public String chartCopy(String id) { + public String chartCopy(String id,String panelId) { String newChartId = UUID.randomUUID().toString(); - extChartViewMapper.chartCopy(newChartId, id); + extChartViewMapper.chartCopy(newChartId, id,panelId); return newChartId; } diff --git a/backend/src/main/java/io/dataease/service/panel/PanelGroupService.java b/backend/src/main/java/io/dataease/service/panel/PanelGroupService.java index b063082e99..eee054f986 100644 --- a/backend/src/main/java/io/dataease/service/panel/PanelGroupService.java +++ b/backend/src/main/java/io/dataease/service/panel/PanelGroupService.java @@ -3,12 +3,16 @@ package io.dataease.service.panel; import io.dataease.base.domain.*; import io.dataease.base.mapper.ChartViewMapper; import io.dataease.base.mapper.PanelGroupMapper; +import io.dataease.base.mapper.VAuthModelMapper; import io.dataease.base.mapper.ext.ExtPanelGroupMapper; import io.dataease.base.mapper.ext.ExtPanelLinkJumpMapper; +import io.dataease.base.mapper.ext.ExtVAuthModelMapper; import io.dataease.commons.constants.PanelConstants; import io.dataease.commons.utils.AuthUtils; import io.dataease.commons.utils.TreeUtils; +import io.dataease.controller.request.authModel.VAuthModelRequest; import io.dataease.controller.request.panel.PanelGroupRequest; +import io.dataease.dto.authModel.VAuthModelDTO; import io.dataease.dto.chart.ChartViewDTO; import io.dataease.dto.panel.PanelGroupDTO; import io.dataease.exception.DataEaseException; @@ -28,6 +32,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Optional; import java.util.UUID; +import java.util.stream.Collectors; /** * Author: wangjiahao @@ -59,7 +64,10 @@ public class PanelGroupService { private PanelViewService panelViewService; @Resource private ExtPanelLinkJumpMapper extPanelLinkJumpMapper; - + @Resource + private ExtVAuthModelMapper extVAuthModelMapper; + @Resource + private VAuthModelMapper vAuthModelMapper; public List tree(PanelGroupRequest panelGroupRequest) { String userId = String.valueOf(AuthUtils.getUser().getUserId()); @@ -157,6 +165,9 @@ public class PanelGroupService { if (!CollectionUtils.isNotEmpty(panelGroupDTOList)) { DataEaseException.throwException("未查询到用户对应的资源权限,请尝试刷新重新保存"); } + + //移除没有用到的仪表板私有视图 + extPanelGroupMapper.removeUselessViews(panelId); return panelGroupDTOList.get(0); } @@ -214,4 +225,31 @@ public class PanelGroupService { return chartViewDTOList; } + public List queryPanelViewTree(){ + List result = new ArrayList<>(); + VAuthModelRequest panelRequest = new VAuthModelRequest(); + panelRequest.setUserId(String.valueOf(AuthUtils.getUser().getUserId())); + panelRequest.setModelType("panel"); + List panelResult = extVAuthModelMapper.queryAuthModel(panelRequest); + // 获取仪表板下面的视图 + if(CollectionUtils.isNotEmpty(panelResult)){ + result.addAll(panelResult); + List panelIds = panelResult.stream().map(VAuthModelDTO::getId).collect(Collectors.toList()); + VAuthModelRequest viewRequest = new VAuthModelRequest(); + viewRequest.setPids(panelIds); + List viewResult = extVAuthModelMapper.queryAuthModelViews(viewRequest); + if(CollectionUtils.isNotEmpty(viewResult)){ + result.addAll(viewResult); + } + result = TreeUtils.mergeTree(panelResult,"panel_list"); + // 原有视图的目录结构 + List viewOriginal = extVAuthModelMapper.queryAuthViewsOriginal(viewRequest); + if(CollectionUtils.isNotEmpty(viewOriginal) && viewOriginal.size()>1){ + result.addAll(TreeUtils.mergeTree(viewOriginal,"public_chart")); + } + } + + return result; + } + } 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 8ba29f5913..a5615ccf45 100644 --- a/backend/src/main/resources/db/migration/V32__1.8.sql +++ b/backend/src/main/resources/db/migration/V32__1.8.sql @@ -1,2 +1,199 @@ ALTER TABLE `chart_view` ADD COLUMN `x_axis_ext` LONGTEXT COMMENT 'table-row' AFTER `x_axis`; -UPDATE `chart_view` SET `x_axis_ext` = '[]'; \ No newline at end of file +UPDATE `chart_view` SET `x_axis_ext` = '[]'; + + +INSERT INTO `chart_group` (`id`, `name`, `pid`, `level`, `type`, `create_by`, `create_time`) VALUES ('0', 'i18n_public_chart', 'public_chart', -1, 'group', 'admin', NULL); + +ALTER TABLE `chart_view` +MODIFY COLUMN `scene_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '场景ID chart_type为privat的时候 是仪表板id' AFTER `title`, +ADD COLUMN `chart_type` varchar(255) NULL DEFAULT 'public' 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'; + +DROP TRIGGER `new_auth_chart_view`; +DROP TRIGGER `delete_auth_chart_view`; + +delete from sys_menu where menu_id ='10'; + +DROP VIEW +IF + EXISTS `v_auth_model`; +CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `v_auth_model` AS SELECT +`sys_user`.`user_id` AS `id`, +`sys_user`.`username` AS `name`, +`sys_user`.`username` AS `label`, +'0' AS `pid`, +'leaf' AS `node_type`, +'user' AS `model_type`, +'user' AS `model_inner_type`, +'target' AS `auth_type`, +`sys_user`.`create_by` AS `create_by`, +0 AS `level`, +0 AS `mode`, +'0' AS `data_source_id` +FROM + `sys_user` +WHERE + ( `sys_user`.`is_admin` <> 1 ) UNION ALL +SELECT + `sys_role`.`role_id` AS `id`, + `sys_role`.`name` AS `name`, + `sys_role`.`name` AS `label`, + '0' AS `pid`, + 'leaf' AS `node_type`, + 'role' AS `model_type`, + 'role' AS `model_inner_type`, + 'target' AS `auth_type`, + `sys_role`.`create_by` AS `create_by`, + 0 AS `level`, + 0 AS `mode`, + '0' AS `data_source_id` +FROM + `sys_role` UNION ALL +SELECT + `sys_dept`.`dept_id` AS `id`, + `sys_dept`.`name` AS `name`, + `sys_dept`.`name` AS `lable`,( + cast( `sys_dept`.`pid` AS CHAR charset utf8mb4 ) COLLATE utf8mb4_general_ci + ) AS `pid`, +IF + (( `sys_dept`.`sub_count` = 0 ), 'leaf', 'spine' ) AS `node_type`, + 'dept' AS `model_type`, + 'dept' AS `model_inner_type`, + 'target' AS `auth_type`, + `sys_dept`.`create_by` AS `create_by`, + 0 AS `level`, + 0 AS `mode`, + '0' AS `data_source_id` +FROM + `sys_dept` UNION ALL +SELECT + `datasource`.`id` AS `id`, + `datasource`.`name` AS `NAME`, + `datasource`.`name` AS `label`, + '0' AS `pid`, + 'leaf' AS `node_type`, + 'link' AS `model_type`, + `datasource`.`type` AS `model_inner_type`, + 'source' AS `auth_type`, + `datasource`.`create_by` AS `create_by`, + 0 AS `level`, + 0 AS `mode`, + '0' AS `data_source_id` +FROM + `datasource` UNION ALL +SELECT + `dataset_group`.`id` AS `id`, + `dataset_group`.`name` AS `NAME`, + `dataset_group`.`name` AS `lable`, +IF + ( isnull( `dataset_group`.`pid` ), '0', `dataset_group`.`pid` ) AS `pid`, + 'spine' AS `node_type`, + 'dataset' AS `model_type`, + `dataset_group`.`type` AS `model_inner_type`, + 'source' AS `auth_type`, + `dataset_group`.`create_by` AS `create_by`, + `dataset_group`.`level` AS `level`, + 0 AS `mode`, + '0' AS `data_source_id` +FROM + `dataset_group` UNION ALL +SELECT + `dataset_table`.`id` AS `id`, + `dataset_table`.`name` AS `NAME`, + `dataset_table`.`name` AS `lable`, + `dataset_table`.`scene_id` AS `pid`, + 'leaf' AS `node_type`, + 'dataset' AS `model_type`, + `dataset_table`.`type` AS `model_inner_type`, + 'source' AS `auth_type`, + `dataset_table`.`create_by` AS `create_by`, + 0 AS `level`, + `dataset_table`.`mode` AS `mode`, + `dataset_table`.`data_source_id` AS `data_source_id` +FROM + `dataset_table` UNION ALL +SELECT + `panel_group`.`id` AS `id`, + `panel_group`.`name` AS `NAME`, + `panel_group`.`name` AS `label`,( + CASE + `panel_group`.`id` + WHEN 'panel_list' THEN + '0' + WHEN 'default_panel' THEN + '0' ELSE `panel_group`.`pid` + END + ) AS `pid`, + IF + (( `panel_group`.`node_type` = 'folder' ), 'spine', 'leaf' ) AS `node_type`, + 'panel' AS `model_type`, + `panel_group`.`panel_type` AS `model_inner_type`, + 'source' AS `auth_type`, + `panel_group`.`create_by` AS `create_by`, + 0 AS `level`, + 0 AS `mode`, + '0' AS `data_source_id` + FROM + `panel_group` UNION ALL + SELECT + `sys_menu`.`menu_id` AS `menu_id`, + `sys_menu`.`title` AS `name`, + `sys_menu`.`title` AS `label`, + `sys_menu`.`pid` AS `pid`, + IF + (( `sys_menu`.`sub_count` > 0 ), 'spine', 'leaf' ) AS `node_type`, + 'menu' AS `model_type`,( + CASE + `sys_menu`.`type` + WHEN 0 THEN + 'folder' + WHEN 1 THEN + 'menu' + WHEN 2 THEN + 'button' + END + ) AS `model_inner_type`, + 'source' AS `auth_type`, + `sys_menu`.`create_by` AS `create_by`, + 0 AS `level`, + 0 AS `mode`, + '0' AS `data_source_id` + FROM + `sys_menu` + WHERE + (( + `sys_menu`.`i_frame` <> 1 + ) + OR isnull( `sys_menu`.`i_frame` )) UNION ALL + SELECT + `plugin_sys_menu`.`menu_id` AS `menu_id`, + `plugin_sys_menu`.`title` AS `name`, + `plugin_sys_menu`.`title` AS `label`, + `plugin_sys_menu`.`pid` AS `pid`, + IF + (( `plugin_sys_menu`.`sub_count` > 0 ), 'spine', 'leaf' ) AS `node_type`, + 'menu' AS `model_type`,( + CASE + `plugin_sys_menu`.`type` + WHEN 0 THEN + 'folder' + WHEN 1 THEN + 'menu' + WHEN 2 THEN + 'button' + END + ) AS `model_inner_type`, + 'source' AS `auth_type`, + `plugin_sys_menu`.`create_by` AS `create_by`, + 0 AS `level`, + 0 AS `mode`, + '0' AS `data_source_id` + FROM + `plugin_sys_menu` + WHERE + (( + `plugin_sys_menu`.`i_frame` <> 1 + ) + OR isnull( `plugin_sys_menu`.`i_frame` )); diff --git a/backend/src/main/resources/i18n/messages_en_US.properties b/backend/src/main/resources/i18n/messages_en_US.properties index 8b8f3705cf..02915a79c1 100644 --- a/backend/src/main/resources/i18n/messages_en_US.properties +++ b/backend/src/main/resources/i18n/messages_en_US.properties @@ -118,4 +118,5 @@ i18n_calc_field_error=Field expression error i18n_cp_exist=Column permission of the same type already exists connection_failed=Connection Failed theme_name_repeat=name of theme has been existed -theme_name_empty=name can not be empty \ No newline at end of file +theme_name_empty=name can not be empty +i18n_public_chart= Public Chart diff --git a/backend/src/main/resources/i18n/messages_zh_CN.properties b/backend/src/main/resources/i18n/messages_zh_CN.properties index e52791f02a..c8702d818b 100644 --- a/backend/src/main/resources/i18n/messages_zh_CN.properties +++ b/backend/src/main/resources/i18n/messages_zh_CN.properties @@ -118,3 +118,4 @@ i18n_cp_exist=已有同类型的列权限存在 connection_failed=连接失败 theme_name_repeat=名称已存在 theme_name_empty=名称不能为空 +i18n_public_chart= 存量视图 diff --git a/backend/src/main/resources/i18n/messages_zh_TW.properties b/backend/src/main/resources/i18n/messages_zh_TW.properties index c3f6464aaa..1f8e756ea5 100644 --- a/backend/src/main/resources/i18n/messages_zh_TW.properties +++ b/backend/src/main/resources/i18n/messages_zh_TW.properties @@ -119,3 +119,4 @@ i18n_cp_exist=已有同類型的列權限存在 connection_failed=連接失敗 theme_name_repeat=名稱已存在 theme_name_empty=名稱不能為空 +i18n_public_chart= 存量视图 diff --git a/frontend/src/api/chart/chart.js b/frontend/src/api/chart/chart.js index d143acf1da..b7657defbc 100644 --- a/frontend/src/api/chart/chart.js +++ b/frontend/src/api/chart/chart.js @@ -28,11 +28,11 @@ export function getChartTree(data) { }) } -export function chartCopy(id) { +export function chartCopy(id, panelId) { return request({ - url: '/chart/view/chartCopy/' + id, + url: '/chart/view/chartCopy/' + id + '/' + panelId, method: 'post', - loading: true + loading: false }) } export function chartGroupTree(data) { diff --git a/frontend/src/api/panel/panel.js b/frontend/src/api/panel/panel.js index 675355f064..0a399b81af 100644 --- a/frontend/src/api/panel/panel.js +++ b/frontend/src/api/panel/panel.js @@ -154,3 +154,11 @@ export function initPanelData(panelId, callback) { callback(response) }) } + +export function queryPanelViewTree() { + return request({ + url: '/panel/group/queryPanelViewTree', + method: 'post' + }) +} + diff --git a/frontend/src/components/canvas/store/copy.js b/frontend/src/components/canvas/store/copy.js index 3b6f34f511..f8bcfa22c7 100644 --- a/frontend/src/components/canvas/store/copy.js +++ b/frontend/src/components/canvas/store/copy.js @@ -47,7 +47,7 @@ export default { // 如果是用户视图 测先进行底层复制 if (data.type === 'view') { - chartCopy(data.propValue.viewId).then(res => { + chartCopy(data.propValue.viewId, state.panel.panelInfo.id).then(res => { const newView = deepCopy(data) newView.id = uuid.v1() newView.propValue.viewId = res.data diff --git a/frontend/src/views/panel/ViewSelect/index.vue b/frontend/src/views/panel/ViewSelect/index.vue index 20e9ccbe39..dbfa684887 100644 --- a/frontend/src/views/panel/ViewSelect/index.vue +++ b/frontend/src/views/panel/ViewSelect/index.vue @@ -2,7 +2,7 @@ - + - - 新建 - + + + @@ -31,46 +31,35 @@ :filter-node-method="filterNode" :highlight-current="true" @node-drag-start="handleDragStart" - @node-click="nodeClick" - @check="checkChanged" - @node-drag-end="dragEnd" > - + - + {{ data.name }} - - - - - - - -