fix: 修复实体详情下拉loading动画加载错误问题

This commit is contained in:
changyongqiang
2022-05-24 15:23:55 +08:00
parent e8de279a01
commit d0a2309669
6 changed files with 11 additions and 41 deletions

View File

@@ -53,6 +53,9 @@ export default {
switchCollapse (isCollapse, index) { switchCollapse (isCollapse, index) {
this.isCollapse = isCollapse this.isCollapse = isCollapse
this.collapseIndex = index this.collapseIndex = index
if (isCollapse) {
this.emitter.emit('switch-collapse')
}
}, },
collapse () { collapse () {
this.isCollapse = true this.isCollapse = true

View File

@@ -43,7 +43,6 @@
<div class="row__charts-msg">{{$t('overall.sent')}}{{unitConvert(entityData.bytesSentRate, unitTypes.byte).join(' ')}}ps</div> <div class="row__charts-msg">{{$t('overall.sent')}}{{unitConvert(entityData.bytesSentRate, unitTypes.byte).join(' ')}}ps</div>
<!-- 曲线--> <!-- 曲线-->
<div class="row__content-loading"> <div class="row__content-loading">
<loading :loading="loadingApp"></loading>
<div class="row__charts" :id="`entityDetailSend${entityData.appName}`" ></div> <div class="row__charts" :id="`entityDetailSend${entityData.appName}`" ></div>
</div> </div>
</div> </div>
@@ -51,7 +50,6 @@
<div class="row__charts-msg">{{$t('overall.received')}}{{unitConvert(entityData.bytesReceivedRate, unitTypes.byte).join(' ')}}ps</div> <div class="row__charts-msg">{{$t('overall.received')}}{{unitConvert(entityData.bytesReceivedRate, unitTypes.byte).join(' ')}}ps</div>
<!-- 曲线--> <!-- 曲线-->
<div class="row__content-loading"> <div class="row__content-loading">
<loading :loading="loadingApp"></loading>
<div class="row__charts" :id="`entityDetailReceived${entityData.appName}`" ></div> <div class="row__charts" :id="`entityDetailReceived${entityData.appName}`" ></div>
</div> </div>
</div> </div>
@@ -287,7 +285,6 @@ export default {
} }
], ],
chartDatas: [null, null, null, null, null], chartDatas: [null, null, null, null, null],
loadingApp: false,
loadingTraffic: false, loadingTraffic: false,
loadingRelationshipOne: false, loadingRelationshipOne: false,
loadingRelationshipTwo: false, loadingRelationshipTwo: false,

View File

@@ -47,7 +47,6 @@
<div class="row__charts-msg">{{$t('overall.sent')}}{{unitConvert(entityData.bytesSentRate, unitTypes.byte).join(' ')}}ps</div> <div class="row__charts-msg">{{$t('overall.sent')}}{{unitConvert(entityData.bytesSentRate, unitTypes.byte).join(' ')}}ps</div>
<!-- 曲线--> <!-- 曲线-->
<div class="row__content-loading"> <div class="row__content-loading">
<loading :loading="loadingDomain"></loading>
<div class="row__charts" :id="`entityDetailSend${entityData.domainName}`" ></div> <div class="row__charts" :id="`entityDetailSend${entityData.domainName}`" ></div>
</div> </div>
</div> </div>
@@ -55,7 +54,6 @@
<div class="row__charts-msg">{{$t('overall.received')}}{{unitConvert(entityData.bytesReceivedRate, unitTypes.byte).join(' ')}}ps</div> <div class="row__charts-msg">{{$t('overall.received')}}{{unitConvert(entityData.bytesReceivedRate, unitTypes.byte).join(' ')}}ps</div>
<!-- 曲线--> <!-- 曲线-->
<div class="row__content-loading"> <div class="row__content-loading">
<loading :loading="loadingDomain"></loading>
<div class="row__charts" :id="`entityDetailReceived${entityData.domainName}`" ></div> <div class="row__charts" :id="`entityDetailReceived${entityData.domainName}`" ></div>
</div> </div>
</div> </div>
@@ -292,7 +290,6 @@ export default {
} }
], ],
chartDatas: [null, null, null, null, null], chartDatas: [null, null, null, null, null],
loadingDomain: false,
loadingTraffic: false, loadingTraffic: false,
loadingRelationshipOne: false, loadingRelationshipOne: false,
loadingRelationshipTwo: false, loadingRelationshipTwo: false,

View File

