feat: 1.仪表盘页面动态添加目录,新建仪表盘无需刷新直接展开,2.新建仪表盘直接进入编辑界面,3.【【仪表盘】右键点开的功能顺序调整】4.【【仪表盘】仪表盘画板中,视图层级操作的文案调整】

This commit is contained in:
wangjiahao 2021-05-25 12:36:35 +08:00
parent bb30f4b068
commit 133f5dcae9
10 changed files with 120 additions and 56 deletions

View File

@ -104,7 +104,14 @@ public class PanelGroupService {
} }
panelGroupMapper.updateByPrimaryKeySelective(request); panelGroupMapper.updateByPrimaryKeySelective(request);
} }
return panelGroupMapper.selectByPrimaryKey(panelId);
//带有权限的返回
PanelGroupRequest authRequest = new PanelGroupRequest();
authRequest.setId(panelId);
authRequest.setUserId(String.valueOf(AuthUtils.getUser().getUserId()));
List<PanelGroupDTO> panelGroupDTOList = extPanelGroupMapper.panelGroupList(authRequest);
return panelGroupDTOList.get(0);
} }

View File

@ -1,18 +1,3 @@
/*
Navicat Premium Data Transfer
Source Server : A-LOCAL-
Source Server Type : MySQL
Source Server Version : 50726
Source Host : localhost:3306
Source Schema : data_ease
Target Server Type : MySQL
Target Server Version : 50726
File Encoding : 65001
Date: 18/05/2021 18:37:45
*/
SET NAMES utf8mb4; SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0; SET FOREIGN_KEY_CHECKS = 0;
@ -191,7 +176,7 @@ delimiter ;
-- ---------------------------- -- ----------------------------
DROP FUNCTION IF EXISTS `get_auths`; DROP FUNCTION IF EXISTS `get_auths`;
delimiter ;; delimiter ;;
CREATE DEFINER=`root`@`%` FUNCTION `get_auths`(authSource varchar(255),modelType varchar(255),userId varchar(255)) RETURNS longtext CHARSET utf8 CREATE FUNCTION `get_auths`(authSource varchar(255),modelType varchar(255),userId varchar(255)) RETURNS longtext CHARSET utf8
READS SQL DATA READS SQL DATA
BEGIN BEGIN
@ -302,7 +287,9 @@ delimiter ;
-- ---------------------------- -- ----------------------------
-- Function structure for GET_V_AUTH_MODEL_ID_P_USE -- Function structure for GET_V_AUTH_MODEL_ID_P_USE
-- ---------------------------- -- ----------------------------
CREATE DEFINER=`root`@`%` FUNCTION `GET_V_AUTH_MODEL_ID_P_USE`(userId longtext,modelType varchar(255)) RETURNS longtext CHARSET utf8 DROP FUNCTION IF EXISTS `GET_V_AUTH_MODEL_ID_P_USE`;
delimiter ;;
CREATE FUNCTION `GET_V_AUTH_MODEL_ID_P_USE`(userId longtext,modelType varchar(255)) RETURNS longtext CHARSET utf8
READS SQL DATA READS SQL DATA
BEGIN BEGIN

View File

@ -3,16 +3,16 @@
<ul @mouseup="handleMouseUp"> <ul @mouseup="handleMouseUp">
<template v-if="curComponent"> <template v-if="curComponent">
<template v-if="!curComponent.isLock"> <template v-if="!curComponent.isLock">
<li @click="edit">编辑</li> <li @click="edit"> {{ $t('panel.edit') }}</li>
<li @click="copy">复制</li> <li @click="copy"> {{ $t('panel.copy') }}</li>
<li @click="paste">粘贴</li> <li @click="paste"> {{ $t('panel.paste') }}</li>
<li @click="cut">剪切</li> <li @click="cut"> {{ $t('panel.cut') }}</li>
<li @click="deleteComponent">删除</li> <li @click="deleteComponent"> {{ $t('panel.delete') }}</li>
<li @click="lock">锁定</li> <li @click="lock"> {{ $t('panel.lock') }}</li>
<li @click="topComponent">置顶</li> <li @click="topComponent"> {{ $t('panel.topComponent') }}</li>
<li @click="bottomComponent">置底</li> <li @click="bottomComponent"> {{ $t('panel.bottomComponent') }}</li>
<li @click="upComponent">上移</li> <li @click="upComponent"> {{ $t('panel.upComponent') }}</li>
<li @click="downComponent">下移</li> <li @click="downComponent"> {{ $t('panel.downComponent') }}</li>
</template> </template>
<li v-else @click="unlock">解锁</li> <li v-else @click="unlock">解锁</li>
</template> </template>

