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

View File

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