Merge pull request #757 from dataease/pr@dev@refactor_panel-pdf

feat:仪表板新增复制功能
This commit is contained in:
王嘉豪 2021-09-03 11:20:52 +08:00 committed by GitHub
commit 6bd2c603aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 5 deletions

View File

@ -103,6 +103,18 @@ public class PanelGroupService {
newDefaultPanel.setCreateBy(AuthUtils.getUser().getUsername());
checkPanelName(newDefaultPanel.getName(), newDefaultPanel.getPid(), PanelConstants.OPT_TYPE_INSERT, newDefaultPanel.getId());
panelGroupMapper.insertSelective(newDefaultPanel);
} else if ("copy".equals(request.getOptType())) {
panelId = UUID.randomUUID().toString();
// 复制模板
PanelGroupWithBLOBs newPanel = panelGroupMapper.selectByPrimaryKey(request.getId());
// 插入校验
if (StringUtils.isNotEmpty(request.getName())) {
checkPanelName(request.getName(), newPanel.getPid(), PanelConstants.OPT_TYPE_INSERT, request.getId());
}
newPanel.setName(request.getName());
newPanel.setId(panelId);
newPanel.setCreateBy(AuthUtils.getUser().getUsername());
panelGroupMapper.insertSelective(newPanel);
}else {
// 更新
if (StringUtils.isNotEmpty(request.getName())) {

View File

@ -109,6 +109,9 @@
<el-dropdown-item v-if="data.nodeType==='panel'" icon="el-icon-share" :command="beforeClickMore('share',data,node)">
{{ $t('panel.share') }}
</el-dropdown-item>
<el-dropdown-item v-if="data.nodeType==='panel'" icon="el-icon-document-copy" :command="beforeClickMore('copy',data,node)">
{{ $t('panel.copy') }}
</el-dropdown-item>
<el-dropdown-item v-if="data.nodeType==='panel'" icon="el-icon-paperclip" :command="beforeClickMore('link',data,node)">
{{ $t('panel.create_public_links') }}
</el-dropdown-item>
@ -306,11 +309,16 @@ export default {
this.lastActiveNodeData.name = panelInfo.name
return
}
//
if (this.editPanel.optType === 'copy') {
this.lastActiveNode.parent.data.children.push(panelInfo)
} else {
if (!this.lastActiveNodeData.children) {
this.$set(this.lastActiveNodeData, 'children', [])
}
this.lastActiveNodeData.children.push(panelInfo)
this.lastActiveNode.expanded = true
}
this.activeNodeAndClick(panelInfo)
} else {
this.tree(this.groupForm)
@ -367,6 +375,18 @@ export default {
}
}
break
case 'copy':
this.editPanel = {
visible: true,
titlePre: this.$t('panel.copy'),
optType: 'copy',
panelInfo: {
id: param.data.id,
name: param.data.name,
optType: 'copy'
}
}
break
}
switch (param.type) {
case 'folder':
@ -388,6 +408,7 @@ export default {
clickMore(param) {
switch (param.optType) {
case 'copy':
case 'toDefaultPanel':
case 'rename':
this.showEditPanel(param)