fix:视图按钮权限控制,同步在仪表板编辑时也适用

This commit is contained in:
wangjiahao 2021-07-28 17:47:39 +08:00
parent 594d20eb4d
commit 5c98e39451
4 changed files with 13 additions and 1 deletions

View File

@ -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);
}
}

View File

@ -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;
}

View File

@ -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,

View File

@ -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