mirror of
https://github.com/dataease/dataease.git
synced 2026-05-19 10:18:11 +08:00
Merge branch 'main' of github.com:dataease/dataease into main
This commit is contained in:
@@ -69,6 +69,13 @@ export function panelSave(data) {
|
||||
data
|
||||
})
|
||||
}
|
||||
export function findOne(id) {
|
||||
return request({
|
||||
url: 'panel/group/findOne/' + id,
|
||||
method: 'get',
|
||||
loading: true
|
||||
})
|
||||
}
|
||||
|
||||
export function getTable(id) {
|
||||
return request({
|
||||
|
||||
@@ -160,7 +160,7 @@ export default {
|
||||
handleFileChange(e) {
|
||||
const file = e.target.files[0]
|
||||
if (!file.type.includes('image')) {
|
||||
toast(this.$t('panel.picture_limit'))
|
||||
toast('只能插入图片')
|
||||
return
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ export default {
|
||||
panelData: JSON.stringify(this.componentData)
|
||||
}
|
||||
post('panel/group/save', requestInfo, () => {})
|
||||
this.$message.success(this.$t('commons.save_success'))
|
||||
this.$message.success('保存成功')
|
||||
},
|
||||
clearCanvas() {
|
||||
this.$store.commit('setComponentData', [])
|
||||
|
||||
@@ -8,7 +8,8 @@ const getDefaultState = () => {
|
||||
preStyle: null
|
||||
},
|
||||
canvasStyleDataTemp: null, // 页面全局临时存储数据
|
||||
componentDataTemp: null // 画布组件临时存储数据
|
||||
componentDataTemp: null, // 画布组件临时存储数据
|
||||
mainActiveName: 'PanelMain'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +19,9 @@ const mutations = {
|
||||
setPanelName: (state, panelName) => {
|
||||
state.panelName = panelName
|
||||
},
|
||||
setMainActiveName: (state, mainActiveName) => {
|
||||
state.mainActiveName = mainActiveName
|
||||
},
|
||||
setPanelInfo: (state, panelInfo) => {
|
||||
state.panelInfo = panelInfo
|
||||
},
|
||||
@@ -33,6 +37,9 @@ const actions = {
|
||||
setPanelName({ commit }, panelName) {
|
||||
commit('setPanelName', panelName)
|
||||
},
|
||||
setMainActiveName({ commit }, mainActiveName) {
|
||||
commit('setMainActiveName', mainActiveName)
|
||||
},
|
||||
setPanelInfo({ commit }, panelInfo) {
|
||||
commit('setPanelInfo', panelInfo)
|
||||
},
|
||||
|
||||
@@ -140,6 +140,7 @@ import { uuid } from 'vue-uuid'
|
||||
import Toolbar from '@/components/canvas/components/Toolbar'
|
||||
import { get } from '@/api/panel/panel'
|
||||
import PreviewFullScreen from '@/components/canvas/components/Editor/PreviewFullScreen'
|
||||
import Preview from '@/components/canvas/components/Editor/Preview'
|
||||
|
||||
// 引入样式
|
||||
import '@/components/canvas/assets/iconfont/iconfont.css'
|
||||
@@ -160,7 +161,8 @@ export default {
|
||||
Toolbar,
|
||||
FilterDialog,
|
||||
SubjectSetting,
|
||||
PreviewFullScreen
|
||||
PreviewFullScreen,
|
||||
Preview
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -350,8 +352,6 @@ export default {
|
||||
},
|
||||
|
||||
deselectCurComponent(e) {
|
||||
console.log('deselectCurComponent123')
|
||||
|
||||
if (!this.isClickComponent) {
|
||||
this.$store.commit('setCurComponent', { component: null, index: null })
|
||||
}
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
<template>
|
||||
<de-container v-loading="$store.getters.loadingMap[$store.getters.currentPath]" style="background-color: #f7f8fa">
|
||||
<de-main-container>
|
||||
<component :is="component" :param="param" />
|
||||
<panel-main v-show="componentName==='PanelMain'" />
|
||||
<chart-edit v-if="componentName==='ChartEdit'" />
|
||||
<panel-edit v-if="componentName==='PanelEdit'" />
|
||||
<!-- <component :is="component" :param="param" />-->
|
||||
</de-main-container>
|
||||
</de-container>
|
||||
</template>
|
||||
@@ -20,23 +23,29 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
component: PanelMain,
|
||||
componentName: 'PanelMain',
|
||||
param: {}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
bus.$on('PanelSwitchComponent', (c) => {
|
||||
this.param = c.param
|
||||
switch (c.name) {
|
||||
case 'PanelEdit':
|
||||
this.component = PanelEdit
|
||||
break
|
||||
case 'ChartEdit':
|
||||
this.component = ChartEdit
|
||||
break
|
||||
default:
|
||||
this.component = PanelMain
|
||||
break
|
||||
}
|
||||
this.componentName = c.name
|
||||
this.$store.dispatch('panel/setMainActiveName', c.name)
|
||||
// switch (c.name) {
|
||||
// case 'PanelEdit':
|
||||
// this.component = PanelEdit
|
||||
// this.componentName = 'PanelEdit'
|
||||
// break
|
||||
// case 'ChartEdit':
|
||||
// this.component = ChartEdit
|
||||
// this.componentName = 'ChartEdit'
|
||||
// break
|
||||
// default:
|
||||
// this.component = PanelMain
|
||||
// this.componentName = 'PanelMain'
|
||||
// break
|
||||
// }
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
:default-expanded-keys="expandedArray"
|
||||
:data="defaultData"
|
||||
node-key="id"
|
||||
highlight-current
|
||||
:expand-on-click-node="true"
|
||||
@node-click="nodeClick"
|
||||
>
|
||||
@@ -19,7 +20,7 @@
|
||||
<span style="margin-left: 6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;">{{ data.name }}</span>
|
||||
</span>
|
||||
<span style="margin-left: 12px;" @click.stop>
|
||||
<el-dropdown trigger="click" size="small" @command="clickMore">
|
||||
<el-dropdown v-if="hasDataPermission('manage',data.privileges)" trigger="click" size="small" @command="clickMore">
|
||||
<span class="el-dropdown-link">
|
||||
<el-button
|
||||
icon="el-icon-more"
|
||||
@@ -57,6 +58,7 @@
|
||||
:default-expanded-keys="expandedArray"
|
||||
:data="tData"
|
||||
node-key="id"
|
||||
highlight-current
|
||||
:expand-on-click-node="true"
|
||||
@node-click="nodeClick"
|
||||
>
|
||||
@@ -158,7 +160,7 @@
|
||||
</el-dialog>
|
||||
<!--新建仪表盘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" />
|
||||
<edit-panel v-if="editPanel.visible" :edit-panel="editPanel" @closeEditPanelDialog="closeEditPanelDialog" @newPanelSave="newPanelSave" />
|
||||
</el-dialog>
|
||||
</el-col>
|
||||
</el-col>
|
||||
@@ -170,7 +172,7 @@ import LinkGenerate from '@/views/link/generate'
|
||||
import { uuid } from 'vue-uuid'
|
||||
import bus from '@/utils/bus'
|
||||
import EditPanel from './EditPanel'
|
||||
import { addGroup, delGroup, groupTree, defaultTree, get } from '@/api/panel/panel'
|
||||
import { addGroup, delGroup, groupTree, defaultTree, findOne } from '@/api/panel/panel'
|
||||
import {
|
||||
DEFAULT_COLOR_CASE,
|
||||
DEFAULT_SIZE,
|
||||
@@ -299,7 +301,7 @@ export default {
|
||||
groupForm: {
|
||||
name: null,
|
||||
pid: null,
|
||||
level: 0,
|
||||
panelType: 'self',
|
||||
nodeType: null,
|
||||
children: [],
|
||||
sort: 'node_type desc,name asc'
|
||||
@@ -350,7 +352,11 @@ export default {
|
||||
switch (param.optType) {
|
||||
case 'new':
|
||||
this.editPanel.titlePre = this.$t('commons.create')
|
||||
this.editPanel.panelInfo.name = this.$t('panel.panelAdd')
|
||||
if (param.type === 'folder') {
|
||||
this.editPanel.panelInfo.name = this.$t('panel.groupAdd')
|
||||
} else {
|
||||
this.editPanel.panelInfo.name = this.$t('panel.panelAdd')
|
||||
}
|
||||
this.editPanel.panelInfo.pid = param.data.id
|
||||
this.editPanel.panelInfo.level = param.data.level + 1
|
||||
this.editPanel.panelInfo.panelType = 'self'
|
||||
@@ -358,7 +364,7 @@ export default {
|
||||
case 'newFirstFolder':
|
||||
this.editPanel.titlePre = this.$t('commons.create')
|
||||
this.editPanel.panelInfo.name = ''
|
||||
this.editPanel.panelInfo.pid = null
|
||||
this.editPanel.panelInfo.pid = 'panel_list'
|
||||
this.editPanel.panelInfo.level = 0
|
||||
this.editPanel.panelInfo.panelType = 'self'
|
||||
break
|
||||
@@ -369,6 +375,7 @@ export default {
|
||||
titlePre: this.$t('commons.edit'),
|
||||
panelInfo: {
|
||||
id: param.data.id,
|
||||
pid: param.data.pid,
|
||||
name: param.data.name
|
||||
}
|
||||
}
|
||||
@@ -497,7 +504,7 @@ export default {
|
||||
this.groupForm = {
|
||||
name: null,
|
||||
pid: null,
|
||||
level: 0,
|
||||
panelType: 'self',
|
||||
nodeType: null,
|
||||
children: [],
|
||||
sort: 'node_type desc,name asc'
|
||||
@@ -520,7 +527,7 @@ export default {
|
||||
nodeClick(data, node) {
|
||||
if (data.nodeType === 'panel') {
|
||||
// 加载视图数据
|
||||
get('panel/group/findOne/' + data.id).then(response => {
|
||||
findOne(data.id).then(response => {
|
||||
this.$store.commit('setComponentData', this.resetID(JSON.parse(response.data.panelData)))
|
||||
// this.$store.commit('setComponentData', sourceInfo.type === 'custom' ? sourceInfo : this.resetID(sourceInfo))
|
||||
const temp = JSON.parse(response.data.panelStyle)
|
||||
@@ -558,6 +565,7 @@ export default {
|
||||
this.authVisible = false
|
||||
},
|
||||
edit(data) {
|
||||
debugger
|
||||
this.$store.dispatch('panel/setPanelInfo', data)
|
||||
bus.$emit('PanelSwitchComponent', { name: 'PanelEdit' })
|
||||
},
|
||||
@@ -576,6 +584,9 @@ export default {
|
||||
})
|
||||
}
|
||||
return data
|
||||
},
|
||||
newPanelSave(id) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
<!--TODO 仪表盘预览区域-->
|
||||
<el-row class="panel-design-preview">
|
||||
<div ref="imageWrapper" style="width: 100%;height: 100%">
|
||||
<Preview v-if="showMain" />
|
||||
<Preview v-if="mainActiveName==='PanelMain'&&showMain" />
|
||||
</div>
|
||||
</el-row>
|
||||
</el-col>
|
||||
@@ -84,6 +84,9 @@ export default {
|
||||
panelInfo() {
|
||||
return this.$store.state.panel.panelInfo
|
||||
},
|
||||
mainActiveName() {
|
||||
return this.$store.state.panel.mainActiveName
|
||||
},
|
||||
...mapState([
|
||||
'componentData',
|
||||
'canvasStyleData'
|
||||
|
||||
Reference in New Issue
Block a user