View File

@ -34,7 +34,7 @@
</el-tooltip> </el-tooltip>
<span style="float: right;margin-left: 10px"> <span style="float: right;margin-left: 10px">
<el-button size="mini" @click="save"> <el-button size="mini" @click="save">
{{ $t('commons.save') }} {{ $t('commons.save') }}
</el-button> </el-button>
<el-button size="mini" @click="closePanelEdit"> <el-button size="mini" @click="closePanelEdit">
@ -54,6 +54,9 @@ import eventBus from '@/components/canvas/utils/eventBus'
import { deepCopy } from '@/components/canvas/utils/utils' import { deepCopy } from '@/components/canvas/utils/utils'
import { post } from '@/api/panel/panel' import { post } from '@/api/panel/panel'
import bus from '@/utils/bus' import bus from '@/utils/bus'
import {
DEFAULT_COMMON_CANVAS_STYLE
} from '@/views/panel/panel'
export default { export default {
data() { data() {
@ -213,6 +216,7 @@ export default {
}, },
clearCanvas() { clearCanvas() {
this.$store.commit('setComponentData', []) this.$store.commit('setComponentData', [])
this.$store.commit('setCanvasStyle', DEFAULT_COMMON_CANVAS_STYLE)
this.$store.commit('recordSnapshot') this.$store.commit('recordSnapshot')
}, },

View File

@ -893,7 +893,15 @@ export default {
insert_picture: 'Insert Picture', insert_picture: 'Insert Picture',
redo: 'Redo', redo: 'Redo',
undo: 'Undo', undo: 'Undo',
panelNull: 'This is a Empty PanelYou Can Edit and Enrich It' panelNull: 'This is a Empty PanelYou Can Edit and Enrich It',
copy: 'Copy',
paste: 'Paste',
cut: 'Cut',
lock: 'Lock',
topComponent: 'Top Component',
bottomComponent: 'Bottom Component',
upComponent: 'Up One Level',
downComponent: 'Down One Level'
}, },
plugin: { plugin: {
local_install: 'Local installation', local_install: 'Local installation',

View File

@ -892,7 +892,15 @@ export default {
insert_picture: '插入圖片', insert_picture: '插入圖片',
redo: '重做', redo: '重做',
undo: '撤銷', undo: '撤銷',
panelNull: '这是个空的儀表盤,可以通过编辑来丰富内容' panelNull: '这是个空的儀表盤,可以通过编辑来丰富内容',
copy: '复制',
paste: '粘贴',
cut: '剪切',
lock: '锁定',
topComponent: '置于顶层',
bottomComponent: '置于底层',
upComponent: '上移一层',
downComponent: '下移一层'
}, },
plugin: { plugin: {
local_install: '本地安裝', local_install: '本地安裝',

View File

@ -894,7 +894,16 @@ export default {
insert_picture: '插入图片', insert_picture: '插入图片',
redo: '重做', redo: '重做',
undo: '撤销', undo: '撤销',
panelNull: '这是个空的仪表板,可以通过编辑来丰富内容' panelNull: '这是个空的仪表板,可以通过编辑来丰富内容',
copy: '复制',
paste: '粘贴',
cut: '剪切',
lock: '锁定',
topComponent: '置于顶层',
bottomComponent: '置于底层',
upComponent: '上移一层',
downComponent: '下移一层'
}, },
plugin: { plugin: {
local_install: '本地安装', local_install: '本地安装',

View File

@ -138,7 +138,7 @@ import { listenGlobalKeyDown } from '@/components/canvas/utils/shortcutKey'
import { mapState } from 'vuex' import { mapState } from 'vuex'
import { uuid } from 'vue-uuid' import { uuid } from 'vue-uuid'
import Toolbar from '@/components/canvas/components/Toolbar' import Toolbar from '@/components/canvas/components/Toolbar'
import { get } from '@/api/panel/panel' import { findOne } from '@/api/panel/panel'
import PreviewFullScreen from '@/components/canvas/components/Editor/PreviewFullScreen' import PreviewFullScreen from '@/components/canvas/components/Editor/PreviewFullScreen'
import Preview from '@/components/canvas/components/Editor/Preview' import Preview from '@/components/canvas/components/Editor/Preview'
@ -243,7 +243,7 @@ export default {
this.$store.commit('setComponentData', this.resetID(JSON.parse(componentDataTemp))) this.$store.commit('setComponentData', this.resetID(JSON.parse(componentDataTemp)))
this.$store.commit('setCanvasStyle', JSON.parse(canvasStyleDataTemp)) this.$store.commit('setCanvasStyle', JSON.parse(canvasStyleDataTemp))
} else if (panelId) { } else if (panelId) {
get('panel/group/findOne/' + panelId).then(response => { findOne(panelId).then(response => {
this.$store.commit('setComponentData', this.resetID(JSON.parse(response.data.panelData))) this.$store.commit('setComponentData', this.resetID(JSON.parse(response.data.panelData)))
const panelStyle = JSON.parse(response.data.panelStyle) const panelStyle = JSON.parse(response.data.panelStyle)
this.$store.commit('setCanvasStyle', panelStyle) this.$store.commit('setCanvasStyle', panelStyle)
@ -257,7 +257,6 @@ export default {
this.$router.replace('/panel/index') this.$router.replace('/panel/index')
}, },
showPanel(type) { showPanel(type) {
if (this.showIndex === -1 || this.showIndex === type) { if (this.showIndex === -1 || this.showIndex === type) {
this.$nextTick(() => (this.show = !this.show)) this.$nextTick(() => (this.show = !this.show))
} }

View File

@ -110,7 +110,7 @@ export default {
type: 'success', type: 'success',
showClose: true showClose: true
}) })
this.$emit('closeEditPanelDialog') this.$emit('closeEditPanelDialog', response.data)
}) })
}, },
handleFileChange(e) { handleFileChange(e) {

View File

@ -8,7 +8,7 @@
:default-expanded-keys="expandedArray" :default-expanded-keys="expandedArray"
:data="defaultData" :data="defaultData"
node-key="id" node-key="id"
highlight-current :highlight-current="activeTree==='system'"
:expand-on-click-node="true" :expand-on-click-node="true"
@node-click="nodeClick" @node-click="nodeClick"
> >
@ -55,10 +55,11 @@
<el-col class="custom-tree-container"> <el-col class="custom-tree-container">
<div class="block"> <div class="block">
<el-tree <el-tree
ref="panel_list_tree"
:default-expanded-keys="expandedArray" :default-expanded-keys="expandedArray"
:data="tData" :data="tData"
node-key="id" node-key="id"
highlight-current :highlight-current="activeTree==='self'"
:expand-on-click-node="true" :expand-on-click-node="true"
@node-click="nodeClick" @node-click="nodeClick"
> >
@ -102,24 +103,24 @@
/> />
</span> </span>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item v-if="data.nodeType==='panel'" icon="el-icon-edit" :command="beforeClickMore('edit',data,node)">
{{ $t('panel.edit') }}
</el-dropdown-item>
<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-paperclip" :command="beforeClickMore('link',data,node)">
{{ $t('panel.create_public_links') }}
</el-dropdown-item>
<el-dropdown-item v-if="data.nodeType==='panel'" icon="el-icon-paperclip" :command="beforeClickMore('toDefaultPanel',data,node)">
{{ $t('panel.to_default_panel') }}
</el-dropdown-item>
<el-dropdown-item icon="el-icon-edit-outline" :command="beforeClickMore('rename',data,node)"> <el-dropdown-item icon="el-icon-edit-outline" :command="beforeClickMore('rename',data,node)">
{{ $t('panel.rename') }} {{ $t('panel.rename') }}
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item icon="el-icon-delete" :command="beforeClickMore('delete',data,node)"> <el-dropdown-item icon="el-icon-delete" :command="beforeClickMore('delete',data,node)">
{{ $t('panel.delete') }} {{ $t('panel.delete') }}
</el-dropdown-item> </el-dropdown-item>
<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-paperclip" :command="beforeClickMore('toDefaultPanel',data,node)">
{{ $t('panel.to_default_panel') }}
</el-dropdown-item>
<el-dropdown-item v-if="data.nodeType==='panel'" icon="el-icon-edit" :command="beforeClickMore('edit',data,node)">
{{ $t('panel.edit') }}
</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>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
</span> </span>
@ -184,6 +185,9 @@ import {
DEFAULT_YAXIS_STYLE, DEFAULT_YAXIS_STYLE,
DEFAULT_BACKGROUND_COLOR DEFAULT_BACKGROUND_COLOR
} from '@/views/chart/chart/chart' } from '@/views/chart/chart/chart'
import {
DEFAULT_COMMON_CANVAS_STYLE
} from '@/views/panel/panel'
import { DEFAULT_PANEL_STYLE } from '@/views/panel/panel' import { DEFAULT_PANEL_STYLE } from '@/views/panel/panel'
@ -192,6 +196,9 @@ export default {
components: { GrantAuth, LinkGenerate, EditPanel }, components: { GrantAuth, LinkGenerate, EditPanel },
data() { data() {
return { return {
lastActiveNode: null, //
lastActiveNodeData: null,
activeTree: 'self', // self system
editPanelModel: { editPanelModel: {
titlePre: null, titlePre: null,
titleSuf: null, titleSuf: null,
@ -332,19 +339,31 @@ export default {
} }
}, },
watch: { watch: {
}, },
mounted() { mounted() {
this.$store.commit('setComponentData', [])
this.$store.commit('setCanvasStyle', DEFAULT_COMMON_CANVAS_STYLE)
this.defaultTree() this.defaultTree()
this.tree(this.groupForm) this.tree(this.groupForm)
}, },
methods: { methods: {
closeEditPanelDialog() { closeEditPanelDialog(panelInfo) {
this.editPanel.visible = false this.editPanel.visible = false
debugger
this.defaultTree() this.defaultTree()
this.tree(this.groupForm) //
if (panelInfo && this.lastActiveNodeData.id) {
if (!this.lastActiveNodeData.children) {
this.$set(this.lastActiveNodeData, 'children', [])
}
this.lastActiveNodeData.children.push(panelInfo)
this.lastActiveNode.expanded = true
this.activeNodeAndClick(panelInfo)
}
}, },
showEditPanel(param) { showEditPanel(param) {
this.lastActiveNode = param.node
this.lastActiveNodeData = param.data
this.editPanel = JSON.parse(JSON.stringify(this.editPanelModel)) this.editPanel = JSON.parse(JSON.stringify(this.editPanelModel))
this.editPanel.optType = param.optType this.editPanel.optType = param.optType
this.editPanel.panelInfo.nodeType = param.type this.editPanel.panelInfo.nodeType = param.type
@ -425,7 +444,7 @@ export default {
this.share(param.data) this.share(param.data)
break break
case 'edit': case 'edit':
this.edit(param.data) this.edit(param.data, param.node)
break break
case 'link': case 'link':
this.link(param.data) this.link(param.data)
@ -525,6 +544,9 @@ export default {
}, },
nodeClick(data, node) { nodeClick(data, node) {
this.lastActiveNode = node
this.lastActiveNodeData = data
this.activeTree = data.panelType
if (data.nodeType === 'panel') { if (data.nodeType === 'panel') {
// //
findOne(data.id).then(response => { findOne(data.id).then(response => {
@ -564,8 +586,12 @@ export default {
this.authResourceId = null this.authResourceId = null
this.authVisible = false this.authVisible = false
}, },
edit(data) { edit(data, node) {
debugger this.lastActiveNodeData = data
this.lastActiveNode = node
//
this.$store.commit('setComponentData', [])
this.$store.commit('setCanvasStyle', DEFAULT_COMMON_CANVAS_STYLE)
this.$store.dispatch('panel/setPanelInfo', data) this.$store.dispatch('panel/setPanelInfo', data)
bus.$emit('PanelSwitchComponent', { name: 'PanelEdit' }) bus.$emit('PanelSwitchComponent', { name: 'PanelEdit' })
}, },
@ -587,6 +613,22 @@ export default {
}, },
newPanelSave(id) { newPanelSave(id) {
},
//
activeNodeAndClick(panelInfo) {
if (panelInfo) {
this.$nextTick(() => {
// CurrentKey
this.$refs.panel_list_tree.setCurrentKey(panelInfo.id)
this.$nextTick(() => {
document.querySelector('.is-current').firstChild.click()
//
if (panelInfo.nodeType === 'panel' && panelInfo.panelType === 'self') {
this.edit(this.lastActiveNodeData, this.lastActiveNode)
}
})
})
}
} }
} }
} }