mirror of
https://github.com/dataease/dataease.git
synced 2026-05-15 05:22:13 +08:00
fix(图表): 修复导出地图时,在不是预览状态下导出图片或者PDF时地图空白的问题
This commit is contained in:
committed by
jianneng-fit2cloud
parent
90bc05bdd1
commit
51620b487d
@@ -1107,12 +1107,14 @@ const dragCollision = computed(() => {
|
||||
|
||||
const htmlToImage = () => {
|
||||
downLoading.value = true
|
||||
useEmitt().emitter.emit('l7-prepare-picture', element.value.id)
|
||||
setTimeout(() => {
|
||||
activeWatermarkCheckUser(viewDemoInnerId.value, 'canvas-main', scale.value)
|
||||
downloadCanvas2('img', componentInnerRef.value, '图表', () => {
|
||||
// do callback
|
||||
removeActiveWatermark(viewDemoInnerId.value)
|
||||
downLoading.value = false
|
||||
useEmitt().emitter.emit('l7-unprepare-picture', element.value.id)
|
||||
})
|
||||
}, 200)
|
||||
}
|
||||
|
||||
@@ -420,9 +420,12 @@ const openMessageLoading = cb => {
|
||||
customClass
|
||||
})
|
||||
}
|
||||
// 地图
|
||||
const mapChartTypes = ['bubble-map', 'flow-map', 'heat-map', 'map', 'symbolic-map']
|
||||
const htmlToImage = () => {
|
||||
downLoading.value = true
|
||||
downLoading.value = mapChartTypes.includes(viewInfo.value.type) ? false : true
|
||||
useEmitt().emitter.emit('renderChart-' + viewInfo.value.id)
|
||||
useEmitt().emitter.emit('l7-prepare-picture', viewInfo.value.id)
|
||||
// 表格和支持最值图表的渲染时间为2000毫秒,其他图表为500毫秒。
|
||||
const renderTime =
|
||||
viewInfo.value.type?.includes('table') ||
|
||||
@@ -438,12 +441,14 @@ const htmlToImage = () => {
|
||||
a.setAttribute('download', viewInfo.value.title)
|
||||
a.href = dataUrl
|
||||
a.click()
|
||||
useEmitt().emitter.emit('l7-unprepare-picture', viewInfo.value.id)
|
||||
useEmitt().emitter.emit('renderChart-' + viewInfo.value.id)
|
||||
initWatermark()
|
||||
})
|
||||
.catch(error => {
|
||||
downLoading.value = false
|
||||
initWatermark()
|
||||
useEmitt().emitter.emit('l7-unprepare-picture', viewInfo.value.id)
|
||||
useEmitt().emitter.emit('renderChart-' + viewInfo.value.id)
|
||||
console.error('oops, something went wrong!', error)
|
||||
})
|
||||
|
||||
@@ -115,13 +115,20 @@ const loadCanvasData = (dvId, weight?) => {
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
// 地图类图表,需要预先准备图片
|
||||
const mapChartTypes = ['bubble-map', 'flow-map', 'heat-map', 'map', 'symbolic-map']
|
||||
const downloadH2 = type => {
|
||||
downloadStatus.value = true
|
||||
const mapElementIds =
|
||||
state.canvasDataPreview
|
||||
?.filter(ele => mapChartTypes.includes(ele.innerType))
|
||||
.map(ele => ele.id) || []
|
||||
mapElementIds.forEach(id => useEmitt().emitter.emit('l7-prepare-picture', id))
|
||||
nextTick(() => {
|
||||
const vueDom = previewCanvasContainer.value.querySelector('.canvas-container')
|
||||
downloadCanvas2(type, vueDom, state.dvInfo.name, () => {
|
||||
downloadStatus.value = false
|
||||
mapElementIds.forEach(id => useEmitt().emitter.emit('l7-unprepare-picture', id))
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user