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 abbb5c9bf7..4102d67b73 100644 --- a/backend/src/main/java/io/dataease/controller/chart/ChartViewController.java +++ b/backend/src/main/java/io/dataease/controller/chart/ChartViewController.java @@ -65,4 +65,9 @@ public class ChartViewController { public String searchAdviceSceneId(@PathVariable String panelId){ return chartViewService.searchAdviceSceneId(panelId); } + + @PostMapping("/getOneWithPermission/{id}") + public ChartViewDTO getOneWithPermission(@PathVariable String id, @RequestBody ChartExtRequest requestList) throws Exception { + return chartViewService.getData(id, requestList); + } } 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 84dbbf0fd7..b96a55334e 100644 --- a/backend/src/main/java/io/dataease/service/chart/ChartViewService.java +++ b/backend/src/main/java/io/dataease/service/chart/ChartViewService.java @@ -315,6 +315,12 @@ 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/api/chart/chart.js b/frontend/src/api/chart/chart.js index de77b0b87e..08e9df093c 100644 --- a/frontend/src/api/chart/chart.js +++ b/frontend/src/api/chart/chart.js @@ -11,7 +11,7 @@ export function post(url, data) { export function ajaxGetData(id, data) { return request({ - url: '/chart/view/getData/' + id, + url: '/chart/view/getOneWithPermission/' + id, method: 'post', loading: true, hideMsg: true, diff --git a/frontend/src/views/chart/view/ChartEdit.vue b/frontend/src/views/chart/view/ChartEdit.vue index 2bccf7f778..50530bd824 100644 --- a/frontend/src/views/chart/view/ChartEdit.vue +++ b/frontend/src/views/chart/view/ChartEdit.vue @@ -902,6 +902,7 @@ export default { this.data = response.data.data // console.log(JSON.stringify(this.chart)) this.httpRequest.status = true + this.param.privileges = this.chart.privileges }).catch(err => { this.resetView() this.httpRequest.status = err.response.data.success