diff --git a/backend/src/main/java/io/dataease/controller/panel/PanelGroupController.java b/backend/src/main/java/io/dataease/controller/panel/PanelGroupController.java
index 217ab70c06..28bb812286 100644
--- a/backend/src/main/java/io/dataease/controller/panel/PanelGroupController.java
+++ b/backend/src/main/java/io/dataease/controller/panel/PanelGroupController.java
@@ -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);
+ }
}
diff --git a/backend/src/main/java/io/dataease/ext/ExtPanelGroupMapper.xml b/backend/src/main/java/io/dataease/ext/ExtPanelGroupMapper.xml
index d9249ab5d9..1354bc5b56 100644
--- a/backend/src/main/java/io/dataease/ext/ExtPanelGroupMapper.xml
+++ b/backend/src/main/java/io/dataease/ext/ExtPanelGroupMapper.xml
@@ -16,16 +16,19 @@
- 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 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 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}))
- 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}
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}
AND id NOT IN
-
+
#{viewId}
diff --git a/backend/src/main/java/io/dataease/service/panel/PanelGroupService.java b/backend/src/main/java/io/dataease/service/panel/PanelGroupService.java
index ed05bbbf6d..5ad6ab684e 100644
--- a/backend/src/main/java/io/dataease/service/panel/PanelGroupService.java
+++ b/backend/src/main/java/io/dataease/service/panel/PanelGroupService.java
@@ -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);
+
+ }
}
diff --git a/backend/src/main/resources/db/migration/V44__1.17.sql b/backend/src/main/resources/db/migration/V44__1.17.sql
index 0726c5ed68..30b3206948 100644
--- a/backend/src/main/resources/db/migration/V44__1.17.sql
+++ b/backend/src/main/resources/db/migration/V44__1.17.sql
@@ -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`;
diff --git a/frontend/src/api/panel/panel.js b/frontend/src/api/panel/panel.js
index dc41cd5079..6bd6714b92 100644
--- a/frontend/src/api/panel/panel.js
+++ b/frontend/src/api/panel/panel.js
@@ -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
+ })
+}
diff --git a/frontend/src/components/canvas/components/editor/Preview.vue b/frontend/src/components/canvas/components/editor/Preview.vue
index c8040af5aa..770930e288 100644
--- a/frontend/src/components/canvas/components/editor/Preview.vue
+++ b/frontend/src/components/canvas/components/editor/Preview.vue
@@ -115,11 +115,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: {
diff --git a/frontend/src/lang/en.js b/frontend/src/lang/en.js
index 72e253be4a..e9909f4f7e 100644
--- a/frontend/src/lang/en.js
+++ b/frontend/src/lang/en.js
@@ -1871,12 +1871,10 @@ export default {
back_parent: 'Back to previous'
},
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',
diff --git a/frontend/src/lang/tw.js b/frontend/src/lang/tw.js
index ee8d9b1d31..74b0b40a07 100644
--- a/frontend/src/lang/tw.js
+++ b/frontend/src/lang/tw.js
@@ -1871,12 +1871,10 @@ export default {
back_parent: '返回上一級'
},
panel: {
-
+ to_top: '置頂',
down: '下載',
-
mobile_style_setting: '樣式設置',
mobile_style_setting_tips: '自定義移動端背景',
-
board: '邊框',
text: '文字',
board_background: '背景',
diff --git a/frontend/src/lang/zh.js b/frontend/src/lang/zh.js
index ba5fe35c28..1ee639b2b0 100644
--- a/frontend/src/lang/zh.js
+++ b/frontend/src/lang/zh.js
@@ -1871,12 +1871,10 @@ export default {
back_parent: '返回上一级'
},
panel: {
-
+ to_top: '置顶',
down: '下载',
-
mobile_style_setting: '样式设置',
mobile_style_setting_tips: '自定义移动端背景',
-
board: '边框',
text: '文字',
board_background: '背景',
diff --git a/frontend/src/views/panel/list/PanelList.vue b/frontend/src/views/panel/list/PanelList.vue
index e8e37eff2a..4a77719708 100644
--- a/frontend/src/views/panel/list/PanelList.vue
+++ b/frontend/src/views/panel/list/PanelList.vue
@@ -67,6 +67,19 @@
:title="data.name"
>{{ data.name }}
+
+
+
{
+ 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