fix:修改 topology 内存溢出的问题

This commit is contained in:
zhangyu
2022-07-12 11:51:12 +08:00
parent 1ac93fd7a4
commit f8e1657824

View File

@@ -336,7 +336,9 @@
</template>
<script>
import { Topology, registerNode } from '@topology/core'
import { Topology, registerNode } from '@/components/common/@topology/core/index.js'
import { Store as le5leStore } from 'le5le-store'
// import { Topology, registerNode } from '@topology/core'
import imgDefault from '@/components/common/project/L5/services/img'
import {
Tools,
@@ -363,6 +365,7 @@ import endpointTable from './popData/endpointTable'
import topoTooltip from './L5/topoTooltip'
import { getMetricTypeValue, dealLegendAlias } from '../js/tools'
import bus from '../../../libs/bus'
// 注册到画布
registerNode('rectangleImg', myShape, myAnchors, myIconRect, myTextRect)
registerNode('myCube', myCubec, myCubeAnchors, null, null)
@@ -479,9 +482,9 @@ export default {
chartData: {},
chartGetData: [],
penLineType: [
{ d: 'M5 19 a50,100 0 0,1 40,0', 'stroke-dasharray': '', name: this.$t('project.topology.curve'), id: 'curve' , strokeColor: theme == 'light' ? 'black' : '#BEBEBE'},
{ d: 'M5 8 l20 0 l0 12 l20 0', 'stroke-dasharray': '', name: this.$t('project.topology.polyline'), id: 'polyline' , strokeColor: theme == 'light' ? 'black' : '#BEBEBE'},
{ d: 'M5 14 l40 0', 'stroke-dasharray': '', name: this.$t('project.topology.line'), id: 'line' , strokeColor: theme == 'light' ? 'black' : '#BEBEBE'}
{ d: 'M5 19 a50,100 0 0,1 40,0', 'stroke-dasharray': '', name: this.$t('project.topology.curve'), id: 'curve', strokeColor: theme == 'light' ? 'black' : '#BEBEBE' },
{ d: 'M5 8 l20 0 l0 12 l20 0', 'stroke-dasharray': '', name: this.$t('project.topology.polyline'), id: 'polyline', strokeColor: theme == 'light' ? 'black' : '#BEBEBE' },
{ d: 'M5 14 l40 0', 'stroke-dasharray': '', name: this.$t('project.topology.line'), id: 'line', strokeColor: theme == 'light' ? 'black' : '#BEBEBE' }
// {d:'M5 20 C0,8 50,0 85,0',"stroke-dasharray":"",name:'mind', strokeColor: theme == 'light' ? 'black' : '#BEBEBE'},
],
lineName: 'curve',
@@ -2280,8 +2283,21 @@ export default {
this.timer4 = null
}
if (getTopology(this.topologyIndex)) {
getTopology(this.topologyIndex).open({ pens: [] })
getTopology(this.topologyIndex).off('contextmenu', this.onContextMenu)
getTopology(this.topologyIndex).destroy()
const StoreData = le5leStore.get()
const arr = []
Object.keys(StoreData).forEach(key => {
const id = key.split('-')[0]
arr.push(id)
if (getTopology(this.topologyIndex).id == id) {
le5leStore.set(key, null)
delete StoreData[key]
}
})
console.log(this.$loadsh.uniq(arr))
console.log(le5leStore.get())
Object.keys(getTopology(this.topologyIndex)).forEach(key => {
getTopology(this.topologyIndex)[key] = null
})
@@ -2292,6 +2308,9 @@ export default {
}
window.removeEventListener('resize', this.winResize)
window.removeEventListener('click', this.contextmenuNone)
},
destroyed () {
}
}
</script>