This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
nezha-nezha-fronted/nezha-fronted/src/components/common/mixin/beforeMeta2d.js

64 lines
1.5 KiB
JavaScript
Raw Normal View History

2023-02-16 16:33:20 +08:00
export default {
data () {
return {
topoData: {},
2023-02-20 14:25:09 +08:00
querysArray: [],
2023-02-16 18:13:14 +08:00
meta2dType: '',
params: {},
iconArray: []
2023-02-16 16:33:20 +08:00
}
},
2023-02-20 14:25:09 +08:00
watch: {
currentProject: {
handler (n) {
this.reload()
}
},
chart: {}
},
methods: {
reload () {
2023-06-09 10:36:48 +08:00
if (this.currentProject && this.currentProject.id) {
2023-02-20 19:11:10 +08:00
this.$get('monitor/project/topo', { projectId: this.currentProject.id }).then(res => {
if (res.data && res.data.topo) {
2023-03-14 18:13:54 +08:00
this.topoData = res.data.topo || {}
if (res.data.topo.topo) {
this.topoData = res.data.topo.topo || {}
}
2023-02-20 19:11:10 +08:00
this.querysArray = res.data.topo.elements || []
2023-02-21 19:05:49 +08:00
this.params = {
2023-03-14 18:13:54 +08:00
timeType: res.data.topo.timeType || 5
2023-02-21 19:05:49 +08:00
}
2023-02-20 19:11:10 +08:00
} else {
this.topoData = {}
this.querysArray = []
2023-02-21 19:05:49 +08:00
this.params = {
2023-03-14 18:13:54 +08:00
timeType: 5
2023-02-21 19:05:49 +08:00
}
2023-02-20 19:11:10 +08:00
}
})
2023-06-08 19:13:05 +08:00
} else if (this.isChart) {
const res = {
data: this.chartInfo.param
}
if (res.data && res.data.topo) {
this.topoData = res.data.topo || {}
if (res.data.topo.topo) {
this.topoData = res.data.topo.topo || {}
}
this.querysArray = res.data.topo.elements || []
this.params = {
timeType: res.data.topo.timeType || 5
}
} else {
this.topoData = {}
this.querysArray = []
this.params = {
timeType: 5
}
}
2023-02-20 19:11:10 +08:00
}
2023-02-16 16:33:20 +08:00
}
}
}