feat(仪表板、数据大屏): 联动按钮固定悬浮在页面右上角 #15276

This commit is contained in:
wangjiahao
2025-03-17 18:05:01 +08:00
committed by 王嘉豪
parent 2b1afd1b05
commit 5e0bfe4419
4 changed files with 40 additions and 4 deletions

View File

@@ -93,6 +93,11 @@ const props = defineProps({
type: String,
required: false,
default: 'inherit'
},
// 联动按钮位置
showLinkageButton: {
type: Boolean,
default: true
}
})
@@ -501,9 +506,11 @@ defineExpose({
:show-position="'preview'"
></PopArea>
<canvas-opt-bar
v-if="showLinkageButton"
:canvas-id="canvasId"
:canvas-style-data="canvasStyleData"
:component-data="baseComponentData"
:is-fixed="isOverSize"
></canvas-opt-bar>
<template v-if="renderReady">
<ComponentWrapper

View File

@@ -2,10 +2,12 @@
<div
v-if="existLinkage && (!dvMainStore.mobileInPc || isMobile())"
class="bar-main-right"
:class="{ 'bar-main-edit-right': dvEditMode }"
:class="{
'bar-main-preview-fixed': dvPreviewMode
}"
@mousedown="handOptBarMousedown"
>
<el-button size="mini" type="warning" @click="clearAllLinkage"
<el-button type="warning" @click="clearAllLinkage"
><el-icon class="bar-base-icon">
<Icon name="dv-bar-unLinkage"><dvBarUnLinkage class="svg-icon" /></Icon></el-icon
>{{ $t('visualization.remove_all_linkage') }}</el-button
@@ -35,6 +37,10 @@ const props = defineProps({
type: String,
required: false,
default: 'canvas-main'
},
isFixed: {
type: Boolean,
default: false
}
})
@@ -48,9 +54,10 @@ const clearAllLinkage = () => {
useEmitt().emitter.emit('clearPanelLinkage', { viewId: 'all' })
}
const dvEditMode = computed(() => {
return dvMainStore.dvInfo.type === 'dataV' && dvMainStore.editMode === 'preview' && !isMobile()
const dvPreviewMode = computed(() => {
return dvMainStore.dvInfo.type === 'dataV' && props.isFixed
})
const existLinkage = computed(() => {
if (isMainCanvas(props.canvasId)) {
let linkageFiltersCount = 0
@@ -104,4 +111,10 @@ const existLinkage = computed(() => {
opacity: 0.8;
}
}
.bar-main-preview-fixed {
position: fixed;
top: 120px;
right: 5px;
}
</style>

View File

@@ -19,6 +19,7 @@ import AppExportForm from '@/components/de-app/AppExportForm.vue'
import { useEmitt } from '@/hooks/web/useEmitt'
import { useUserStoreWithOut } from '@/store/modules/user'
import { useI18n } from '@/hooks/web/useI18n'
import CanvasOptBar from '@/components/visualization/CanvasOptBar.vue'
const userStore = useUserStoreWithOut()
const userName = computed(() => userStore.getName)
@@ -283,6 +284,11 @@ defineExpose({
id="de-preview-content"
:class="{ 'de-screen-full': fullscreenFlag }"
>
<canvas-opt-bar
canvas-id="canvas-main"
:canvas-style-data="state.canvasStylePreview || {}"
:component-data="state.canvasDataPreview || []"
></canvas-opt-bar>
<de-preview
ref="dashboardPreview"
v-if="state.canvasStylePreview && dataInitState"
@@ -293,6 +299,7 @@ defineExpose({
:canvas-view-info="state.canvasViewInfoPreview"
:show-position="showPosition"
:download-status="downloadStatus"
:show-linkage-button="false"
></de-preview>
</div>
</template>
@@ -354,6 +361,7 @@ defineExpose({
}
.content {
position: relative;
display: flex;
width: 100%;
height: 100%;

View File

@@ -18,6 +18,7 @@ import { isLink, setTitle } from '@/utils/utils'
import EmptyBackground from '../../components/empty-background/src/EmptyBackground.vue'
import { useRoute } from 'vue-router'
import { filterEnumMapSync } from '@/utils/componentUtils'
import CanvasOptBar from '@/components/visualization/CanvasOptBar.vue'
const routeWatch = useRoute()
const dvMainStore = dvMainStoreWithOut()
@@ -216,6 +217,11 @@ defineExpose({
:class="{ 'canvas_keep-size': dataVKeepSize }"
ref="previewCanvasContainer"
>
<canvas-opt-bar
canvas-id="canvas-main"
:canvas-style-data="state.canvasStylePreview || {}"
:component-data="state.canvasDataPreview || []"
></canvas-opt-bar>
<de-preview
ref="dvPreview"
v-if="state.canvasStylePreview && state.initState"
@@ -227,6 +233,7 @@ defineExpose({
:is-selector="props.isSelector"
:download-status="downloadStatus"
:show-pop-bar="true"
:show-linkage-button="false"
></de-preview>
<empty-background
v-if="!state.initState"
@@ -252,6 +259,7 @@ defineExpose({
display: none;
}
.content {
position: relative;
background-color: #ffffff;
width: 100%;
height: 100vh;