From 5c98e3945166db194a4094b0009c5d28dbf68a1a Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Wed, 28 Jul 2021 17:47:39 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E8=A7=86=E5=9B=BE=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E6=9D=83=E9=99=90=E6=8E=A7=E5=88=B6=EF=BC=8C=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E5=9C=A8=E4=BB=AA=E8=A1=A8=E6=9D=BF=E7=BC=96=E8=BE=91=E6=97=B6?= =?UTF-8?q?=E4=B9=9F=E9=80=82=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/dataease/controller/chart/ChartViewController.java | 5 +++++ .../java/io/dataease/service/chart/ChartViewService.java | 6 ++++++ frontend/src/api/chart/chart.js | 2 +- frontend/src/views/chart/view/ChartEdit.vue | 1 + 4 files changed, 13 insertions(+), 1 deletion(-) 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