diff --git a/frontend/src/components/canvas/components/editor/ComponentWrapper.vue b/frontend/src/components/canvas/components/editor/ComponentWrapper.vue index 45a0b017b1..4a757dd5fc 100644 --- a/frontend/src/components/canvas/components/editor/ComponentWrapper.vue +++ b/frontend/src/components/canvas/components/editor/ComponentWrapper.vue @@ -201,12 +201,16 @@ export default { componentActiveFlag() { 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() { - 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([ 'mobileLayoutStatus', 'curComponent', + 'previewCanvasScale', 'componentGap' ]) }, diff --git a/frontend/src/components/canvas/components/editor/Preview.vue b/frontend/src/components/canvas/components/editor/Preview.vue index 4ad3d7717a..7c523fe88c 100644 --- a/frontend/src/components/canvas/components/editor/Preview.vue +++ b/frontend/src/components/canvas/components/editor/Preview.vue @@ -552,7 +552,7 @@ export default { component.style[key] = this.format(component.style[key], this.scaleHeight) } if (this.needToChangeWidth.includes(key)) { - if (key === 'fontSize' && this.terminal === 'mobile') { + if (key === 'fontSize' && (this.terminal === 'mobile' || component.type === 'custom')) { // do nothing 移动端字符大小无需按照比例缩放,当前保持不变(包括 v-text 和 过滤组件) } else { component.style[key] = this.format(component.style[key], this.scaleWidth) diff --git a/frontend/src/components/dataease/DeOutWidget.vue b/frontend/src/components/dataease/DeOutWidget.vue index 31025ae3f4..f12aae39d9 100644 --- a/frontend/src/components/dataease/DeOutWidget.vue +++ b/frontend/src/components/dataease/DeOutWidget.vue @@ -2,6 +2,7 @@
import inputStyleMixin from '@/components/widget/deWidget/inputStyleMixin' +import { mapState } from 'vuex' + export default { name: 'DeOutWidget', mixins: [inputStyleMixin], @@ -112,6 +115,18 @@ export default { } }, 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() { let size if (this.duHeight > this.inputLargeSize) { @@ -133,7 +148,10 @@ export default { }, isFilterComponent() { return ['de-select', 'de-select-grid', 'de-date', 'de-input-search', 'de-number-range', 'de-select-tree'].includes(this.element.component) - } + }, + ...mapState([ + 'previewCanvasScale' + ]) }, watch: { 'element.style': { diff --git a/frontend/src/views/chart/components/ChartComponentS2.vue b/frontend/src/views/chart/components/ChartComponentS2.vue index 45a26c20f4..d8e0a556c2 100644 --- a/frontend/src/views/chart/components/ChartComponentS2.vue +++ b/frontend/src/views/chart/components/ChartComponentS2.vue @@ -55,25 +55,32 @@ /> - - {{ $t('chart.total') }} - {{ chart.datasetMode === 0 ? chart.totalItems : ((chart.data && chart.data.tableRow) ? chart.data.tableRow.length : 0) }} - {{ $t('chart.items') }} - - + + + {{ $t('chart.total') }} + {{ + chart.datasetMode === 0 ? chart.totalItems : ((chart.data && chart.data.tableRow) ? chart.data.tableRow.length : 0) + }} + {{ $t('chart.items') }} + + +
@@ -87,6 +94,7 @@ import { baseTableInfo, baseTableNormal, baseTablePivot } from '@/views/chart/ch import TitleRemark from '@/views/chart/view/TitleRemark' import { DEFAULT_TITLE_STYLE } from '@/views/chart/chart/chart' import ChartTitleUpdate from './ChartTitleUpdate.vue' +import { mapState } from 'vuex' export default { name: 'ChartComponentS2', @@ -162,6 +170,18 @@ export default { }, 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() { return this.trackBarStyle }, @@ -173,7 +193,10 @@ export default { chartInfo() { const { id, title } = this.chart return { id, title } - } + }, + ...mapState([ + 'previewCanvasScale' + ]) }, watch: { chart: { diff --git a/frontend/src/views/chart/components/table/TableNormal.vue b/frontend/src/views/chart/components/table/TableNormal.vue index 6533281768..7529b1efb1 100644 --- a/frontend/src/views/chart/components/table/TableNormal.vue +++ b/frontend/src/views/chart/components/table/TableNormal.vue @@ -44,23 +44,33 @@ v-show="showPage" class="table-page" > - - {{ $t('chart.total') }} - {{ chart.datasetMode === 0 ? chart.totalItems : ((chart.data && chart.data.tableRow) ? chart.data.tableRow.length : 0) }} - {{ $t('chart.items') }} - - + + + + {{ $t('chart.total') }} + {{ + chart.datasetMode === 0 ? chart.totalItems : ((chart.data && chart.data.tableRow) ? chart.data.tableRow.length : 0) + }} + {{ $t('chart.items') }} + + + + + @@ -70,6 +80,7 @@ import { hexColorToRGBA } from '../../chart/util' import eventBus from '@/components/canvas/utils/eventBus' import { DEFAULT_SIZE } from '@/views/chart/chart/chart' +import { mapState } from 'vuex' export default { name: 'TableNormal', @@ -147,12 +158,27 @@ export default { } }, 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() { return { background: hexColorToRGBA('#ffffff', 0), borderRadius: this.borderRadius } - } + }, + ...mapState([ + 'previewCanvasScale' + ]) }, watch: { chart: function() { @@ -473,38 +499,53 @@ export default {