feat: 仪表板复用时支持选择存量视图

This commit is contained in:
wangjiahao 2022-05-25 10:53:50 +08:00
parent 1a75c3ed33
commit d8c73873a2
3 changed files with 48 additions and 30 deletions

View File

@ -329,13 +329,13 @@ public class PanelGroupService {
// result.addAll(viewResult);
// }
result = TreeUtils.mergeTree(result, "panel_list");
// if (AuthUtils.getUser().getIsAdmin()) {
// // 原有视图的目录结构
// List<VAuthModelDTO> viewOriginal = extVAuthModelMapper.queryAuthViewsOriginal(viewRequest);
// if (CollectionUtils.isNotEmpty(viewOriginal) && viewOriginal.size() > 1) {
// result.addAll(TreeUtils.mergeTree(viewOriginal, "public_chart"));
// }
// }
if (AuthUtils.getUser().getIsAdmin()) {
// 原有视图的目录结构
List<VAuthModelDTO> viewOriginal = extVAuthModelMapper.queryAuthViewsOriginal(viewRequest);
if (CollectionUtils.isNotEmpty(viewOriginal) && viewOriginal.size() > 1) {
result.addAll(TreeUtils.mergeTree(viewOriginal, "public_chart"));
}
}
}
return result;

View File

@ -226,6 +226,28 @@ export const otherList = [
}
]
export const USER_VIEW = {
id: '10005',
component: 'user-view',
label: '用户视图',
propValue: '',
icon: 'juxing',
type: 'view',
mobileStyle: BASE_MOBILE_STYLE,
hyperlinks: HYPERLINKS,
style: {
width: 300,
height: 200
},
x: 1,
y: 108,
sizex: 12,
sizey: 6,
auxiliaryMatrix: true,
miniSizex: 1,
miniSizey: 1
}
// 编辑器左侧组件列表
const list = [
{
@ -337,27 +359,7 @@ const list = [
miniSizex: 1,
miniSizey: 1
},
{
id: '10005',
component: 'user-view',
label: '用户视图',
propValue: '',
icon: 'juxing',
type: 'view',
mobileStyle: BASE_MOBILE_STYLE,
hyperlinks: HYPERLINKS,
style: {
width: 300,
height: 200
},
x: 1,
y: 108,
sizex: 12,
sizey: 6,
auxiliaryMatrix: true,
miniSizex: 1,
miniSizey: 1
},
USER_VIEW,
{
id: '10006',
component: 'de-tabs',

View File

@ -27,9 +27,12 @@ import DeMainContainer from '@/components/dataease/DeMainContainer'
import DeContainer from '@/components/dataease/DeContainer'
import DeAsideContainer from '@/components/dataease/DeAsideContainer'
import { findOne } from '@/api/panel/panel'
import { panelDataPrepare } from '@/components/canvas/utils/utils'
import { deepCopy, panelDataPrepare } from '@/components/canvas/utils/utils'
import Preview from '@/components/canvas/components/Editor/Preview'
import MultiplexingView from '@/views/panel/ViewSelect/multiplexingView'
import { DEFAULT_COMMON_CANVAS_STYLE_STRING } from '@/views/panel/panel'
import { USER_VIEW } from '@/components/canvas/custom-component/component-list'
import { uuid } from 'vue-uuid'
export default {
name: 'Multiplexing',
@ -61,7 +64,7 @@ export default {
methods: {
showDetails(params) {
const _this = this
_this.selectedPanel = params.showId
_this.selectedPanel = params
if (params.showType === 'panel') {
this.panelLoading = true
findOne(params.showId).then(response => {
@ -71,6 +74,19 @@ export default {
_this.canvasStyleData = rsp.componentStyle
})
})
} else if (params.showType === 'view') {
const componentId = uuid.v1()
_this.canvasStyleData = deepCopy(DEFAULT_COMMON_CANVAS_STYLE_STRING)
const userView = {
... deepCopy(USER_VIEW),
'id': componentId }
userView.style.width = _this.canvasStyleData.width
userView.style.height = _this.canvasStyleData.height
userView['propValue'] = {
'viewId': params.showId,
'id': componentId
}
_this.componentData.push(userView)
}
}
}