forked from github/dataease
Merge pull request #13108 from dataease/pr@dev-v2@fix_screen
fix(数据大屏): 修复数据大屏中时间组件预览未出现等问题 #12118
This commit is contained in:
commit
1cdb55b3e6
@ -235,7 +235,8 @@ const resetLayout = () => {
|
|||||||
baseComponentData.value,
|
baseComponentData.value,
|
||||||
canvasStyleData.value,
|
canvasStyleData.value,
|
||||||
scaleMin.value || outerScale.value * 100,
|
scaleMin.value || outerScale.value * 100,
|
||||||
scaleMinHeight || outerScale.value * 100
|
scaleMinHeight || outerScale.value * 100,
|
||||||
|
outerScale.value * 100
|
||||||
)
|
)
|
||||||
scaleMin.value = isMainCanvas(canvasId.value) ? scaleMin.value : outerScale.value * 100
|
scaleMin.value = isMainCanvas(canvasId.value) ? scaleMin.value : outerScale.value * 100
|
||||||
}
|
}
|
||||||
|
@ -129,8 +129,10 @@ import DePreview from '@/components/data-visualization/canvas/DePreview.vue'
|
|||||||
import { useEmitt } from '@/hooks/web/useEmitt'
|
import { useEmitt } from '@/hooks/web/useEmitt'
|
||||||
import { getPanelAllLinkageInfo } from '@/api/visualization/linkage'
|
import { getPanelAllLinkageInfo } from '@/api/visualization/linkage'
|
||||||
import { dataVTabComponentAdd, groupSizeStyleAdaptor } from '@/utils/style'
|
import { dataVTabComponentAdd, groupSizeStyleAdaptor } from '@/utils/style'
|
||||||
import { copyStoreWithOut, deepCopyTabItemHelper } from '@/store/modules/data-visualization/copy'
|
import { deepCopyTabItemHelper } from '@/store/modules/data-visualization/copy'
|
||||||
|
import { snapshotStoreWithOut } from '@/store/modules/data-visualization/snapshot'
|
||||||
const dvMainStore = dvMainStoreWithOut()
|
const dvMainStore = dvMainStoreWithOut()
|
||||||
|
const snapshotStore = snapshotStoreWithOut()
|
||||||
const { tabMoveInActiveId, bashMatrixInfo, editMode, mobileInPc } = storeToRefs(dvMainStore)
|
const { tabMoveInActiveId, bashMatrixInfo, editMode, mobileInPc } = storeToRefs(dvMainStore)
|
||||||
const tabComponentRef = ref(null)
|
const tabComponentRef = ref(null)
|
||||||
let carouselTimer = null
|
let carouselTimer = null
|
||||||
@ -233,6 +235,7 @@ const curPreviewGap = computed(() =>
|
|||||||
function sureCurTitle() {
|
function sureCurTitle() {
|
||||||
state.curItem.title = state.textarea
|
state.curItem.title = state.textarea
|
||||||
state.dialogVisible = false
|
state.dialogVisible = false
|
||||||
|
snapshotStore.recordSnapshotCache()
|
||||||
}
|
}
|
||||||
|
|
||||||
function addTab() {
|
function addTab() {
|
||||||
@ -245,6 +248,7 @@ function addTab() {
|
|||||||
}
|
}
|
||||||
element.value.propValue.push(newTab)
|
element.value.propValue.push(newTab)
|
||||||
editableTabsValue.value = newTab.name
|
editableTabsValue.value = newTab.name
|
||||||
|
snapshotStore.recordSnapshotCache()
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteCur(param) {
|
function deleteCur(param) {
|
||||||
@ -286,9 +290,11 @@ function handleCommand(command) {
|
|||||||
break
|
break
|
||||||
case 'deleteCur':
|
case 'deleteCur':
|
||||||
deleteCur(command.param)
|
deleteCur(command.param)
|
||||||
|
snapshotStore.recordSnapshotCache()
|
||||||
break
|
break
|
||||||
case 'copyCur':
|
case 'copyCur':
|
||||||
copyCur(command.param)
|
copyCur(command.param)
|
||||||
|
snapshotStore.recordSnapshotCache()
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,17 +26,18 @@ export function changeSizeWithScale(scale) {
|
|||||||
return changeComponentsSizeWithScale(scale)
|
return changeComponentsSizeWithScale(scale)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function changeComponentsSizeWithScale(scale) {
|
function changeComponentsSizeWithScaleCircle(componentDataCopy, scale) {
|
||||||
const componentDataCopy = deepCopy(componentData.value)
|
|
||||||
componentDataCopy.forEach(component => {
|
componentDataCopy.forEach(component => {
|
||||||
Object.keys(component.style).forEach(key => {
|
Object.keys(component.style).forEach(key => {
|
||||||
if (needToChangeDirectionAttrs.width.includes(key)) {
|
if (needToChangeDirectionAttrs.width.includes(key)) {
|
||||||
// 根据原来的比例获取样式原来的尺寸
|
// 根据原来的比例获取样式原来的尺寸
|
||||||
// 再用原来的尺寸 * 现在的比例得出新的尺寸
|
// 再用原来的尺寸 * 现在的比例得出新的尺寸
|
||||||
component.style[key] = format(
|
if (!!component.style[key]) {
|
||||||
getOriginStyle(component.style[key], canvasStyleData.value.scale),
|
component.style[key] = format(
|
||||||
scale
|
getOriginStyle(component.style[key], canvasStyleData.value.scale),
|
||||||
)
|
scale
|
||||||
|
)
|
||||||
|
}
|
||||||
} else if (needToChangeDirectionAttrs.height.includes(key)) {
|
} else if (needToChangeDirectionAttrs.height.includes(key)) {
|
||||||
// 根据原来的比例获取样式原来的尺寸
|
// 根据原来的比例获取样式原来的尺寸
|
||||||
// 再用原来的尺寸 * 现在的比例得出新的尺寸
|
// 再用原来的尺寸 * 现在的比例得出新的尺寸
|
||||||
@ -46,6 +47,14 @@ export function changeComponentsSizeWithScale(scale) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (['Group'].includes(component.component)) {
|
||||||
|
changeComponentsSizeWithScaleCircle(component.propValue, scale)
|
||||||
|
} else if (['DeTabs'].includes(component.component)) {
|
||||||
|
component.propValue.forEach(tabItem => {
|
||||||
|
changeComponentsSizeWithScaleCircle(tabItem.componentData, scale)
|
||||||
|
})
|
||||||
|
}
|
||||||
// 如果是分组组件 则要进行分组内部组件groupStyle进行深度计算
|
// 如果是分组组件 则要进行分组内部组件groupStyle进行深度计算
|
||||||
// 计算逻辑 Group 中样式 * groupComponent.groupStyle[sonKey].
|
// 计算逻辑 Group 中样式 * groupComponent.groupStyle[sonKey].
|
||||||
if (['Group', 'DeTabs'].includes(component.component)) {
|
if (['Group', 'DeTabs'].includes(component.component)) {
|
||||||
@ -57,7 +66,11 @@ export function changeComponentsSizeWithScale(scale) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function changeComponentsSizeWithScale(scale) {
|
||||||
|
const componentDataCopy = deepCopy(componentData.value)
|
||||||
|
changeComponentsSizeWithScaleCircle(componentDataCopy, scale)
|
||||||
dvMainStore.setComponentData(componentDataCopy)
|
dvMainStore.setComponentData(componentDataCopy)
|
||||||
// 更新画布数组后,需要重新设置当前组件,否则在改变比例后,直接拖动圆点改变组件大小不会生效
|
// 更新画布数组后,需要重新设置当前组件,否则在改变比例后,直接拖动圆点改变组件大小不会生效
|
||||||
dvMainStore.setCurComponent({
|
dvMainStore.setCurComponent({
|
||||||
@ -94,7 +107,8 @@ export function changeRefComponentsSizeWithScalePoint(
|
|||||||
componentDataRef,
|
componentDataRef,
|
||||||
canvasStyleDataRef,
|
canvasStyleDataRef,
|
||||||
scaleWidth,
|
scaleWidth,
|
||||||
scaleHeight
|
scaleHeight,
|
||||||
|
outScale
|
||||||
) {
|
) {
|
||||||
componentDataRef.forEach(component => {
|
componentDataRef.forEach(component => {
|
||||||
Object.keys(component.style).forEach(key => {
|
Object.keys(component.style).forEach(key => {
|
||||||
@ -103,14 +117,14 @@ export function changeRefComponentsSizeWithScalePoint(
|
|||||||
// 根据原来的比例获取样式原来的尺寸
|
// 根据原来的比例获取样式原来的尺寸
|
||||||
// 再用原来的尺寸 * 现在的比例得出新的尺寸
|
// 再用原来的尺寸 * 现在的比例得出新的尺寸
|
||||||
component.style[key] = format(
|
component.style[key] = format(
|
||||||
getOriginStyle(component.style[key], canvasStyleDataRef.scale),
|
getOriginStyle(component.style[key], canvasStyleDataRef.scale || outScale),
|
||||||
scaleWidth
|
scaleWidth
|
||||||
)
|
)
|
||||||
} else if (needToChangeDirectionAttrs.height.includes(key)) {
|
} else if (needToChangeDirectionAttrs.height.includes(key)) {
|
||||||
// 根据原来的比例获取样式原来的尺寸
|
// 根据原来的比例获取样式原来的尺寸
|
||||||
// 再用原来的尺寸 * 现在的比例得出新的尺寸
|
// 再用原来的尺寸 * 现在的比例得出新的尺寸
|
||||||
component.style[key] = format(
|
component.style[key] = format(
|
||||||
getOriginStyle(component.style[key], canvasStyleDataRef.scaleHeight),
|
getOriginStyle(component.style[key], canvasStyleDataRef.scaleHeight || outScale),
|
||||||
scaleHeight
|
scaleHeight
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -240,7 +240,7 @@ const state = reactive({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 'market',
|
value: 'market',
|
||||||
label: t('work_branch.template_market_official')
|
label: t('visualization.template_market')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 'manage',
|
value: 'manage',
|
||||||
|
Loading…
Reference in New Issue
Block a user