refactor(仪表板): 隐藏组件测试

This commit is contained in:
wangjiahao 2024-05-20 16:20:55 +08:00
parent bbc6064045
commit 8e0510db50
7 changed files with 120 additions and 3 deletions

View File

@ -42,6 +42,7 @@ import PointShadow from '@/components/data-visualization/canvas/PointShadow.vue'
import DragInfo from '@/components/visualization/common/DragInfo.vue' import DragInfo from '@/components/visualization/common/DragInfo.vue'
import { activeWatermark } from '@/components/watermark/watermark' import { activeWatermark } from '@/components/watermark/watermark'
import { personInfoApi } from '@/api/user' import { personInfoApi } from '@/api/user'
import ComponentHangPopver from '@/custom-component/independent-hang/ComponentHangPopver.vue'
const snapshotStore = snapshotStoreWithOut() const snapshotStore = snapshotStoreWithOut()
const dvMainStore = dvMainStoreWithOut() const dvMainStore = dvMainStoreWithOut()
const composeStore = composeStoreWithOut() const composeStore = composeStoreWithOut()

View File

@ -211,6 +211,7 @@ const list = [
propValue: '', propValue: '',
icon: 'other_text', icon: 'other_text',
innerType: 'VQuery', innerType: 'VQuery',
isHang: false,
x: 1, x: 1,
y: 1, y: 1,
sizeX: 72, sizeX: 72,

View File

@ -0,0 +1,45 @@
<template>
<div class="hang-main" @keydown.stop @keyup.stop>
<div :key="index" v-for="(config, index) in hangComponentData">
<component
:is="findComponent(config['component'])"
:view="canvasViewInfo[config['id']]"
ref="component"
class="component"
:element="config"
:scale="deepScale"
/>
</div>
</div>
</template>
<script setup lang="ts">
import { computed, toRefs } from 'vue'
import findComponent from '@/utils/components'
const props = defineProps({
hangComponentData: {
type: Object,
required: true
},
canvasViewInfo: {
type: Object,
required: true
},
scale: {
type: Number,
required: false,
default: 100
}
})
const { hangComponentData, scale } = toRefs(props)
const deepScale = computed(() => scale.value / 100)
</script>
<style lang="less" scoped>
.hang-main {
overflow: auto;
width: 100%;
height: 300px;
}
</style>

View File

@ -0,0 +1,58 @@
<script setup lang="ts">
import { computed, toRefs } from 'vue'
import ComponentHang from '@/custom-component/independent-hang/ComponentHang.vue'
const props = defineProps({
componentData: {
type: Object,
required: true
},
canvasViewInfo: {
type: Object,
required: true
},
themes: {
type: String,
required: true,
default: 'dark'
}
})
const { componentData, canvasViewInfo } = toRefs(props)
const hangComponentData = computed(() =>
componentData.value.filter(ele => {
return ele.component === 'VQuery' && ele.isHang === true
})
)
</script>
<template>
<el-popover
width="300"
trigger="click"
:show-arrow="false"
:popper-class="'custom-popover-' + themes"
>
<template #reference>
<div class="reference-position">
<el-button style="margin-right: 16px">隐藏按钮</el-button>
</div>
</template>
<div>
<component-hang
:hang-component-data="hangComponentData"
:canvas-view-info="canvasViewInfo"
:scale="100"
>
</component-hang>
</div>
</el-popover>
</template>
<style lang="less" scoped>
.reference-position {
position: absolute;
right: 100px;
top: 100px;
}
</style>

View File

@ -9,6 +9,10 @@ const state = {
} }
const props = defineProps({ const props = defineProps({
element: {
type: Object,
required: true
},
chart: { chart: {
type: Object, type: Object,
required: true required: true
@ -24,7 +28,7 @@ const props = defineProps({
}) })
const predefineColors = COLOR_PANEL const predefineColors = COLOR_PANEL
const { chart, commonBackgroundPop } = toRefs(props) const { element, chart, commonBackgroundPop } = toRefs(props)
</script> </script>
<template> <template>
@ -33,6 +37,11 @@ const { chart, commonBackgroundPop } = toRefs(props)
<el-collapse v-model="state.styleActiveNames" class="style-collapse"> <el-collapse v-model="state.styleActiveNames" class="style-collapse">
<el-collapse-item :effect="themes" name="component" :title="t('visualization.module')"> <el-collapse-item :effect="themes" name="component" :title="t('visualization.module')">
<el-form label-position="top"> <el-form label-position="top">
<el-form-item class="form-item margin-bottom-8" :class="'form-item-' + themes">
<el-checkbox :effect="themes" v-model="element.isHang" size="small">
隐藏组件
</el-checkbox>
</el-form-item>
<el-form-item class="form-item margin-bottom-8" :class="'form-item-' + themes"> <el-form-item class="form-item margin-bottom-8" :class="'form-item-' + themes">
<el-checkbox <el-checkbox
:effect="themes" :effect="themes"

View File

@ -1518,9 +1518,10 @@ const drop = (ev: MouseEvent, type = 'xAxis') => {
</el-row> </el-row>
<el-row style="height: calc(100vh - 110px); overflow-y: auto"> <el-row style="height: calc(100vh - 110px); overflow-y: auto">
<div class="query-style-tab" v-if="view.type === 'VQuery'"> <div class="query-style-tab" v-if="view.type === 'VQuery' && curComponent">
<div style="padding-top: 1px"> <div style="padding-top: 1px">
<VQueryChartStyle <VQueryChartStyle
:element="curComponent"
:common-background-pop="curComponent?.commonBackground" :common-background-pop="curComponent?.commonBackground"
:chart="view" :chart="view"
:themes="themes" :themes="themes"

View File

@ -93,7 +93,9 @@ public class DefaultCacheImpl implements DECacheService {
@Override @Override
public void keyRemove(String cacheName, String key) { public void keyRemove(String cacheName, String key) {
Cache<Object, Object> cache = cacheManager.getCache(cacheName); Cache<Object, Object> cache = cacheManager.getCache(cacheName);
cache.remove(key); if(cache != null){
cache.remove(key);
}
} }
@PostConstruct @PostConstruct