Showing
1 changed file
with
16 additions
and
5 deletions
@@ -44,6 +44,8 @@ import { useUserStore } from '@/store/external/modules/user' | @@ -44,6 +44,8 @@ import { useUserStore } from '@/store/external/modules/user' | ||
44 | import { checkSharePageNeedAccessToken, getPublicToken, getShareContentData } from '@/api/external/sys/share' | 44 | import { checkSharePageNeedAccessToken, getPublicToken, getShareContentData } from '@/api/external/sys/share' |
45 | import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' | 45 | import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' |
46 | import { fetchChartComponent } from '@/packages' | 46 | import { fetchChartComponent } from '@/packages' |
47 | +import { CreateComponentType } from '@/packages/index.d' | ||
48 | +import { CreateComponentGroupType } from '@/packages/index.d' | ||
47 | 49 | ||
48 | const allowLoadPreviewPage = ref(true) | 50 | const allowLoadPreviewPage = ref(true) |
49 | const showModal = ref(false) | 51 | const showModal = ref(false) |
@@ -78,6 +80,19 @@ const sharePageHandlerProcess = async () => { | @@ -78,6 +80,19 @@ const sharePageHandlerProcess = async () => { | ||
78 | } | 80 | } |
79 | } | 81 | } |
80 | 82 | ||
83 | +const handleRegisterComponent = (record: (CreateComponentType | CreateComponentGroupType)[]) => { | ||
84 | + const fn = (params: (CreateComponentType | CreateComponentGroupType)[]) => { | ||
85 | + for (const item of params) { | ||
86 | + if (item.isGroup) { | ||
87 | + fn(item.groupList || []) | ||
88 | + continue | ||
89 | + } | ||
90 | + componentInstall(item.chartConfig.chartKey, fetchChartComponent(item.chartConfig)) | ||
91 | + } | ||
92 | + } | ||
93 | + fn(record) | ||
94 | +} | ||
95 | + | ||
81 | const isEmpty = ref(false) | 96 | const isEmpty = ref(false) |
82 | const getSharePageContentData = async () => { | 97 | const getSharePageContentData = async () => { |
83 | try { | 98 | try { |
@@ -93,11 +108,7 @@ const getSharePageContentData = async () => { | @@ -93,11 +108,7 @@ const getSharePageContentData = async () => { | ||
93 | chartEditStore.editCanvasConfig = editCanvasConfig | 108 | chartEditStore.editCanvasConfig = editCanvasConfig |
94 | chartEditStore.requestGlobalConfig = requestGlobalConfig | 109 | chartEditStore.requestGlobalConfig = requestGlobalConfig |
95 | chartEditStore.componentList = componentList | 110 | chartEditStore.componentList = componentList |
96 | - | ||
97 | - // register 组件 | ||
98 | - componentList.forEach(item => { | ||
99 | - componentInstall(item.chartConfig.chartKey, fetchChartComponent(item.chartConfig)) | ||
100 | - }) | 111 | + handleRegisterComponent(componentList) |
101 | } | 112 | } |
102 | setTitle(dataViewName || '') | 113 | setTitle(dataViewName || '') |
103 | showModal.value = false | 114 | showModal.value = false |