forked from github/dataease
feat(仪表板): 进入仪表板菜单默认打开第一个默认仪表板且默认仪表板增加置顶功能
This commit is contained in:
parent
5199aaae8f
commit
9875240437
@ -5,11 +5,11 @@ import io.dataease.auth.annotation.DePermission;
|
||||
import io.dataease.auth.annotation.DePermissionProxy;
|
||||
import io.dataease.auth.annotation.DePermissions;
|
||||
import io.dataease.auth.service.impl.ExtAuthServiceImpl;
|
||||
import io.dataease.commons.constants.PanelConstants;
|
||||
import io.dataease.controller.request.panel.*;
|
||||
import io.dataease.commons.constants.DePermissionType;
|
||||
import io.dataease.commons.constants.PanelConstants;
|
||||
import io.dataease.commons.constants.ResourceAuthLevel;
|
||||
import io.dataease.controller.handler.annotation.I18n;
|
||||
import io.dataease.controller.request.panel.*;
|
||||
import io.dataease.dto.PermissionProxy;
|
||||
import io.dataease.dto.authModel.VAuthModelDTO;
|
||||
import io.dataease.dto.panel.PanelExport2App;
|
||||
@ -17,10 +17,11 @@ import io.dataease.dto.panel.PanelGroupDTO;
|
||||
import io.dataease.service.panel.PanelGroupService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.pentaho.di.core.util.UUIDUtil;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.pentaho.di.core.util.UUIDUtil;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
@ -62,12 +63,12 @@ public class PanelGroupController {
|
||||
@DePermission(type = DePermissionType.PANEL, value = "pid", level = ResourceAuthLevel.PANEL_LEVEL_MANAGE)
|
||||
}, logical = Logical.AND)
|
||||
@I18n
|
||||
public PanelGroupDTO save(@RequestBody PanelGroupRequest request) throws Exception{
|
||||
public PanelGroupDTO save(@RequestBody PanelGroupRequest request) throws Exception {
|
||||
String panelId = panelGroupService.save(request);
|
||||
PanelGroupDTO result = findOne(panelId);
|
||||
// 如果新建来源来自模板市场,在返回数据中加入父级ID便于跳转展开仪表板树
|
||||
if(PanelConstants.NEW_PANEL_FROM.NEW_MARKET_TEMPLATE.equals(request.getNewFrom())){
|
||||
result.setParents(authService.parentResource(panelId,"panel"));
|
||||
if (PanelConstants.NEW_PANEL_FROM.NEW_MARKET_TEMPLATE.equals(request.getNewFrom())) {
|
||||
result.setParents(authService.parentResource(panelId, "panel"));
|
||||
result.setRequestId(UUIDUtil.getUUIDAsString());
|
||||
}
|
||||
return result;
|
||||
@ -150,31 +151,33 @@ public class PanelGroupController {
|
||||
public void updatePanelStatus(@PathVariable String panelId, @RequestBody PanelGroupBaseInfoRequest request) {
|
||||
panelGroupService.updatePanelStatus(panelId, request);
|
||||
}
|
||||
|
||||
@ApiOperation("自动缓存")
|
||||
@PostMapping("/autoCache")
|
||||
@DePermissions(value = {
|
||||
@DePermission(type = DePermissionType.PANEL, value = "id"),
|
||||
@DePermission(type = DePermissionType.PANEL, value = "pid", level = ResourceAuthLevel.PANEL_LEVEL_MANAGE)
|
||||
}, logical = Logical.AND)
|
||||
public void autoCache(@RequestBody PanelGroupRequest request){
|
||||
public void autoCache(@RequestBody PanelGroupRequest request) {
|
||||
panelGroupService.autoCache(request);
|
||||
|
||||
}
|
||||
|
||||
@ApiOperation("查找缓存")
|
||||
@GetMapping("/findUserCache/{panelId}")
|
||||
public PanelGroupDTO findUserCache(@PathVariable String panelId){
|
||||
public PanelGroupDTO findUserCache(@PathVariable String panelId) {
|
||||
return panelGroupService.findUserPanelCache(panelId);
|
||||
}
|
||||
|
||||
@ApiOperation("检查缓存")
|
||||
@GetMapping("/checkUserCache/{panelId}")
|
||||
public Boolean checkUserCache(@PathVariable String panelId){
|
||||
public Boolean checkUserCache(@PathVariable String panelId) {
|
||||
return panelGroupService.checkUserCache(panelId);
|
||||
}
|
||||
|
||||
@ApiOperation("删除缓存")
|
||||
@DeleteMapping("/removePanelCache/{panelId}")
|
||||
public void removePanelCache(@PathVariable String panelId){
|
||||
public void removePanelCache(@PathVariable String panelId) {
|
||||
panelGroupService.removePanelCache(panelId);
|
||||
}
|
||||
|
||||
@ -183,39 +186,46 @@ public class PanelGroupController {
|
||||
public void viewLog(@RequestBody PanelViewLogRequest request) {
|
||||
panelGroupService.viewLog(request);
|
||||
}
|
||||
|
||||
@ApiOperation("获取仪表板中视图Element信息")
|
||||
@GetMapping("/findPanelElementInfo/{viewId}")
|
||||
@I18n
|
||||
public Object findPanelElementInfo(@PathVariable String viewId){
|
||||
return panelGroupService.findPanelElementInfo(viewId);
|
||||
public Object findPanelElementInfo(@PathVariable String viewId) {
|
||||
return panelGroupService.findPanelElementInfo(viewId);
|
||||
}
|
||||
|
||||
@GetMapping("/export2AppCheck/{panelId}")
|
||||
@I18n
|
||||
public PanelExport2App export2AppCheck(@PathVariable String panelId){
|
||||
return panelGroupService.panelExport2AppCheck(panelId);
|
||||
public PanelExport2App export2AppCheck(@PathVariable String panelId) {
|
||||
return panelGroupService.panelExport2AppCheck(panelId);
|
||||
}
|
||||
|
||||
@PostMapping("/appApply")
|
||||
public PanelGroupDTO appApply(@RequestBody PanelAppTemplateApplyRequest request) throws Exception{
|
||||
public PanelGroupDTO appApply(@RequestBody PanelAppTemplateApplyRequest request) throws Exception {
|
||||
String panelId = panelGroupService.appApply(request);
|
||||
PanelGroupDTO result = findOne(panelId);
|
||||
result.setParents(authService.parentResource(panelId,"panel"));
|
||||
result.setParents(authService.parentResource(panelId, "panel"));
|
||||
result.setRequestId(UUIDUtil.getUUIDAsString());
|
||||
result.setResponseSource("appApply");
|
||||
return result;
|
||||
}
|
||||
|
||||
@PostMapping("/appEdit")
|
||||
public void appEdit(@RequestBody PanelAppTemplateApplyRequest request) throws Exception{
|
||||
public void appEdit(@RequestBody PanelAppTemplateApplyRequest request) throws Exception {
|
||||
panelGroupService.appEdit(request);
|
||||
}
|
||||
|
||||
@GetMapping("/findOneWithParent/{panelId}")
|
||||
public PanelGroupDTO findOneWithParent(@PathVariable String panelId) throws Exception{
|
||||
public PanelGroupDTO findOneWithParent(@PathVariable String panelId) throws Exception {
|
||||
PanelGroupDTO result = findOne(panelId);
|
||||
result.setParents(authService.parentResource(panelId,"panel"));
|
||||
result.setParents(authService.parentResource(panelId, "panel"));
|
||||
result.setRequestId(UUIDUtil.getUUIDAsString());
|
||||
result.setResponseSource("appApply");
|
||||
return result;
|
||||
}
|
||||
|
||||
@PostMapping("/toTop/{panelId}")
|
||||
public void toTop(@PathVariable String panelId) throws Exception {
|
||||
panelGroupService.toTop(panelId);
|
||||
}
|
||||
}
|
||||
|
@ -16,16 +16,19 @@
|
||||
|
||||
<select id="findOneWithPrivileges" resultMap="BaseResultMapDTO">
|
||||
select panel_group.*,
|
||||
panel_group.name as label,
|
||||
panel_group.name as label,
|
||||
(select nick_name from sys_user where username = panel_group.create_by) as creator_name,
|
||||
(select nick_name from sys_user where username = panel_group.update_by) as update_name,
|
||||
get_auths(panel_group.id, 'panel', #{userId}) as `privileges`
|
||||
get_auths(panel_group.id, 'panel', #{userId}) as `privileges`
|
||||
from panel_group
|
||||
where id = #{panelId}
|
||||
</select>
|
||||
|
||||
<select id="panelGroupInit" resultMap="BaseResultMapDTO">
|
||||
select id, name,panel_data from panel_group where node_type = 'panel' and panel_type ='self'
|
||||
select id, name, panel_data
|
||||
from panel_group
|
||||
where node_type = 'panel'
|
||||
and panel_type = 'self'
|
||||
</select>
|
||||
|
||||
<select id="panelGroupListDefault" resultMap="BaseResultMapDTO">
|
||||
@ -49,34 +52,34 @@
|
||||
LEFT JOIN panel_group sourcePanelGroup
|
||||
on sourcePanelGroup.id=panel_group.source
|
||||
left join (
|
||||
SELECT
|
||||
auth_source,
|
||||
group_concat( DISTINCT sys_auth_detail.privilege_extend ) as `privileges`
|
||||
FROM
|
||||
(
|
||||
`sys_auth`
|
||||
LEFT JOIN `sys_auth_detail` ON ((
|
||||
`sys_auth`.`id` = `sys_auth_detail`.`auth_id`
|
||||
)))
|
||||
WHERE
|
||||
sys_auth_detail.privilege_value = 1
|
||||
AND sys_auth.auth_source_type = 'panel'
|
||||
AND (
|
||||
(
|
||||
sys_auth.auth_target_type = 'dept'
|
||||
AND sys_auth.auth_target IN ( SELECT dept_id FROM sys_user WHERE user_id = #{userId} )
|
||||
)
|
||||
OR (
|
||||
sys_auth.auth_target_type = 'user'
|
||||
AND sys_auth.auth_target = #{userId}
|
||||
)
|
||||
OR (
|
||||
sys_auth.auth_target_type = 'role'
|
||||
AND sys_auth.auth_target IN ( SELECT role_id FROM sys_users_roles WHERE user_id = #{userId} )
|
||||
)
|
||||
)
|
||||
GROUP BY
|
||||
`sys_auth`.`auth_source`
|
||||
SELECT
|
||||
auth_source,
|
||||
group_concat( DISTINCT sys_auth_detail.privilege_extend ) as `privileges`
|
||||
FROM
|
||||
(
|
||||
`sys_auth`
|
||||
LEFT JOIN `sys_auth_detail` ON ((
|
||||
`sys_auth`.`id` = `sys_auth_detail`.`auth_id`
|
||||
)))
|
||||
WHERE
|
||||
sys_auth_detail.privilege_value = 1
|
||||
AND sys_auth.auth_source_type = 'panel'
|
||||
AND (
|
||||
(
|
||||
sys_auth.auth_target_type = 'dept'
|
||||
AND sys_auth.auth_target IN ( SELECT dept_id FROM sys_user WHERE user_id = #{userId} )
|
||||
)
|
||||
OR (
|
||||
sys_auth.auth_target_type = 'user'
|
||||
AND sys_auth.auth_target = #{userId}
|
||||
)
|
||||
OR (
|
||||
sys_auth.auth_target_type = 'role'
|
||||
AND sys_auth.auth_target IN ( SELECT role_id FROM sys_users_roles WHERE user_id = #{userId} )
|
||||
)
|
||||
)
|
||||
GROUP BY
|
||||
`sys_auth`.`auth_source`
|
||||
) authInfo
|
||||
on panel_group.id = authInfo.auth_source
|
||||
<where>
|
||||
@ -100,7 +103,7 @@
|
||||
and panel_group.level = #{level}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY CONVERT(panel_group.name using gbk)
|
||||
ORDER BY panel_group.panel_sort desc, CONVERT(panel_group.name using gbk)
|
||||
</select>
|
||||
|
||||
<select id="panelGroupList" resultMap="BaseResultMapDTO">
|
||||
@ -125,34 +128,34 @@
|
||||
LEFT JOIN panel_group defaultPanelGroup
|
||||
on defaultPanelGroup.source=panel_group.id and defaultPanelGroup.source is not null
|
||||
left join (
|
||||
SELECT
|
||||
auth_source,
|
||||
group_concat( DISTINCT sys_auth_detail.privilege_extend ) as `privileges`
|
||||
FROM
|
||||
(
|
||||
`sys_auth`
|
||||
LEFT JOIN `sys_auth_detail` ON ((
|
||||
`sys_auth`.`id` = `sys_auth_detail`.`auth_id`
|
||||
)))
|
||||
WHERE
|
||||
sys_auth_detail.privilege_value = 1
|
||||
AND sys_auth.auth_source_type = 'panel'
|
||||
AND (
|
||||
(
|
||||
sys_auth.auth_target_type = 'dept'
|
||||
AND sys_auth.auth_target IN ( SELECT dept_id FROM sys_user WHERE user_id = #{userId} )
|
||||
)
|
||||
OR (
|
||||
sys_auth.auth_target_type = 'user'
|
||||
AND sys_auth.auth_target = #{userId}
|
||||
)
|
||||
OR (
|
||||
sys_auth.auth_target_type = 'role'
|
||||
AND sys_auth.auth_target IN ( SELECT role_id FROM sys_users_roles WHERE user_id = #{userId} )
|
||||
)
|
||||
)
|
||||
GROUP BY
|
||||
`sys_auth`.`auth_source`
|
||||
SELECT
|
||||
auth_source,
|
||||
group_concat( DISTINCT sys_auth_detail.privilege_extend ) as `privileges`
|
||||
FROM
|
||||
(
|
||||
`sys_auth`
|
||||
LEFT JOIN `sys_auth_detail` ON ((
|
||||
`sys_auth`.`id` = `sys_auth_detail`.`auth_id`
|
||||
)))
|
||||
WHERE
|
||||
sys_auth_detail.privilege_value = 1
|
||||
AND sys_auth.auth_source_type = 'panel'
|
||||
AND (
|
||||
(
|
||||
sys_auth.auth_target_type = 'dept'
|
||||
AND sys_auth.auth_target IN ( SELECT dept_id FROM sys_user WHERE user_id = #{userId} )
|
||||
)
|
||||
OR (
|
||||
sys_auth.auth_target_type = 'user'
|
||||
AND sys_auth.auth_target = #{userId}
|
||||
)
|
||||
OR (
|
||||
sys_auth.auth_target_type = 'role'
|
||||
AND sys_auth.auth_target IN ( SELECT role_id FROM sys_users_roles WHERE user_id = #{userId} )
|
||||
)
|
||||
)
|
||||
GROUP BY
|
||||
`sys_auth`.`auth_source`
|
||||
) authInfo
|
||||
on panel_group.id = authInfo.auth_source
|
||||
<where>
|
||||
@ -176,42 +179,47 @@
|
||||
and panel_group.level = #{level}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY panel_group.node_type desc, CONVERT(panel_group.name using gbk)
|
||||
ORDER BY panel_group.node_type desc, CONVERT(panel_group.name using gbk)
|
||||
</select>
|
||||
|
||||
<delete id="deleteCircle">
|
||||
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
|
||||
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>
|
||||
|
||||
<delete id="deleteCircleView">
|
||||
delete from chart_view where FIND_IN_SET(chart_view.scene_id,GET_PANEL_GROUP_WITH_CHILDREN(#{pid}))
|
||||
delete
|
||||
from chart_view
|
||||
where FIND_IN_SET(chart_view.scene_id, GET_PANEL_GROUP_WITH_CHILDREN(#{pid}))
|
||||
</delete>
|
||||
|
||||
<delete id="deleteCircleViewCache">
|
||||
delete from chart_view_cache where FIND_IN_SET(chart_view_cache.scene_id,GET_PANEL_GROUP_WITH_CHILDREN(#{pid}))
|
||||
delete
|
||||
from chart_view_cache
|
||||
where FIND_IN_SET(chart_view_cache.scene_id, GET_PANEL_GROUP_WITH_CHILDREN(#{pid}))
|
||||
</delete>
|
||||
|
||||
<insert id="copyPanelView">
|
||||
INSERT INTO panel_view ( id, panel_id, chart_view_id ) SELECT
|
||||
uuid(),
|
||||
#{panelId},
|
||||
chart_view_id
|
||||
FROM
|
||||
panel_view
|
||||
WHERE
|
||||
panel_id = #{panelId}
|
||||
INSERT INTO panel_view (id, panel_id, chart_view_id)
|
||||
SELECT uuid(),
|
||||
#{panelId},
|
||||
chart_view_id
|
||||
FROM panel_view
|
||||
WHERE panel_id = #{panelId}
|
||||
</insert>
|
||||
|
||||
<delete id="removeUselessViews">
|
||||
DELETE
|
||||
FROM
|
||||
chart_view
|
||||
chart_view
|
||||
WHERE
|
||||
chart_view.chart_type = 'private'
|
||||
AND chart_view.scene_id = #{panelId}
|
||||
chart_view.chart_type = 'private'
|
||||
AND chart_view.scene_id = #{panelId}
|
||||
<if test="viewIds != null and viewIds.size>0">
|
||||
AND id NOT IN
|
||||
<foreach collection="viewIds" item="viewId" open="(" separator="," close=")" >
|
||||
<foreach collection="viewIds" item="viewId" open="(" separator="," close=")">
|
||||
#{viewId}
|
||||
</foreach>
|
||||
</if>
|
||||
|
@ -947,4 +947,15 @@ public class PanelGroupService {
|
||||
//数据源变更
|
||||
panelAppTemplateService.editDatasource(request.getDatasourceList());
|
||||
}
|
||||
|
||||
public void toTop(String panelId) {
|
||||
Long time = System.currentTimeMillis();
|
||||
PanelGroupWithBLOBs request = new PanelGroupWithBLOBs();
|
||||
request.setId(panelId);
|
||||
request.setPanelSort(time);
|
||||
request.setUpdateTime(time);
|
||||
request.setUpdateBy(AuthUtils.getUser().getUsername());
|
||||
panelGroupMapper.updateByPrimaryKeySelective(request);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -36,3 +36,6 @@ WHERE (`component` = 'msg/all');
|
||||
UPDATE `sys_menu`
|
||||
SET `component` = 'msg/Setting'
|
||||
WHERE (`component` = 'msg/setting');
|
||||
|
||||
ALTER TABLE `panel_group`
|
||||
ADD COLUMN `panel_sort` bigint(13) NULL COMMENT '排序' AFTER `watermark_open`;
|
||||
|
@ -358,3 +358,11 @@ export function findOneWithParent(panelId) {
|
||||
loading: false
|
||||
})
|
||||
}
|
||||
|
||||
export function panelToTop(panelId) {
|
||||
return request({
|
||||
url: 'panel/group/toTop/' + panelId,
|
||||
method: 'post',
|
||||
loading: false
|
||||
})
|
||||
}
|
||||
|
@ -137,7 +137,7 @@
|
||||
:target="curComponent.hyperlinks.openMode "
|
||||
:href="curComponent.hyperlinks.content "
|
||||
>
|
||||
<i class="icon iconfont icon-com-jump"/>
|
||||
<i class="icon iconfont icon-com-jump" />
|
||||
</a>
|
||||
</span>
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
:style="customStyle"
|
||||
@scroll="canvasScroll"
|
||||
>
|
||||
<canvas-opt-bar @link-export-pdf="downloadAsPDF" />
|
||||
<canvas-opt-bar @link-export-pdf="downloadAsPDF"/>
|
||||
<div
|
||||
:id="previewDomId"
|
||||
:ref="previewRefId"
|
||||
@ -112,11 +112,12 @@ import bus from '@/utils/bus'
|
||||
import { buildFilterMap, buildViewKeyMap, formatCondition, valueValid, viewIdMatch } from '@/utils/conditionUtil'
|
||||
import { hasDataPermission } from '@/utils/permission'
|
||||
import { activeWatermark } from '@/components/canvas/tools/watermark'
|
||||
import { proxyUserLoginInfo, userLoginInfo } from '@/api/systemInfo/userLogin'
|
||||
import { userLoginInfo } from '@/api/systemInfo/userLogin'
|
||||
import html2canvas from 'html2canvasde'
|
||||
import { queryAll } from '@/api/panel/pdfTemplate'
|
||||
const erd = elementResizeDetectorMaker()
|
||||
import PDFPreExport from '@/views/panel/export/PDFPreExport'
|
||||
|
||||
const erd = elementResizeDetectorMaker()
|
||||
export default {
|
||||
components: { ComponentWrapper, CanvasOptBar, PDFPreExport },
|
||||
model: {
|
||||
|
@ -1865,12 +1865,10 @@ export default {
|
||||
sure_bt: 'Confirm'
|
||||
},
|
||||
panel: {
|
||||
|
||||
to_top: 'To Top',
|
||||
down: 'Down',
|
||||
|
||||
mobile_style_setting: 'Style setting',
|
||||
mobile_style_setting_tips: 'Customize the mobile background',
|
||||
|
||||
board: 'Border',
|
||||
text: 'Text',
|
||||
board_background: 'Background',
|
||||
|
@ -1865,12 +1865,10 @@ export default {
|
||||
sure_bt: '確定'
|
||||
},
|
||||
panel: {
|
||||
|
||||
to_top: '置頂',
|
||||
down: '下載',
|
||||
|
||||
mobile_style_setting: '樣式設置',
|
||||
mobile_style_setting_tips: '自定義移動端背景',
|
||||
|
||||
board: '邊框',
|
||||
text: '文字',
|
||||
board_background: '背景',
|
||||
|
@ -1865,12 +1865,10 @@ export default {
|
||||
sure_bt: '确定'
|
||||
},
|
||||
panel: {
|
||||
|
||||
to_top: '置顶',
|
||||
down: '下载',
|
||||
|
||||
mobile_style_setting: '样式设置',
|
||||
mobile_style_setting_tips: '自定义移动端背景',
|
||||
|
||||
board: '边框',
|
||||
text: '文字',
|
||||
board_background: '背景',
|
||||
|
@ -112,7 +112,7 @@
|
||||
:http-request="upload"
|
||||
:file-list="fileList"
|
||||
>
|
||||
<i class="el-icon-plus"/>
|
||||
<i class="el-icon-plus" />
|
||||
</el-upload>
|
||||
<el-dialog
|
||||
top="25vh"
|
||||
|
@ -67,6 +67,19 @@
|
||||
:title="data.name"
|
||||
>{{ data.name }}</span>
|
||||
</span>
|
||||
<span
|
||||
v-if="hasDataPermission('manage', data.privileges)"
|
||||
:title="'置顶'"
|
||||
class="child"
|
||||
@click.stop
|
||||
>
|
||||
<el-button
|
||||
icon="el-icon-upload2"
|
||||
type="text"
|
||||
size="small"
|
||||
@click="toTop(data, node)"
|
||||
/>
|
||||
</span>
|
||||
<span
|
||||
style="margin-left: 12px"
|
||||
class="child"
|
||||
@ -431,7 +444,16 @@ import LinkGenerate from '@/views/link/generate'
|
||||
import { uuid } from 'vue-uuid'
|
||||
import bus from '@/utils/bus'
|
||||
import EditPanel from './editPanel'
|
||||
import { addGroup, defaultTree, delGroup, groupTree, initPanelData, panelUpdate, viewPanelLog } from '@/api/panel/panel'
|
||||
import {
|
||||
addGroup,
|
||||
defaultTree,
|
||||
delGroup,
|
||||
groupTree,
|
||||
initPanelData,
|
||||
panelToTop,
|
||||
panelUpdate,
|
||||
viewPanelLog
|
||||
} from '@/api/panel/panel'
|
||||
import { mapState } from 'vuex'
|
||||
import { DEFAULT_COMMON_CANVAS_STYLE_STRING } from '@/views/panel/panel'
|
||||
import TreeSelector from '@/components/treeSelector'
|
||||
@ -442,6 +464,7 @@ export default {
|
||||
components: { GrantAuth, LinkGenerate, EditPanel, TreeSelector },
|
||||
data() {
|
||||
return {
|
||||
lastActiveDefaultPanelId: null, // 激活的节点 在这个节点下面动态放置子节点
|
||||
responseSource: 'panelQuery',
|
||||
defaultExpansion: false,
|
||||
clearLocalStorage: ['chart-tree', 'dataset-tree'],
|
||||
@ -591,13 +614,13 @@ export default {
|
||||
},
|
||||
mounted() {
|
||||
this.clearCanvas()
|
||||
this.defaultTree(true)
|
||||
this.initCache()
|
||||
const routerParam = this.$router.currentRoute.params
|
||||
if (routerParam && routerParam.responseSource === 'appApply') {
|
||||
this.responseSource = routerParam.responseSource
|
||||
this.lastActiveNode = routerParam
|
||||
this.tree()
|
||||
this.defaultTree(true, false)
|
||||
} else if (
|
||||
routerParam &&
|
||||
routerParam.nodeType === 'panel' &&
|
||||
@ -605,12 +628,19 @@ export default {
|
||||
) {
|
||||
this.historyRequestId = routerParam.requestId
|
||||
this.tree()
|
||||
this.defaultTree(true, false)
|
||||
this.edit(routerParam, null)
|
||||
} else {
|
||||
this.defaultTree(true, true)
|
||||
this.tree(true)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
toTop(data, node) {
|
||||
panelToTop(data.id).then(() => {
|
||||
this.defaultTree()
|
||||
})
|
||||
},
|
||||
fromAppActive() {
|
||||
this.activeNodeAndClickOnly(this.lastActiveNode)
|
||||
this.clearLocalStorage.forEach((item) => {
|
||||
@ -637,7 +667,7 @@ export default {
|
||||
closeEditPanelDialog(panelInfo) {
|
||||
this.editPanel.visible = false
|
||||
if (panelInfo) {
|
||||
this.defaultTree()
|
||||
this.defaultTree(false)
|
||||
this.tree()
|
||||
if (this.editPanel.optType === 'rename' && panelInfo.id === this.$store.state.panel.panelInfo.id) {
|
||||
this.$store.state.panel.panelInfo.name = panelInfo.name
|
||||
@ -809,7 +839,7 @@ export default {
|
||||
showClose: true
|
||||
})
|
||||
this.tree()
|
||||
this.defaultTree()
|
||||
this.defaultTree(false)
|
||||
})
|
||||
} else {
|
||||
this.$message({
|
||||
@ -837,7 +867,7 @@ export default {
|
||||
})
|
||||
this.clearCanvas()
|
||||
this.tree()
|
||||
this.defaultTree()
|
||||
this.defaultTree(false)
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
@ -887,7 +917,7 @@ export default {
|
||||
}
|
||||
})
|
||||
},
|
||||
defaultTree(cache = false) {
|
||||
defaultTree(cache = false, showFirst = false) {
|
||||
const requestInfo = {
|
||||
panelType: 'system'
|
||||
}
|
||||
@ -896,21 +926,38 @@ export default {
|
||||
|
||||
if (userCache) {
|
||||
this.defaultData = JSON.parse(modelInfo)
|
||||
if (showFirst && this.defaultData.length > 0) {
|
||||
this.activeDefaultNodeAndClickOnly(this.defaultData[0].id)
|
||||
}
|
||||
}
|
||||
const currentKey = this.$refs.default_panel_tree.getCurrentKey()
|
||||
defaultTree(requestInfo, false).then((res) => {
|
||||
localStorage.setItem('panel-default-tree', JSON.stringify(res.data))
|
||||
if (!userCache) {
|
||||
this.defaultData = res.data
|
||||
if (showFirst && this.defaultData.length > 0) {
|
||||
this.activeDefaultNodeAndClickOnly(this.defaultData[0].id)
|
||||
}
|
||||
}
|
||||
if (this.filterText) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.default_panel_tree.filter(this.filterText)
|
||||
})
|
||||
}
|
||||
if (currentKey) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.default_panel_tree.setCurrentKey(currentKey)
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
nodeClick(data, node) {
|
||||
if (data.panelType === 'self') {
|
||||
this.$refs.default_panel_tree.setCurrentKey(null)
|
||||
} else {
|
||||
this.$refs.panel_list_tree.setCurrentKey(null)
|
||||
}
|
||||
this.lastActiveNode = node
|
||||
this.lastActiveNodeData = data
|
||||
this.activeTree = data.panelType
|
||||
@ -1029,6 +1076,20 @@ export default {
|
||||
})
|
||||
}
|
||||
},
|
||||
// 激活当前默认仪表板节点节点
|
||||
activeDefaultNodeAndClickOnly(panelId) {
|
||||
if (panelId) {
|
||||
const _this = this
|
||||
_this.$nextTick(() => {
|
||||
_this.$refs.panel_list_tree.setCurrentKey(null)
|
||||
// 延迟设置CurrentKey
|
||||
_this.$refs.default_panel_tree.setCurrentKey(panelId)
|
||||
_this.$nextTick(() => {
|
||||
document.querySelector('.is-current').firstChild.click()
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
moveTo(data) {
|
||||
const _this = this
|
||||
this.moveInfo = data
|
||||
|
Loading…
Reference in New Issue
Block a user