Merge pull request #2282 from dataease/pr@dev@refactor_panel-unpublished

refactor: 优化仪表板下架逻辑,下架禁止查看
This commit is contained in:
王嘉豪 2022-05-19 17:59:12 +08:00 committed by GitHub
commit cb9f427782
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 64 additions and 24 deletions

View File

@ -27,4 +27,7 @@ public class PanelShareOutDTO implements Serializable {
@ApiModelProperty("分享时间")
private Long createTime;
@ApiModelProperty("仪表板状态")
private String status;
}

View File

@ -16,5 +16,7 @@ public class PanelSharePo {
private String creator;
@ApiModelProperty("分享人ID")
private Long userId;
@ApiModelProperty("仪表板状态")
private String status;
}

View File

@ -13,5 +13,7 @@ public class PanelStoreDto {
private String name;
@ApiModelProperty("仪表板Id")
private String panelGroupId;
@ApiModelProperty("仪表板状态")
private String status;
}

View File

@ -91,9 +91,9 @@
<if test="level != null">
and panel_group.level = #{level}
</if>
<if test="isAdmin != null and !isAdmin">
and (panel_group.node_type='folder' or (panel_group.node_type='panel' and panel_group.`status`='publish') or (panel_group.node_type='panel' and panel_group.`status`='unpublished' and authInfo.privileges like '%manage%') )
</if>
<!-- <if test="isAdmin != null and !isAdmin">-->
<!-- and (panel_group.node_type='folder' or (panel_group.node_type='panel' and panel_group.`status`='publish') or (panel_group.node_type='panel' and panel_group.`status`='unpublished' and authInfo.privileges like '%manage%') )-->
<!-- </if>-->
</where>
ORDER BY CONVERT(panel_group.name using gbk)
</select>
@ -170,9 +170,9 @@
<if test="level != null">
and panel_group.level = #{level}
</if>
<if test="isAdmin != null and !isAdmin">
and (panel_group.node_type='folder' or (panel_group.node_type='panel' and panel_group.`status`='publish') or (panel_group.node_type='panel' and panel_group.`status`='unpublished' and authInfo.privileges like '%manage%') )
</if>
<!-- <if test="isAdmin != null and !isAdmin">-->
<!-- and (panel_group.node_type='folder' or (panel_group.node_type='panel' and panel_group.`status`='publish') or (panel_group.node_type='panel' and panel_group.`status`='unpublished' and authInfo.privileges like '%manage%') )-->
<!-- </if>-->
</where>
ORDER BY panel_group.node_type desc, CONVERT(panel_group.name using gbk)
</select>

View File

