feat:仪表板联动设置

This commit is contained in:
wangjiahao 2021-08-03 18:37:24 +08:00
parent f9291ec651
commit f909427422
7 changed files with 78 additions and 15 deletions

View File

@ -19,7 +19,7 @@
@mouseenter="enter" @mouseenter="enter"
@mouseleave="leave" @mouseleave="leave"
> >
<edit-bar v-if="active" :active-model="'edit'" @showViewDetails="showViewDetails" /> <edit-bar v-if="active||linkageSettingStatus" :active-model="'edit'" :element="element" @showViewDetails="showViewDetails" />
<div <div
v-for="(handlei, indexi) in actualHandles" v-for="(handlei, indexi) in actualHandles"
:key="indexi" :key="indexi"
@ -463,7 +463,8 @@ export default {
'curComponent', 'curComponent',
'editor', 'editor',
'curCanvasScale', 'curCanvasScale',
'canvasStyleData' 'canvasStyleData',
'linkageSettingStatus'
]) ])
}, },
watch: { watch: {

View File

@ -6,7 +6,7 @@
@click="handleClick" @click="handleClick"
@mousedown="elementMouseDown" @mousedown="elementMouseDown"
> >
<edit-bar v-if="config === curComponent" @showViewDetails="showViewDetails" /> <edit-bar v-if="config === curComponent" :element="config" @showViewDetails="showViewDetails" />
<de-out-widget <de-out-widget
v-if="config.type==='custom'" v-if="config.type==='custom'"
:id="'component' + config.id" :id="'component' + config.id"

View File

@ -1,22 +1,34 @@
<template> <template>
<div class="bar-main"> <div class="bar-main">
<setting-menu v-if="activeModel==='edit'" style="float: right;height: 24px!important;"> <div v-if="linkageSettingStatus" style="margin-right: 0px;width: 18px">
<i slot="icon" class="icon iconfont icon-shezhi" /> <el-checkbox v-model="linkageActiveStatus" />
</setting-menu> <i v-if="linkageActiveStatus" class="icon iconfont icon-edit" @click.stop="linkageEdit" />
<i v-if="curComponent.type==='view'" class="icon iconfont icon-fangda" @click.stop="showViewDetails" /> </div>
<!-- <el-checkbox />--> <div v-else>
<setting-menu v-if="activeModel==='edit'" style="float: right;height: 24px!important;">
<i slot="icon" class="icon iconfont icon-shezhi" />
</setting-menu>
<i v-if="activeModel==='edit'&&curComponent&&editFilter.includes(curComponent.type)" class="icon iconfont icon-edit" @click.stop="edit" />
<i v-if="curComponent.type==='view'" class="icon iconfont icon-fangda" @click.stop="showViewDetails" />
</div>
</div> </div>
</template> </template>
<script> <script>
import { mapState } from 'vuex' import { mapState } from 'vuex'
import eventBus from '@/components/canvas/utils/eventBus' import eventBus from '@/components/canvas/utils/eventBus'
import bus from '@/utils/bus'
import SettingMenu from '@/components/canvas/components/Editor/SettingMenu' import SettingMenu from '@/components/canvas/components/Editor/SettingMenu'
export default { export default {
components: { SettingMenu }, components: { SettingMenu },
props: { props: {
element: {
type: Object,
required: true
},
active: { active: {
type: Boolean, type: Boolean,
required: false, required: false,
@ -32,6 +44,7 @@ export default {
data() { data() {
return { return {
componentType: null, componentType: null,
linkageActiveStatus: false,
editFilter: [ editFilter: [
'view', 'view',
'custom' 'custom'
@ -44,11 +57,34 @@ export default {
'menuShow', 'menuShow',
'curComponent', 'curComponent',
'componentData', 'componentData',
'canvasStyleData' 'canvasStyleData',
'linkageSettingStatus'
]), ]),
methods: { methods: {
showViewDetails() { showViewDetails() {
this.$emit('showViewDetails') this.$emit('showViewDetails')
},
edit() {
//
this.$store.dispatch('panel/setComponentDataTemp', JSON.stringify(this.componentData))
this.$store.dispatch('panel/setCanvasStyleDataTemp', JSON.stringify(this.canvasStyleData))
if (this.curComponent.type === 'view') {
this.$store.dispatch('chart/setViewId', null)
this.$store.dispatch('chart/setViewId', this.curComponent.propValue.viewId)
bus.$emit('PanelSwitchComponent', { name: 'ChartEdit', param: { 'id': this.curComponent.propValue.viewId, 'optType': 'edit' }})
}
if (this.curComponent.type === 'custom') {
bus.$emit('component-dialog-edit')
}
//
if (this.curComponent.type === 'v-text' || this.curComponent.type === 'rect-shape') {
bus.$emit('component-dialog-style')
}
},
linkageEdit() {
} }
} }
} }

View File

@ -153,6 +153,7 @@ export default {
this.searchCount++ this.searchCount++
}, refreshTime) }, refreshTime)
eventBus.$on('openChartDetailsDialog', this.openChartDetailsDialog) eventBus.$on('openChartDetailsDialog', this.openChartDetailsDialog)
this.$store.commit('setLinkageSettingStatus', false)
}, },
beforeDestroy() { beforeDestroy() {
clearInterval(this.timer) clearInterval(this.timer)

View File

@ -8,7 +8,7 @@
@mousedown="handleMouseDown" @mousedown="handleMouseDown"
> >
<!-- 网格线 --> <!-- 网格线 -->
<Grid v-if="canvasStyleData.auxiliaryMatrix" :matrix-style="matrixStyle" /> <Grid v-if="canvasStyleData.auxiliaryMatrix&&!linkageSettingStatus" :matrix-style="matrixStyle" />
<!--页面组件列表展示--> <!--页面组件列表展示-->
<de-drag <de-drag
v-for="(item, index) in componentData" v-for="(item, index) in componentData"
@ -29,6 +29,7 @@
:snap="true" :snap="true"
:snap-tolerance="2" :snap-tolerance="2"
:change-style="customStyle" :change-style="customStyle"
:draggable="!linkageSettingStatus"
@refLineParams="getRefLineParams" @refLineParams="getRefLineParams"
@showViewDetails="showViewDetails(index)" @showViewDetails="showViewDetails(index)"
> >
@ -249,7 +250,8 @@ export default {
'componentData', 'componentData',
'curComponent', 'curComponent',
'canvasStyleData', 'canvasStyleData',
'editor' 'editor',
'linkageSettingStatus'
]) ])
}, },
watch: { watch: {

View File

@ -1,6 +1,17 @@
<template> <template>
<div> <div>
<div class="toolbar"> <!-- linkageActiveStatus:{{ linkageActiveStatus }}-->
<div v-if="linkageSettingStatus" class="toolbar">
<span style="float: right;">
<el-button size="mini" @click="saveLinkage">
{{ $t('commons.confirm') }}
</el-button>
<el-button size="mini" @click="cancelLinkage">
{{ $t('commons.cancel') }}
</el-button>
</span>
</div>
<div v-else class="toolbar">
<div class="canvas-config" style="margin-right: 10px"> <div class="canvas-config" style="margin-right: 10px">
<el-switch v-model="canvasStyleData.auxiliaryMatrix" :width="35" name="auxiliaryMatrix" /> <el-switch v-model="canvasStyleData.auxiliaryMatrix" :width="35" name="auxiliaryMatrix" />
@ -125,7 +136,8 @@ export default {
'curComponent', 'curComponent',
'changeTimes', 'changeTimes',
'snapshotIndex', 'snapshotIndex',
'lastSaveSnapshotIndex' 'lastSaveSnapshotIndex',
'linkageSettingStatus'
]), ]),
created() { created() {
@ -302,6 +314,15 @@ export default {
}, },
closeNotSave() { closeNotSave() {
this.close() this.close()
},
saveLinkage() {
this.cancelLinkageSettingStatus()
},
cancelLinkage() {
this.cancelLinkageSettingStatus()
},
cancelLinkageSettingStatus() {
this.$store.commit('setLinkageSettingStatus', false)
} }
} }
} }

