From 07d3ca07af105948320212d133bb181bd5d9e72d Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Thu, 21 Jul 2022 11:16:34 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=A8=A1=E6=9D=BF=E5=B8=82=E5=9C=BA?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=A2=84=E8=A7=88=E5=8A=9F=E8=83=BD=E5=B9=B6?= =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E7=9B=B4=E6=8E=A5=E5=BA=94=E7=94=A8=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../panel/PanelGroupController.java | 15 +- .../io/dataease/dto/panel/PanelGroupDTO.java | 5 +- .../main/resources/db/migration/V38__1.13.sql | 42 ++ frontend/src/icons/svg/button_right.svg | 2 + frontend/src/lang/en.js | 4 + frontend/src/lang/tw.js | 6 +- frontend/src/lang/zh.js | 6 +- frontend/src/layout/components/Topbar.vue | 1 - frontend/src/styles/deicon/demo_index.html | 144 ++++++- frontend/src/styles/deicon/iconfont.css | 30 +- frontend/src/styles/deicon/iconfont.js | 2 +- frontend/src/styles/deicon/iconfont.json | 42 ++ frontend/src/styles/deicon/iconfont.ttf | Bin 30012 -> 31404 bytes frontend/src/styles/deicon/iconfont.woff | Bin 18416 -> 19172 bytes frontend/src/styles/deicon/iconfont.woff2 | Bin 15512 -> 16208 bytes frontend/src/views/panel/edit/index.vue | 2 +- frontend/src/views/panel/index.vue | 5 +- frontend/src/views/panel/list/PanelList.vue | 37 +- frontend/src/views/panel/list/PanelMain.vue | 6 +- .../component/MarketPreview.vue | 403 ++++++++++++++++++ .../component/TemplateMarketItem.vue | 28 +- .../component/TemplateMarketPreviewItem.vue | 112 +++++ .../src/views/panel/templateMarket/index.vue | 175 ++++---- 23 files changed, 939 insertions(+), 128 deletions(-) create mode 100644 frontend/src/icons/svg/button_right.svg create mode 100644 frontend/src/views/panel/templateMarket/component/MarketPreview.vue create mode 100644 frontend/src/views/panel/templateMarket/component/TemplateMarketPreviewItem.vue 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 c8d3478e44..7af5c0c243 100644 --- a/backend/src/main/java/io/dataease/controller/panel/PanelGroupController.java +++ b/backend/src/main/java/io/dataease/controller/panel/PanelGroupController.java @@ -4,6 +4,8 @@ import com.github.xiaoymin.knife4j.annotations.ApiSupport; import io.dataease.auth.annotation.DePermission; import io.dataease.auth.annotation.DePermissionProxy; import io.dataease.auth.annotation.DePermissions; +import io.dataease.auth.service.impl.ExtAuthServiceImpl; +import io.dataease.commons.constants.PanelConstants; import io.dataease.controller.request.panel.PanelGroupBaseInfoRequest; import io.dataease.plugins.common.base.domain.PanelGroup; import io.dataease.commons.constants.DePermissionType; @@ -17,6 +19,7 @@ import io.dataease.dto.panel.PanelGroupDTO; import io.dataease.service.panel.PanelGroupService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import org.pentaho.di.core.util.UUIDUtil; import springfox.documentation.annotations.ApiIgnore; import org.apache.shiro.authz.annotation.Logical; import org.springframework.web.bind.annotation.*; @@ -39,6 +42,8 @@ public class PanelGroupController { @Resource private PanelGroupService panelGroupService; + @Resource + private ExtAuthServiceImpl authService; @ApiOperation("查询树") @PostMapping("/tree") @@ -59,9 +64,15 @@ public class PanelGroupController { @DePermission(type = DePermissionType.PANEL, value = "pid", level = ResourceAuthLevel.PANNEL_LEVEL_MANAGE) }, logical = Logical.AND) @I18n - public PanelGroup save(@RequestBody PanelGroupRequest request) throws Exception{ + public PanelGroupDTO save(@RequestBody PanelGroupRequest request) throws Exception{ String panelId = panelGroupService.save(request); - return findOne(panelId); + PanelGroupDTO result = findOne(panelId); + // 如果新建来源来自模板市场,在返回数据中加入父级ID便于跳转展开仪表板树 + if(PanelConstants.NEW_PANEL_FROM.NEW_MARKET_TEMPLATE.equals(request.getNewFrom())){ + result.setParents(authService.parentResource(panelId,"panel")); + result.setRequestId(UUIDUtil.getUUIDAsString()); + } + return result; } @ApiOperation("更新") diff --git a/backend/src/main/java/io/dataease/dto/panel/PanelGroupDTO.java b/backend/src/main/java/io/dataease/dto/panel/PanelGroupDTO.java index bfd71cc075..ac11385e94 100644 --- a/backend/src/main/java/io/dataease/dto/panel/PanelGroupDTO.java +++ b/backend/src/main/java/io/dataease/dto/panel/PanelGroupDTO.java @@ -33,5 +33,8 @@ public class PanelGroupDTO extends PanelGroupWithBLOBs implements ITreeBase children; @ApiModelProperty("视图信息") private List> viewsInfo; - + @ApiModelProperty("父级ID") + private List parents; + @ApiModelProperty("请求ID") + private String requestId; } diff --git a/backend/src/main/resources/db/migration/V38__1.13.sql b/backend/src/main/resources/db/migration/V38__1.13.sql index ba5dc6f822..102e706ae2 100644 --- a/backend/src/main/resources/db/migration/V38__1.13.sql +++ b/backend/src/main/resources/db/migration/V38__1.13.sql @@ -39,5 +39,47 @@ VALUES ('Mongo 数据源插件', 'default', '0', '0', 'datasource', 'Mongo 数 '1650765903630', 'mongo-backend', 'mongobi'); +INSERT INTO `sys_menu` ( + `menu_id`, + `pid`, + `sub_count`, + `type`, + `title`, + `name`, + `component`, + `menu_sort`, + `icon`, + `path`, + `i_frame`, + `cache`, + `hidden`, + `permission`, + `create_by`, + `update_by`, + `create_time`, + `update_time` +) +VALUES + ( + 41, + 1, + 1, + 1, + '模板市场', + 'template-market', + 'panel/templateMarket/index', + 13, + 'dashboard', + 'panel/templateMarket/index', + 0, + 0, + 0, + '', + NULL, + NULL, + NULL, + 1620444227389 + ); + INSERT INTO `system_parameter` (`param_key`, `param_value`, `type`, `sort`) VALUES ('basic.templateAccessKey', 'dataease', 'text', NULL); INSERT INTO `system_parameter` (`param_key`, `param_value`, `type`, `sort`) VALUES ('basic.templateMarketUlr', 'https://dataease.io/templates', 'text', 4); diff --git a/frontend/src/icons/svg/button_right.svg b/frontend/src/icons/svg/button_right.svg new file mode 100644 index 0000000000..7972225f1b --- /dev/null +++ b/frontend/src/icons/svg/button_right.svg @@ -0,0 +1,2 @@ + \ No newline at end of file diff --git a/frontend/src/lang/en.js b/frontend/src/lang/en.js index 6e1d082176..c9482d8fec 100644 --- a/frontend/src/lang/en.js +++ b/frontend/src/lang/en.js @@ -1495,6 +1495,10 @@ export default { sure_bt: 'Confirm' }, panel: { + template_market: 'Template Market', + template_preview: 'Template Preview', + apply: 'Apply', + apply_this_template: 'Apply This Template', market_network_tips: 'View template Market template requires server and template Market( https://dataease.io/templates ), please check the network... ', enter_name_tips: 'Please enter the name of the panel', name: 'Name', diff --git a/frontend/src/lang/tw.js b/frontend/src/lang/tw.js index 5d2cb77c4f..0054ab4033 100644 --- a/frontend/src/lang/tw.js +++ b/frontend/src/lang/tw.js @@ -1496,11 +1496,15 @@ export default { sure_bt: '確定' }, panel: { + template_market: '模板市场', + template_preview: '预览模板', + apply: '应用', + apply_this_template: '应用此模板', market_network_tips: '查看模板市场模板需要服务器与模板市场(https://dataease.io/templates)联通,请检查网络...', enter_name_tips: '请输入仪表板名称', name: '名称', apply_template: '应用模板', - enter_template_name_tips: '请输入模板名称...', + enter_template_name_tips: '搜索模板名称', pic_adaptation: '适应组件', pic_equiratio: '等比适应', pic_original: '原始尺寸', diff --git a/frontend/src/lang/zh.js b/frontend/src/lang/zh.js index 2bd4bcacaa..4014715056 100644 --- a/frontend/src/lang/zh.js +++ b/frontend/src/lang/zh.js @@ -1504,11 +1504,15 @@ export default { sure_bt: '确定' }, panel: { + template_market: '模板市场', + template_preview: '预览模板', + apply: '应用', + apply_this_template: '应用此模板', market_network_tips: '查看模板市场模板需要服务器与模板市场(https://dataease.io/templates)联通,请检查网络...', enter_name_tips: '请输入仪表板名称', name: '名称', apply_template: '应用模板', - enter_template_name_tips: '请输入模板名称...', + enter_template_name_tips: '搜索模板名称', pic_adaptation: '适应组件', pic_equiratio: '等比适应', pic_original: '原始尺寸', diff --git a/frontend/src/layout/components/Topbar.vue b/frontend/src/layout/components/Topbar.vue index 825f2a279b..9459ee439d 100644 --- a/frontend/src/layout/components/Topbar.vue +++ b/frontend/src/layout/components/Topbar.vue @@ -22,7 +22,6 @@
@@ -55,7 +55,7 @@ export default { this.$emit('templateApply', this.template) }, templatePreview() { - this.$emit('templatePreview', this.thumbnailUrl) + this.$emit('templatePreview', this.template.id) } } } @@ -66,20 +66,20 @@ export default { .testcase-template { position: relative; display: inline-block; - margin: 10px 30px; + margin: 24px 0 0 24px; box-shadow: 0 0 2px 0 rgba(31,31,31,0.15), 0 1px 2px 0 rgba(31,31,31,0.15); border: solid 2px #fff; box-sizing: border-box; - border-radius: 3px; - height: 250px; + border-radius: 4px; + height: 256px; } .demonstration { display: block; - font-size: 14px; - color: gray; - text-align: center; - margin: 10px auto; + font-size: 16px; + text-align: left; + margin-left: 12px; + margin-top: 12px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; @@ -87,8 +87,8 @@ export default { .template-img { background-size: 100% 100%; - height: 170px; - width: 300px; + height: 180px; + width: 318px; margin: 0 auto; border: solid 2px #fff; box-sizing: border-box; @@ -96,7 +96,7 @@ export default { .template-img:hover { border: solid 1px #4b8fdf; - border-radius: 3px; + border-radius: 4px; color: deepskyblue; cursor: pointer; } @@ -110,7 +110,7 @@ export default { position:absolute; bottom: 5px; left: 0px; - width: 300px; + width: 318px; } diff --git a/frontend/src/views/panel/templateMarket/component/TemplateMarketPreviewItem.vue b/frontend/src/views/panel/templateMarket/component/TemplateMarketPreviewItem.vue new file mode 100644 index 0000000000..0e1588b8be --- /dev/null +++ b/frontend/src/views/panel/templateMarket/component/TemplateMarketPreviewItem.vue @@ -0,0 +1,112 @@ + + + + + diff --git a/frontend/src/views/panel/templateMarket/index.vue b/frontend/src/views/panel/templateMarket/index.vue index 97621f9675..09d7b88894 100644 --- a/frontend/src/views/panel/templateMarket/index.vue +++ b/frontend/src/views/panel/templateMarket/index.vue @@ -1,82 +1,71 @@