@ -5,6 +5,7 @@
<resultMap id="treeNodeMap" type="io.dataease.dto.panel.PanelSharePo">
<id column="id" property="id" />
<result column="name" property="name" />
<result column="status" property="status" />
<result column="creator" property="creator" />
<result column="user_id" jdbcType="BIGINT" property="userId" />
</resultMap>
@ -35,7 +36,7 @@
</delete>
<select id="query" resultMap="treeNodeMap">
select distinct s.panel_group_id as id, u.nick_name as creator, g.name, u.user_id
select distinct s.panel_group_id as id, u.nick_name as creator, g.name, u.user_id, g.status
from panel_share s
left join panel_group g on g.id = s.panel_group_id
left join sys_user u on u.username = IFNULL(s.granter,g.create_by)
@ -54,7 +55,7 @@
</select>
<select id="queryOut" resultMap="treeNodeMap">
select distinct s.panel_group_id as id, g.name
select distinct s.panel_group_id as id, g.name, g.status
from panel_share s
left join panel_group g on g.id = s.panel_group_id
where ( s.granter is not null and s.granter = #{userName} ) or ( s.granter is null and g.create_by = #{userName} )

View File

@ -6,13 +6,14 @@
<id column="store_id" property="storeId"></id>
<result column="panel_group_id" property="panelGroupId"></result>
<result column="name" property="name"></result>
<result column="status" property="status"></result>
</resultMap>
<select id="query" parameterType="io.dataease.ext.query.GridExample" resultMap="panelStoreMap">
select s.store_id,s.panel_group_id, g.name
select s.store_id,s.panel_group_id, g.name ,g.status
from panel_store s
inner join panel_group g on g.id = s.panel_group_id
<if test="_parameter != null">

View File

@ -1,7 +1,17 @@
<template>
<div class="bg" :style="customStyle" @scroll="canvasScroll">
<div id="canvasInfoMain" ref="canvasInfoMain" :style="canvasInfoMainStyle">
<el-row v-if="showUnpublishedArea" class="custom-position">
<pre>
<svg-icon icon-class="unpublished" style="font-size: 75px" />
{{ $t('panel.panel_off') }}
</pre>
</el-row>
<el-row v-else-if="componentDataShow.length===0" class="custom-position">
{{ $t('panel.panelNull') }}
</el-row>
<div
v-else
id="canvasInfoTemp"
ref="canvasInfoTemp"
:style="[canvasInfoTempStyle,screenShotStyle]"
@ -9,9 +19,6 @@
@mouseup="deselectCurComponent"
@mousedown="handleMouseDown"
>
<el-row v-if="componentDataShow.length===0" class="custom-position">
{{ $t('panel.panelNull') }}
</el-row>
<canvas-opt-bar />
<ComponentWrapper
v-for="(item, index) in componentDataInfo"
@ -137,6 +144,20 @@ export default {
created() {
},
computed: {
mainActiveName() {
return this.$store.state.panel.mainActiveName
},
showUnpublishedArea() {
return this.panelInfo.status === 'unpublished'
// if (this.mainActiveName === 'PanelMain') {
// return this.panelInfo.status === 'unpublished' && this.panelInfo.privileges.indexOf('manage') === -1
// } else {
// return this.panelInfo.status === 'unpublished'
// }
},
panelInfo() {
return this.$store.state.panel.panelInfo
},
showExportImgButton() {
return this.showChartInfo.type && !this.showChartInfo.type.includes('table')
},
@ -372,7 +393,12 @@ export default {
}
.custom-position {
line-height: 30px;
width: 100%;
z-index: 100;
height: 100%;
text-align: center;
cursor:not-allowed;
flex: 1;
display: flex;
align-items: center;

View File

@ -0,0 +1,2 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1652951914828" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2768" data-spm-anchor-id="a313x.7781069.0.i0" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css">@font-face { font-family: feedback-iconfont; src: url("//at.alicdn.com/t/font_1031158_u69w8yhxdu.woff2?t=1630033759944") format("woff2"), url("//at.alicdn.com/t/font_1031158_u69w8yhxdu.woff?t=1630033759944") format("woff"), url("//at.alicdn.com/t/font_1031158_u69w8yhxdu.ttf?t=1630033759944") format("truetype"); }
</style></defs><path d="M327.59296 687.74912l511.36 1.28512c23.89504-1.47456 43.82208-17.0752 49.68448-39.38304l99.29216-416.4864c3.8912-14.69952 0.71168-30.13632-8.72448-42.37312-10.25536-13.30688-26.84928-21.248-44.42112-21.248l-203.86304 0c-13.79328 0-24.98048 11.17696-24.98048 24.95488 0 13.78304 11.1872 24.96512 24.98048 24.96512l203.86816 0c3.24608 0 4.73088 1.53088 4.69504 1.53088l-99.2512 416.37376c-0.23552 0.44544-1.69472 1.68448-2.75968 1.80736l-489.42592-1.27488L245.39648 219.45344l213.34016 0c13.79328 0 24.97536-11.17696 24.97536-24.96 0-13.77792-11.18208-24.96-24.97536-24.96l-225.5872 0-27.776-113.22368L59.10528 56.30976c-13.79328 0-24.97536 11.17184-24.97536 24.96 0 13.78304 11.18208 24.96 24.97536 24.96l107.06944 0 131.584 536.35584c-40.72448 12.99968-70.30784 51.16928-70.30784 96.11264 0 30.23872 13.40416 57.39008 34.56 75.89888-21.15584 18.5088-34.56 45.66016-34.56 75.89376 0 55.64928 45.29664 100.90496 100.97152 100.90496 55.68 0 100.97664-45.25568 100.97152-100.90496 0-18.5856-5.07904-36.00384-13.88544-50.9696l360.82688 0c-8.81152 14.96576-13.89056 32.384-13.89056 50.9696 0 55.64928 45.29664 100.90496 100.97152 100.90496 55.68 0 100.97152-45.25568 100.97152-100.90496 0-55.62368-45.29152-100.8896-100.97152-100.8896L328.4224 789.60128c-0.51712 0-1.024 0.03072-1.536 0.04096-27.42272-0.81408-49.47968-23.34208-49.47968-50.944C277.40672 710.86592 299.84256 688.19968 327.59296 687.74912L327.59296 687.74912zM863.4112 839.52128c28.13952 0 51.0208 22.86592 51.0208 50.97472 0 28.11392-22.88128 50.99008-51.0208 50.99008-28.1344 0-51.01056-22.87616-51.01056-50.99008C812.40064 862.3872 835.2768 839.52128 863.4112 839.52128L863.4112 839.52128zM326.97344 839.55712c0.4864 0.01024 0.96256 0.04096 1.44896 0.04096 0.32768 0 0.64512-0.03584 0.96768-0.04608 27.69408 0.51712 50.048 23.15776 50.048 50.944 0 28.11904-22.88128 50.99008-51.0208 50.99008-28.1344 0-51.01568-22.87104-51.01568-50.99008C277.40672 862.8736 299.50976 840.33024 326.97344 839.55712L326.97344 839.55712zM472.99584 297.43616l106.24 102.5536c0.23552 0.22528 0.50176 0.42496 0.7424 0.64512 0.31232 0.27136 0.6144 0.54784 0.93696 0.80896 0.3072 0.256 0.62464 0.47616 0.9472 0.71168 0.33792 0.25088 0.67072 0.49664 1.024 0.73216 0.32256 0.20992 0.64 0.39424 0.96256 0.58368 0.37888 0.22528 0.75264 0.45056 1.14176 0.65024 0.3072 0.16384 0.6144 0.30208 0.93184 0.45056 0.42496 0.19968 0.8448 0.40448 1.28 0.57856 0.28672 0.10752 0.57344 0.20992 0.86016 0.31232 0.47104 0.17408 0.9472 0.34816 1.4336 0.49664 0.256 0.0768 0.52224 0.128 0.768 0.19456 0.52736 0.13312 1.0496 0.27136 1.58208 0.37888 0.23552 0.04608 0.48128 0.07168 0.7168 0.10752 0.55296 0.09216 1.10592 0.18432 1.664 0.24064 0.20992 0.01536 0.4096 0.01024 0.61952 0.03072 0.57856 0.03584 1.16224 0.08704 1.75616 0.08704 0.58368 0 1.15712-0.0512 1.73056-0.08704 0.21504-0.01536 0.42496-0.01024 0.64-0.03072 0.55296-0.0512 1.1008-0.14848 1.6384-0.2304 0.25088-0.04096 0.50176-0.06656 0.74752-0.11776 0.52736-0.1024 1.03936-0.23552 1.55648-0.36864 0.26624-0.07168 0.53248-0.128 0.79872-0.2048 0.48128-0.14336 0.95232-0.31744 1.41312-0.4864 0.29696-0.10752 0.58368-0.2048 0.88064-0.32256 0.43008-0.17408 0.83968-0.37376 1.25952-0.57344 0.32256-0.14848 0.64-0.29184 0.95744-0.4608 0.37376-0.19968 0.7424-0.41984 1.11616-0.64 0.32768-0.19456 0.66048-0.384 0.98304-0.59904 0.34304-0.22528 0.67584-0.47616 1.00352-0.7168 0.32256-0.23552 0.65024-0.46592 0.96256-0.7168 0.31744-0.256 0.6144-0.53248 0.91648-0.80384 0.25088-0.22016 0.512-0.42496 0.75264-0.65536l106.23488-102.5536c9.92256-9.57952 10.19904-25.3696 0.60928-35.28704-4.89984-5.07392-11.42784-7.61344-17.96608-7.61344-6.25152 0-12.49792 2.3296-17.3568 7.00928l-63.90272 61.68064L621.57824 66.79552c0-13.77792-11.1872-24.96-24.98048-24.96s-24.97536 11.18208-24.97536 24.96l0 256.42496L507.70944 261.53472c-9.93792-9.59488-25.72288-9.32352-35.32288 0.60416C462.7968 272.06656 463.0784 287.85152 472.99584 297.43616L472.99584 297.43616z" p-id="2769"></path><path d="M596.59264 358.2464 596.59264 358.2464z" p-id="2770"></path></svg>

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

@ -1432,6 +1432,7 @@ export default {
sure_bt: 'Confirm'
},
panel: {
panel_off: 'Off the shelf',
batch_opt: 'Batch Operation',
edit_leave_tips: 'Do You Want To Abandon And Leave The Current Page?',
hyperlinks: 'Hyperlinks',

View File

@ -1433,6 +1433,7 @@ export default {
sure_bt: '確定'
},
panel: {
panel_off: '仪表板已下架',
batch_opt: '批量操作',
edit_leave_tips: '是否放弃编辑离开当前界面?',
hyperlinks: '超鏈接',

View File

@ -1440,6 +1440,7 @@ export default {
sure_bt: '确定'
},
panel: {
panel_off: '仪表板已下架',
batch_opt: '批量操作',
edit_leave_tips: '是否放弃编辑离开当前界面?',
hyperlinks: '超链接',

View File

@ -7,7 +7,7 @@
<span slot-scope="{ data }" class="custom-tree-node father">
<span style="display: flex; flex: 1 1 0%; width: 0px;" :class="!!data.msgNode ? 'msg-node-class': ''">
<span v-if="!!data.id">
<svg-icon icon-class="panel" class="ds-icon-scene" />
<svg-icon :icon-class="'panel-'+data.status" class="ds-icon-scene" />
</span>
<span style="margin-left: 6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;">{{ data.name }}</span>
</span>
@ -24,7 +24,7 @@
<span slot-scope="{ data }" class="custom-tree-node father">
<span style="display: flex; flex: 1 1 0%; width: 0px;" @click="viewMyShare(data)">
<span v-if="!!data.id">
<svg-icon icon-class="panel" class="ds-icon-scene" />
<svg-icon :icon-class="'panel-'+data.status" class="ds-icon-scene" />
</span>
<span style="margin-left: 6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;">{{ data.name }}</span>
</span>

View File

@ -11,7 +11,7 @@
<template :id="scope.row.storeId" slot-scope="scope">
<div class="start-item">
<div class="filter-db-row star-item-content" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" @click="showPanel(scope.row)">
<svg-icon icon-class="panel" class="ds-icon-scene" />
<svg-icon :icon-class="'panel-'+scope.row.status" class="ds-icon-scene" />
<span> {{ scope.row.name }}</span>
</div>
<div class="star-item-close">

View File

@ -37,12 +37,12 @@
</el-button>
</span>
<span v-if="hasDataPermission('export',panelInfo.privileges)" style="float: right;margin-right: 10px">
<span v-if="hasDataPermission('export',panelInfo.privileges)&&panelInfo.status==='publish'" style="float: right;margin-right: 10px">
<el-tooltip :content="$t('panel.save_to_panel')">
<el-button class="el-icon-folder-checked" size="mini" circle @click="saveToTemplate" />
</el-tooltip>
</span>
<span v-if="hasDataPermission('export',panelInfo.privileges)" style="float: right;margin-right: 10px">
<span v-if="hasDataPermission('export',panelInfo.privileges)&&panelInfo.status==='publish'" style="float: right;margin-right: 10px">
<el-dropdown>
<el-button size="mini" class="el-icon-download" circle />
<el-dropdown-menu slot="dropdown">
@ -52,25 +52,25 @@
</el-dropdown-menu>
</el-dropdown>
</span>
<span style="float: right;margin-right: 10px">
<span style="float: right;margin-right: 10px" v-if="panelInfo.status==='publish'">
<el-tooltip :content="$t('panel.fullscreen_preview')">
<el-button class="el-icon-view" size="mini" circle @click="clickFullscreen" />
</el-tooltip>
</span>
<span style="float: right;margin-right: 10px">
<span style="float: right;margin-right: 10px" v-if="panelInfo.status==='publish'">
<el-tooltip :content="$t('panel.new_tab_preview')">
<el-button class="el-icon-data-analysis" size="mini" circle @click="newTab" />
</el-tooltip>
</span>
<span v-if="!hasStar && panelInfo && showType !== 1" style="float: right;margin-right: 10px">
<span v-if="!hasStar && panelInfo && showType !== 1&&panelInfo.status==='publish'" style="float: right;margin-right: 10px">
<el-tooltip :content="$t('panel.store')">
<el-button class="el-icon-star-off" size="mini" circle @click="star" />
</el-tooltip>
</span>
<span v-if="hasStar && panelInfo && showType !== 1" style="float: right;margin-right: 10px">
<span v-if="hasStar && panelInfo && showType !== 1&&panelInfo.status==='publish'" style="float: right;margin-right: 10px">
<el-tooltip :content="$t('commons.cancel')">
<el-button class="el-icon-star-on" size="mini" circle @click="unstar" />
</el-tooltip>