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: '',
|
2023-04-07 15:13:37 +08:00
|
|
|
params: {},
|
2023-06-09 14:23:19 +08:00
|
|
|
iconArray: [],
|
|
|
|
|
iconArrayLoad: false
|
2023-02-16 16:33:20 +08:00
|
|
|
}
|
|
|
|
|
},
|
2023-02-20 14:25:09 +08:00
|
|
|
watch: {
|
|
|
|
|
currentProject: {
|
|
|
|
|
handler (n) {
|
|
|
|
|
this.reload()
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
chart: {}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
2023-09-08 15:18:23 +08:00
|
|
|
reload (isRefresh) {
|
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
|
|
|
|
|
}
|
2023-09-08 15:18:23 +08:00
|
|
|
if (isRefresh) {
|
|
|
|
|
this.$get('/visual/dashboard/chart/' + this.chartInfo.id).then(response => {
|
|
|
|
|
res.data = JSON.parse(response.data.param)
|
|
|
|
|
console.log(res.data)
|
|
|
|
|
this.topoInit(res)
|
|
|
|
|
this.chartInfo.param.topo = res.data.topo
|
|
|
|
|
this.$refs.diagram && this.$refs.diagram.reload()
|
|
|
|
|
})
|
2023-06-08 19:13:05 +08:00
|
|
|
} else {
|
2023-09-08 15:18:23 +08:00
|
|
|
this.topoInit(res)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
topoInit (res) {
|
|
|
|
|
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-06-08 19:13:05 +08:00
|
|
|
}
|
2023-02-20 19:11:10 +08:00
|
|
|
}
|
2023-02-16 16:33:20 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|