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