Merge pull request #10983 from dataease/pr@dev-v2@fix_scrren_chart_plugin

fix(图表): 修复图表插件在大屏无法显示
This commit is contained in:
wisonic-s 2024-07-16 14:44:07 +08:00 committed by GitHub
commit 1db213aae9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 4 deletions

View File

@ -46,7 +46,7 @@ export function findDragComponent(componentInfo) {
return findNewComponent(componentName, innerType)
}
export function findNewComponent(componentName, innerType, isPlugin?: boolean) {
export function findNewComponent(componentName, innerType, staticMap?) {
let newComponent
componentList.forEach(comp => {
if (comp.component === componentName || comp.component === innerType) {
@ -69,7 +69,10 @@ export function findNewComponent(componentName, innerType, isPlugin?: boolean) {
newComponent.name = viewConfig?.title
newComponent.label = viewConfig?.title
newComponent.render = viewConfig?.render
newComponent.isPlugin = !!isPlugin
newComponent.isPlugin = !!staticMap
if (newComponent.isPlugin) {
newComponent.staticMap = staticMap
}
}
return newComponent
}

View File

@ -116,10 +116,10 @@ const contentStyle = computed(() => {
//
const handleNew = newComponentInfo => {
const { componentName, innerType, isPlugin } = newComponentInfo
const { componentName, innerType, staticMap } = newComponentInfo
if (componentName) {
const { width, height, scale } = canvasStyleData.value
const component = findNewComponent(componentName, innerType, isPlugin)
const component = findNewComponent(componentName, innerType, staticMap)
component.style.top = ((height - component.style.height) * scale) / 200
component.style.left = ((width - component.style.width) * scale) / 200
component.id = guid()