NEZ-3180 fix:Dashboard 页面 query_range 时间参数与上方时间选择器展示不一致

This commit is contained in:
zhangyu
2023-09-08 15:18:23 +08:00
parent cc6f3883d2
commit 3cf58c72e8
5 changed files with 74 additions and 26 deletions

View File

@@ -18,7 +18,7 @@ export default {
chart: {}
},
methods: {
reload () {
reload (isRefresh) {
if (this.currentProject && this.currentProject.id) {
this.$get('monitor/project/topo', { projectId: this.currentProject.id }).then(res => {
if (res.data && res.data.topo) {
@@ -42,21 +42,34 @@ export default {
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
}
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()
})
} else {
this.topoData = {}
this.querysArray = []
this.params = {
timeType: 5
}
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
}
}
}