Merge pull request #10788 from dataease/pr@dev-v2@refactor_chart_plugin_init

refactor(图表): 插件初始化优化
This commit is contained in:
wisonic-s 2024-07-04 00:58:32 +08:00 committed by GitHub
commit 3b105d1c6f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -46,11 +46,14 @@ import ChartEmptyInfo from '@/views/chart/components/views/components/ChartEmpty
import { snapshotStoreWithOut } from '@/store/modules/data-visualization/snapshot'
import { viewFieldTimeTrans } from '@/utils/viewUtils'
import { CHART_TYPE_CONFIGS } from '@/views/chart/components/editor/util/chart'
import request from '@/config/axios'
import { store } from '@/store'
const { wsCache } = useCache()
const chartComponent = ref<any>()
const { t } = useI18n()
const dvMainStore = dvMainStoreWithOut()
const { emitter } = useEmitt()
let innerRefreshTimer = null
const appStore = useAppStoreWithOut()
@ -495,7 +498,7 @@ const calcData = params => {
const showChartView = (...libs: ChartLibraryType[]) => {
if (view.value?.render && view.value?.type) {
const chartView = chartViewManager.getChartView(view.value.render, view.value.type)
return libs?.includes(chartView.library)
return chartView && libs?.includes(chartView.library)
} else {
return false
}
@ -825,13 +828,16 @@ const loadPluginCategory = data => {
<!--这里去渲染不同图库的图表-->
<div v-if="chartAreaShow" style="flex: 1; overflow: hidden">
<plugin-component
v-if="view.isPlugin"
v-if="view.plugin?.isPlugin"
:jsname="view.plugin.staticMap['index']"
:scale="scale"
:dynamic-area-id="dynamicAreaId"
:view="view"
:show-position="showPosition"
:element="element"
:request="request"
:emitter="emitter"
:store="store"
ref="chartComponent"
@onChartClick="chartClick"
@onPointClick="onPointClick"