forked from github/dataease
refactor(仪表板): 优化仪表板过滤组件表格等组件的自适应缩放方式,防止组件在仪表板不同分辨率下组件大小不适配问题
This commit is contained in:
parent
e9af2b2ebb
commit
b87630e364
@ -201,12 +201,16 @@ export default {
|
|||||||
componentActiveFlag() {
|
componentActiveFlag() {
|
||||||
return !this.mobileLayoutStatus && ((this.curComponent && this.config === this.curComponent && !this.previewVisible && !this.showPosition.includes('email-task')) || this.showPosition.includes('multiplexing'))
|
return !this.mobileLayoutStatus && ((this.curComponent && this.config === this.curComponent && !this.previewVisible && !this.showPosition.includes('email-task')) || this.showPosition.includes('multiplexing'))
|
||||||
},
|
},
|
||||||
|
scale() {
|
||||||
|
return Math.min(this.previewCanvasScale.scalePointWidth, this.previewCanvasScale.scalePointHeight)
|
||||||
|
},
|
||||||
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) * this.scale
|
||||||
},
|
},
|
||||||
...mapState([
|
...mapState([
|
||||||
'mobileLayoutStatus',
|
'mobileLayoutStatus',
|
||||||
'curComponent',
|
'curComponent',
|
||||||
|
'previewCanvasScale',
|
||||||
'componentGap'
|
'componentGap'
|
||||||
])
|
])
|
||||||
},
|
},
|
||||||
|
@ -552,7 +552,7 @@ export default {
|
|||||||
component.style[key] = this.format(component.style[key], this.scaleHeight)
|
component.style[key] = this.format(component.style[key], this.scaleHeight)
|
||||||
}
|
}
|
||||||
if (this.needToChangeWidth.includes(key)) {
|
if (this.needToChangeWidth.includes(key)) {
|
||||||
if (key === 'fontSize' && this.terminal === 'mobile') {
|
if (key === 'fontSize' && (this.terminal === 'mobile' || component.type === 'custom')) {
|
||||||
// do nothing 移动端字符大小无需按照比例缩放,当前保持不变(包括 v-text 和 过滤组件)
|
// do nothing 移动端字符大小无需按照比例缩放,当前保持不变(包括 v-text 和 过滤组件)
|
||||||
} else {
|
} else {
|
||||||
component.style[key] = this.format(component.style[key], this.scaleWidth)
|
component.style[key] = this.format(component.style[key], this.scaleWidth)
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
<div
|
<div
|
||||||
ref="myContainer"
|
ref="myContainer"
|
||||||
class="my-container"
|
class="my-container"
|
||||||
|
:style="autoStyle"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
ref="conditionMain"
|
ref="conditionMain"
|
||||||
@ -60,6 +61,8 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import inputStyleMixin from '@/components/widget/deWidget/inputStyleMixin'
|
import inputStyleMixin from '@/components/widget/deWidget/inputStyleMixin'
|
||||||
|
import { mapState } from 'vuex'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'DeOutWidget',
|
name: 'DeOutWidget',
|
||||||
mixins: [inputStyleMixin],
|
mixins: [inputStyleMixin],
|
||||||
@ -112,6 +115,18 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
scale() {
|
||||||
|
return this.previewCanvasScale.scalePointHeight
|
||||||
|
},
|
||||||
|
autoStyle() {
|
||||||
|
return {
|
||||||
|
height: (100 / this.scale) + '%!important',
|
||||||
|
width: (100 / this.scale) + '%!important',
|
||||||
|
left: 50 * (1 - 1 / this.scale) + '%', // 放大余量 除以 2
|
||||||
|
top: 50 * (1 - 1 / this.scale) + '%', // 放大余量 除以 2
|
||||||
|
transform: 'scale(' + this.scale + ')'
|
||||||
|
}
|
||||||
|
},
|
||||||
sizeInfo() {
|
sizeInfo() {
|
||||||
let size
|
let size
|
||||||
if (this.duHeight > this.inputLargeSize) {
|
if (this.duHeight > this.inputLargeSize) {
|
||||||
@ -133,7 +148,10 @@ export default {
|
|||||||
},
|
},
|
||||||
isFilterComponent() {
|
isFilterComponent() {
|
||||||
return ['de-select', 'de-select-grid', 'de-date', 'de-input-search', 'de-number-range', 'de-select-tree'].includes(this.element.component)
|
return ['de-select', 'de-select-grid', 'de-date', 'de-input-search', 'de-number-range', 'de-select-tree'].includes(this.element.component)
|
||||||
}
|
},
|
||||||
|
...mapState([
|
||||||
|
'previewCanvasScale'
|
||||||
|
])
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
'element.style': {
|
'element.style': {
|
||||||
|
@ -55,25 +55,32 @@
|
|||||||
/>
|
/>
|
||||||
<el-row
|
<el-row
|
||||||
v-show="showPage"
|
v-show="showPage"
|
||||||
class="table-page"
|
style="position: relative;"
|
||||||
>
|
>
|
||||||
<span class="total-style">
|
<el-row
|
||||||
{{ $t('chart.total') }}
|
class="table-page"
|
||||||
<span>{{ chart.datasetMode === 0 ? chart.totalItems : ((chart.data && chart.data.tableRow) ? chart.data.tableRow.length : 0) }}</span>
|
:style="autoStyle"
|
||||||
{{ $t('chart.items') }}
|
>
|
||||||
</span>
|
<span class="total-style">
|
||||||
<el-pagination
|
{{ $t('chart.total') }}
|
||||||
small
|
<span>{{
|
||||||
:current-page="currentPage.page"
|
chart.datasetMode === 0 ? chart.totalItems : ((chart.data && chart.data.tableRow) ? chart.data.tableRow.length : 0)
|
||||||
:page-sizes="[10,20,50,100]"
|
}}</span>
|
||||||
:page-size="currentPage.pageSize"
|
{{ $t('chart.items') }}
|
||||||
:pager-count="5"
|
</span>
|
||||||
layout="prev, pager, next"
|
<el-pagination
|
||||||
:total="currentPage.show"
|
small
|
||||||
class="page-style"
|
:current-page="currentPage.page"
|
||||||
@current-change="pageClick"
|
:page-sizes="[10,20,50,100]"
|
||||||
@size-change="pageChange"
|
:page-size="currentPage.pageSize"
|
||||||
/>
|
:pager-count="5"
|
||||||
|
layout="prev, pager, next"
|
||||||
|
:total="currentPage.show"
|
||||||
|
class="page-style"
|
||||||
|
@current-change="pageClick"
|
||||||
|
@size-change="pageChange"
|
||||||
|
/>
|
||||||
|
</el-row>
|
||||||
</el-row>
|
</el-row>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -87,6 +94,7 @@ import { baseTableInfo, baseTableNormal, baseTablePivot } from '@/views/chart/ch
|
|||||||
import TitleRemark from '@/views/chart/view/TitleRemark'
|
import TitleRemark from '@/views/chart/view/TitleRemark'
|
||||||
import { DEFAULT_TITLE_STYLE } from '@/views/chart/chart/chart'
|
import { DEFAULT_TITLE_STYLE } from '@/views/chart/chart/chart'
|
||||||
import ChartTitleUpdate from './ChartTitleUpdate.vue'
|
import ChartTitleUpdate from './ChartTitleUpdate.vue'
|
||||||
|
import { mapState } from 'vuex'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ChartComponentS2',
|
name: 'ChartComponentS2',
|
||||||
@ -162,6 +170,18 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
|
scale() {
|
||||||
|
return this.previewCanvasScale.scalePointWidth
|
||||||
|
},
|
||||||
|
autoStyle() {
|
||||||
|
return {
|
||||||
|
height: (100 / this.scale) + '%!important',
|
||||||
|
width: (100 / this.scale) + '%!important',
|
||||||
|
left: 50 * (1 - 1 / this.scale) + '%', // 放大余量 除以 2
|
||||||
|
top: 50 * (1 - 1 / this.scale) + '%', // 放大余量 除以 2
|
||||||
|
transform: 'scale(' + this.scale + ')'
|
||||||
|
}
|
||||||
|
},
|
||||||
trackBarStyleTime() {
|
trackBarStyleTime() {
|
||||||
return this.trackBarStyle
|
return this.trackBarStyle
|
||||||
},
|
},
|
||||||
@ -173,7 +193,10 @@ export default {
|
|||||||
chartInfo() {
|
chartInfo() {
|
||||||
const { id, title } = this.chart
|
const { id, title } = this.chart
|
||||||
return { id, title }
|
return { id, title }
|
||||||
}
|
},
|
||||||
|
...mapState([
|
||||||
|
'previewCanvasScale'
|
||||||
|
])
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
chart: {
|
chart: {
|
||||||
|
@ -44,23 +44,33 @@
|
|||||||
v-show="showPage"
|
v-show="showPage"
|
||||||
class="table-page"
|
class="table-page"
|
||||||
>
|
>
|
||||||
<span class="total-style">
|
<el-row style="position: relative;width:100% ">
|
||||||
{{ $t('chart.total') }}
|
<el-row
|
||||||
<span>{{ chart.datasetMode === 0 ? chart.totalItems : ((chart.data && chart.data.tableRow) ? chart.data.tableRow.length : 0) }}</span>
|
class="table-page-inner"
|
||||||
{{ $t('chart.items') }}
|
:style="autoStyle"
|
||||||
</span>
|
>
|
||||||
<el-pagination
|
<span class="total-style">
|
||||||
small
|
{{ $t('chart.total') }}
|
||||||
:current-page="currentPage.page"
|
<span>{{
|
||||||
:page-sizes="[10,20,50,100]"
|
chart.datasetMode === 0 ? chart.totalItems : ((chart.data && chart.data.tableRow) ? chart.data.tableRow.length : 0)
|
||||||
:page-size="currentPage.pageSize"
|
}}</span>
|
||||||
:pager-count="5"
|
{{ $t('chart.items') }}
|
||||||
layout="prev, pager, next"
|
</span>
|
||||||
:total="currentPage.show"
|
<el-pagination
|
||||||
class="page-style"
|
small
|
||||||
@current-change="pageClick"
|
:current-page="currentPage.page"
|
||||||
@size-change="pageChange"
|
:page-sizes="[10,20,50,100]"
|
||||||
/>
|
:page-size="currentPage.pageSize"
|
||||||
|
:pager-count="5"
|
||||||
|
layout="prev, pager, next"
|
||||||
|
:total="currentPage.show"
|
||||||
|
class="page-style"
|
||||||
|
@current-change="pageClick"
|
||||||
|
@size-change="pageChange"
|
||||||
|
/>
|
||||||
|
</el-row>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-row>
|
</el-row>
|
||||||
</div>
|
</div>
|
||||||
@ -70,6 +80,7 @@
|
|||||||
import { hexColorToRGBA } from '../../chart/util'
|
import { hexColorToRGBA } from '../../chart/util'
|
||||||
import eventBus from '@/components/canvas/utils/eventBus'
|
import eventBus from '@/components/canvas/utils/eventBus'
|
||||||
import { DEFAULT_SIZE } from '@/views/chart/chart/chart'
|
import { DEFAULT_SIZE } from '@/views/chart/chart/chart'
|
||||||
|
import { mapState } from 'vuex'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'TableNormal',
|
name: 'TableNormal',
|
||||||
@ -147,12 +158,27 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
scale() {
|
||||||
|
return this.previewCanvasScale.scalePointWidth
|
||||||
|
},
|
||||||
|
autoStyle() {
|
||||||
|
return {
|
||||||
|
height: (100 / this.scale) + '%!important',
|
||||||
|
width: (100 / this.scale) + '%!important',
|
||||||
|
left: 50 * (1 - 1 / this.scale) + '%', // 放大余量 除以 2
|
||||||
|
top: 50 * (1 - 1 / this.scale) + '%', // 放大余量 除以 2
|
||||||
|
transform: 'scale(' + this.scale + ')'
|
||||||
|
}
|
||||||
|
},
|
||||||
bg_class() {
|
bg_class() {
|
||||||
return {
|
return {
|
||||||
background: hexColorToRGBA('#ffffff', 0),
|
background: hexColorToRGBA('#ffffff', 0),
|
||||||
borderRadius: this.borderRadius
|
borderRadius: this.borderRadius
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
...mapState([
|
||||||
|
'previewCanvasScale'
|
||||||
|
])
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
chart: function() {
|
chart: function() {
|
||||||
@ -473,38 +499,53 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.table-class ::v-deep .body--wrapper{
|
.table-class ::v-deep .body--wrapper {
|
||||||
background: rgba(1,1,1,0);
|
background: rgba(1, 1, 1, 0);
|
||||||
}
|
}
|
||||||
.table-class ::v-deep .elx-cell{
|
|
||||||
max-height: none!important;
|
.table-class ::v-deep .elx-cell {
|
||||||
line-height: normal!important;
|
max-height: none !important;
|
||||||
}
|
line-height: normal !important;
|
||||||
.table-page{
|
}
|
||||||
position: absolute;
|
|
||||||
bottom: 0;
|
.table-page-inner {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
.page-style{
|
|
||||||
margin-right: auto;
|
.table-page {
|
||||||
}
|
position: absolute;
|
||||||
.total-style{
|
bottom: 0;
|
||||||
flex: 1;
|
display: flex;
|
||||||
font-size: 12px;
|
align-items: center;
|
||||||
color: #606266;
|
justify-content: flex-end;
|
||||||
white-space:nowrap;
|
width: 100%;
|
||||||
}
|
overflow: hidden;
|
||||||
.page-style ::v-deep .el-input__inner{
|
}
|
||||||
height: 24px;
|
|
||||||
}
|
.page-style {
|
||||||
.page-style ::v-deep button{
|
margin-right: auto;
|
||||||
background: transparent!important;
|
}
|
||||||
}
|
|
||||||
.page-style ::v-deep li{
|
.total-style {
|
||||||
background: transparent!important;
|
flex: 1;
|
||||||
}
|
font-size: 12px;
|
||||||
|
color: #606266;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-style ::v-deep .el-input__inner {
|
||||||
|
height: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-style ::v-deep button {
|
||||||
|
background: transparent !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-style ::v-deep li {
|
||||||
|
background: transparent !important;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
Reference in New Issue
Block a user