CN-128 perf: 优化图表加载动画

This commit is contained in:
chenjinsong
2021-09-07 11:38:06 +08:00
parent 49d7fdb1d1
commit 3c47b8d613
9 changed files with 44 additions and 20 deletions

View File

@@ -19,3 +19,14 @@
font-weight:900;
}
}
.chart__loading {
display: flex;
justify-content: center;
align-items: center;
background-color: #fefefe;
i {
font-size: 30px;
color: #aaa;
}
}

View File

@@ -9,9 +9,12 @@
<slot name="operations"></slot>
</div>
</div>
<div class="cn-chart__body" v-loading="loading">
<div class="cn-chart__body" v-show="!loading">
<slot></slot>
</div>
<div class="cn-chart__body chart__loading" v-show="loading">
<i class="el-icon-loading"></i>
</div>
<div class="cn-chart__footer">
<slot name="footer"></slot>
</div>

View File

@@ -1,10 +1,13 @@
<template>
<div class="cn-chart cn-chart__single-value chart-header-position" :class="singleValueClass(type)" >
<div class="cn-chart cn-chart__single-value chart-header-position" :class="singleValueClass(type)">
<slot name="chartErrorInfo"></slot>
<div class="single-value-icon__box" >
<div class="single-value__icon"><i :class="icon"></i></div>
</div>
<div class="single-value__content" v-if="type === 51">
<div class="single-value__content chart__loading" style="height: 100%; width: 100%;" v-if="loading">
<i class="el-icon-loading"></i>
</div>
<div class="single-value__content" v-if="type === 51" v-show="!loading">
<div class="content__data">
<slot name="data"></slot>
</div>
@@ -12,7 +15,7 @@
<slot name="title"></slot>
</div>
</div>
<div class="single-value__content" v-if="type === 52">
<div class="single-value__content" v-if="type === 52" v-show="!loading">
<div class="content__title">
<slot name="title"></slot>
</div>
@@ -23,7 +26,7 @@
<slot name="chart"></slot>
</div>
</div>
<div class="single-value__content" v-if="type === 53">
<div class="single-value__content" v-if="type === 53" v-show="!loading">
<div class="content__title"></div>
<div class="content__data"></div>
</div>
@@ -35,7 +38,8 @@ export default {
name: 'ChartSingleValue',
props: {
type: Number,
icon: String
icon: String,
loading: Boolean
},
computed: {
singleValueClass () {

View File

@@ -9,7 +9,10 @@
<slot name="operations"></slot>
</div>
</div>
<div class="cn-chart__body" v-loading="loading" v-no-data="noData">
<div class="cn-chart__body chart__loading" v-show="loading">
<i class="el-icon-loading"></i>
</div>
<div class="cn-chart__body" v-show="!loading" v-no-data="noData">
<el-table
style="width: 100%"
tooltip-effect="light"

View File

@@ -9,9 +9,12 @@
<slot name="operations"></slot>
</div>
</div>
<div class="cn-chart__body" :class="{'pie-with-table': isPieWithTable}" v-loading="loading" v-no-data="noData">
<div class="cn-chart__body" :class="{'pie-with-table': isPieWithTable}" v-no-data="noData" v-show="!loading">
<slot></slot>
</div>
<div class="cn-chart__body chart__loading" v-show="loading">
<i class="el-icon-loading"></i>
</div>
<div class="cn-chart__footer" v-if="layout.indexOf(layoutConstant.FOOTER) > -1 && !noData" :class="{'pie-with-table': isPieWithTable}" v-loading="loading">
<slot name="footer"></slot>
</div>

View File

@@ -38,7 +38,7 @@ export const panelTypeAndRouteMapping = {
trafficSummary: 1,
networkAppPerformance: 2,
dnsServiceInsights: 3,
ipEntityDetail: 4,//此为clientIP
ipEntityDetail: 4, // 此为clientIP
domainEntityDetail: 5,
appEntityDetail: 6,
serverIpEntityDetail: 7

View File

@@ -99,7 +99,7 @@
:type="chartInfo.type"
:style="computePosition"
:icon="singleValue.icon"
v-loading="loading"
:loading="loading"
>
<template #chartErrorInfo>
<chart-error

View File

@@ -69,7 +69,7 @@ export default {
tabTitle () {
let title
switch (this.typeName) {
case 'ipEntityDetail':{//client IP
case 'ipEntityDetail': { // client IP
title = this.$t('entities.ipDetail')
break
}
@@ -119,14 +119,14 @@ export default {
this.$emit('goBack')
},
async changeTab (label) {
let routePath;
if(label=='clientIP'){
routePath = 'ipEntityDetail';
}else if(label=='serverIP'){
routePath = 'serverIpEntityDetail';
let routePath
if (label == 'clientIP') {
routePath = 'ipEntityDetail'
} else if (label == 'serverIP') {
routePath = 'serverIpEntityDetail'
}
this.panelType = panelTypeAndRouteMapping[routePath];
await this.init();
this.panelType = panelTypeAndRouteMapping[routePath]
await this.init()
},
async init () {
const panels = await getPanelList({ type: this.panelType })

View File

@@ -53,7 +53,7 @@ import galaxyProxyBox from '@/components/rightBox/settings/GalaxyProxyBox'
import galaxyProxyTable from '@/components/table/settings/GalaxyProxyTable'
import dataListMixin from '@/mixins/dataList'
import { api } from '@/utils/api'
import {get} from "@/utils/http";
import { get } from '@/utils/http'
export default {
name: 'GalaxyProxy',