Merge branch 'dev-3.2' of https://git.mesalab.cn/nezha/nezha-fronted into dev-3.2

# Conflicts:
#	nezha-fronted/src/components/common/project/topologyL5.vue
This commit is contained in:
zhangyu
2022-04-19 15:47:36 +08:00
3 changed files with 34 additions and 19 deletions

View File

@@ -172,6 +172,15 @@
:is-fullscreen="isFullscreen"
@chartIsNoData="chartIsNoData"
></chart-clock>
<chart-topology
:ref="'chart' + chartInfo.id"
v-if="isTopology(chartInfo.type)"
:chart-data="chartData"
:chart-info="chartInfo"
:chart-option="chartOption"
:is-fullscreen="isFullscreen"
@chartIsNoData="chartIsNoData"
></chart-topology>
</template>
</div>
</template>
@@ -224,7 +233,8 @@ export default {
chartUrl,
chartValue,
chartHexagonD3,
chartMap
chartMap,
chartTopology
},
props: {
chartInfo: Object,
@@ -293,6 +303,7 @@ export default {
isTable,
isGauge,
isClock,
isTopology,
chartIsNoData (flag) {
this.chartChildrenData = flag
},

View File

@@ -1,5 +1,5 @@
<template>
<div v-loading="topologyLoading" class="overview">
<div v-my-loading="topologyLoading" class="overview">
<transition name = "el-zoom-in-center">
<div v-if="allProject&&allProject.length>0" style="width: 100%;height: 100%;position: relative">
<el-carousel :interval="5000" :trigger="'click'" arrow="hover">
@@ -46,7 +46,7 @@ export default {
this.$get('monitor/project', { pageSize: -1 }).then(res => {
this.topologyLoading = true
const axiosAll = []
const temp = []
let temp = []
if (res.data.list.length === 0) {
this.topologyLoading = false
}
@@ -64,7 +64,8 @@ export default {
res2.forEach(item => {
temp.push(item)
})
this.allProject = temp
this.allProject = JSON.parse(JSON.stringify(temp))
temp = []
this.topologyLoading = false
})
})

View File

@@ -660,12 +660,11 @@ export default {
this.chartGetData = []
const axiosArr = []
const promiseArr = []
const self = this
const pensPromise = (pen, arr, index) => {
return new Promise(function (resolve, reject) {
return new Promise((resolve, reject) => {
Promise.all(arr).then((res) => {
self.chartGetData[index].res = self.computeData(res, pen.data.aggregation, pen)
self.setAnimation(pen, self.chartGetData[index].res)
this.chartGetData[index].res = this.computeData(res, pen.data.aggregation, pen)
this.setAnimation(pen, this.chartGetData[index].res)
resolve()
})
})
@@ -802,7 +801,7 @@ export default {
if (!res.data) {
return
}
let data = res.data.topo
let data = JSON.parse(JSON.stringify(res.data.topo))
if (!res.data.topo || !res.data.topo.pens.length) {
this.showNoData = true
} else {
@@ -848,12 +847,11 @@ export default {
const arr = data.pens.filter(item => !item.type)
this.addNodeInit(arr)
}
const timer = setInterval(() => {
let timer = setInterval(() => {
if (!this.imgInit) {
return
}
const promiseArr = [this.$get('stat/module/abnormal', { projectId: this.obj.id })]
const self = this
for (let i = 0; i < data.pens.length; i++) {
const line = data.pens[i]
if (line.type === 1) {
@@ -916,15 +914,17 @@ export default {
}
}
})
self.saveData = { ...data }
this.saveData = { ...data }
resolve(data)
data = null
clearInterval(timer)
timer = null
}).catch(res => {
self.saveData = { ...data }
this.saveData = { ...data }
resolve(data)
data = null
clearInterval(timer)
timer = null
})
}, 100)
}
@@ -1066,7 +1066,6 @@ export default {
},
getNodesArr () {
const arr = []
if (!getTopology(this.topologyIndex)) return
this.offsetX = getTopology(this.topologyIndex).data.x
this.offsetY = getTopology(this.topologyIndex).data.y
@@ -1560,7 +1559,7 @@ export default {
fileList = fileList.splice(fileList.length - 1, 1)
return false
}
const isSize = new Promise(function (resolve, reject) {
new Promise(function (resolve, reject) {
const width = 0
const height = 0
const _URL = window.URL || window.webkitURL
@@ -1858,8 +1857,7 @@ export default {
// resolve(img)
// })
})
.catch(err => {
})
.catch()
})
}
},
@@ -2269,8 +2267,13 @@ export default {
}
}
},
destroyed () {
beforeDestroy () {
if (this.timer) {
clearInterval(this.timer)
this.timer = null
}
if (getTopology(this.topologyIndex)) {
getTopology(this.topologyIndex).off('contextmenu', this.onContextMenu)
getTopology(this.topologyIndex).destroy()
setTopology(this.topologyIndex, null)
window.topology = null
@@ -2282,7 +2285,7 @@ export default {
document.getElementById('topology-canvas' + this.topologyIndexF).removeEventListener('mousemove', this.canvasMove)
}
window.removeEventListener('resize', this.winResize)
window.removeEventListener('resize', this.contextmenuNone)
window.removeEventListener('click', this.contextmenuNone)
}
}
</script>