refactor:更换仪表板视图设置组件

This commit is contained in:
wangjiahao 2021-08-03 15:49:04 +08:00
parent 5d5e54b593
commit 52990c9684
4 changed files with 22 additions and 8 deletions

View File

@ -19,9 +19,7 @@
@mouseenter="enter" @mouseenter="enter"
@mouseleave="leave" @mouseleave="leave"
> >
<setting-menu style="right:5px;position: absolute;z-index: 2"> <edit-bar v-if="active" :active-model="'edit'" @showViewDetails="showViewDetails" />
<i slot="icon" class="icon iconfont icon-shezhi" />
</setting-menu>
<div <div
v-for="(handlei, indexi) in actualHandles" v-for="(handlei, indexi) in actualHandles"
:key="indexi" :key="indexi"
@ -46,11 +44,12 @@ let eventsFor = events.mouse
import eventBus from '@/components/canvas/utils/eventBus' import eventBus from '@/components/canvas/utils/eventBus'
import { mapState } from 'vuex' import { mapState } from 'vuex'
import SettingMenu from '@/components/canvas/components/Editor/SettingMenu' import SettingMenu from '@/components/canvas/components/Editor/SettingMenu'
import EditBar from '@/components/canvas/components/Editor/EditBar'
export default { export default {
replace: true, replace: true,
name: 'VueDragResizeRotate', name: 'VueDragResizeRotate',
components: { SettingMenu }, components: { EditBar },
props: { props: {
className: { className: {
type: String, type: String,
@ -1540,6 +1539,9 @@ export default {
removeEvent(document.documentElement, 'mouseup', this.handleUp) removeEvent(document.documentElement, 'mouseup', this.handleUp)
removeEvent(document.documentElement, 'touchend touchcancel', this.deselect) removeEvent(document.documentElement, 'touchend touchcancel', this.deselect)
removeEvent(window, 'resize', this.checkParentSize) removeEvent(window, 'resize', this.checkParentSize)
},
showViewDetails() {
this.$emit('showViewDetails')
} }
} }

View File

@ -18,9 +18,9 @@
/> />
<component <component
ref="wrapperChild"
:is="config.component" :is="config.component"
v-else v-else
ref="wrapperChild"
:out-style="config.style" :out-style="config.style"
:style="getComponentStyleDefault(config.style)" :style="getComponentStyleDefault(config.style)"
:prop-value="config.propValue" :prop-value="config.propValue"
@ -112,8 +112,8 @@ export default {
e.stopPropagation() e.stopPropagation()
this.$store.commit('setCurComponent', { component: this.config, index: this.index }) this.$store.commit('setCurComponent', { component: this.config, index: this.index })
}, },
showViewDetails(){ showViewDetails() {
this.$refs.wrapperChild.openChartDetailsDialog(); this.$refs.wrapperChild.openChartDetailsDialog()
} }
} }
} }

View File

@ -1,15 +1,20 @@
<template> <template>
<div class="bar-main"> <div class="bar-main">
<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="curComponent.type==='view'" class="icon iconfont icon-fangda" @click.stop="showViewDetails" /> <i v-if="curComponent.type==='view'" class="icon iconfont icon-fangda" @click.stop="showViewDetails" />
<i v-if="activeModel==='edit'" class="icon iconfont icon-shezhi" @click.stop="showViewDetails" /> <!-- <el-checkbox />-->
</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 SettingMenu from '@/components/canvas/components/Editor/SettingMenu'
export default { export default {
components: { SettingMenu },
props: { props: {
active: { active: {

View File

@ -30,11 +30,13 @@
:snap-tolerance="2" :snap-tolerance="2"
:change-style="customStyle" :change-style="customStyle"
@refLineParams="getRefLineParams" @refLineParams="getRefLineParams"
@showViewDetails="showViewDetails(index)"
> >
<component <component
:is="item.component" :is="item.component"
v-if="item.type==='v-text'" v-if="item.type==='v-text'"
:id="'component' + item.id" :id="'component' + item.id"
ref="wrapperChild"
class="component" class="component"
:style="getComponentStyleDefault(item.style)" :style="getComponentStyleDefault(item.style)"
:prop-value="item.propValue" :prop-value="item.propValue"
@ -69,6 +71,7 @@
:is="item.component" :is="item.component"
v-else-if="item.type==='other'" v-else-if="item.type==='other'"
:id="'component' + item.id" :id="'component' + item.id"
ref="wrapperChild"
class="component" class="component"
:style="getComponentStyle(item.style)" :style="getComponentStyle(item.style)"
:prop-value="item.propValue" :prop-value="item.propValue"
@ -80,6 +83,7 @@
:is="item.component" :is="item.component"
v-else v-else
:id="'component' + item.id" :id="'component' + item.id"
ref="wrapperChild"
class="component" class="component"
:style="getComponentStyleDefault(item.style)" :style="getComponentStyleDefault(item.style)"
:prop-value="item.propValue" :prop-value="item.propValue"
@ -603,6 +607,9 @@ export default {
}, },
exportExcel() { exportExcel() {
this.$refs['userViewDialog'].exportExcel() this.$refs['userViewDialog'].exportExcel()
},
showViewDetails(index) {
this.$refs.wrapperChild[index].openChartDetailsDialog()
} }
} }
} }