feat(数据大屏): 数据大屏支持隐藏组件
This commit is contained in:
parent
4907e74e27
commit
c1fa037bde
@ -15,9 +15,11 @@ import { personInfoApi } from '@/api/user'
|
||||
import router from '@/router'
|
||||
import { XpackComponent } from '@/components/plugin'
|
||||
import PopArea from '@/custom-component/pop-area/Component.vue'
|
||||
import CanvasFilterBtn from '@/custom-component/canvas-filter-btn/Component.vue'
|
||||
const dvMainStore = dvMainStoreWithOut()
|
||||
const { pcMatrixCount, curComponent, mobileInPc, canvasState } = storeToRefs(dvMainStore)
|
||||
const openHandler = ref(null)
|
||||
|
||||
const props = defineProps({
|
||||
canvasStyleData: {
|
||||
type: Object,
|
||||
@ -295,6 +297,9 @@ const userViewEnlargeOpen = (opt, item) => {
|
||||
}
|
||||
const handleMouseDown = () => {
|
||||
dvMainStore.setCurComponent({ component: null, index: null })
|
||||
if (!curComponent.value || (curComponent.value && curComponent.value.category !== 'hidden')) {
|
||||
dvMainStore.canvasStateChange({ key: 'curPointArea', value: 'base' })
|
||||
}
|
||||
}
|
||||
|
||||
const onPointClick = param => {
|
||||
@ -328,6 +333,10 @@ const popAreaAvailable = computed(
|
||||
() => canvasStyleData.value?.popupAvailable && isMainCanvas(canvasId.value)
|
||||
)
|
||||
|
||||
const filterBtnShow = computed(
|
||||
() => popAreaAvailable.value && popComponentData.value && popComponentData.value.length > 0
|
||||
)
|
||||
|
||||
defineExpose({
|
||||
restore
|
||||
})
|
||||
@ -341,6 +350,8 @@ defineExpose({
|
||||
ref="previewCanvas"
|
||||
@mousedown="handleMouseDown"
|
||||
>
|
||||
<!--弹框触发区域-->
|
||||
<canvas-filter-btn v-if="filterBtnShow"></canvas-filter-btn>
|
||||
<!-- 弹框区域 -->
|
||||
<PopArea
|
||||
v-if="popAreaAvailable"
|
||||
|
||||
@ -0,0 +1,81 @@
|
||||
<!-- IconSlider.vue -->
|
||||
<template>
|
||||
<el-tooltip offset="18" effect="dark" placement="left" content="查询">
|
||||
<div class="canvas-filter">
|
||||
<div class="icon-slider" @mouseenter="slideOut" @mouseleave="slideBack">
|
||||
<div
|
||||
class="icon-container"
|
||||
:class="{ 'icon-container-active': filterActive }"
|
||||
:style="{ transform: `translateX(${offset}px)` }"
|
||||
@click="popAreaActiveChange"
|
||||
>
|
||||
<el-icon><Filter /></el-icon>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref } from 'vue'
|
||||
import { ElTooltip } from 'element-plus-secondary'
|
||||
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
|
||||
import { storeToRefs } from 'pinia'
|
||||
const dvMainStore = dvMainStoreWithOut()
|
||||
const offset = ref(0)
|
||||
const slideDistance = ref(14) // 滑动距离
|
||||
const { canvasState } = storeToRefs(dvMainStore)
|
||||
|
||||
const filterActive = computed(() => canvasState.value.curPointArea === 'hidden')
|
||||
const slideOut = () => {
|
||||
offset.value = -slideDistance.value
|
||||
}
|
||||
|
||||
const popAreaActiveChange = () => {
|
||||
dvMainStore.popAreaActiveSwitch()
|
||||
}
|
||||
const slideBack = () => {
|
||||
offset.value = 0
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.canvas-filter {
|
||||
position: absolute;
|
||||
right: -14px;
|
||||
bottom: 50px;
|
||||
width: 28px;
|
||||
height: 32px;
|
||||
}
|
||||
.icon-slider {
|
||||
position: relative;
|
||||
z-index: 100;
|
||||
width: 28px;
|
||||
height: 32px;
|
||||
}
|
||||
|
||||
.icon-container {
|
||||
transition: transform 0.3s ease; /* 过渡动画 */
|
||||
background: rgba(26, 26, 26, 1);
|
||||
font-size: 14px;
|
||||
border: 1px solid rgba(67, 67, 67, 1);
|
||||
border-radius: 16px 0 0 16px;
|
||||
padding: 6px 0 0 6px;
|
||||
cursor: pointer;
|
||||
&:hover {
|
||||
background: rgba(235, 235, 235, 0.1);
|
||||
}
|
||||
|
||||
&:active {
|
||||
background: rgba(235, 235, 235, 0.2);
|
||||
}
|
||||
}
|
||||
.icon-container-active {
|
||||
transform: translateX(-14px) !important;
|
||||
}
|
||||
|
||||
img {
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
}
|
||||
</style>
|
||||
@ -88,8 +88,10 @@ const colorPickerWidth = computed(() => {
|
||||
}
|
||||
})
|
||||
|
||||
// 暂时关闭
|
||||
const eventsShow = computed(() => {
|
||||
return !dashboardActive.value && ['Picture'].includes(element.value.component)
|
||||
return false
|
||||
// return !dashboardActive.value && ['Picture'].includes(element.value.component)
|
||||
})
|
||||
|
||||
const backgroundCustomShow = computed(() => {
|
||||
|
||||
@ -71,6 +71,7 @@ const uploadImg = () => {
|
||||
overflow: hidden;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
cursor: pointer;
|
||||
}
|
||||
.pic-upload {
|
||||
display: flex;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<!--此区域暂时放到类似视图和分组平行的组件作为后续扩展使用,但当前版本只作为类似MarkLine 和canvasCore平行组件 仅做区域显示使用-->
|
||||
<div class="pop-area" :style="popCanvasStyle" @mousedown="handleMouseDown">
|
||||
<div class="pop-area" :style="popCanvasStyle" @mousedown.stop @mousedup.stop>
|
||||
<div style="width: 100%; height: 100%">
|
||||
<div v-if="popComponentData && popComponentData.length > 0" class="pop-content">
|
||||
<!--使用ComponentWrapper 保留扩展能力-->
|
||||
|
||||
Loading…
Reference in New Issue
Block a user