2021-03-08 14:31:09 +08:00
|
|
|
<template xmlns:el-col="http://www.w3.org/1999/html">
|
|
|
|
<el-col>
|
2021-03-08 18:43:28 +08:00
|
|
|
<!-- panel list -->
|
|
|
|
<el-col>
|
2021-03-08 14:31:09 +08:00
|
|
|
<el-row>
|
|
|
|
<span class="header-title">默认仪表盘</span>
|
|
|
|
<div class="block">
|
|
|
|
<el-tree
|
|
|
|
:default-expanded-keys="expandedArray"
|
2021-03-08 18:43:28 +08:00
|
|
|
:data="defaultData"
|
2021-03-08 14:31:09 +08:00
|
|
|
node-key="id"
|
|
|
|
:expand-on-click-node="true"
|
2021-04-09 13:53:04 +08:00
|
|
|
@node-click="nodeClick"
|
2021-03-08 14:31:09 +08:00
|
|
|
>
|
2021-03-16 18:28:19 +08:00
|
|
|
<span slot-scope="{ data }" class="custom-tree-node">
|
2021-03-08 14:31:09 +08:00
|
|
|
<span>
|
|
|
|
<span>
|
|
|
|
<el-button
|
|
|
|
icon="el-icon-picture-outline"
|
|
|
|
type="text"
|
|
|
|
/>
|
|
|
|
</span>
|
|
|
|
<span style="margin-left: 6px">{{ data.name }}</span>
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
</el-tree>
|
|
|
|
</div>
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
<el-row>
|
|
|
|
<span class="header-title">仪表盘列表</span>
|
|
|
|
</el-row>
|
|
|
|
<el-col class="custom-tree-container">
|
|
|
|
<div class="block">
|
|
|
|
<el-tree
|
|
|
|
:default-expanded-keys="expandedArray"
|
|
|
|
:data="tData"
|
|
|
|
node-key="id"
|
|
|
|
:expand-on-click-node="true"
|
|
|
|
@node-click="nodeClick"
|
|
|
|
>
|
|
|
|
<span slot-scope="{ node, data }" class="custom-tree-node">
|
|
|
|
<span>
|
2021-03-08 18:43:28 +08:00
|
|
|
<span v-if="data.nodeType === 'panel'">
|
2021-03-08 14:31:09 +08:00
|
|
|
<el-button
|
2021-03-08 18:43:28 +08:00
|
|
|
icon="el-icon-picture-outline"
|
2021-03-08 14:31:09 +08:00
|
|
|
type="text"
|
|
|
|
/>
|
|
|
|
</span>
|
|
|
|
<span style="margin-left: 6px">{{ data.name }}</span>
|
|
|
|
</span>
|
|
|
|
<span>
|
2021-03-08 18:43:28 +08:00
|
|
|
<span v-if="data.nodeType ==='folder'" @click.stop>
|
2021-04-21 18:48:57 +08:00
|
|
|
<el-dropdown trigger="click" size="small" @command="showEditPanel">
|
2021-03-08 14:31:09 +08:00
|
|
|
<span class="el-dropdown-link">
|
|
|
|
<el-button
|
|
|
|
icon="el-icon-plus"
|
|
|
|
type="text"
|
|
|
|
size="small"
|
|
|
|
/>
|
|
|
|
</span>
|
|
|
|
<el-dropdown-menu slot="dropdown">
|
2021-04-21 18:48:57 +08:00
|
|
|
<el-dropdown-item icon="el-icon-circle-plus" :command="beforeClickEdit('folder','new',data,node)">
|
2021-03-08 18:43:28 +08:00
|
|
|
{{ $t('panel.groupAdd') }}
|
2021-03-08 14:31:09 +08:00
|
|
|
</el-dropdown-item>
|
2021-04-21 18:48:57 +08:00
|
|
|
<el-dropdown-item icon="el-icon-folder-add" :command="beforeClickEdit('panel','new',data,node)">
|
2021-03-08 18:43:28 +08:00
|
|
|
{{ $t('panel.panelAdd') }}
|
2021-03-08 14:31:09 +08:00
|
|
|
</el-dropdown-item>
|
|
|
|
</el-dropdown-menu>
|
|
|
|
</el-dropdown>
|
|
|
|
</span>
|
|
|
|
<span style="margin-left: 12px;" @click.stop>
|
|
|
|
<el-dropdown trigger="click" size="small" @command="clickMore">
|
|
|
|
<span class="el-dropdown-link">
|
|
|
|
<el-button
|
|
|
|
icon="el-icon-more"
|
|
|
|
type="text"
|
|
|
|
size="small"
|
|
|
|
/>
|
|
|
|
</span>
|
|
|
|
<el-dropdown-menu slot="dropdown">
|
2021-04-22 10:33:51 +08:00
|
|
|
<el-dropdown-item icon="el-icon-edit-outline" :command="beforeClickMore('rename',data,node)">
|
2021-03-08 18:43:28 +08:00
|
|
|
{{ $t('panel.rename') }}
|
2021-03-08 14:31:09 +08:00
|
|
|
</el-dropdown-item>
|
|
|
|
<el-dropdown-item icon="el-icon-delete" :command="beforeClickMore('delete',data,node)">
|
2021-03-08 18:43:28 +08:00
|
|
|
{{ $t('panel.delete') }}
|
2021-03-08 14:31:09 +08:00
|
|
|
</el-dropdown-item>
|
2021-03-16 18:28:19 +08:00
|
|
|
<el-dropdown-item v-if="data.nodeType==='panel'" icon="el-icon-share" :command="beforeClickMore('share',data,node)">
|
|
|
|
{{ $t('panel.share') }}
|
|
|
|
</el-dropdown-item>
|
2021-03-22 19:05:35 +08:00
|
|
|
<el-dropdown-item v-if="data.nodeType==='panel'" icon="el-icon-edit" :command="beforeClickMore('edit',data,node)">
|
|
|
|
{{ $t('panel.edit') }}
|
|
|
|
</el-dropdown-item>
|
2021-03-25 18:58:05 +08:00
|
|
|
|
|
|
|
<el-dropdown-item v-if="data.nodeType==='panel'" icon="el-icon-paperclip" :command="beforeClickMore('link',data,node)">
|
|
|
|
创建公共链接
|
|
|
|
</el-dropdown-item>
|
2021-03-08 14:31:09 +08:00
|
|
|
</el-dropdown-menu>
|
|
|
|
</el-dropdown>
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
</el-tree>
|
|
|
|
</div>
|
|
|
|
</el-col>
|
|
|
|
|
|
|
|
<el-dialog :title="dialogTitle" :visible="editGroup" :show-close="false" width="30%">
|
|
|
|
<el-form ref="groupForm" :model="groupForm" :rules="groupFormRules">
|
|
|
|
<el-form-item :label="$t('commons.name')" prop="name">
|
2021-03-08 21:10:16 +08:00
|
|
|
<el-input v-model="groupForm.name" />
|
2021-03-08 14:31:09 +08:00
|
|
|
</el-form-item>
|
|
|
|
</el-form>
|
|
|
|
<div slot="footer" class="dialog-footer">
|
2021-03-08 18:43:28 +08:00
|
|
|
<el-button size="mini" @click="close()">{{ $t('panel.cancel') }}</el-button>
|
|
|
|
<el-button type="primary" size="mini" @click="saveGroup(groupForm)">{{ $t('panel.confirm') }}
|
2021-03-08 14:31:09 +08:00
|
|
|
</el-button>
|
|
|
|
</div>
|
|
|
|
</el-dialog>
|
2021-03-16 18:28:19 +08:00
|
|
|
|
|
|
|
<el-dialog
|
2021-03-17 11:22:18 +08:00
|
|
|
:title="authTitle"
|
2021-03-16 18:28:19 +08:00
|
|
|
:visible.sync="authVisible"
|
2021-03-17 18:50:29 +08:00
|
|
|
custom-class="de-dialog"
|
2021-03-16 18:28:19 +08:00
|
|
|
>
|
2021-03-18 16:55:31 +08:00
|
|
|
<grant-auth v-if="authVisible" :resource-id="authResourceId" @close-grant="closeGrant" />
|
2021-03-16 18:28:19 +08:00
|
|
|
</el-dialog>
|
2021-03-25 18:58:05 +08:00
|
|
|
|
|
|
|
<el-dialog
|
|
|
|
:title="linkTitle"
|
|
|
|
:visible.sync="linkVisible"
|
2021-03-29 14:15:39 +08:00
|
|
|
width="500px"
|
2021-03-25 18:58:05 +08:00
|
|
|
@closed="removeLink"
|
|
|
|
>
|
|
|
|
<link-generate v-if="linkVisible" :resource-id="linkResourceId" />
|
|
|
|
<!-- <span slot="footer" class="dialog-footer">
|
|
|
|
<el-button @click="copyUri">复制链接</el-button>
|
|
|
|
</span> -->
|
|
|
|
</el-dialog>
|
2021-04-21 18:48:57 +08:00
|
|
|
<!--新建仪表盘dialog-->
|
|
|
|
<el-dialog :title="panelDialogTitle" :visible.sync="editPanel.visible" :show-close="true" width="600px">
|
|
|
|
<edit-panel v-if="editPanel.visible" :edit-panel="editPanel" @closeEditPanelDialog="closeEditPanelDialog" />
|
|
|
|
</el-dialog>
|
2021-03-08 14:31:09 +08:00
|
|
|
</el-col>
|
|
|
|
</el-col>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2021-03-17 11:22:18 +08:00
|
|
|
import GrantAuth from '../GrantAuth'
|
2021-03-25 18:58:05 +08:00
|
|
|
import LinkGenerate from '@/views/link/generate'
|
2021-04-01 11:38:30 +08:00
|
|
|
import { uuid } from 'vue-uuid'
|
|
|
|
import bus from '@/utils/bus'
|
2021-04-21 18:48:57 +08:00
|
|
|
import EditPanel from './EditPanel'
|
|
|
|
import { addGroup, delGroup, groupTree, defaultTree, get } from '@/api/panel/panel'
|
2021-05-06 23:40:34 +08:00
|
|
|
import {
|
|
|
|
DEFAULT_COLOR_CASE,
|
|
|
|
DEFAULT_SIZE,
|
|
|
|
DEFAULT_TITLE_STYLE,
|
|
|
|
DEFAULT_LEGEND_STYLE,
|
|
|
|
DEFAULT_LABEL,
|
|
|
|
DEFAULT_TOOLTIP,
|
|
|
|
DEFAULT_XAXIS_STYLE,
|
|
|
|
DEFAULT_YAXIS_STYLE,
|
|
|
|
DEFAULT_BACKGROUND_COLOR
|
|
|
|
} from '@/views/chart/chart/chart'
|
|
|
|
|
|
|
|
import { DEFAULT_PANEL_STYLE } from '@/views/panel/panel'
|
2021-03-08 21:10:16 +08:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'PanelList',
|
2021-04-21 18:48:57 +08:00
|
|
|
components: { GrantAuth, LinkGenerate, EditPanel },
|
2021-03-08 21:10:16 +08:00
|
|
|
data() {
|
|
|
|
return {
|
2021-04-21 18:48:57 +08:00
|
|
|
editPanelModel: {
|
|
|
|
titlePre: null,
|
|
|
|
titleSuf: null,
|
|
|
|
visible: false,
|
|
|
|
optType: null,
|
|
|
|
panelInfo: {
|
|
|
|
name: null,
|
|
|
|
pid: null,
|
|
|
|
level: null,
|
|
|
|
nodeType: null,
|
|
|
|
panelType: null,
|
2021-05-06 23:40:34 +08:00
|
|
|
panelStyle: JSON.stringify({
|
|
|
|
width: 1680,
|
|
|
|
height: 1050,
|
|
|
|
scale: 100,
|
|
|
|
openCommonStyle: true,
|
|
|
|
panel: DEFAULT_PANEL_STYLE,
|
|
|
|
chart: {
|
|
|
|
xaxis: '[]',
|
|
|
|
yaxis: '[]',
|
|
|
|
show: true,
|
|
|
|
type: 'panel',
|
|
|
|
title: '',
|
|
|
|
customAttr: JSON.stringify({
|
|
|
|
color: DEFAULT_COLOR_CASE,
|
|
|
|
size: DEFAULT_SIZE,
|
|
|
|
label: DEFAULT_LABEL,
|
|
|
|
tooltip: DEFAULT_TOOLTIP
|
|
|
|
}),
|
|
|
|
customStyle: JSON.stringify({
|
|
|
|
text: DEFAULT_TITLE_STYLE,
|
|
|
|
legend: DEFAULT_LEGEND_STYLE,
|
|
|
|
xAxis: DEFAULT_XAXIS_STYLE,
|
|
|
|
yAxis: DEFAULT_YAXIS_STYLE,
|
|
|
|
background: DEFAULT_BACKGROUND_COLOR
|
|
|
|
}),
|
|
|
|
customFilter: '[]'
|
|
|
|
}}),
|
|
|
|
panelData: '[]'
|
2021-04-21 18:48:57 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
editPanel: {
|
|
|
|
titlePre: null,
|
|
|
|
titleSuf: '仪表盘',
|
|
|
|
visible: false,
|
|
|
|
optType: 'new',
|
|
|
|
panelInfo: {
|
|
|
|
name: null,
|
|
|
|
pid: null,
|
|
|
|
level: null,
|
|
|
|
nodeType: null,
|
|
|
|
panelType: null,
|
2021-05-06 23:40:34 +08:00
|
|
|
panelStyle: JSON.stringify({
|
|
|
|
width: 1680,
|
|
|
|
height: 1050,
|
|
|
|
scale: 100,
|
|
|
|
openCommonStyle: true,
|
|
|
|
panel: DEFAULT_PANEL_STYLE,
|
|
|
|
chart: {
|
|
|
|
xaxis: '[]',
|
|
|
|
yaxis: '[]',
|
|
|
|
show: true,
|
|
|
|
type: 'panel',
|
|
|
|
title: '',
|
|
|
|
customAttr: JSON.stringify({
|
|
|
|
color: DEFAULT_COLOR_CASE,
|
|
|
|
size: DEFAULT_SIZE,
|
|
|
|
label: DEFAULT_LABEL,
|
|
|
|
tooltip: DEFAULT_TOOLTIP
|
|
|
|
}),
|
|
|
|
customStyle: JSON.stringify({
|
|
|
|
text: DEFAULT_TITLE_STYLE,
|
|
|
|
legend: DEFAULT_LEGEND_STYLE,
|
|
|
|
xAxis: DEFAULT_XAXIS_STYLE,
|
|
|
|
yAxis: DEFAULT_YAXIS_STYLE,
|
|
|
|
background: DEFAULT_BACKGROUND_COLOR
|
|
|
|
}),
|
|
|
|
customFilter: '[]'
|
|
|
|
}}),
|
|
|
|
panelData: '[]'
|
2021-04-21 18:48:57 +08:00
|
|
|
}
|
|
|
|
},
|
2021-03-25 18:58:05 +08:00
|
|
|
linkTitle: '链接分享',
|
|
|
|
linkVisible: false,
|
|
|
|
linkResourceId: null,
|
2021-03-17 11:22:18 +08:00
|
|
|
authTitle: null,
|
|
|
|
authResourceId: null,
|
2021-03-16 18:28:19 +08:00
|
|
|
authVisible: false,
|
2021-03-08 21:10:16 +08:00
|
|
|
defaultData: [],
|
|
|
|
dialogTitle: '',
|
|
|
|
search: '',
|
|
|
|
editGroup: false,
|
|
|
|
tData: [],
|
|
|
|
tableData: [],
|
|
|
|
currGroup: {},
|
|
|
|
expandedArray: [],
|
|
|
|
groupForm: {
|
|
|
|
name: null,
|
|
|
|
pid: null,
|
|
|
|
level: 0,
|
|
|
|
nodeType: null,
|
|
|
|
children: [],
|
|
|
|
sort: 'node_type desc,name asc'
|
2021-03-08 14:31:09 +08:00
|
|
|
},
|
2021-03-08 21:10:16 +08:00
|
|
|
tableForm: {
|
|
|
|
name: '',
|
|
|
|
mode: '',
|
|
|
|
sort: 'node_type asc,create_time desc,name asc'
|
2021-03-08 14:31:09 +08:00
|
|
|
},
|
2021-03-08 21:10:16 +08:00
|
|
|
groupFormRules: {
|
|
|
|
name: [
|
|
|
|
{ required: true, message: this.$t('commons.input_content'), trigger: 'blur' }
|
|
|
|
]
|
2021-03-08 14:31:09 +08:00
|
|
|
},
|
2021-03-08 21:10:16 +08:00
|
|
|
tableFormRules: {
|
|
|
|
name: [
|
|
|
|
{ required: true, message: this.$t('commons.input_content'), trigger: 'blur' }
|
|
|
|
],
|
|
|
|
mode: [
|
|
|
|
{ required: true, message: this.$t('commons.input_content'), trigger: 'blur' }
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
2021-04-21 18:48:57 +08:00
|
|
|
panelDialogTitle() {
|
|
|
|
return this.editPanel.titlePre + this.editPanel.titleSuf
|
|
|
|
}
|
2021-03-08 21:10:16 +08:00
|
|
|
},
|
|
|
|
watch: {
|
2021-04-21 18:48:57 +08:00
|
|
|
|
2021-03-08 21:10:16 +08:00
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
this.defaultTree()
|
|
|
|
this.tree(this.groupForm)
|
|
|
|
},
|
|
|
|
methods: {
|
2021-04-21 18:48:57 +08:00
|
|
|
closeEditPanelDialog() {
|
|
|
|
this.editPanel.visible = false
|
|
|
|
this.tree(this.groupForm)
|
2021-03-08 21:10:16 +08:00
|
|
|
},
|
2021-04-21 18:48:57 +08:00
|
|
|
showEditPanel(param) {
|
|
|
|
this.editPanel = JSON.parse(JSON.stringify(this.editPanelModel))
|
|
|
|
this.editPanel.optType = param.optType
|
|
|
|
this.editPanel.panelInfo.nodeType = param.type
|
|
|
|
this.editPanel.visible = true
|
|
|
|
switch (param.optType) {
|
|
|
|
case 'new':
|
|
|
|
this.editPanel.titlePre = '新建'
|
|
|
|
this.editPanel.panelInfo.name = '新建仪表盘'
|
|
|
|
this.editPanel.panelInfo.pid = param.data.id
|
|
|
|
this.editPanel.panelInfo.level = param.data.level + 1
|
|
|
|
break
|
|
|
|
case 'edit':
|
2021-04-22 10:33:51 +08:00
|
|
|
case 'rename':
|
2021-04-21 18:48:57 +08:00
|
|
|
this.editPanel.titlePre = '编辑'
|
|
|
|
this.editPanel.panelInfo.id = param.data.id
|
|
|
|
this.editPanel.panelInfo.name = param.data.name
|
|
|
|
break
|
|
|
|
}
|
|
|
|
switch (param.type) {
|
|
|
|
case 'folder':
|
|
|
|
this.editPanel.titleSuf = '目录'
|
|
|
|
break
|
|
|
|
case 'panel':
|
|
|
|
this.editPanel.titleSuf = '仪表盘'
|
|
|
|
break
|
|
|
|
}
|
|
|
|
},
|
|
|
|
beforeClickEdit(type, optType, data, node) {
|
2021-03-08 21:10:16 +08:00
|
|
|
return {
|
|
|
|
'type': type,
|
|
|
|
'data': data,
|
2021-04-21 18:48:57 +08:00
|
|
|
'node': node,
|
|
|
|
'optType': optType
|
2021-03-08 21:10:16 +08:00
|
|
|
}
|
|
|
|
},
|
2021-03-08 14:31:09 +08:00
|
|
|
|
2021-03-08 21:10:16 +08:00
|
|
|
clickMore(param) {
|
2021-04-21 18:48:57 +08:00
|
|
|
switch (param.optType) {
|
2021-04-22 10:33:51 +08:00
|
|
|
case 'rename':
|
2021-04-21 18:48:57 +08:00
|
|
|
this.showEditPanel(param)
|
2021-03-08 21:10:16 +08:00
|
|
|
break
|
|
|
|
case 'move':
|
|
|
|
break
|
|
|
|
case 'delete':
|
|
|
|
this.delete(param.data)
|
|
|
|
break
|
2021-03-16 18:28:19 +08:00
|
|
|
case 'share':
|
|
|
|
this.share(param.data)
|
|
|
|
break
|
2021-04-22 10:33:51 +08:00
|
|
|
case 'edit':
|
|
|
|
this.edit(param.data)
|
|
|
|
break
|
2021-03-25 18:58:05 +08:00
|
|
|
case 'link':
|
|
|
|
this.link(param.data)
|
|
|
|
break
|
2021-03-08 21:10:16 +08:00
|
|
|
}
|
|
|
|
},
|
2021-03-08 14:31:09 +08:00
|
|
|
|
2021-04-21 18:48:57 +08:00
|
|
|
beforeClickMore(optType, data, node) {
|
2021-03-08 21:10:16 +08:00
|
|
|
return {
|
2021-04-21 18:48:57 +08:00
|
|
|
'type': data.nodeType,
|
2021-03-08 21:10:16 +08:00
|
|
|
'data': data,
|
2021-04-21 18:48:57 +08:00
|
|
|
'node': node,
|
|
|
|
'optType': optType
|
2021-03-08 21:10:16 +08:00
|
|
|
}
|
|
|
|
},
|
2021-03-08 14:31:09 +08:00
|
|
|
|
2021-03-08 21:10:16 +08:00
|
|
|
add(nodeType) {
|
2021-04-21 18:48:57 +08:00
|
|
|
this.groupForm.nodeType = nodeType
|
2021-03-08 21:10:16 +08:00
|
|
|
switch (nodeType) {
|
|
|
|
case 'folder':
|
|
|
|
this.dialogTitle = this.$t('panel.groupAdd')
|
2021-04-21 18:48:57 +08:00
|
|
|
this.editGroup = true
|
2021-03-08 21:10:16 +08:00
|
|
|
break
|
|
|
|
case 'panel':
|
2021-04-21 18:48:57 +08:00
|
|
|
this.editPanel.title = this.$t('panel.panelAdd')
|
|
|
|
this.editPanel.visible = true
|
2021-03-08 21:10:16 +08:00
|
|
|
break
|
|
|
|
}
|
|
|
|
},
|
2021-03-08 14:31:09 +08:00
|
|
|
|
2021-03-08 21:10:16 +08:00
|
|
|
saveGroup(group) {
|
|
|
|
this.$refs['groupForm'].validate((valid) => {
|
|
|
|
if (valid) {
|
|
|
|
addGroup(group).then(res => {
|
|
|
|
this.close()
|
2021-03-08 14:31:09 +08:00
|
|
|
this.$message({
|
2021-03-08 21:10:16 +08:00
|
|
|
message: this.$t('commons.save_success'),
|
2021-03-08 14:31:09 +08:00
|
|
|
type: 'success',
|
|
|
|
showClose: true
|
|
|
|
})
|
|
|
|
this.tree(this.groupForm)
|
|
|
|
})
|
2021-03-08 21:10:16 +08:00
|
|
|
} else {
|
|
|
|
this.$message({
|
|
|
|
message: this.$t('commons.input_content'),
|
|
|
|
type: 'error',
|
|
|
|
showClose: true
|
|
|
|
})
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
2021-03-08 14:31:09 +08:00
|
|
|
|
2021-03-08 21:10:16 +08:00
|
|
|
delete(data) {
|
|
|
|
this.$confirm(this.$t('panel.confirm_delete'), this.$t('panel.tips'), {
|
|
|
|
confirmButtonText: this.$t('panel.confirm'),
|
|
|
|
cancelButtonText: this.$t('panel.cancel'),
|
|
|
|
type: 'warning'
|
|
|
|
}).then(() => {
|
|
|
|
delGroup(data.id).then(response => {
|
|
|
|
this.$message({
|
|
|
|
type: 'success',
|
|
|
|
message: this.$t('panel.delete_success'),
|
|
|
|
showClose: true
|
|
|
|
})
|
|
|
|
this.tree(this.groupForm)
|
2021-03-08 18:43:28 +08:00
|
|
|
})
|
2021-03-08 21:10:16 +08:00
|
|
|
}).catch(() => {
|
|
|
|
})
|
|
|
|
},
|
2021-03-08 14:31:09 +08:00
|
|
|
|
2021-03-08 21:10:16 +08:00
|
|
|
close() {
|
|
|
|
this.editGroup = false
|
|
|
|
this.groupForm = {
|
|
|
|
name: null,
|
|
|
|
pid: null,
|
|
|
|
level: 0,
|
|
|
|
nodeType: null,
|
|
|
|
children: [],
|
|
|
|
sort: 'node_type desc,name asc'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
tree(group) {
|
|
|
|
groupTree(group).then(res => {
|
|
|
|
this.tData = res.data
|
|
|
|
})
|
|
|
|
},
|
|
|
|
defaultTree() {
|
|
|
|
const requestInfo = {
|
|
|
|
panelType: 'system'
|
|
|
|
}
|
|
|
|
defaultTree(requestInfo).then(res => {
|
|
|
|
this.defaultData = res.data
|
|
|
|
})
|
|
|
|
},
|
2021-03-08 14:31:09 +08:00
|
|
|
|
2021-03-08 21:10:16 +08:00
|
|
|
nodeClick(data, node) {
|
|
|
|
if (data.nodeType === 'panel') {
|
2021-04-01 11:38:30 +08:00
|
|
|
// 加载视图数据
|
2021-04-09 13:53:04 +08:00
|
|
|
get('panel/group/findOne/' + data.id).then(response => {
|
|
|
|
this.$store.commit('setComponentData', this.resetID(JSON.parse(response.data.panelData)))
|
2021-05-06 23:40:34 +08:00
|
|
|
const temp = JSON.parse(response.data.panelStyle)
|
|
|
|
this.$store.commit('setCanvasStyle', temp)
|
2021-04-09 13:53:04 +08:00
|
|
|
this.$store.dispatch('panel/setPanelInfo', data)
|
2021-04-01 11:38:30 +08:00
|
|
|
})
|
2021-03-08 21:10:16 +08:00
|
|
|
}
|
|
|
|
if (node.expanded) {
|
|
|
|
this.expandedArray.push(data.id)
|
|
|
|
} else {
|
|
|
|
const index = this.expandedArray.indexOf(data.id)
|
|
|
|
if (index > -1) {
|
|
|
|
this.expandedArray.splice(index, 1)
|
2021-03-08 14:31:09 +08:00
|
|
|
}
|
2021-03-08 21:10:16 +08:00
|
|
|
}
|
2021-03-29 14:57:04 +08:00
|
|
|
},
|
2021-03-08 21:10:16 +08:00
|
|
|
back() {
|
|
|
|
this.sceneMode = false
|
|
|
|
this.$store.dispatch('dataset/setSceneData', null)
|
|
|
|
this.$emit('switchComponent', { name: '' })
|
|
|
|
},
|
|
|
|
beforeClickAddData(type) {
|
|
|
|
return {
|
|
|
|
'type': type
|
|
|
|
}
|
|
|
|
},
|
2021-03-08 14:31:09 +08:00
|
|
|
|
2021-03-16 18:28:19 +08:00
|
|
|
share(data) {
|
2021-03-17 11:22:18 +08:00
|
|
|
this.authResourceId = data.id
|
2021-03-17 18:50:29 +08:00
|
|
|
this.authTitle = '把[' + data.label + ']分享给'
|
2021-03-16 18:28:19 +08:00
|
|
|
this.authVisible = true
|
|
|
|
},
|
2021-03-18 16:55:31 +08:00
|
|
|
closeGrant() {
|
2021-03-17 18:50:29 +08:00
|
|
|
this.authResourceId = null
|
2021-03-18 16:55:31 +08:00
|
|
|
this.authVisible = false
|
2021-03-22 19:05:35 +08:00
|
|
|
},
|
|
|
|
edit(data) {
|
2021-03-23 17:16:51 +08:00
|
|
|
this.$store.dispatch('panel/setPanelInfo', data)
|
2021-04-01 17:40:12 +08:00
|
|
|
bus.$emit('PanelSwitchComponent', { name: 'PanelEdit' })
|
2021-03-25 18:58:05 +08:00
|
|
|
},
|
|
|
|
link(data) {
|
|
|
|
this.linkVisible = true
|
|
|
|
this.linkResourceId = data.id
|
|
|
|
},
|
|
|
|
removeLink() {
|
|
|
|
this.linkVisible = false
|
|
|
|
this.linkResourceId = null
|
2021-04-01 11:38:30 +08:00
|
|
|
},
|
|
|
|
resetID(data) {
|
2021-05-06 23:40:34 +08:00
|
|
|
if (data) {
|
2021-05-05 22:14:23 +08:00
|
|
|
data.forEach(item => {
|
|
|
|
item.id = uuid.v1()
|
|
|
|
})
|
|
|
|
}
|
2021-04-01 11:38:30 +08:00
|
|
|
|
|
|
|
return data
|
2021-03-08 14:31:09 +08:00
|
|
|
}
|
|
|
|
}
|
2021-03-08 21:10:16 +08:00
|
|
|
}
|
2021-03-08 14:31:09 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
.header-title {
|
|
|
|
font-size: 14px;
|
|
|
|
flex: 1;
|
|
|
|
color: #606266;
|
|
|
|
font-weight: bold;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
.el-divider--horizontal {
|
|
|
|
margin: 12px 0
|
|
|
|
}
|
|
|
|
|
|
|
|
.search-input {
|
|
|
|
padding: 12px 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.custom-tree-node {
|
|
|
|
flex: 1;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: space-between;
|
|
|
|
font-size: 14px;
|
|
|
|
padding-right: 8px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.custom-position {
|
|
|
|
flex: 1;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
font-size: 14px;
|
|
|
|
flex-flow: row nowrap;
|
|
|
|
}
|
|
|
|
|
|
|
|
.form-item {
|
|
|
|
margin-bottom: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.title-css {
|
|
|
|
height: 26px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.title-text {
|
|
|
|
line-height: 26px;
|
|
|
|
}
|
2021-03-17 11:22:18 +08:00
|
|
|
|
2021-03-08 14:31:09 +08:00
|
|
|
</style>
|