feat(仪表板、数据大屏): 指标卡、富文本支持事件设置 #10960

This commit is contained in:
wangjiahao 2024-08-12 17:25:10 +08:00
parent f2bb6a3e57
commit bf2ea2a2c6
6 changed files with 27 additions and 11 deletions

View File

@ -209,12 +209,12 @@ const onPointClick = param => {
const eventEnable = computed( const eventEnable = computed(
() => () =>
(['Picture', 'CanvasIcon', 'CircleShape', 'SvgTriangle', 'RectShape', 'ScrollText'].includes( ['Picture', 'CanvasIcon', 'CircleShape', 'SvgTriangle', 'RectShape', 'ScrollText'].includes(
config.value.component config.value.component
) || ) ||
config.value.innerType === 'rich-text') && (['indicator', 'rich-text'].includes(config.value.innerType) &&
config.value.events && config.value.events &&
config.value.events.checked config.value.events.checked)
) )
const onWrapperClick = e => { const onWrapperClick = e => {

View File

@ -2,7 +2,7 @@
import { computed, nextTick, onMounted, ref, toRefs } from 'vue' import { computed, nextTick, onMounted, ref, toRefs } from 'vue'
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain' import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
import { storeToRefs } from 'pinia' import { storeToRefs } from 'pinia'
import { styleData, selectKey, optionMap, horizontalPosition } from '@/utils/attr' import { styleData } from '@/utils/attr'
import ComponentPosition from '@/components/visualization/common/ComponentPosition.vue' import ComponentPosition from '@/components/visualization/common/ComponentPosition.vue'
import BackgroundOverallCommon from '@/components/visualization/component-background/BackgroundOverallCommon.vue' import BackgroundOverallCommon from '@/components/visualization/component-background/BackgroundOverallCommon.vue'
import { useI18n } from '@/hooks/web/useI18n' import { useI18n } from '@/hooks/web/useI18n'

View File

@ -1,8 +1,10 @@
<script setup lang="ts"> <script setup lang="ts">
import { toRefs } from 'vue' import { computed, toRefs } from 'vue'
import { ElFormItem, ElIcon } from 'element-plus-secondary' import { ElFormItem, ElIcon } from 'element-plus-secondary'
import { snapshotStoreWithOut } from '@/store/modules/data-visualization/snapshot' import { snapshotStoreWithOut } from '@/store/modules/data-visualization/snapshot'
import Icon from '../../components/icon-custom/src/Icon.vue' import Icon from '../../components/icon-custom/src/Icon.vue'
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
const dvMainStore = dvMainStoreWithOut()
const snapshotStore = snapshotStoreWithOut() const snapshotStore = snapshotStoreWithOut()
@ -16,9 +18,15 @@ const props = withDefaults(
} }
) )
const { themes, eventsInfo } = toRefs(props) const { themes, eventsInfo } = toRefs(props)
const isDashboard = dvMainStore.dvInfo.type === 'dashboard'
const curSupportEvents = ['jump', 'showHidden', 'refreshDataV'] const curSupportEvents = computed(() => {
if (isDashboard) {
return ['jump', 'refreshDataV']
} else {
return ['jump', 'showHidden', 'refreshDataV']
}
})
const onEventChange = () => { const onEventChange = () => {
snapshotStore.recordSnapshotCache('renderChart') snapshotStore.recordSnapshotCache('renderChart')
} }

View File

@ -224,7 +224,9 @@ export const commonAttr = {
'picture', 'picture',
'frameLinks', 'frameLinks',
'videoLinks', 'videoLinks',
'streamLinks' 'streamLinks',
'carouselInfo',
'events'
], // 编辑组件时记录当前使用的是哪个折叠面板再次回来时恢复上次打开的折叠面板优化用户体验 ], // 编辑组件时记录当前使用的是哪个折叠面板再次回来时恢复上次打开的折叠面板优化用户体验
linkage: { linkage: {
duration: 0, // 过渡持续时间 duration: 0, // 过渡持续时间

View File

@ -173,7 +173,9 @@ export function historyAdaptor(
} }
// 组件事件适配 // 组件事件适配
componentItem.events = componentItem.events =
componentItem.events && componentItem.events.checked !== undefined componentItem.events &&
componentItem.events.checked !== undefined &&
componentItem.events.type !== 'displayChange'
? componentItem.events ? componentItem.events
: deepCopy(BASE_EVENTS) : deepCopy(BASE_EVENTS)
componentItem['category'] = componentItem['category'] || 'base' componentItem['category'] = componentItem['category'] || 'base'

View File

@ -124,7 +124,11 @@ const positionComponentShow = computed(() => {
}) })
const eventsShow = computed(() => { const eventsShow = computed(() => {
return !batchOptStatus.value && chart.value.type.includes('rich-text') && props.eventInfo return (
!batchOptStatus.value &&
['indicator', 'rich-text'].includes(chart.value.type) &&
props.eventInfo
)
}) })
const showProperties = (property: EditorProperty) => properties.value?.includes(property) const showProperties = (property: EditorProperty) => properties.value?.includes(property)