forked from github/dataease
feat: 默认仪表盘直接关联源仪表盘
This commit is contained in:
parent
0b1d5a07c9
commit
a8ce990a4d
@ -6,6 +6,10 @@
|
||||
extends="io.dataease.base.mapper.PanelGroupMapper.BaseResultMap">
|
||||
<result column="label" jdbcType="VARCHAR" property="label"/>
|
||||
<result column="privileges" jdbcType="VARCHAR" property="privileges"/>
|
||||
<result column="default_panel_id" jdbcType="VARCHAR" property="defaultPanelId"/>
|
||||
<result column="default_panel_name" jdbcType="VARCHAR" property="defaultPanelName"/>
|
||||
<result column="source_panel_name" jdbcType="VARCHAR" property="sourcePanelName"/>
|
||||
<result column="is_default" property="isDefault"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="panelGroup" resultMap="BaseResultMapDTO">
|
||||
@ -14,32 +18,70 @@
|
||||
|
||||
<select id="panelGroupListDefault" resultMap="BaseResultMapDTO">
|
||||
SELECT
|
||||
id,
|
||||
`name`,
|
||||
pid,
|
||||
`level`,
|
||||
node_type,
|
||||
create_by,
|
||||
create_time,
|
||||
panel_type,
|
||||
`name` AS label
|
||||
from panel_group
|
||||
where panel_group.panel_type=#{panelType}
|
||||
panel_group.id,
|
||||
panel_group.`name`,
|
||||
panel_group.pid,
|
||||
panel_group.`level`,
|
||||
panel_group.node_type,
|
||||
panel_group.create_by,
|
||||
panel_group.create_time,
|
||||
panel_group.panel_type,
|
||||
panel_group.`name` AS label,
|
||||
panel_group.`source`,
|
||||
panel_group.`panel_type`,
|
||||
sourcePanelGroup.`name` as source_panel_name,
|
||||
get_auths(panel_group.id,'panel',#{userId}) as `privileges`
|
||||
from (select GET_V_AUTH_MODEL_ID_P_USE (#{userId}, 'panel') cids) t,panel_group
|
||||
LEFT JOIN (select id,`name` from panel_group) sourcePanelGroup
|
||||
on sourcePanelGroup.id=panel_group.source
|
||||
<where>
|
||||
FIND_IN_SET(panel_group.id,cids)
|
||||
<if test="name != null">
|
||||
and panel_group.name like CONCAT('%', #{name},'%')
|
||||
</if>
|
||||
<if test="nodeType != null">
|
||||
and panel_group.node_type = #{nodeType}
|
||||
</if>
|
||||
<if test="panelType != null">
|
||||
and panel_group.panel_type = #{panelType}
|
||||
</if>
|
||||
<if test="id != null">
|
||||
and panel_group.id = #{id}
|
||||
</if>
|
||||
<if test="pid != null">
|
||||
and panel_group.pid = #{pid}
|
||||
</if>
|
||||
<if test="level != null">
|
||||
and panel_group.level = #{level}
|
||||
</if>
|
||||
</where>
|
||||
<if test="sort != null">
|
||||
order by ${sort}
|
||||
</if>
|
||||
<if test="sort == null">
|
||||
order by panel_group.create_time desc
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="panelGroupList" resultMap="BaseResultMapDTO">
|
||||
SELECT
|
||||
id,
|
||||
`name`,
|
||||
pid,
|
||||
`level`,
|
||||
node_type,
|
||||
create_by,
|
||||
create_time,
|
||||
panel_type,
|
||||
`name` AS label,
|
||||
get_auths(id,'panel',#{userId}) as `privileges`
|
||||
panel_group.id,
|
||||
panel_group.`name`,
|
||||
panel_group.pid,
|
||||
panel_group.`level`,
|
||||
panel_group.node_type,
|
||||
panel_group.create_by,
|
||||
panel_group.create_time,
|
||||
panel_group.panel_type,
|
||||
panel_group.`name` AS label,
|
||||
panel_group.`node_type`,
|
||||
(case when ISNULL(defaultPanelGroup.id) then false else true end) is_default,
|
||||
defaultPanelGroup.id as default_panel_id,
|
||||
defaultPanelGroup.`name` as default_panel_name,
|
||||
get_auths(panel_group.id,'panel',#{userId}) as `privileges`
|
||||
from (select GET_V_AUTH_MODEL_ID_P_USE (#{userId}, 'panel') cids) t,panel_group
|
||||
LEFT JOIN (select source,id,`name` from panel_group where source is not null) defaultPanelGroup
|
||||
on defaultPanelGroup.source=panel_group.id
|
||||
<where>
|
||||
FIND_IN_SET(panel_group.id,cids)
|
||||
<if test="name != null">
|
||||
@ -70,6 +112,7 @@
|
||||
</select>
|
||||
|
||||
<delete id="deleteCircle">
|
||||
delete from panel_group where FIND_IN_SET(panel_group.id,GET_PANEL_GROUP_WITH_CHILDREN(#{pid}))
|
||||
delete from panel_group where FIND_IN_SET(panel_group.id,GET_PANEL_GROUP_WITH_CHILDREN(#{pid})) or FIND_IN_SET(panel_group.source,GET_PANEL_GROUP_WITH_CHILDREN(#{pid}))
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
@ -21,6 +21,14 @@ public class PanelGroupDTO extends PanelGroupWithBLOBs implements ITreeBase<Pane
|
||||
|
||||
private String privileges;
|
||||
|
||||
private String defaultPanelId;
|
||||
|
||||
private String defaultPanelName;
|
||||
|
||||
private Boolean isDefault;
|
||||
|
||||
private String sourcePanelName;
|
||||
|
||||
private List<PanelGroupDTO> children = new ArrayList<>();
|
||||
|
||||
|
||||
|
@ -69,7 +69,7 @@ public class PanelGroupService {
|
||||
public List<PanelGroupDTO> defaultTree(PanelGroupRequest panelGroupRequest) {
|
||||
String userId = String.valueOf(AuthUtils.getUser().getUserId());
|
||||
panelGroupRequest.setUserId(userId);
|
||||
List<PanelGroupDTO> panelGroupDTOList = extPanelGroupMapper.panelGroupList(panelGroupRequest);
|
||||
List<PanelGroupDTO> panelGroupDTOList = extPanelGroupMapper.panelGroupListDefault(panelGroupRequest);
|
||||
List<PanelGroupDTO> result = TreeUtils.mergeTree(panelGroupDTOList,"default_panel");
|
||||
return result;
|
||||
}
|
||||
@ -132,6 +132,7 @@ public class PanelGroupService {
|
||||
|
||||
public void deleteCircle(String id) {
|
||||
Assert.notNull(id, "id cannot be null");
|
||||
// 同时会删除对应默认仪表盘
|
||||
extPanelGroupMapper.deleteCircle(id);
|
||||
storeService.removeByPanelId(id);
|
||||
shareService.delete(id, null);
|
||||
|
@ -989,7 +989,9 @@ export default {
|
||||
border_style_dashed: 'Dashed',
|
||||
select_component: 'Check Component',
|
||||
other_module: 'Other',
|
||||
content: 'Content'
|
||||
content: 'Content',
|
||||
default_panel_name: 'Default Dashboard Name',
|
||||
source_panel_name: 'Source Dashboard Name'
|
||||
},
|
||||
plugin: {
|
||||
local_install: 'Local installation',
|
||||
|
@ -989,7 +989,9 @@ export default {
|
||||
border_style_dashed: '虚线',
|
||||
select_component: '请选择组件',
|
||||
other_module: '其他',
|
||||
content: '内容'
|
||||
content: '内容',
|
||||
default_panel_name: '默认仪表板名称',
|
||||
source_panel_name: '原仪表板名称'
|
||||
},
|
||||
plugin: {
|
||||
local_install: '本地安裝',
|
||||
|
@ -989,7 +989,9 @@ export default {
|
||||
border_style_dashed: '虚线',
|
||||
select_component: '请选择组件',
|
||||
other_module: '其他',
|
||||
content: '内容'
|
||||
content: '内容',
|
||||
default_panel_name: '默认仪表板名称',
|
||||
source_panel_name: '原仪表板名称'
|
||||
},
|
||||
plugin: {
|
||||
local_install: '本地安装',
|
||||
|
@ -115,7 +115,7 @@
|
||||
<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-copy-document" :command="beforeClickMore('toDefaultPanel',data,node)">
|
||||
<el-dropdown-item v-if="data.nodeType==='panel'" :disabled="data.isDefault" icon="el-icon-copy-document" :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)">
|
||||
@ -575,7 +575,9 @@ export default {
|
||||
this.activeTree = data.panelType
|
||||
if (data.nodeType === 'panel') {
|
||||
// 加载视图数据
|
||||
findOne(data.id).then(response => {
|
||||
// 如果是默认仪表盘 需要查询原仪表板的详细数据
|
||||
const queryPanelId = data.panelType === 'system' ? data.source : data.id
|
||||
findOne(queryPanelId).then(response => {
|
||||
const componentDatas = JSON.parse(response.data.panelData)
|
||||
componentDatas.forEach(item => {
|
||||
item.filters = (item.filters || [])
|
||||
|
@ -6,6 +6,9 @@
|
||||
<div style="border-bottom: 1px solid #dfe4ed;height: 100%;">
|
||||
<el-col :span="12" style="text-overflow:ellipsis;overflow: hidden;white-space: nowrap;font-size: 14px">
|
||||
<span>{{ panelInfo.name || '测试仪表板' }}</span>
|
||||
|
||||
<span v-if="panelInfo.isDefault" style="color: green;font-size: 12px">({{ $t('panel.default_panel_name') }}:{{ panelInfo.defaultPanelName }})</span>
|
||||
<span v-if="panelInfo.sourcePanelName" style="color: green;font-size: 12px">({{ $t('panel.source_panel_name') }}:{{ panelInfo.sourcePanelName }})</span>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<span v-if="hasDataPermission('export',panelInfo.privileges)" style="float: right;margin-right: 10px">
|
||||
|
Loading…
Reference in New Issue
Block a user