From fdf8ca012d99787043d0ee505759a1336a300591 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Thu, 29 Jul 2021 15:05:23 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E6=99=AE=E9=80=9A?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=88=9B=E5=BB=BA=E8=A7=86=E5=9B=BE=E6=9D=83?= =?UTF-8?q?=E9=99=90=E6=9F=A5=E4=B8=8D=E5=88=B0=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dataease/controller/chart/ChartViewController.java | 9 ++++++++- .../java/io/dataease/service/chart/ChartViewService.java | 6 ------ .../components/canvas/components/Editor/SettingMenu.vue | 1 - frontend/src/views/chart/view/ChartEdit.vue | 4 +++- 4 files changed, 11 insertions(+), 9 deletions(-) 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 4102d67b73..d84402a9a6 100644 --- a/backend/src/main/java/io/dataease/controller/chart/ChartViewController.java +++ b/backend/src/main/java/io/dataease/controller/chart/ChartViewController.java @@ -1,6 +1,7 @@ package io.dataease.controller.chart; import io.dataease.base.domain.ChartViewWithBLOBs; +import io.dataease.commons.utils.AuthUtils; import io.dataease.controller.request.chart.ChartExtRequest; import io.dataease.controller.request.chart.ChartViewRequest; import io.dataease.dto.chart.ChartViewDTO; @@ -68,6 +69,12 @@ public class ChartViewController { @PostMapping("/getOneWithPermission/{id}") public ChartViewDTO getOneWithPermission(@PathVariable String id, @RequestBody ChartExtRequest requestList) throws Exception { - return chartViewService.getData(id, requestList); + //如果能获取用户 则添加对应的权限 + ChartViewDTO dto = chartViewService.getData(id, requestList); + if(dto!=null && AuthUtils.getUser()!=null){ + ChartViewDTO permissionDto = chartViewService.getOneWithPermission(dto.getId()); + dto.setPrivileges(permissionDto.getPrivileges()); + } + return dto; } } 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 b96a55334e..84dbbf0fd7 100644 --- a/backend/src/main/java/io/dataease/service/chart/ChartViewService.java +++ b/backend/src/main/java/io/dataease/service/chart/ChartViewService.java @@ -315,12 +315,6 @@ public class ChartViewService { BeanUtils.copyBean(dto, view); dto.setData(map); dto.setSql(datasourceRequest.getQuery()); - - //如果能获取用户 则添加对应的权限 - if(AuthUtils.getUser()!=null){ - ChartViewDTO permissionDto = getOneWithPermission(dto.getId()); - dto.setPrivileges(permissionDto.getPrivileges()); - } return dto; } diff --git a/frontend/src/components/canvas/components/Editor/SettingMenu.vue b/frontend/src/components/canvas/components/Editor/SettingMenu.vue index 5fb8c00d73..39dbb39ba3 100644 --- a/frontend/src/components/canvas/components/Editor/SettingMenu.vue +++ b/frontend/src/components/canvas/components/Editor/SettingMenu.vue @@ -4,7 +4,6 @@ - this is test {{ $t('panel.edit') }} {{ $t('panel.copy') }} {{ $t('panel.delete') }} diff --git a/frontend/src/views/chart/view/ChartEdit.vue b/frontend/src/views/chart/view/ChartEdit.vue index af50191417..208d59c7a6 100644 --- a/frontend/src/views/chart/view/ChartEdit.vue +++ b/frontend/src/views/chart/view/ChartEdit.vue @@ -908,7 +908,9 @@ export default { this.data = response.data.data // console.log(JSON.stringify(this.chart)) this.httpRequest.status = true - this.param.privileges = this.chart.privileges + if (this.chart.privileges) { + this.param.privileges = this.chart.privileges + } }).catch(err => { this.resetView() this.httpRequest.status = err.response.data.success