forked from github/dataease
Merge pull request #11735 from dataease/pr@dev-v2_st
fix(嵌入式): 嵌入式多视图测试
This commit is contained in:
commit
9f33e5dd40
@ -1,5 +1,5 @@
|
||||
<script lang="ts" setup>
|
||||
import { ref, onBeforeMount, reactive } from 'vue'
|
||||
import { ref, onBeforeMount, reactive, inject } from 'vue'
|
||||
import { initCanvasData } from '@/utils/canvasUtils'
|
||||
import { interactiveStoreWithOut } from '@/store/modules/interactive'
|
||||
import { useEmbedded } from '@/store/modules/embedded'
|
||||
@ -13,6 +13,7 @@ import { XpackComponent } from '@/components/plugin'
|
||||
const { wsCache } = useCache()
|
||||
const interactiveStore = interactiveStoreWithOut()
|
||||
const embeddedStore = useEmbedded()
|
||||
const chartId = inject('embeddedParams') as string
|
||||
const config = ref()
|
||||
const viewInfo = ref()
|
||||
const userViewEnlargeRef = ref()
|
||||
@ -86,8 +87,8 @@ onBeforeMount(async () => {
|
||||
dvMainStore.addOuterParamsFilter(attachParams, canvasDataResult)
|
||||
}
|
||||
|
||||
viewInfo.value = canvasViewInfoPreview[embeddedStore.chartId]
|
||||
console.log(embeddedStore.chartId, 'embeddedStore.chartId')
|
||||
console.log('chartId', chartId)
|
||||
viewInfo.value = canvasViewInfoPreview[chartId]
|
||||
;(
|
||||
(canvasDataResult as unknown as Array<{
|
||||
id: string
|
||||
@ -95,14 +96,14 @@ onBeforeMount(async () => {
|
||||
propValue: Array<{ id: string }>
|
||||
}>) || []
|
||||
).some(ele => {
|
||||
if (ele.id === embeddedStore.chartId) {
|
||||
if (ele.id === chartId) {
|
||||
config.value = ele
|
||||
return true
|
||||
}
|
||||
|
||||
if (ele.component === 'Group') {
|
||||
return (ele.propValue || []).some(itx => {
|
||||
if (itx.id === embeddedStore.chartId) {
|
||||
if (itx.id === chartId) {
|
||||
config.value = itx
|
||||
return true
|
||||
}
|
||||
|
@ -78,6 +78,7 @@ const setupAll = async (
|
||||
resourceId: string
|
||||
): Promise<App<Element>> => {
|
||||
const app = createApp(AppElement, { componentName: type })
|
||||
app.provide('embeddedParams', chartId)
|
||||
await setupI18n(app)
|
||||
setupStore(app)
|
||||
setupRouter(app)
|
||||
@ -91,8 +92,6 @@ const setupAll = async (
|
||||
embeddedStore.setBaseUrl(baseUrl)
|
||||
embeddedStore.setDvId(dvId)
|
||||
embeddedStore.setPid(pid)
|
||||
console.log(chartId, 'chartId')
|
||||
embeddedStore.setChartId(chartId)
|
||||
embeddedStore.setResourceId(resourceId)
|
||||
const directive = await import('@/directive')
|
||||
directive.installDirective(app)
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { store } from '../index'
|
||||
import { cloneDeep } from 'lodash-es'
|
||||
|
||||
interface AppState {
|
||||
type: string
|
||||
@ -199,6 +198,5 @@ export const userStore = defineStore('embedded', {
|
||||
})
|
||||
|
||||
export const useEmbedded = () => {
|
||||
console.log('cloneDeep', cloneDeep(store))
|
||||
return userStore(store)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user