提交 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 { }
outline: none;
width: 100% !important; .component-custom {
height: 100%; outline: none;
} width: 100% !important;
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%">
<el-row v-if="componentDataShow.length===0" style="height: 100%;" class="custom-position"> <div
{{ $t('panel.panelNull') }} id="canvasInfoTemp"
</el-row> ref="canvasInfoTemp"
<canvas-opt-bar /> class="main-class"
<ComponentWrapper @mouseup="deselectCurComponent"
v-for="(item, index) in componentDataInfo" @mousedown="handleMouseDown"
:key="index"
:config="item"
:search-count="searchCount"
:in-screen="inScreen"
/>
<!--视图详情-->
<el-dialog
:title="'['+showChartInfo.name+']'+$t('chart.chart_details')"
:visible.sync="chartDetailsVisible"
width="70%"
class="dialog-css"
:destroy-on-close="true"
> >
<span style="position: absolute;right: 70px;top:15px"> <el-row v-if="componentDataShow.length===0" style="height: 100%;" class="custom-position">
<el-button size="mini" @click="exportExcel"> {{ $t('panel.panelNull') }}
<svg-icon icon-class="ds-excel" class="ds-icon-excel" /> </el-row>
{{ $t('chart.export_details') }} <canvas-opt-bar />
</el-button> <ComponentWrapper
</span> v-for="(item, index) in componentDataInfo"
<UserViewDialog ref="userViewDialog" :chart="showChartInfo" :chart-table="showChartTableInfo" /> :key="index"
</el-dialog> :config="item"
:search-count="searchCount"
:in-screen="inScreen"
/>
<!--视图详情-->
<el-dialog
:title="'['+showChartInfo.name+']'+$t('chart.chart_details')"
:visible.sync="chartDetailsVisible"
width="70%"
class="dialog-css"
:destroy-on-close="true"
>
<span style="position: absolute;right: 70px;top:15px">
<el-button size="mini" @click="exportExcel">
<svg-icon icon-class="ds-excel" class="ds-icon-excel" />
{{ $t('chart.export_details') }}
</el-button>
</span>
<UserViewDialog ref="userViewDialog" :chart="showChartInfo" :chart-table="showChartTableInfo" />
</el-dialog>
</div>
</div> </div>
</div> </div>
</template> </template>
...@@ -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,47 +238,45 @@ export default { ...@@ -244,47 +238,45 @@ 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%; .main-class {
.canvas { width: 100%;
position: relative; height: 100%;
margin: auto; }
}
} .custom-position {
} flex: 1;
.main-class { display: flex;
width: 100%; align-items: center;
height: 100%; justify-content: space-between;
} font-size: 14px;
.custom-position { flex-flow: row nowrap;
flex: 1; color: #9ea6b2;
display: flex; }
align-items: center;
justify-content: space-between; .gap_class {
font-size: 14px; padding: 5px;
flex-flow: row nowrap; }
color: #9ea6b2;
} .dialog-css > > > .el-dialog__title {
.gap_class{ font-size: 14px;
padding:5px; }
}
.dialog-css>>>.el-dialog__title { .dialog-css > > > .el-dialog__header {
font-size: 14px; padding: 20px 20px 0;
} }
.dialog-css >>> .el-dialog__header {
padding: 20px 20px 0; .dialog-css > > > .el-dialog__body {
} padding: 10px 20px 20px;
.dialog-css >>> .el-dialog__body { }
padding: 10px 20px 20px;
}
</style> </style>
<template> <template>
<div ref="myContainer" class="my-container"> <div class="outside-container">
<div ref="conditionMain" class="condition-main" :class="mainClass"> <div ref="myContainer" class="my-container">
<div v-if="element.options.attrs.title" ref="deTitleContainer" class="condition-title"> <div ref="conditionMain" class="condition-main" :class="mainClass">
<div class="condition-title-absolute"> <div v-if="element.options.attrs.title" ref="deTitleContainer" class="condition-title">
<div class="first-title"> <div class="condition-title-absolute">
<div class="span-container"> <div class="first-title">
<span ref="deTitle">{{ element.options.attrs.title }}</span> <div class="span-container">
<span ref="deTitle">{{ element.options.attrs.title }}</span>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> <div ref="deContentContainer" class="condition-content" :class="element.options.attrs.title ? '' : 'condition-content-default'">
<div ref="deContentContainer" class="condition-content" :class="element.options.attrs.title ? '' : 'condition-content-default'"> <div class="condition-content-container">
<div class="condition-content-container"> <div class="first-element">
<div class="first-element"> <div :class="element.component === 'de-select-grid' ? 'first-element-grid-contaner': ''" class="first-element-contaner">
<div :class="element.component === 'de-select-grid' ? 'first-element-grid-contaner': ''" class="first-element-contaner"> <component
<component :is="element.component"
:is="element.component" v-if="element.type==='custom'"
v-if="element.type==='custom'" :id="'component' + element.id"
:id="'component' + element.id" class="component-custom"
class="component-custom" :out-style="element.style"
:out-style="element.style" :element="element"
:element="element" :in-draw="inDraw"
:in-draw="inDraw" :in-screen="inScreen"
:in-screen="inScreen" />
/> </div>
</div> </div>
</div> </div>
</div> </div>
...@@ -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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论