Merge pull request #480 from dataease/pr@dev@feat_panel-view-set-bar

feat:预览界面点击组件显示设置入口,点击空白也取消设置入口;去掉原有鼠标移入显示的样式
This commit is contained in:
王嘉豪 2021-08-03 11:33:37 +08:00 committed by GitHub
commit 1ebb5690a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 104 additions and 5 deletions

View File

@ -4,7 +4,9 @@
:class="{'gap_class':canvasStyleData.panel.gap==='yes'}" :class="{'gap_class':canvasStyleData.panel.gap==='yes'}"
class="component" class="component"
@click="handleClick" @click="handleClick"
@mousedown="elementMouseDown"
> >
<edit-bar v-if="config === curComponent" />
<de-out-widget <de-out-widget
v-if="config.type==='custom'" v-if="config.type==='custom'"
:id="'component' + config.id" :id="'component' + config.id"
@ -33,8 +35,10 @@ import runAnimation from '@/components/canvas/utils/runAnimation'
import { mixins } from '@/components/canvas/utils/events' import { mixins } from '@/components/canvas/utils/events'
import { mapState } from 'vuex' import { mapState } from 'vuex'
import DeOutWidget from '@/components/dataease/DeOutWidget' import DeOutWidget from '@/components/dataease/DeOutWidget'
import EditBar from '@/components/canvas/components/Editor/EditBar'
export default { export default {
components: { DeOutWidget }, components: { DeOutWidget, EditBar },
mixins: [mixins], mixins: [mixins],
props: { props: {
config: { config: {
@ -60,7 +64,8 @@ export default {
}, },
computed: { computed: {
...mapState([ ...mapState([
'canvasStyleData' 'canvasStyleData',
'curComponent'
]) ])
}, },
mounted() { mounted() {
@ -94,6 +99,17 @@ export default {
Object.keys(events).forEach(event => { Object.keys(events).forEach(event => {
this[event](events[event]) this[event](events[event])
}) })
},
elementMouseDown(e) {
debugger
// private
this.$store.commit('setClickComponentStatus', true)
if (this.config.component !== 'v-text' && this.config.component !== 'rect-shape' && this.config.component !== 'de-input-search' && this.config.component !== 'de-number-range') {
e.preventDefault()
}
//
e.stopPropagation()
this.$store.commit('setCurComponent', { component: this.config, index: this.index })
} }
} }
} }

View File

@ -0,0 +1,70 @@
<template>
<div class="bar-main">
<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" />
</div>
</template>
<script>
import { mapState } from 'vuex'
import eventBus from '@/components/canvas/utils/eventBus'
export default {
props: {
active: {
type: Boolean,
required: false,
default: false
},
// preview edit
activeModel: {
type: String,
required: false,
default: 'preview'
}
},
data() {
return {
componentType: null,
editFilter: [
'view',
'custom'
]
}
},
computed: mapState([
'menuTop',
'menuLeft',
'menuShow',
'curComponent',
'componentData',
'canvasStyleData'
]),
methods: {
showViewDetails() {
eventBus.$emit('showViewDetails')
}
}
}
</script>
<style lang="scss" scoped>
.bar-main{
position: absolute;
right: 0px;
float:right;
z-index: 2;
border-radius:2px;
padding-left: 5px;
padding-right: 2px;
cursor:pointer!important;
background-color: #0a7be0;
}
.bar-main i{
color: white;
float: right;
margin-right: 3px;
}
</style>

View File

@ -1,5 +1,5 @@
<template> <template>
<div id="canvasInfoTemp" :style="customStyle" class="bg"> <div id="canvasInfoTemp" :style="customStyle" class="bg" @mouseup="deselectCurComponent" @mousedown="handleMouseDown">
<el-row v-if="componentDataShow.length===0" style="height: 100%;" class="custom-position"> <el-row v-if="componentDataShow.length===0" style="height: 100%;" class="custom-position">
{{ $t('panel.panelNull') }} {{ $t('panel.panelNull') }}
</el-row> </el-row>
@ -121,6 +121,8 @@ export default {
return this.componentDataShow return this.componentDataShow
}, },
...mapState([ ...mapState([
'isClickComponent',
'curComponent',
'componentData', 'componentData',
'canvasStyleData' 'canvasStyleData'
]) ])
@ -204,6 +206,17 @@ export default {
}, },
exportExcel() { exportExcel() {
this.$refs['userViewDialog'].exportExcel() this.$refs['userViewDialog'].exportExcel()
},
deselectCurComponent(e) {
debugger
if (!this.isClickComponent) {
this.$store.commit('setCurComponent', { component: null, index: null })
}
},
handleMouseDown() {
// console.log('handleMouseDown123')
this.$store.commit('setClickComponentStatus', false)
} }
} }
} }

View File

@ -8,7 +8,7 @@
'rect-shape' 'rect-shape'
]" ]"
> >
<i v-if="requestStatus==='success'" style="right:25px;position: absolute;z-index: 2" class="icon iconfont icon-fangda" @click.stop="openChartDetailsDialog" /> <!-- <i v-if="requestStatus==='success'" style="right:25px;position: absolute;z-index: 2" class="icon iconfont icon-fangda" @click.stop="openChartDetailsDialog" />-->
<div v-if="requestStatus==='error'" class="chart-error-class"> <div v-if="requestStatus==='error'" class="chart-error-class">
<div style="font-size: 12px; color: #9ea6b2;height: 100%;display: flex;align-items: center;justify-content: center;"> <div style="font-size: 12px; color: #9ea6b2;height: 100%;display: flex;align-items: center;justify-content: center;">
{{ message }},{{ $t('chart.chart_show_error') }} {{ message }},{{ $t('chart.chart_show_error') }}
@ -128,7 +128,7 @@ export default {
this.getData(this.element.propValue.viewId) this.getData(this.element.propValue.viewId)
}, },
mounted() { mounted() {
eventBus.$on('showViewDetails', this.openChartDetailsDialog)
}, },
methods: { methods: {
mergeStyle() { mergeStyle() {