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}")
|
||||
@ -107,7 +119,7 @@ public class PanelGroupController {
|
||||
@ApiOperation("仪表板组件信息")
|
||||
@GetMapping("/queryPanelComponents/{id}")
|
||||
@I18n
|
||||
public Map queryPanelComponents(@PathVariable String id){
|
||||
public Map queryPanelComponents(@PathVariable String id) {
|
||||
return panelGroupService.queryPanelComponents(id);
|
||||
}
|
||||
|
||||
@ -115,15 +127,15 @@ public class PanelGroupController {
|
||||
@PostMapping("/exportDetails")
|
||||
@I18n
|
||||
public void exportDetails(@RequestBody PanelViewDetailsRequest request, HttpServletResponse response) throws IOException {
|
||||
panelGroupService.exportPanelViewDetails(request,response);
|
||||
panelGroupService.exportPanelViewDetails(request, response);
|
||||
}
|
||||
|
||||
@ApiOperation("更新仪表板状态")
|
||||
@PostMapping("/updatePanelStatus/{panelId}")
|
||||
@I18n
|
||||
@DePermission(type = DePermissionType.PANEL, level = ResourceAuthLevel.PANNEL_LEVEL_MANAGE)
|
||||
public void updatePanelStatus(@PathVariable String panelId,@RequestBody PanelGroupBaseInfoRequest request){
|
||||
panelGroupService.updatePanelStatus(panelId,request);
|
||||
public void updatePanelStatus(@PathVariable String panelId, @RequestBody PanelGroupBaseInfoRequest request) {
|
||||
panelGroupService.updatePanelStatus(panelId, request);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -23,7 +23,7 @@
|
||||
</el-col>
|
||||
<el-col :span="16" :style="classBackground" class="preview-show" />
|
||||
</el-row>
|
||||
<el-row v-if="inputType==='new_outer_template'" class="preview" :style="classBackground" />
|
||||
<el-row v-if="inputType==='new_outer_template'" class="preview" :style="classBackground" />
|
||||
<el-row class="root-class">
|
||||
<el-button size="mini" @click="cancel()">{{ $t('commons.cancel') }}</el-button>
|
||||
<el-button type="primary" size="mini" @click="save()">{{ $t('commons.confirm') }}</el-button>
|
||||
@ -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