mirror of
https://github.com/dataease/dataease.git
synced 2025-02-24 11:32:57 +08:00
feat(仪表板): 仪表板提供按照实际宽高比例缩放的方式 #14027
Some checks are pending
Typos Check / Spell Check with Typos (push) Waiting to run
Some checks are pending
Typos Check / Spell Check with Typos (push) Waiting to run
This commit is contained in:
parent
d03cf9a912
commit
e0d65ae322
@ -49,6 +49,21 @@
|
|||||||
<el-radio :effect="themes" label="no">{{ t('visualization.no_gap') }}</el-radio>
|
<el-radio :effect="themes" label="no">{{ t('visualization.no_gap') }}</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item
|
||||||
|
v-if="dvInfo.type === 'dashboard'"
|
||||||
|
class="form-item"
|
||||||
|
:class="'form-item-' + themes"
|
||||||
|
:label="t('visualization.dashboard_adaptor')"
|
||||||
|
>
|
||||||
|
<el-radio-group v-model="canvasStyleData.dashboardAdaptor" @change="themeChange">
|
||||||
|
<el-radio :effect="themes" label="keepHeightAndWidth">{{
|
||||||
|
t('visualization.scale_keep_height_and_width')
|
||||||
|
}}</el-radio>
|
||||||
|
<el-radio :effect="themes" label="withWidth">{{
|
||||||
|
t('visualization.scale_with_width')
|
||||||
|
}}</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item class="form-item" :class="'form-item-' + themes" style="margin-bottom: 8px">
|
<el-form-item class="form-item" :class="'form-item-' + themes" style="margin-bottom: 8px">
|
||||||
<el-checkbox
|
<el-checkbox
|
||||||
:effect="themes"
|
:effect="themes"
|
||||||
|
@ -133,6 +133,11 @@ const curSearchCount = computed(() => {
|
|||||||
const dataVKeepRadio = computed(() => {
|
const dataVKeepRadio = computed(() => {
|
||||||
return canvasStyleData.value?.screenAdaptor !== 'full'
|
return canvasStyleData.value?.screenAdaptor !== 'full'
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 仪表板是否跟随宽度缩放 非全屏 full 都需要保持宽高比例
|
||||||
|
const dashboardScaleWithWidth = computed(() => {
|
||||||
|
return isDashboard() && canvasStyleData.value?.dashboardAdaptor === 'withWidth'
|
||||||
|
})
|
||||||
const isReport = computed(() => {
|
const isReport = computed(() => {
|
||||||
return !!router.currentRoute.value.query?.report
|
return !!router.currentRoute.value.query?.report
|
||||||
})
|
})
|
||||||
@ -235,13 +240,21 @@ const resetLayout = () => {
|
|||||||
let canvasWidth = previewCanvas.value.clientWidth
|
let canvasWidth = previewCanvas.value.clientWidth
|
||||||
let canvasHeight = previewCanvas.value.clientHeight
|
let canvasHeight = previewCanvas.value.clientHeight
|
||||||
scaleWidthPoint.value = (canvasWidth * 100) / canvasStyleData.value.width
|
scaleWidthPoint.value = (canvasWidth * 100) / canvasStyleData.value.width
|
||||||
|
if (dashboardScaleWithWidth.value) {
|
||||||
|
scaleHeightPoint.value = scaleWidthPoint.value * 0.7
|
||||||
|
} else {
|
||||||
scaleHeightPoint.value = (canvasHeight * 100) / canvasStyleData.value.height
|
scaleHeightPoint.value = (canvasHeight * 100) / canvasStyleData.value.height
|
||||||
|
}
|
||||||
scaleMin.value = isDashboard()
|
scaleMin.value = isDashboard()
|
||||||
? Math.floor(Math.min(scaleWidthPoint.value, scaleHeightPoint.value))
|
? Math.floor(Math.min(scaleWidthPoint.value, scaleHeightPoint.value))
|
||||||
: scaleWidthPoint.value
|
: scaleWidthPoint.value
|
||||||
if (dashboardActive.value) {
|
if (dashboardActive.value) {
|
||||||
cellWidth.value = canvasWidth / pcMatrixCount.value.x
|
cellWidth.value = canvasWidth / pcMatrixCount.value.x
|
||||||
|
if (dashboardScaleWithWidth.value) {
|
||||||
|
cellHeight.value = (canvasHeight * 0.7) / cellWidth.value
|
||||||
|
} else {
|
||||||
cellHeight.value = canvasHeight / pcMatrixCount.value.y
|
cellHeight.value = canvasHeight / pcMatrixCount.value.y
|
||||||
|
}
|
||||||
scaleMin.value = isMainCanvas(canvasId.value)
|
scaleMin.value = isMainCanvas(canvasId.value)
|
||||||
? scaleMin.value * 1.2
|
? scaleMin.value * 1.2
|
||||||
: outerScale.value * 100
|
: outerScale.value * 100
|
||||||
|
@ -2806,6 +2806,9 @@ Scatter chart (bubble) chart: {a} (series name), {b} (data name), {c} (value arr
|
|||||||
column_name: 'Field name'
|
column_name: 'Field name'
|
||||||
},
|
},
|
||||||
visualization: {
|
visualization: {
|
||||||
|
dashboard_adaptor: 'Zoom Mode',
|
||||||
|
scale_keep_height_and_width: 'Default Aspect Ratio',
|
||||||
|
scale_with_width: 'Actual Aspect Ratio',
|
||||||
multi_selected: '{0} components selected',
|
multi_selected: '{0} components selected',
|
||||||
number1: '1',
|
number1: '1',
|
||||||
number2: '2',
|
number2: '2',
|
||||||
|
@ -2734,6 +2734,9 @@ export default {
|
|||||||
column_name: '欄位名稱'
|
column_name: '欄位名稱'
|
||||||
},
|
},
|
||||||
visualization: {
|
visualization: {
|
||||||
|
dashboard_adaptor: '縮放模式',
|
||||||
|
scale_keep_height_and_width: '按預設寬高比例縮放',
|
||||||
|
scale_with_width: '按照實際寬高比例縮放',
|
||||||
multi_selected: '已選{0}項',
|
multi_selected: '已選{0}項',
|
||||||
number1: '一',
|
number1: '一',
|
||||||
number2: '二',
|
number2: '二',
|
||||||
|
@ -2736,6 +2736,9 @@ export default {
|
|||||||
column_name: '字段名称'
|
column_name: '字段名称'
|
||||||
},
|
},
|
||||||
visualization: {
|
visualization: {
|
||||||
|
dashboard_adaptor: '缩放模式',
|
||||||
|
scale_keep_height_and_width: '按默认宽高比例缩放',
|
||||||
|
scale_with_width: '按照实际宽高比例缩放',
|
||||||
multi_selected: '已选{0}项',
|
multi_selected: '已选{0}项',
|
||||||
number1: '一',
|
number1: '一',
|
||||||
number2: '二',
|
number2: '二',
|
||||||
|
@ -250,6 +250,8 @@ export function historyAdaptor(
|
|||||||
? false
|
? false
|
||||||
: canvasStyleResult['suspensionButtonAvailable']
|
: canvasStyleResult['suspensionButtonAvailable']
|
||||||
canvasStyleResult['screenAdaptor'] = canvasStyleResult['screenAdaptor'] || 'widthFirst'
|
canvasStyleResult['screenAdaptor'] = canvasStyleResult['screenAdaptor'] || 'widthFirst'
|
||||||
|
canvasStyleResult['dashboardAdaptor'] =
|
||||||
|
canvasStyleResult['dashboardAdaptor'] || 'keepHeightAndWidth'
|
||||||
canvasStyleResult['refreshBrowserEnable'] =
|
canvasStyleResult['refreshBrowserEnable'] =
|
||||||
canvasStyleResult['refreshBrowserEnable'] === undefined
|
canvasStyleResult['refreshBrowserEnable'] === undefined
|
||||||
? false
|
? false
|
||||||
|
@ -93,6 +93,7 @@ export const DEFAULT_CANVAS_STYLE_DATA_BASE = {
|
|||||||
popupButtonAvailable: true, // 弹框区域显示按钮是否可用 默认为true
|
popupButtonAvailable: true, // 弹框区域显示按钮是否可用 默认为true
|
||||||
suspensionButtonAvailable: false, // 悬浮按钮是否可用 默认false
|
suspensionButtonAvailable: false, // 悬浮按钮是否可用 默认false
|
||||||
screenAdaptor: 'widthFirst', // 屏幕适配方式 widthFirst=宽度优先 heightFirst=高度优先 full=铺满全屏 keepSize=不缩放
|
screenAdaptor: 'widthFirst', // 屏幕适配方式 widthFirst=宽度优先 heightFirst=高度优先 full=铺满全屏 keepSize=不缩放
|
||||||
|
dashboardAdaptor: 'keepHeightAndWidth', //仪表板预览展示适配方式 keepHeightAndWidth=高度宽度独立缩放(默认模式),withWidth=跟随宽度
|
||||||
scale: 60,
|
scale: 60,
|
||||||
scaleWidth: 60,
|
scaleWidth: 60,
|
||||||
scaleHeight: 60,
|
scaleHeight: 60,
|
||||||
|
Loading…
Reference in New Issue
Block a user