forked from github/dataease
Merge pull request #757 from dataease/pr@dev@refactor_panel-pdf
feat:仪表板新增复制功能
This commit is contained in:
commit
6bd2c603aa
@ -103,7 +103,19 @@ public class PanelGroupService {
|
||||
newDefaultPanel.setCreateBy(AuthUtils.getUser().getUsername());
|
||||
checkPanelName(newDefaultPanel.getName(), newDefaultPanel.getPid(), PanelConstants.OPT_TYPE_INSERT, newDefaultPanel.getId());
|
||||
panelGroupMapper.insertSelective(newDefaultPanel);
|
||||
} else {
|
||||
} 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())) {
|
||||
checkPanelName(request.getName(), request.getPid(), PanelConstants.OPT_TYPE_UPDATE, request.getId());
|
||||
|
@ -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.lastActiveNodeData.children) {
|
||||
this.$set(this.lastActiveNodeData, 'children', [])
|
||||
// 复制后的仪表板 放在父节点下面
|
||||
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.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)
|
||||
|
Loading…
Reference in New Issue
Block a user