feat(X-Pack): 数据填报支持嵌入式
This commit is contained in:
parent
dcbcc7d32a
commit
3b6fdfe1ef
@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { shallowRef, defineAsyncComponent } from 'vue'
|
||||
import { shallowRef, defineAsyncComponent, ref, onMounted, nextTick } from 'vue'
|
||||
import { propTypes } from '@/utils/propTypes'
|
||||
import { useEmitt } from '@/hooks/web/useEmitt'
|
||||
|
||||
@ -26,6 +26,8 @@ const DashboardPanel = defineAsyncComponent(
|
||||
const Preview = defineAsyncComponent(() => import('@/views/data-visualization/PreviewCanvas.vue'))
|
||||
const DashboardEmpty = defineAsyncComponent(() => import('@/views/mobile/panel/DashboardEmpty.vue'))
|
||||
|
||||
const XpackComponent = defineAsyncComponent(() => import('@/components/plugin/src/index.vue'))
|
||||
|
||||
const props = defineProps({
|
||||
componentName: propTypes.string.def('Iframe')
|
||||
})
|
||||
@ -46,8 +48,27 @@ const componentMap = {
|
||||
DashboardEmpty
|
||||
}
|
||||
|
||||
const isDataFilling = ref(false)
|
||||
const dataFillingPath = ref('')
|
||||
|
||||
const changeCurrentComponent = val => {
|
||||
currentComponent.value = componentMap[val]
|
||||
isDataFilling.value = false
|
||||
currentComponent.value = undefined
|
||||
if (val && val.includes('DataFilling')) {
|
||||
if (val === 'DataFilling') {
|
||||
dataFillingPath.value = 'L21lbnUvZGF0YS9kYXRhLWZpbGxpbmcvbWFuYWdlL2luZGV4'
|
||||
} else if (val === 'DataFillingEditor') {
|
||||
dataFillingPath.value = 'L21lbnUvZGF0YS9kYXRhLWZpbGxpbmcvbWFuYWdlL2Zvcm0vaW5kZXg='
|
||||
} else if (val === 'DataFillingHandler') {
|
||||
dataFillingPath.value = 'L21lbnUvZGF0YS9kYXRhLWZpbGxpbmcvZmlsbC9UYWJQYW5lVGFibGU='
|
||||
}
|
||||
nextTick(() => {
|
||||
currentComponent.value = XpackComponent
|
||||
isDataFilling.value = true
|
||||
})
|
||||
} else {
|
||||
currentComponent.value = componentMap[val]
|
||||
}
|
||||
}
|
||||
|
||||
useEmitt({
|
||||
@ -55,8 +76,14 @@ useEmitt({
|
||||
callback: changeCurrentComponent
|
||||
})
|
||||
|
||||
currentComponent.value = componentMap[props.componentName]
|
||||
//currentComponent.value = componentMap[props.componentName]
|
||||
onMounted(() => {
|
||||
changeCurrentComponent(props.componentName)
|
||||
})
|
||||
</script>
|
||||
<template>
|
||||
<component :is="currentComponent"></component>
|
||||
<component :is="currentComponent" v-if="!isDataFilling"></component>
|
||||
<template v-else>
|
||||
<component :is="currentComponent" :jsname="dataFillingPath"></component>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
@ -75,10 +75,20 @@ const setupAll = async (
|
||||
dvId: string,
|
||||
pid: string,
|
||||
chartId: string,
|
||||
resourceId: string
|
||||
resourceId: string,
|
||||
dfId: string
|
||||
): Promise<App<Element>> => {
|
||||
const app = createApp(AppElement, { componentName: type })
|
||||
app.provide('embeddedParams', { chartId, resourceId, dvId, pid, busiFlag, outerParams, suffixId })
|
||||
app.provide('embeddedParams', {
|
||||
chartId,
|
||||
resourceId,
|
||||
dfId,
|
||||
dvId,
|
||||
pid,
|
||||
busiFlag,
|
||||
outerParams,
|
||||
suffixId
|
||||
})
|
||||
await setupI18n(app)
|
||||
setupStore(app)
|
||||
setupRouter(app)
|
||||
@ -94,6 +104,7 @@ const setupAll = async (
|
||||
embeddedStore.setDvId(dvId)
|
||||
embeddedStore.setPid(pid)
|
||||
embeddedStore.setResourceId(resourceId)
|
||||
embeddedStore.setDfId(dfId)
|
||||
const directive = await import('@/directive')
|
||||
directive.installDirective(app)
|
||||
const res = await import('@/store/modules/user')
|
||||
@ -131,11 +142,13 @@ class DataEaseBi {
|
||||
| 'Dashboard'
|
||||
| 'ScreenPanel'
|
||||
| 'DashboardPanel'
|
||||
| 'DataFilling'
|
||||
dvId: string
|
||||
busiFlag: 'dashboard' | 'dataV'
|
||||
outerParams: string
|
||||
suffixId: string
|
||||
resourceId: string
|
||||
dfId: string
|
||||
pid: string
|
||||
chartId: string
|
||||
deOptions: Options
|
||||
@ -152,6 +165,7 @@ class DataEaseBi {
|
||||
this.pid = options.pid
|
||||
this.chartId = options.chartId
|
||||
this.resourceId = options.resourceId
|
||||
this.dfId = options.dfId
|
||||
}
|
||||
|
||||
async initialize(options: Options) {
|
||||
@ -167,7 +181,8 @@ class DataEaseBi {
|
||||
this.dvId,
|
||||
this.pid,
|
||||
this.chartId,
|
||||
this.resourceId
|
||||
this.resourceId,
|
||||
this.dfId
|
||||
)
|
||||
}
|
||||
|
||||
@ -192,6 +207,7 @@ class DataEaseBi {
|
||||
this.pid = null
|
||||
this.chartId = null
|
||||
this.resourceId = null
|
||||
this.dfId = null
|
||||
this.vm = null
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,6 +12,7 @@ interface AppState {
|
||||
pid: string
|
||||
chartId: string
|
||||
resourceId: string
|
||||
dfId: string
|
||||
opt: string
|
||||
createType: string
|
||||
templateParams: string
|
||||
@ -38,6 +39,7 @@ export const userStore = defineStore('embedded', {
|
||||
pid: '',
|
||||
chartId: '',
|
||||
resourceId: '',
|
||||
dfId: '',
|
||||
opt: '',
|
||||
createType: '',
|
||||
templateParams: '',
|
||||
@ -94,6 +96,9 @@ export const userStore = defineStore('embedded', {
|
||||
getResourceId(): string {
|
||||
return this.resourceId
|
||||
},
|
||||
getDfId(): string {
|
||||
return this.dfId
|
||||
},
|
||||
getOpt(): string {
|
||||
return this.opt
|
||||
},
|
||||
@ -110,7 +115,8 @@ export const userStore = defineStore('embedded', {
|
||||
dvId: this.dvId,
|
||||
chartId: this.chartId,
|
||||
pid: this.pid,
|
||||
resourceId: this.resourceId
|
||||
resourceId: this.resourceId,
|
||||
dfId: this.dfId
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -172,6 +178,9 @@ export const userStore = defineStore('embedded', {
|
||||
setResourceId(resourceId: string) {
|
||||
this.resourceId = resourceId
|
||||
},
|
||||
setDfId(dfId: string) {
|
||||
this.dfId = dfId
|
||||
},
|
||||
setOpt(opt: string) {
|
||||
this.opt = opt
|
||||
},
|
||||
@ -185,6 +194,7 @@ export const userStore = defineStore('embedded', {
|
||||
this.chartId = data['chartId']
|
||||
this.pid = data['pid']
|
||||
this.resourceId = data['resourceId']
|
||||
this.dfId = data['dfId']
|
||||
},
|
||||
async setTokenInfo(tokenInfo: Map<string, object>) {
|
||||
this.tokenInfo = tokenInfo
|
||||
@ -195,6 +205,7 @@ export const userStore = defineStore('embedded', {
|
||||
this.setCreateType('')
|
||||
this.setTemplateParams('')
|
||||
this.setResourceId('')
|
||||
this.setDfId('')
|
||||
this.setDvId('')
|
||||
this.setJumpInfoParam('')
|
||||
this.setOuterUrl('')
|
||||
|
||||
@ -1,5 +1,12 @@
|
||||
<script lang="ts" setup>
|
||||
import { shallowRef, defineAsyncComponent, ref, onBeforeUnmount, onBeforeMount } from 'vue'
|
||||
import {
|
||||
shallowRef,
|
||||
defineAsyncComponent,
|
||||
ref,
|
||||
onBeforeUnmount,
|
||||
onBeforeMount,
|
||||
nextTick
|
||||
} from 'vue'
|
||||
import { debounce } from 'lodash-es'
|
||||
import { XpackComponent } from '@/components/plugin'
|
||||
import { useEmitt } from '@/hooks/web/useEmitt'
|
||||
@ -22,6 +29,8 @@ const DashboardPanel = defineAsyncComponent(
|
||||
() => import('@/views/dashboard/DashboardPreviewShow.vue')
|
||||
)
|
||||
|
||||
const AsyncXpackComponent = defineAsyncComponent(() => import('@/components/plugin/src/index.vue'))
|
||||
|
||||
const componentMap = {
|
||||
DashboardEditor,
|
||||
VisualizationEditor,
|
||||
@ -47,8 +56,28 @@ onBeforeMount(() => {
|
||||
onBeforeUnmount(() => {
|
||||
window.removeEventListener('resize', setStyle)
|
||||
})
|
||||
|
||||
const showComponent = ref(false)
|
||||
const dataFillingPath = ref('')
|
||||
|
||||
const initIframe = (name: string) => {
|
||||
currentComponent.value = componentMap[name || 'ViewWrapper']
|
||||
showComponent.value = false
|
||||
if (name && name.includes('DataFilling')) {
|
||||
if (name === 'DataFilling') {
|
||||
dataFillingPath.value = 'L21lbnUvZGF0YS9kYXRhLWZpbGxpbmcvbWFuYWdlL2luZGV4'
|
||||
} else if (name === 'DataFillingEditor') {
|
||||
dataFillingPath.value = 'L21lbnUvZGF0YS9kYXRhLWZpbGxpbmcvbWFuYWdlL2Zvcm0vaW5kZXg='
|
||||
} else if (name === 'DataFillingHandler') {
|
||||
dataFillingPath.value = 'L21lbnUvZGF0YS9kYXRhLWZpbGxpbmcvZmlsbC9UYWJQYW5lVGFibGU='
|
||||
}
|
||||
nextTick(() => {
|
||||
currentComponent.value = AsyncXpackComponent
|
||||
showComponent.value = true
|
||||
})
|
||||
} else {
|
||||
currentComponent.value = componentMap[name || 'ViewWrapper']
|
||||
showComponent.value = true
|
||||
}
|
||||
}
|
||||
|
||||
useEmitt({
|
||||
@ -63,6 +92,6 @@ useEmitt({
|
||||
@init-iframe="initIframe"
|
||||
/>
|
||||
<div :style="iframeStyle">
|
||||
<component :is="currentComponent"></component>
|
||||
<component :is="currentComponent" :jsname="dataFillingPath" v-if="showComponent"></component>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
2
de-xpack
2
de-xpack
@ -1 +1 @@
|
||||
Subproject commit bdb72d02398f70e857004d58f937626bd8861a86
|
||||
Subproject commit 15e8a34565a1abf5e5516f67fb54bc8f3ffc88de
|
||||
@ -12,6 +12,7 @@ import io.dataease.extensions.datasource.dto.SimpleDatasourceDTO;
|
||||
import io.dataease.model.BusiNodeRequest;
|
||||
import io.dataease.model.BusiNodeVO;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@ -139,6 +140,6 @@ public interface DataFillingApi {
|
||||
|
||||
void geFullName(Long pid, List<String> fullName);
|
||||
|
||||
@PostMapping("/innerExport/{formId}")
|
||||
void innerExport(@PathVariable("formId") Long formId) throws Exception;
|
||||
@PostMapping("/innerExport/{isDataEaseBi}/{formId}")
|
||||
void innerExport(@PathVariable("formId") Long formId, @PathVariable("isDataEaseBi") boolean isDataEaseBi, HttpServletResponse response) throws Exception;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user