forked from github/dataease
Merge pull request #480 from dataease/pr@dev@feat_panel-view-set-bar
feat:预览界面点击组件显示设置入口,点击空白也取消设置入口;去掉原有鼠标移入显示的样式
This commit is contained in:
commit
1ebb5690a8
@ -4,7 +4,9 @@
|
||||
:class="{'gap_class':canvasStyleData.panel.gap==='yes'}"
|
||||
class="component"
|
||||
@click="handleClick"
|
||||
@mousedown="elementMouseDown"
|
||||
>
|
||||
<edit-bar v-if="config === curComponent" />
|
||||
<de-out-widget
|
||||
v-if="config.type==='custom'"
|
||||
:id="'component' + config.id"
|
||||
@ -33,8 +35,10 @@ import runAnimation from '@/components/canvas/utils/runAnimation'
|
||||
import { mixins } from '@/components/canvas/utils/events'
|
||||
import { mapState } from 'vuex'
|
||||
import DeOutWidget from '@/components/dataease/DeOutWidget'
|
||||
import EditBar from '@/components/canvas/components/Editor/EditBar'
|
||||
|
||||
export default {
|
||||
components: { DeOutWidget },
|
||||
components: { DeOutWidget, EditBar },
|
||||
mixins: [mixins],
|
||||
props: {
|
||||
config: {
|
||||
@ -60,7 +64,8 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
...mapState([
|
||||
'canvasStyleData'
|
||||
'canvasStyleData',
|
||||
'curComponent'
|
||||
])
|
||||
},
|
||||
mounted() {
|
||||
@ -94,6 +99,17 @@ export default {
|
||||
Object.keys(events).forEach(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 })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
70
frontend/src/components/canvas/components/Editor/EditBar.vue
Normal file
70
frontend/src/components/canvas/components/Editor/EditBar.vue
Normal 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>
|
@ -1,5 +1,5 @@
|
||||
<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">
|
||||
{{ $t('panel.panelNull') }}
|
||||
</el-row>
|
||||
@ -121,6 +121,8 @@ export default {
|
||||
return this.componentDataShow
|
||||
},
|
||||
...mapState([
|
||||
'isClickComponent',
|
||||
'curComponent',
|
||||
'componentData',
|
||||
'canvasStyleData'
|
||||
])
|
||||
@ -204,6 +206,17 @@ export default {
|
||||
},
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
'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 style="font-size: 12px; color: #9ea6b2;height: 100%;display: flex;align-items: center;justify-content: center;">
|
||||
{{ message }},{{ $t('chart.chart_show_error') }}
|
||||
@ -128,7 +128,7 @@ export default {
|
||||
this.getData(this.element.propValue.viewId)
|
||||
},
|
||||
mounted() {
|
||||
|
||||
eventBus.$on('showViewDetails', this.openChartDetailsDialog)
|
||||
},
|
||||
methods: {
|
||||
mergeStyle() {
|
||||
|
Loading…
Reference in New Issue
Block a user