fix(数据大屏、仪表板): 修复含有分组、tab的资源导出模板再导入时出现图片列开问题

This commit is contained in:
wangjiahao 2024-10-25 14:00:30 +08:00
parent ca3bb7bbc2
commit 7761512bcb

View File

@ -158,17 +158,8 @@ export function dataURLToBlob(dataUrl) {
return new Blob([u8arr], { type: mime })
}
// 解析静态文件
export function findStaticSource(callBack) {
const staticResource = []
// 系统背景文件
if (
typeof canvasStyleData.value.background === 'string' &&
canvasStyleData.value.background.indexOf('static-resource') > -1
) {
staticResource.push(canvasStyleData.value.background)
}
componentData.value.forEach(item => {
function findStaticSourceInner(componentDataInfo, staticResource) {
componentDataInfo.forEach(item => {
if (
typeof item.commonBackground.outerImage === 'string' &&
item.commonBackground.outerImage.indexOf('static-resource') > -1
@ -182,8 +173,37 @@ export function findStaticSource(callBack) {
item.propValue['url'].indexOf('static-resource') > -1
) {
staticResource.push(item.propValue['url'])
} else if (
item.component === 'picture-group' &&
item.propValue['urlList'] &&
item.propValue['urlList'].length > 0
) {
item.propValue['urlList'].forEach(urlInfo => {
if (urlInfo.url.indexOf('static-resource') > -1) {
staticResource.push(urlInfo.url)
}
})
} else if (item.component === 'Group') {
findStaticSourceInner(item.propValue, staticResource)
} else if (item.component === 'DeTabs') {
item.propValue.forEach(tabItem => {
findStaticSourceInner(tabItem.componentData, staticResource)
})
}
})
}
// 解析静态文件
export function findStaticSource(callBack) {
const staticResource = []
// 系统背景文件
if (
typeof canvasStyleData.value.background === 'string' &&
canvasStyleData.value.background.indexOf('static-resource') > -1
) {
staticResource.push(canvasStyleData.value.background)
}
findStaticSourceInner(componentData.value, staticResource)
if (staticResource.length > 0) {
try {
findResourceAsBase64({ resourcePathList: staticResource }).then(rsp => {