提交 9f879a88 authored 作者: wangjiahao's avatar wangjiahao

refactor: 优化仪表板展示边界间隙,保持常有间隙

上级 70427efb
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
@click="handleClick" @click="handleClick"
@mousedown="elementMouseDown" @mousedown="elementMouseDown"
> >
<edit-bar v-if="curComponent && config === curComponent" :element="config" @showViewDetails="showViewDetails" /> <edit-bar v-if="editBarShow" :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"
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
:element="config" :element="config"
:in-screen="inScreen" :in-screen="inScreen"
/> />
<component <component
:is="config.component" :is="config.component"
v-else v-else
...@@ -65,6 +64,9 @@ export default { ...@@ -65,6 +64,9 @@ export default {
} }
}, },
computed: { computed: {
editBarShow() {
return this.curComponent && this.config === this.curComponent
},
curGap() { curGap() {
return this.canvasStyleData.panel.gap === 'yes' && this.config.auxiliaryMatrix ? this.componentGap : 0 return this.canvasStyleData.panel.gap === 'yes' && this.config.auxiliaryMatrix ? this.componentGap : 0
}, },
...@@ -79,7 +81,6 @@ export default { ...@@ -79,7 +81,6 @@ export default {
}, },
methods: { methods: {
getStyle, getStyle,
getShapeStyleIntDeDrag(style, prop) { getShapeStyleIntDeDrag(style, prop) {
if (prop === 'rotate') { if (prop === 'rotate') {
return style['rotate'] return style['rotate']
...@@ -114,17 +115,11 @@ export default { ...@@ -114,17 +115,11 @@ export default {
result[attr] = style[attr] + 'px' result[attr] = style[attr] + 'px'
}) })
result['rotate'] = style['rotate'] result['rotate'] = style['rotate']
// result['opacity'] = style['opacity']
return result return result
// return style
}, },
getComponentStyleDefault(style) { getComponentStyleDefault(style) {
return getStyle(style, ['top', 'left', 'width', 'height', 'rotate']) return getStyle(style, ['top', 'left', 'width', 'height', 'rotate'])
// console.log('styleInfo', JSON.stringify(styleInfo))
// return styleInfo
// return style
}, },
handleClick() { handleClick() {
...@@ -151,19 +146,21 @@ export default { ...@@ -151,19 +146,21 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.component { .component {
position: absolute; position: absolute;
} }
.component:hover { .component:hover {
box-shadow:0px 0px 7px #0a7be0; box-shadow: 0px 0px 7px #0a7be0;
} }
.gap_class{
padding:5px; .gap_class {
} padding: 5px;
.component-custom { }
.component-custom {
outline: none; outline: none;
width: 100% !important; width: 100% !important;
height: 100%; height: 100%;
} }
</style> </style>
<template> <template>
<div id="canvasInfoMain" ref="canvasInfoMain" :style="customStyle" class="bg"> <div class="bg" :style="customStyle">
<div id="canvasInfoTemp" ref="canvasInfoTemp" class="main-class" @mouseup="deselectCurComponent" @mousedown="handleMouseDown"> <div id="canvasInfoMain" ref="canvasInfoMain" style="width: 100%;height: 100%">
<div
id="canvasInfoTemp"
ref="canvasInfoTemp"
class="main-class"
@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>
...@@ -30,6 +37,7 @@ ...@@ -30,6 +37,7 @@
</el-dialog> </el-dialog>
</div> </div>
</div> </div>
</div>
</template> </template>
<script> <script>
...@@ -94,9 +102,7 @@ export default { ...@@ -94,9 +102,7 @@ export default {
}, },
computed: { computed: {
customStyle() { customStyle() {
let style = { let style = {}
padding: this.componentGap + 'px'
}
if (this.canvasStyleData.openCommonStyle) { if (this.canvasStyleData.openCommonStyle) {
if (this.canvasStyleData.panel.backgroundType === 'image' && this.canvasStyleData.panel.imageUrl) { if (this.canvasStyleData.panel.backgroundType === 'image' && this.canvasStyleData.panel.imageUrl) {
style = { style = {
...@@ -110,16 +116,6 @@ export default { ...@@ -110,16 +116,6 @@ export default {
} }
} }
} }
// if (this.canvasStyleData.selfAdaption) {
// style = {
// overflow: 'hidden',
// ...style
// }
// }
// style = {
// overflow-x :'hidden',
// ...style
// }
return style return style
}, },
// 此处单独计算componentData的值 不放入全局mapState中 // 此处单独计算componentData的值 不放入全局mapState中
...@@ -152,17 +148,17 @@ export default { ...@@ -152,17 +148,17 @@ export default {
const _this = this const _this = this
const erd = elementResizeDetectorMaker() const erd = elementResizeDetectorMaker()
// 监听div变动事件 // 监听div变动事件
const tempDom = document.getElementById('canvasInfoMain') const mainDom = document.getElementById('canvasInfoMain')
erd.listenTo(tempDom, element => { erd.listenTo(mainDom, element => {
_this.$nextTick(() => { _this.$nextTick(() => {
_this.restore() _this.restore()
// 将mainHeight 修改为px 临时解决html2canvas 截图不全的问题 // 将mainHeight 修改为px 临时解决html2canvas 截图不全的问题
_this.mainHeight = tempDom.scrollHeight + 'px!important' _this.mainHeight = mainDom.scrollHeight + 'px!important'
}) })
}) })
eventBus.$on('openChartDetailsDialog', this.openChartDetailsDialog) eventBus.$on('openChartDetailsDialog', this.openChartDetailsDialog)
this.$store.commit('clearLinkageSettingInfo', false) _this.$store.commit('clearLinkageSettingInfo', false)
this.canvasStyleDataInit() _this.canvasStyleDataInit()
}, },
beforeDestroy() { beforeDestroy() {
clearInterval(this.timer) clearInterval(this.timer)
...@@ -235,8 +231,6 @@ export default { ...@@ -235,8 +231,6 @@ export default {
} }
}, },
handleMouseDown() { handleMouseDown() {
// console.log('handleMouseDown123')
this.$store.commit('setClickComponentStatus', false) this.$store.commit('setClickComponentStatus', false)
} }
} }
...@@ -244,28 +238,22 @@ export default { ...@@ -244,28 +238,22 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.bg { .bg {
padding: 5px;
min-width: 600px; min-width: 600px;
min-height: 300px; min-height: 300px;
width: 100%; width: 100%;
height: 100%; height: 100%;
overflow-x: hidden; overflow-x: hidden;
/*border: 1px solid #E6E6E6;*/
background-size: 100% 100% !important; background-size: 100% 100% !important;
.canvas-container {
width: 100%;
height: 100%;
.canvas {
position: relative;
margin: auto;
} }
}
} .main-class {
.main-class {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.custom-position {
.custom-position {
flex: 1; flex: 1;
display: flex; display: flex;
align-items: center; align-items: center;
...@@ -273,18 +261,22 @@ export default { ...@@ -273,18 +261,22 @@ export default {
font-size: 14px; font-size: 14px;
flex-flow: row nowrap; flex-flow: row nowrap;
color: #9ea6b2; color: #9ea6b2;
} }
.gap_class{
padding:5px; .gap_class {
} padding: 5px;
.dialog-css>>>.el-dialog__title { }
.dialog-css > > > .el-dialog__title {
font-size: 14px; font-size: 14px;
} }
.dialog-css >>> .el-dialog__header {
.dialog-css > > > .el-dialog__header {
padding: 20px 20px 0; padding: 20px 20px 0;
} }
.dialog-css >>> .el-dialog__body {
.dialog-css > > > .el-dialog__body {
padding: 10px 20px 20px; padding: 10px 20px 20px;
} }
</style> </style>
<template> <template>
<div class="outside-container">
<div ref="myContainer" class="my-container"> <div ref="myContainer" class="my-container">
<div ref="conditionMain" class="condition-main" :class="mainClass"> <div ref="conditionMain" class="condition-main" :class="mainClass">
<div v-if="element.options.attrs.title" ref="deTitleContainer" class="condition-title"> <div v-if="element.options.attrs.title" ref="deTitleContainer" class="condition-title">
...@@ -30,6 +31,7 @@ ...@@ -30,6 +31,7 @@
</div> </div>
</div> </div>
</div> </div>
</div>
</template> </template>
<script> <script>
...@@ -97,12 +99,16 @@ export default { ...@@ -97,12 +99,16 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.outside-container {
width: 100%;
height: 100%;
}
.my-container { .my-container {
position: absolute; position: absolute;
overflow: auto; overflow: auto;
inset: 0px; inset: 0px;
} }
.ccondition-main { .condition-main {
position: absolute; position: absolute;
overflow: auto; overflow: auto;
inset: 0px; inset: 0px;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论