forked from github/dataease
Merge pull request #2360 from dataease/pr@dev@refactor_panel-save
refactor: 优化仪表板保存返回信息
This commit is contained in:
commit
23acb3c9c0
@ -62,10 +62,22 @@ public class PanelGroupController {
|
||||
@DePermission(type = DePermissionType.PANEL, value = "pid", level = ResourceAuthLevel.PANNEL_LEVEL_MANAGE)
|
||||
}, logical = Logical.AND)
|
||||
@I18n
|
||||
public PanelGroup saveOrUpdate(@RequestBody PanelGroupRequest request) {
|
||||
public String saveOrUpdate(@RequestBody PanelGroupRequest request) {
|
||||
return panelGroupService.saveOrUpdate(request);
|
||||
}
|
||||
|
||||
@ApiOperation("保存并返回数据")
|
||||
@PostMapping("/saveWithData")
|
||||
@DePermissions(value = {
|
||||
@DePermission(type = DePermissionType.PANEL, value = "id"),
|
||||
@DePermission(type = DePermissionType.PANEL, value = "pid", level = ResourceAuthLevel.PANNEL_LEVEL_MANAGE)
|
||||
}, logical = Logical.AND)
|
||||
@I18n
|
||||
public PanelGroup saveOrUpdateWithData(@RequestBody PanelGroupRequest request) throws Exception {
|
||||
String panelId = panelGroupService.saveOrUpdate(request);
|
||||
return findOne(panelId);
|
||||
}
|
||||
|
||||
@ApiOperation("删除")
|
||||
@DePermission(type = DePermissionType.PANEL, level = ResourceAuthLevel.PANNEL_LEVEL_MANAGE)
|
||||
@PostMapping("/deleteCircle/{id}")
|
||||
|
@ -121,7 +121,7 @@ public class PanelGroupService {
|
||||
}
|
||||
|
||||
@DeCleaner(value = DePermissionType.PANEL, key = "pid")
|
||||
public PanelGroup saveOrUpdate(PanelGroupRequest request) {
|
||||
public String saveOrUpdate(PanelGroupRequest request) {
|
||||
String panelId = request.getId();
|
||||
if (StringUtils.isNotEmpty(panelId)) {
|
||||
panelViewService.syncPanelViews(request);
|
||||
@ -191,19 +191,9 @@ public class PanelGroupService {
|
||||
request.setPid(panel.getPid());
|
||||
}
|
||||
}
|
||||
|
||||
DeLogUtils.save(SysLogConstants.OPERATE_TYPE.MODIFY, sourceType, request.getId(), request.getPid(), null, sourceType);
|
||||
}
|
||||
|
||||
//带有权限的返回
|
||||
PanelGroupRequest authRequest = new PanelGroupRequest();
|
||||
authRequest.setId(panelId);
|
||||
authRequest.setUserId(String.valueOf(AuthUtils.getUser().getUserId()));
|
||||
List<PanelGroupDTO> panelGroupDTOList = extPanelGroupMapper.panelGroupList(authRequest);
|
||||
if (!CollectionUtils.isNotEmpty(panelGroupDTOList)) {
|
||||
DataEaseException.throwException("未查询到用户对应的资源权限,请尝试刷新重新保存");
|
||||
}
|
||||
return panelGroupDTOList.get(0);
|
||||
return panelId;
|
||||
}
|
||||
|
||||
|
||||
|
@ -72,6 +72,14 @@ export function panelSave(data) {
|
||||
data
|
||||
})
|
||||
}
|
||||
export function panelSaveWithData(data) {
|
||||
return request({
|
||||
url: 'panel/group/saveWithData',
|
||||
method: 'post',
|
||||
loading: true,
|
||||
data
|
||||
})
|
||||
}
|
||||
export function findOne(id) {
|
||||
return request({
|
||||
url: 'panel/group/findOne/' + id,
|
||||
|
@ -32,7 +32,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { panelSave } from '@/api/panel/panel'
|
||||
import { panelSaveWithData } from '@/api/panel/panel'
|
||||
import { showTemplateList } from '@/api/system/template'
|
||||
import TemplateAllList from './TemplateAllList'
|
||||
import { deepCopy } from '@/components/canvas/utils/utils'
|
||||
@ -147,7 +147,7 @@ export default {
|
||||
}
|
||||
this.editPanel.panelInfo['newFrom'] = this.inputType
|
||||
this.loading = true
|
||||
panelSave(this.editPanel.panelInfo).then(response => {
|
||||
panelSaveWithData(this.editPanel.panelInfo).then(response => {
|
||||
this.$message({
|
||||
message: this.$t('commons.save_success'),
|
||||
type: 'success',
|
||||
|
Loading…
Reference in New Issue
Block a user