Merge pull request #12665 from dataease/pr@dev-v2@feat_inject-viewv2

feat(数据大屏、仪表板): 支持相同界面嵌入多个相同图表
This commit is contained in:
王嘉豪 2024-10-12 15:43:27 +08:00 committed by GitHub
commit 6f6365e032
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 1 deletions

View File

@ -69,6 +69,7 @@ const setupAll = async (
type: string,
busiFlag: string,
outerParams: string,
suffixId: string,
token: string,
baseUrl: string,
dvId: string,
@ -77,7 +78,7 @@ const setupAll = async (
resourceId: string
): Promise<App<Element>> => {
const app = createApp(AppElement, { componentName: type })
app.provide('embeddedParams', { chartId, resourceId, dvId, pid, busiFlag, outerParams })
app.provide('embeddedParams', { chartId, resourceId, dvId, pid, busiFlag, outerParams, suffixId })
await setupI18n(app)
setupStore(app)
setupRouter(app)
@ -87,6 +88,7 @@ const setupAll = async (
embeddedStore.setType(type)
embeddedStore.setBusiFlag(busiFlag)
embeddedStore.setOuterParams(outerParams)
embeddedStore.setSuffixId(suffixId)
embeddedStore.setToken(token)
embeddedStore.setBaseUrl(baseUrl)
embeddedStore.setDvId(dvId)
@ -132,6 +134,7 @@ class DataEaseBi {
dvId: string
busiFlag: 'dashboard' | 'dataV'
outerParams: string
suffixId: string
resourceId: string
pid: string
chartId: string
@ -143,6 +146,7 @@ class DataEaseBi {
this.token = options.token
this.busiFlag = options.busiFlag
this.outerParams = options.outerParams
this.suffixId = options.suffixId
this.baseUrl = options.baseUrl
this.dvId = options.dvId
this.pid = options.pid
@ -157,6 +161,7 @@ class DataEaseBi {
this.type,
this.busiFlag,
this.outerParams,
this.suffixId,
this.token,
this.baseUrl,
this.dvId,
@ -171,6 +176,7 @@ class DataEaseBi {
embeddedStore.setType(null)
embeddedStore.setBusiFlag(null)
embeddedStore.setOuterParams(null)
embeddedStore.setSuffixId(null)
embeddedStore.setToken(null)
embeddedStore.setBaseUrl(null)
embeddedStore.setChartId(null)
@ -180,6 +186,7 @@ class DataEaseBi {
this.token = null
this.busiFlag = null
this.outerParams = null
this.suffixId = null
this.baseUrl = null
this.dvId = null
this.pid = null

View File

@ -6,6 +6,7 @@ interface AppState {
token: string
busiFlag: string
outerParams: string
suffixId: string
baseUrl: string
dvId: string
pid: string
@ -31,6 +32,7 @@ export const userStore = defineStore('embedded', {
token: '',
busiFlag: '',
outerParams: '',
suffixId: '',
baseUrl: '',
dvId: '',
pid: '',
@ -74,6 +76,9 @@ export const userStore = defineStore('embedded', {
getOuterParams(): string {
return this.outerParams
},
getSuffixId(): string {
return this.suffixId
},
getBaseUrl(): string {
return this.baseUrl
},
@ -100,6 +105,7 @@ export const userStore = defineStore('embedded', {
embeddedToken: this.token,
busiFlag: this.busiFlag,
outerParams: this.outerParams,
suffixId: this.suffixId,
type: this.type,
dvId: this.dvId,
chartId: this.chartId,
@ -148,6 +154,9 @@ export const userStore = defineStore('embedded', {
setOuterParams(outerParams: string) {
this.outerParams = outerParams
},
setSuffixId(suffixId: string) {
this.suffixId = suffixId
},
setBaseUrl(baseUrl: string) {
this.baseUrl = baseUrl
},
@ -171,6 +180,7 @@ export const userStore = defineStore('embedded', {
this.token = data['embeddedToken']
this.busiFlag = data['busiFlag']
this.outerParams = data['outerParams']
this.suffixId = data['suffixId']
this.dvId = data['dvId']
this.chartId = data['chartId']
this.pid = data['pid']