fix: 看板查询次数过多,系统崩溃问题 #5515

This commit is contained in:
dataeaseShu 2023-07-03 10:34:50 +08:00
parent d8c3f757af
commit b33c196b52
4 changed files with 58 additions and 20 deletions

View File

@ -300,6 +300,9 @@ export default {
this[event](events[event]) this[event](events[event])
}) })
} }
},
setChartData() {
}, },
elementMouseDown(e) { elementMouseDown(e) {
// // private // // private

View File

@ -238,6 +238,8 @@ export default {
return { return {
imageDownloading: false, imageDownloading: false,
chartDetailsVisible: false, chartDetailsVisible: false,
canvasMain: null,
tempCanvas: null,
showChartInfo: {}, showChartInfo: {},
showChartTableInfo: {}, showChartTableInfo: {},
showChartInfoType: 'details', showChartInfoType: 'details',
@ -439,8 +441,14 @@ export default {
this.initPdfTemplate() this.initPdfTemplate()
}, },
beforeDestroy() { beforeDestroy() {
erd.uninstall(this.$refs[this.previewTempRefId]) if (this.$refs[this.previewTempRefId]) {
erd.uninstall(this.$refs[this.previewRefId]) erd.uninstall(this.$refs[this.previewTempRefId])
}
if (this.$refs[this.previewRefId]) {
erd.uninstall(this.$refs[this.previewRefId])
}
erd.uninstall(this.canvasMain)
erd.uninstall(this.tempCanvas)
clearInterval(this.timer) clearInterval(this.timer)
this.canvasId === 'canvas-main' && bus.$off('pcChartDetailsDialog', this.openChartDetailsDialog) this.canvasId === 'canvas-main' && bus.$off('pcChartDetailsDialog', this.openChartDetailsDialog)
bus.$off('trigger-search-button', this.triggerSearchButton) bus.$off('trigger-search-button', this.triggerSearchButton)
@ -719,26 +727,27 @@ export default {
bus.$emit('onScroll') bus.$emit('onScroll')
}, },
initListen() { initListen() {
const _this = this this.canvasMain = document.getElementById(this.previewDomId)
const canvasMain = document.getElementById(this.previewDomId)
// div // div
if (canvasMain) { if (this.canvasMain) {
erd.listenTo(canvasMain, element => { erd.uninstall(this.canvasMain)
_this.$nextTick(() => { erd.listenTo(this.canvasMain, () => {
_this.restore() this.$nextTick(() => {
this.restore()
}) })
}) })
} }
setTimeout(() => { setTimeout(() => {
// div // div
const tempCanvas = document.getElementById(this.previewTempDomId) this.tempCanvas = document.getElementById(this.previewTempDomId)
if (tempCanvas) { if (this.tempCanvas) {
erd.listenTo(document.getElementById(this.previewTempDomId), element => { erd.uninstall(this.tempCanvas)
_this.$nextTick(() => { erd.listenTo(document.getElementById(this.previewTempDomId), () => {
this.$nextTick(() => {
// mainHeight px html2canvas // mainHeight px html2canvas
_this.mainHeight = tempCanvas.scrollHeight + 'px!important' this.mainHeight = this.tempCanvas.scrollHeight + 'px!important'
_this.mainHeightCount = tempCanvas.scrollHeight this.mainHeightCount = this.tempCanvas.scrollHeight
this.$emit('mainHeightChange', _this.mainHeight) this.$emit('mainHeightChange', this.mainHeight)
}) })
}) })
} }

View File

@ -560,6 +560,12 @@ export default {
}, },
beforeDestroy() { beforeDestroy() {
for (const key in this.chart) {
this.$delete(this.chart, key)
}
for (const key in this.view) {
this.$delete(this.view, key)
}
this.innerRefreshTimer && clearInterval(this.innerRefreshTimer) this.innerRefreshTimer && clearInterval(this.innerRefreshTimer)
bus.$off('plugin-chart-click', this.pluginChartClick) bus.$off('plugin-chart-click', this.pluginChartClick)
bus.$off('plugin-jump-click', this.pluginJumpClick) bus.$off('plugin-jump-click', this.pluginJumpClick)
@ -570,6 +576,7 @@ export default {
bus.$off('onThemeColorChange', this.optFromBatchThemeChange) bus.$off('onThemeColorChange', this.optFromBatchThemeChange)
bus.$off('onThemeAttrChange', this.optFromBatchSingleProp) bus.$off('onThemeAttrChange', this.optFromBatchSingleProp)
bus.$off('clear_panel_linkage', this.clearPanelLinkage) bus.$off('clear_panel_linkage', this.clearPanelLinkage)
bus.$off('tab-canvas-change', this.tabSwitch)
}, },
created() { created() {
this.refId = uuid.v1 this.refId = uuid.v1
@ -865,8 +872,8 @@ export default {
}, },
initCurFields(chartDetails) { initCurFields(chartDetails) {
this.curFields = [] this.curFields = []
this.dataRowSelect = [] this.dataRowSelect = {}
this.dataRowNameSelect = [] this.dataRowNameSelect = {}
if (chartDetails.data && chartDetails.data.sourceFields) { if (chartDetails.data && chartDetails.data.sourceFields) {
const checkAllAxisStr = chartDetails.xaxis + chartDetails.xaxisExt + chartDetails.yaxis + chartDetails.yaxisExt const checkAllAxisStr = chartDetails.xaxis + chartDetails.xaxisExt + chartDetails.yaxis + chartDetails.yaxisExt
chartDetails.data.sourceFields.forEach(field => { chartDetails.data.sourceFields.forEach(field => {

View File

@ -61,7 +61,7 @@ import ChartTitleUpdate from './ChartTitleUpdate.vue'
import { equalsAny } from '@/utils/StringUtils' import { equalsAny } from '@/utils/StringUtils'
import { mapState } from 'vuex' import { mapState } from 'vuex'
import { baseFlowMapOption } from '@/views/chart/chart/map/map_antv' import { baseFlowMapOption } from '@/views/chart/chart/map/map_antv'
import { clear } from 'size-sensor'
export default { export default {
name: 'ChartComponentG2', name: 'ChartComponentG2',
components: { TitleRemark, ViewTrackBar, ChartTitleUpdate }, components: { TitleRemark, ViewTrackBar, ChartTitleUpdate },
@ -166,7 +166,26 @@ export default {
} }
}, },
beforeDestroy() { beforeDestroy() {
this.myChart.destroy() if (this.myChart.container) {
clear(this.myChart.container)
}
this.myChart?.clear?.()
this.myChart?.unbindSizeSensor?.()
this.myChart?.unbind?.()
this.myChart?.destroy?.()
if (this.myChart) {
for (const key in this.myChart.chart) {
this.myChart.chart[key] = null
this.$delete(this.myChart.chart, key)
}
for (const key in this.myChart) {
this.myChart[key] = null
this.$delete(this.myChart, key)
}
}
for (const key in this.pointParam) {
this.$delete(this.pointParam, key)
}
window.removeEventListener('resize', this.calcHeightDelay) window.removeEventListener('resize', this.calcHeightDelay)
this.myChart = null this.myChart = null
}, },
@ -222,7 +241,7 @@ export default {
window.addEventListener('resize', this.calcHeightDelay) window.addEventListener('resize', this.calcHeightDelay)
}, },
drawView() { drawView() {
const chart = this.chart const chart = JSON.parse(JSON.stringify(this.chart))
// type // type
// if (chart.data) { // if (chart.data) {
this.antVRenderStatus = true this.antVRenderStatus = true