refactor(数据大屏、仪表板): 图表编辑区域样式优化

This commit is contained in:
wangjiahao 2024-10-12 10:37:54 +08:00
parent f63e9a1665
commit fa8414ff9c
3 changed files with 39 additions and 3 deletions

View File

@ -1,10 +1,11 @@
<script setup lang="ts"> <script setup lang="ts">
import icon_info_outlined from '@/assets/svg/icon_info_outlined.svg' import icon_info_outlined from '@/assets/svg/icon_info_outlined.svg'
import { computed, toRefs } from 'vue' import { computed, nextTick, toRefs } from 'vue'
import { ElFormItem, ElIcon, ElInputNumber } from 'element-plus-secondary' import { ElFormItem, ElIcon, ElInputNumber } from 'element-plus-secondary'
import { snapshotStoreWithOut } from '@/store/modules/data-visualization/snapshot' import { snapshotStoreWithOut } from '@/store/modules/data-visualization/snapshot'
import CollapseSwitchItem from '../../components/collapse-switch-item/src/CollapseSwitchItem.vue' import CollapseSwitchItem from '../../components/collapse-switch-item/src/CollapseSwitchItem.vue'
import Icon from '../../components/icon-custom/src/Icon.vue' import Icon from '../../components/icon-custom/src/Icon.vue'
import { useEmitt } from '@/hooks/web/useEmitt'
const snapshotStore = snapshotStoreWithOut() const snapshotStore = snapshotStoreWithOut()
@ -28,6 +29,13 @@ const onSettingChange = () => {
if (!carouselInfo.value.time || carouselInfo.value.time < 1) { if (!carouselInfo.value.time || carouselInfo.value.time < 1) {
carouselInfo.value.time = 1 carouselInfo.value.time = 1
} }
if (carouselInfo.value.enable) {
useEmitt().emitter.emit('carouselValueChange')
}
nextTick(() => {
useEmitt().emitter.emit('calcData-' + element.value.id)
})
snapshotStore.recordSnapshotCache('renderChart') snapshotStore.recordSnapshotCache('renderChart')
} }

View File

@ -43,6 +43,7 @@ const { curComponent, canvasViewInfo } = storeToRefs(dvMainStore)
<template v-slot:threshold> <template v-slot:threshold>
<picture-group-threshold <picture-group-threshold
:themes="themes" :themes="themes"
:element="curComponent"
:view="canvasViewInfo[curComponent ? curComponent.id : 'default']" :view="canvasViewInfo[curComponent ? curComponent.id : 'default']"
> >
<template v-slot:dataset> <template v-slot:dataset>

View File

@ -1,10 +1,11 @@
<script setup lang="ts"> <script setup lang="ts">
import { PropType, toRefs } from 'vue' import { nextTick, onMounted, PropType, toRefs } from 'vue'
import { BASE_VIEW_CONFIG } from '@/views/chart/components/editor/util/chart' import { BASE_VIEW_CONFIG } from '@/views/chart/components/editor/util/chart'
import { snapshotStoreWithOut } from '@/store/modules/data-visualization/snapshot' import { snapshotStoreWithOut } from '@/store/modules/data-visualization/snapshot'
import Threshold from '@/views/chart/components/editor/editor-senior/components/Threshold.vue' import Threshold from '@/views/chart/components/editor/editor-senior/components/Threshold.vue'
import { CollapseSwitchItem } from '@/components/collapse-switch-item' import { CollapseSwitchItem } from '@/components/collapse-switch-item'
import { useI18n } from '@/hooks/web/useI18n' import { useI18n } from '@/hooks/web/useI18n'
import { useEmitt } from '@/hooks/web/useEmitt'
const snapshotStore = snapshotStoreWithOut() const snapshotStore = snapshotStoreWithOut()
const { t } = useI18n() const { t } = useI18n()
@ -13,6 +14,16 @@ const props = defineProps({
type: String as PropType<EditorTheme>, type: String as PropType<EditorTheme>,
default: 'dark' default: 'dark'
}, },
element: {
type: Object,
default() {
return {
propValue: {
urlList: []
}
}
}
},
view: { view: {
type: Object as PropType<ChartObj>, type: Object as PropType<ChartObj>,
required: false, required: false,
@ -21,13 +32,29 @@ const props = defineProps({
} }
} }
}) })
const { view } = toRefs(props) const { view, element } = toRefs(props)
const onThresholdChange = val => { const onThresholdChange = val => {
// do // do
view.value.senior.threshold = val view.value.senior.threshold = val
if (val.enable) {
element.value.carousel.enable = false
}
nextTick(() => {
useEmitt().emitter.emit('calcData-' + element.value.id)
})
snapshotStore.recordSnapshotCache('calcData', view.value.id) snapshotStore.recordSnapshotCache('calcData', view.value.id)
} }
const closeThreshold = () => {
view.value.senior.threshold.enable = false
}
onMounted(() => {
useEmitt({
name: 'carouselValueChange',
callback: () => closeThreshold()
})
})
</script> </script>
<template> <template>