View File

@ -21,7 +21,7 @@
<de-container> <de-container>
<!--左侧导航栏--> <!--左侧导航栏-->
<de-aside-container class="ms-aside-container"> <de-aside-container class="ms-aside-container">
<div style="width: 60px; left: 0px; top: 0px; bottom: 0px; position: absolute"> <div v-if="!linkageSettingStatus" style="width: 60px; left: 0px; top: 0px; bottom: 0px; position: absolute">
<div style="width: 60px;height: 100%;overflow: hidden auto;position: relative;margin: 0px auto; font-size: 14px"> <div style="width: 60px;height: 100%;overflow: hidden auto;position: relative;margin: 0px auto; font-size: 14px">
<!-- 视图图表 start --> <!-- 视图图表 start -->
<div class="button-div-class" style=" width: 24px;height: 24px;text-align: center;line-height: 1;position: relative;margin: 16px auto 0px;"> <div class="button-div-class" style=" width: 24px;height: 24px;text-align: center;line-height: 1;position: relative;margin: 16px auto 0px;">
@ -290,7 +290,8 @@ export default {
'isClickComponent', 'isClickComponent',
'canvasStyleData', 'canvasStyleData',
'curComponentIndex', 'curComponentIndex',
'componentData' 'componentData',
'linkageSettingStatus'
]) ])
}, },
@ -322,6 +323,7 @@ export default {
listenGlobalKeyDown() listenGlobalKeyDown()
this.$store.commit('setCurComponent', { component: null, index: null }) this.$store.commit('setCurComponent', { component: null, index: null })
this.$store.commit('setLinkageSettingStatus', false)
}, },
mounted() { mounted() {
// this.insertToBody() // this.insertToBody()