@@ -70,7 +70,6 @@
<div class="row__charts-msg">{{$t('overall.sent')}}{{unitConvert(entityData.bytesSentRate, unitTypes.byte).join(' ')}}ps</div> <div class="row__charts-msg">{{$t('overall.sent')}}{{unitConvert(entityData.bytesSentRate, unitTypes.byte).join(' ')}}ps</div>
<!-- 曲线--> <!-- 曲线-->
<div class="row__content-loading"> <div class="row__content-loading">
<loading :loading="loadingIp"></loading>
<div class="row__charts" :id="`entityDetailSend${entityData.ipAddr}`"></div> <div class="row__charts" :id="`entityDetailSend${entityData.ipAddr}`"></div>
</div> </div>
</div> </div>
@@ -78,7 +77,6 @@
<div class="row__charts-msg">{{$t('overall.received')}}{{unitConvert(entityData.bytesReceivedRate, unitTypes.byte).join(' ')}}ps</div> <div class="row__charts-msg">{{$t('overall.received')}}{{unitConvert(entityData.bytesReceivedRate, unitTypes.byte).join(' ')}}ps</div>
<!-- 曲线--> <!-- 曲线-->
<div class="row__content-loading"> <div class="row__content-loading">
<loading :loading="loadingIp"></loading>
<div class="row__charts" :id="`entityDetailReceived${entityData.ipAddr}`"></div> <div class="row__charts" :id="`entityDetailReceived${entityData.ipAddr}`"></div>
</div> </div>
</div> </div>
@@ -317,7 +315,6 @@ export default {
chartDatas: [null, null, null, null, null] chartDatas: [null, null, null, null, null]
}, },
timer: null, timer: null,
loadingIp: false,
loadingDns: false, loadingDns: false,
loading: false, loading: false,
loadingTraffic: false, loadingTraffic: false,

View File

@@ -106,16 +106,7 @@ export default {
queryEntityDetailTraffic () { queryEntityDetailTraffic () {
this.sentChart = echarts.init(document.getElementById(`entityDetailSend${this.entityName}`)) this.sentChart = echarts.init(document.getElementById(`entityDetailSend${this.entityName}`))
this.receivedChart = echarts.init(document.getElementById(`entityDetailReceived${this.entityName}`)) this.receivedChart = echarts.init(document.getElementById(`entityDetailReceived${this.entityName}`))
if (this.entity.entityType === 'app') { this.loadingTraffic = true
this.loadingApp = true
this.loadingTraffic = true
} else if (this.entity.entityType === 'ip') {
this.loadingIp = true
this.loadingTraffic = true
} else if (this.entity.entityType === 'domain') {
this.loadingDomain = true
this.loadingTraffic = true
}
get(this.trafficUrl, this.getQueryParams()).then(response => { get(this.trafficUrl, this.getQueryParams()).then(response => {
if (response.code === 200 && response.data.result && response.data.result.length > 0) { if (response.code === 200 && response.data.result && response.data.result.length > 0) {
response.data.result.forEach(t => { response.data.result.forEach(t => {
@@ -173,27 +164,9 @@ export default {
this.echartsArray.push(shallowRef(this.sentChart), shallowRef(this.receivedChart)) this.echartsArray.push(shallowRef(this.sentChart), shallowRef(this.receivedChart))
this.sentChart.setOption(this.chartOptionSent) this.sentChart.setOption(this.chartOptionSent)
this.receivedChart.setOption(this.chartOptionReceived) this.receivedChart.setOption(this.chartOptionReceived)
if (this.entity.entityType === 'app') { this.loadingTraffic = false
this.loadingApp = false
this.loadingTraffic = false
} else if (this.entity.entityType === 'ip') {
this.loadingIp = false
this.loadingTraffic = false
} else if (this.entity.entityType === 'domain') {
this.loadingDomain = false
this.loadingTraffic = false
}
} else { } else {
if (this.entity.entityType === 'app') { this.loadingTraffic = false
this.loadingApp = false
this.loadingTraffic = false
} else if (this.entity.entityType === 'ip') {
this.loadingIp = false
this.loadingTraffic = false
} else if (this.entity.entityType === 'domain') {
this.loadingDomain = false
this.loadingTraffic = false
}
} }
}).finally(() => { }).finally(() => {
setTimeout(() => { setTimeout(() => {
@@ -456,6 +429,10 @@ export default {
window.addEventListener('resize', this.debounceFunc) window.addEventListener('resize', this.debounceFunc)
this.chartOption = _.cloneDeep(entityListLineOption) this.chartOption = _.cloneDeep(entityListLineOption)
setTimeout(() => { this.queryEntityDetail() }) setTimeout(() => { this.queryEntityDetail() })
const _this = this
this.emitter.on('switch-collapse', function () {
setTimeout(() => { _this.queryEntityDetail() }, 400)
})
}, },
beforeUnmount () { beforeUnmount () {
window.removeEventListener('resize', this.debounceFunc) window.removeEventListener('resize', this.debounceFunc)

View File

@@ -12,8 +12,7 @@ export default {
props: { props: {
entity: Object, entity: Object,
timeFilter: Object, timeFilter: Object,
listMode: String, listMode: String
loading: Boolean
}, },
data () { data () {
return { return {