fix(图表): 修复在编辑图表时,放大图表后到处图片不携带最值标签的问题,以及放大后关闭,在图表右侧导出图片不成功的问题

This commit is contained in:
jianneng-fit2cloud
2025-02-27 18:32:11 +08:00
committed by jianneng-fit2cloud
parent 5b974f6e0e
commit c4fad7881f
4 changed files with 16 additions and 14 deletions

View File

@@ -171,13 +171,11 @@ const handleInnerMouseDown = e => {
onMounted(() => {
currentInstance = getCurrentInstance()
const methodName = 'componentImageDownload-' + config.value.id
useEmitt().emitter.off(methodName)
useEmitt({
name: methodName,
callback: () => {
if (!useEmitt().emitter.all.get(methodName)?.length) {
useEmitt().emitter.on(methodName, () => {
htmlToImage()
}
})
})
}
})
const onClick = e => {

View File

@@ -1138,13 +1138,11 @@ onMounted(() => {
})
settingAttribute()
const methodName = 'componentImageDownload-' + element.value.id
useEmitt().emitter.off(methodName)
useEmitt({
name: methodName,
callback: () => {
if (!useEmitt().emitter.all.get(methodName)?.length) {
useEmitt().emitter.on(methodName, () => {
htmlToImage()
}
})
})
}
})
</script>

View File

@@ -181,6 +181,7 @@ import { activeWatermarkCheckUser } from '@/components/watermark/watermark'
import { getCanvasStyle } from '@/utils/style'
import { exportPermission } from '@/utils/utils'
import EmptyBackground from '../empty-background/src/EmptyBackground.vue'
import { supportExtremumChartType } from '@/views/chart/components/js/extremumUitl'
const downLoading = ref(false)
const dvMainStore = dvMainStoreWithOut()
const dialogShow = ref(false)
@@ -422,7 +423,12 @@ const openMessageLoading = cb => {
const htmlToImage = () => {
downLoading.value = true
useEmitt().emitter.emit('renderChart-' + viewInfo.value.id)
const renderTime = viewInfo.value.type?.includes('table') ? 2000 : 500
// 表格和支持最值图表的渲染时间为2000毫秒其他图表为500毫秒。
const renderTime =
viewInfo.value.type?.includes('table') ||
supportExtremumChartType({ type: viewInfo.value.type })
? 2000
: 500
setTimeout(() => {
initWatermark()
toPng(viewContainer.value)

View File

@@ -109,7 +109,7 @@ const noChildrenFieldChart = chart => {
* 支持最值图表的折线图,面积图,柱状图,分组柱状图
* @param chart
*/
const supportExtremumChartType = chart => {
export const supportExtremumChartType = chart => {
return ['line', 'area', 'bar', 'bar-group'].includes(chart.type)
}