2022-07-06 21:08:12 +08:00
|
|
|
|
<template>
|
2022-07-15 14:27:11 +08:00
|
|
|
|
<div class="line network">
|
2022-11-21 17:31:30 +08:00
|
|
|
|
<chart-error v-if="showError" :content="errorMsg" />
|
|
|
|
|
|
<div class="line-header" v-if="!showError">
|
2022-09-28 14:59:14 +08:00
|
|
|
|
<div class="line-header-left">
|
|
|
|
|
|
<div class="line-value-active" v-if="lineTab"></div>
|
|
|
|
|
|
<div class="line-value">
|
|
|
|
|
|
<div class="line-value-mpackets"
|
|
|
|
|
|
v-show="item.show"
|
|
|
|
|
|
:class=" {'is-active': lineTab === item.class, 'mousemove-cursor': mousemoveCursor === item.class}"
|
|
|
|
|
|
v-for="(item, index) in mpackets"
|
|
|
|
|
|
:key="index"
|
|
|
|
|
|
@mouseenter="mouseenter(item)"
|
|
|
|
|
|
@mouseleave="mouseleave(item)"
|
|
|
|
|
|
@click="activeChange(item, index)">
|
|
|
|
|
|
<div class="line-value-mpackets-name">
|
|
|
|
|
|
<div :class="item.class"></div>
|
|
|
|
|
|
<div class="mpackets-name">{{$t(item.name)}}</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="line-value-unit">
|
|
|
|
|
|
<span class="line-value-unit-number">{{unitConvert(item.analysis.avg, unitTypes.number)[0]}}</span>
|
|
|
|
|
|
<span class="line-value-unit-number2">
|
2022-09-07 20:17:38 +08:00
|
|
|
|
<span>{{unitConvert(item.analysis.avg, unitTypes.number)[1]}}</span><span v-if="item.unitType">{{item.unitType}}</span>
|
|
|
|
|
|
</span>
|
2022-08-11 16:45:48 +08:00
|
|
|
|
</div>
|
2022-08-10 09:24:53 +08:00
|
|
|
|
</div>
|
2022-08-09 16:58:10 +08:00
|
|
|
|
</div>
|
2022-09-28 14:59:14 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="line-select line-header-right">
|
|
|
|
|
|
<div class="line-select-reference-line">
|
|
|
|
|
|
<span>{{$t('network.referenceLine')}}:</span>
|
|
|
|
|
|
<div class="line-select__operation">
|
|
|
|
|
|
<el-select
|
|
|
|
|
|
size="mini"
|
|
|
|
|
|
v-model="lineRefer"
|
|
|
|
|
|
:disabled="!lineTab"
|
|
|
|
|
|
popper-class="common-select"
|
|
|
|
|
|
:popper-append-to-body="false"
|
|
|
|
|
|
@change="referenceSelectChange"
|
|
|
|
|
|
>
|
|
|
|
|
|
<el-option v-for="item in options2" :key="item.value" :label="item.label" :value="item.value"></el-option>
|
|
|
|
|
|
</el-select>
|
2022-08-10 09:24:53 +08:00
|
|
|
|
</div>
|
2022-07-08 14:11:30 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2022-09-28 14:59:14 +08:00
|
|
|
|
</div>
|
2022-10-08 16:23:48 +08:00
|
|
|
|
<div style="height: calc(100% - 74px); position: relative">
|
2022-11-21 17:31:30 +08:00
|
|
|
|
<chart-no-data v-if="isNoData && !showError"></chart-no-data>
|
|
|
|
|
|
<div class="chart-drawing" v-show="showMarkLine && !isNoData && !showError" id="overviewLineChart"></div>
|
2022-11-09 17:23:31 +08:00
|
|
|
|
<!-- todo 后续改动,此处为框选返回-->
|
|
|
|
|
|
<!-- <div id="brushBtn" style="position: absolute;left: 0;top: 0;" v-show="mouseDownFlag">-->
|
|
|
|
|
|
<!-- <el-button @click.stop="backBrushHistory">返回</el-button>-->
|
|
|
|
|
|
<!-- </div>-->
|
2022-10-08 16:23:48 +08:00
|
|
|
|
</div>
|
2022-07-08 09:34:09 +08:00
|
|
|
|
</div>
|
2022-07-06 21:08:12 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
2022-07-08 09:34:09 +08:00
|
|
|
|
import * as echarts from 'echarts'
|
2022-07-14 17:07:07 +08:00
|
|
|
|
import { stackedLineChartOption } from '@/views/charts2/charts/options/echartOption'
|
2022-07-08 14:11:30 +08:00
|
|
|
|
import unitConvert from '@/utils/unit-convert'
|
2022-07-21 10:19:03 +08:00
|
|
|
|
import { unitTypes, chartColor3, chartColor4 } from '@/utils/constants.js'
|
2022-09-08 18:05:24 +08:00
|
|
|
|
import { ref, shallowRef } from 'vue'
|
2022-07-12 20:13:51 +08:00
|
|
|
|
import { stackedLineTooltipFormatter } from '@/views/charts/charts/tools'
|
2022-08-02 20:17:47 +08:00
|
|
|
|
import _ from 'lodash'
|
|
|
|
|
|
import { get } from '@/utils/http'
|
|
|
|
|
|
import { api } from '@/utils/api'
|
2022-08-05 15:50:54 +08:00
|
|
|
|
import { getSecond } from '@/utils/date-util'
|
2022-08-10 09:24:53 +08:00
|
|
|
|
import ChartNoData from '@/views/charts/charts/ChartNoData'
|
2022-08-21 22:11:53 +08:00
|
|
|
|
import chartMixin from '@/views/charts2/chart-mixin'
|
2022-09-08 18:05:24 +08:00
|
|
|
|
import { useRoute } from 'vue-router'
|
|
|
|
|
|
import { overwriteUrl, urlParamsHandler } from '@/utils/tools'
|
2022-11-21 17:31:30 +08:00
|
|
|
|
import ChartError from '@/components/common/Error'
|
2022-07-06 21:08:12 +08:00
|
|
|
|
export default {
|
2022-07-08 09:34:09 +08:00
|
|
|
|
name: 'NetworkOverviewLine',
|
2022-08-10 09:24:53 +08:00
|
|
|
|
components: {
|
2022-11-21 17:31:30 +08:00
|
|
|
|
ChartError,
|
2022-08-10 09:24:53 +08:00
|
|
|
|
ChartNoData
|
|
|
|
|
|
},
|
2022-11-01 19:23:17 +08:00
|
|
|
|
props: {
|
|
|
|
|
|
metric: {
|
|
|
|
|
|
type: String,
|
|
|
|
|
|
default: 'Bits/s'
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2022-07-11 16:36:11 +08:00
|
|
|
|
setup () {
|
2022-09-08 18:05:24 +08:00
|
|
|
|
const { query } = useRoute()
|
|
|
|
|
|
const lineRefer = ref(query.lineRefer || 'Average')
|
|
|
|
|
|
const lineTab = ref(query.lineTab || '')
|
2022-09-20 09:36:53 +08:00
|
|
|
|
const queryCondition = ref(query.queryCondition || '')
|
2022-11-23 16:51:38 +08:00
|
|
|
|
const tabOperationType = ref(query.tabOperationType)
|
|
|
|
|
|
const networkOverviewBeforeTab = ref(query.networkOverviewBeforeTab)
|
2022-07-11 16:36:11 +08:00
|
|
|
|
return {
|
2022-09-08 18:05:24 +08:00
|
|
|
|
lineRefer,
|
|
|
|
|
|
lineTab,
|
2022-09-20 09:36:53 +08:00
|
|
|
|
queryCondition,
|
2022-11-23 16:51:38 +08:00
|
|
|
|
tabOperationType,
|
|
|
|
|
|
networkOverviewBeforeTab,
|
2022-07-11 16:36:11 +08:00
|
|
|
|
myChart: shallowRef(null)
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2022-08-21 22:11:53 +08:00
|
|
|
|
mixins: [chartMixin],
|
2022-07-08 09:34:09 +08:00
|
|
|
|
data () {
|
|
|
|
|
|
return {
|
2022-07-08 17:06:24 +08:00
|
|
|
|
options2: [
|
|
|
|
|
|
{
|
|
|
|
|
|
value: 'Average',
|
|
|
|
|
|
label: 'Average'
|
|
|
|
|
|
},
|
2022-07-08 09:34:09 +08:00
|
|
|
|
{
|
2022-07-21 10:19:03 +08:00
|
|
|
|
value: '95th Percentile',
|
|
|
|
|
|
label: '95th Percentile'
|
2022-07-08 09:34:09 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
2022-07-21 10:19:03 +08:00
|
|
|
|
value: 'Maximum',
|
|
|
|
|
|
label: 'Maximum'
|
2022-07-11 16:36:11 +08:00
|
|
|
|
}
|
2022-07-08 14:11:30 +08:00
|
|
|
|
],
|
2022-11-03 11:21:39 +08:00
|
|
|
|
mpackets: [
|
|
|
|
|
|
{ analysis: {}, name: 'network.total', class: 'total', show: true, invertTab: true, positioning: 0, data: [], unitType: '' },
|
|
|
|
|
|
{ analysis: {}, name: 'network.inbound', class: 'inbound', show: true, invertTab: true, positioning: 1, data: [], unitType: '' },
|
|
|
|
|
|
{ analysis: {}, name: 'network.outbound', class: 'outbound', show: true, invertTab: true, positioning: 2, data: [], unitType: '' },
|
|
|
|
|
|
{ analysis: {}, name: 'network.internal', class: 'internal', show: true, invertTab: true, positioning: 3, data: [], unitType: '' },
|
|
|
|
|
|
{ analysis: {}, name: 'network.through', class: 'through', show: true, invertTab: true, positioning: 4, data: [], unitType: '' },
|
|
|
|
|
|
{ analysis: {}, name: 'network.other', class: 'other', show: true, invertTab: true, positioning: 5, data: [], unitType: '' }
|
|
|
|
|
|
],
|
2022-07-11 16:36:11 +08:00
|
|
|
|
unitConvert,
|
2022-07-12 20:13:51 +08:00
|
|
|
|
unitTypes,
|
2022-07-14 17:07:07 +08:00
|
|
|
|
chartDateObject: [],
|
2022-07-21 10:19:03 +08:00
|
|
|
|
timer: null,
|
|
|
|
|
|
mousemoveCursor: '',
|
|
|
|
|
|
leftOffset: 0,
|
2022-07-30 15:30:03 +08:00
|
|
|
|
sizes: [3, 4, 6, 8, 9, 10],
|
2022-08-08 18:30:41 +08:00
|
|
|
|
dynamicVariable: '',
|
2022-11-09 17:23:31 +08:00
|
|
|
|
showMarkLine: true,
|
|
|
|
|
|
mouseDownFlag: false,
|
2022-11-21 17:31:30 +08:00
|
|
|
|
brushHistory: [],
|
|
|
|
|
|
showError: false,
|
|
|
|
|
|
errorMsg: ''
|
2022-08-02 20:17:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
watch: {
|
2022-09-08 18:05:24 +08:00
|
|
|
|
lineTab (n) {
|
2022-08-02 20:17:47 +08:00
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.handleActiveBar(n)
|
2022-09-08 18:05:24 +08:00
|
|
|
|
const { query } = this.$route
|
|
|
|
|
|
const newUrl = urlParamsHandler(window.location.href, query, {
|
|
|
|
|
|
lineTab: n
|
|
|
|
|
|
})
|
|
|
|
|
|
overwriteUrl(newUrl)
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
lineRefer (n) {
|
|
|
|
|
|
const { query } = this.$route
|
|
|
|
|
|
const newUrl = urlParamsHandler(window.location.href, query, {
|
|
|
|
|
|
lineRefer: n
|
|
|
|
|
|
})
|
|
|
|
|
|
overwriteUrl(newUrl)
|
2022-08-23 21:42:42 +08:00
|
|
|
|
},
|
|
|
|
|
|
timeFilter: {
|
2022-11-09 17:41:19 +08:00
|
|
|
|
handler () {
|
2022-09-14 14:29:19 +08:00
|
|
|
|
if (this.lineTab) {
|
2022-11-01 19:23:17 +08:00
|
|
|
|
this.init(this.metric, this.showMarkLine, 'active')
|
2022-09-14 14:29:19 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
this.init()
|
|
|
|
|
|
}
|
2022-08-23 21:42:42 +08:00
|
|
|
|
}
|
2022-11-01 19:23:17 +08:00
|
|
|
|
},
|
|
|
|
|
|
metric (n) {
|
|
|
|
|
|
this.handleActiveBar()
|
|
|
|
|
|
this.showMarkLine = !this.showMarkLine
|
2022-11-09 17:41:19 +08:00
|
|
|
|
this.mpackets.forEach((e) => {
|
2022-11-01 19:23:17 +08:00
|
|
|
|
if (!e.invertTab) {
|
|
|
|
|
|
e.invertTab = true
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2022-11-03 15:36:36 +08:00
|
|
|
|
this.init(n, this.showMarkLine, '', n)
|
2022-08-02 20:17:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
2022-11-03 15:36:36 +08:00
|
|
|
|
init (val, show, active, n) {
|
2022-08-02 20:17:47 +08:00
|
|
|
|
if (!val) {
|
2022-11-01 19:23:17 +08:00
|
|
|
|
val = this.metric
|
2022-08-02 20:17:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
const params = {
|
2022-08-05 15:50:54 +08:00
|
|
|
|
startTime: getSecond(this.timeFilter.startTime),
|
|
|
|
|
|
endTime: getSecond(this.timeFilter.endTime)
|
2022-08-02 20:17:47 +08:00
|
|
|
|
}
|
2022-11-23 16:51:38 +08:00
|
|
|
|
let condition = ''
|
|
|
|
|
|
if (this.queryCondition && this.tabOperationType !== '3') {
|
2022-09-20 09:36:53 +08:00
|
|
|
|
params.q = this.queryCondition
|
2022-11-23 16:51:38 +08:00
|
|
|
|
} else if (this.tabOperationType == '3' && this.queryCondition) {
|
|
|
|
|
|
if (this.queryCondition.indexOf(' OR ') > -1) {
|
|
|
|
|
|
if (this.networkOverviewBeforeTab === 'isp') {
|
|
|
|
|
|
condition = this.queryCondition.split(/["|'= ](.*?)["|'= ]/)
|
|
|
|
|
|
params.q = `notEmpty(${condition[0]}) OR notEmpty(${condition[9]})`
|
|
|
|
|
|
} else {
|
|
|
|
|
|
condition = this.queryCondition.split(/["|'= ](.*?)["|'= ]/)
|
|
|
|
|
|
params.q = `notEmpty(${condition[0]}) OR notEmpty(${condition[5]})`
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
condition = this.queryCondition.split(/['=](.*?)['=]/)
|
|
|
|
|
|
params.q = `notEmpty(${condition[0]})`
|
|
|
|
|
|
}
|
2022-08-05 17:40:39 +08:00
|
|
|
|
}
|
2022-08-21 22:11:53 +08:00
|
|
|
|
this.toggleLoading(true)
|
2022-11-21 17:31:30 +08:00
|
|
|
|
|
2022-08-02 20:17:47 +08:00
|
|
|
|
get(api.netWorkOverview.totalTrafficAnalysis, params).then((res) => {
|
2022-11-21 17:31:30 +08:00
|
|
|
|
this.errorMsg = res.message
|
|
|
|
|
|
|
2022-08-02 20:17:47 +08:00
|
|
|
|
if (res.code === 200) {
|
2022-08-21 22:11:53 +08:00
|
|
|
|
this.isNoData = res.data.result.length === 0
|
2022-11-21 17:31:30 +08:00
|
|
|
|
this.showError = false
|
|
|
|
|
|
|
2022-11-03 11:21:39 +08:00
|
|
|
|
if (this.isNoData) {
|
2022-11-22 17:58:15 +08:00
|
|
|
|
this.lineTab = ''
|
2022-11-03 11:21:39 +08:00
|
|
|
|
this.mpackets = [
|
|
|
|
|
|
{ analysis: {}, name: 'network.total', class: 'total', show: true, invertTab: true, positioning: 0, data: [], unitType: '' },
|
|
|
|
|
|
{ analysis: {}, name: 'network.inbound', class: 'inbound', show: true, invertTab: true, positioning: 1, data: [], unitType: '' },
|
|
|
|
|
|
{ analysis: {}, name: 'network.outbound', class: 'outbound', show: true, invertTab: true, positioning: 2, data: [], unitType: '' },
|
|
|
|
|
|
{ analysis: {}, name: 'network.internal', class: 'internal', show: true, invertTab: true, positioning: 3, data: [], unitType: '' },
|
|
|
|
|
|
{ analysis: {}, name: 'network.through', class: 'through', show: true, invertTab: true, positioning: 4, data: [], unitType: '' },
|
|
|
|
|
|
{ analysis: {}, name: 'network.other', class: 'other', show: true, invertTab: true, positioning: 5, data: [], unitType: '' }
|
|
|
|
|
|
]
|
|
|
|
|
|
}
|
2023-01-10 12:25:49 +08:00
|
|
|
|
this.initData(res.data.result, val, active, show, n)
|
2022-11-21 17:31:30 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
this.showError = true
|
|
|
|
|
|
this.errorMsg = res.message
|
2022-08-02 20:17:47 +08:00
|
|
|
|
}
|
2022-08-21 22:11:53 +08:00
|
|
|
|
}).catch(e => {
|
2022-09-06 11:15:48 +08:00
|
|
|
|
console.error(e)
|
2022-11-21 17:31:30 +08:00
|
|
|
|
this.showError = true
|
|
|
|
|
|
this.errorMsg = e.message
|
2022-11-24 14:10:28 +08:00
|
|
|
|
this.isNoData = false
|
2022-08-21 22:11:53 +08:00
|
|
|
|
}).finally(() => {
|
|
|
|
|
|
this.toggleLoading(false)
|
2022-08-02 20:17:47 +08:00
|
|
|
|
})
|
|
|
|
|
|
},
|
2022-11-09 17:23:31 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 初始化echartsdom,用于右键点击返回框选
|
|
|
|
|
|
*/
|
|
|
|
|
|
domInit () {
|
|
|
|
|
|
const self = this
|
|
|
|
|
|
// 去掉默认的contextmenu事件,否则会和右键事件同时出现。
|
|
|
|
|
|
document.oncontextmenu = function (e) {
|
|
|
|
|
|
e.preventDefault()
|
|
|
|
|
|
}
|
|
|
|
|
|
document.getElementById('overviewLineChart').onmousedown = function (e) {
|
|
|
|
|
|
// e.button: 0左键,1滚轮,2右键
|
|
|
|
|
|
if (e.button === 2) {
|
|
|
|
|
|
self.myChart.dispatchAction({
|
|
|
|
|
|
type: 'brush',
|
|
|
|
|
|
areas: [] // 删除选框
|
|
|
|
|
|
})
|
|
|
|
|
|
self.mouseDownFlag = true
|
|
|
|
|
|
document.getElementById('brushBtn').style.left = e.layerX + 'px'
|
|
|
|
|
|
document.getElementById('brushBtn').style.top = e.layerY + 74 + 'px'
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2022-08-08 18:30:41 +08:00
|
|
|
|
echartsInit (echartsData, show) {
|
2022-09-08 18:05:24 +08:00
|
|
|
|
if (this.lineTab) {
|
|
|
|
|
|
this.handleActiveBar()
|
|
|
|
|
|
echartsData = echartsData.filter(t => t.show === true && t.invertTab === false)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
echartsData = echartsData.filter(t => t.show === true)
|
|
|
|
|
|
}
|
2022-08-02 20:17:47 +08:00
|
|
|
|
const _this = this
|
2022-11-09 17:23:31 +08:00
|
|
|
|
// !this.myChart && (this.myChart = echarts.init(dom))
|
|
|
|
|
|
// 此处为验证是否因dom未销毁,导致图表出错,后续可能会改
|
|
|
|
|
|
let dom = null
|
|
|
|
|
|
dom = document.getElementById('overviewLineChart')
|
2022-12-05 15:28:28 +08:00
|
|
|
|
|
2022-08-02 20:17:47 +08:00
|
|
|
|
this.chartOption = stackedLineChartOption
|
2022-07-21 10:19:03 +08:00
|
|
|
|
const chartOption = this.chartOption.series[0]
|
2022-08-02 20:17:47 +08:00
|
|
|
|
this.chartOption.series = echartsData.map((t, i) => {
|
2022-07-21 10:19:03 +08:00
|
|
|
|
return {
|
|
|
|
|
|
...chartOption,
|
|
|
|
|
|
name: t.name,
|
|
|
|
|
|
lineStyle: {
|
|
|
|
|
|
color: chartColor3[t.positioning],
|
|
|
|
|
|
width: 1
|
|
|
|
|
|
},
|
2022-08-05 15:50:54 +08:00
|
|
|
|
stack: t.name !== 'network.total' ? 'network.total' : '',
|
2022-11-09 17:41:19 +08:00
|
|
|
|
symbolSize: function (value) {
|
2022-07-21 10:19:03 +08:00
|
|
|
|
return _this.symbolSizeSortChange(i, value[0])
|
|
|
|
|
|
},
|
2022-12-13 15:17:37 +08:00
|
|
|
|
emphasis: {
|
|
|
|
|
|
itemStyle: {
|
2022-07-21 10:19:03 +08:00
|
|
|
|
borderColor: chartColor4[t.positioning],
|
|
|
|
|
|
borderWidth: 2,
|
|
|
|
|
|
shadowColor: chartColor4[t.positioning],
|
2022-08-02 20:17:47 +08:00
|
|
|
|
shadowBlur: this.sizes[t.positioning] + 2
|
2022-07-21 10:19:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
areaStyle: {
|
|
|
|
|
|
opacity: 0.1,
|
|
|
|
|
|
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
|
|
|
|
{
|
|
|
|
|
|
offset: 0,
|
|
|
|
|
|
color: chartColor3[t.positioning]
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
offset: 1,
|
|
|
|
|
|
color: chartColor3[t.positioning]
|
|
|
|
|
|
}
|
|
|
|
|
|
])
|
|
|
|
|
|
},
|
2022-08-12 15:25:54 +08:00
|
|
|
|
data: t.data.map(v => [Number(v[0]) * 1000, Number(v[1]), 'number']),
|
2022-07-26 17:18:54 +08:00
|
|
|
|
markLine: {
|
|
|
|
|
|
silent: true,
|
|
|
|
|
|
lineStyle: {
|
|
|
|
|
|
color: '#B4B1A8'
|
|
|
|
|
|
},
|
|
|
|
|
|
symbol: 'none',
|
|
|
|
|
|
label: {
|
|
|
|
|
|
formatter (params) {
|
|
|
|
|
|
const arr = unitConvert(params.value, unitTypes.number).join('')
|
2022-09-08 18:05:24 +08:00
|
|
|
|
return _this.lineRefer + '(' + arr + echartsData[0].unitType + ')'
|
2022-07-26 17:18:54 +08:00
|
|
|
|
},
|
|
|
|
|
|
position: 'insideStartTop',
|
|
|
|
|
|
color: '#717171',
|
|
|
|
|
|
fontFamily: 'NotoSansSChineseRegular'
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-07-21 10:19:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
2022-08-08 18:30:41 +08:00
|
|
|
|
if (!show) {
|
2022-11-09 17:41:19 +08:00
|
|
|
|
this.chartOption.series.forEach((t) => {
|
2022-08-08 18:30:41 +08:00
|
|
|
|
t.markLine.label.show = false
|
|
|
|
|
|
t.markLine = []
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2022-09-08 18:05:24 +08:00
|
|
|
|
if (this.lineRefer === 'Average' && show) {
|
2022-08-08 18:30:41 +08:00
|
|
|
|
this.chartOption.series.forEach((t, i) => {
|
|
|
|
|
|
t.markLine.label.show = true
|
2022-08-02 20:17:47 +08:00
|
|
|
|
t.markLine.data = [
|
|
|
|
|
|
{
|
|
|
|
|
|
yAxis: echartsData[i].analysis.avg
|
|
|
|
|
|
}
|
|
|
|
|
|
]
|
|
|
|
|
|
})
|
2022-09-08 18:05:24 +08:00
|
|
|
|
} else if (this.lineRefer === '95th Percentile' && show) {
|
2022-08-02 20:17:47 +08:00
|
|
|
|
this.chartOption.series.forEach((t, i) => {
|
2022-08-08 18:30:41 +08:00
|
|
|
|
t.markLine.label.show = true
|
2022-08-02 20:17:47 +08:00
|
|
|
|
t.markLine.data = [
|
|
|
|
|
|
{ yAxis: echartsData[i].analysis.p95 }
|
|
|
|
|
|
]
|
|
|
|
|
|
})
|
2022-09-08 18:05:24 +08:00
|
|
|
|
} else if (this.lineRefer === 'Maximum' && show) {
|
2022-08-02 20:17:47 +08:00
|
|
|
|
this.chartOption.series.forEach((t, i) => {
|
2022-08-08 18:30:41 +08:00
|
|
|
|
t.markLine.label.show = true
|
2022-08-02 20:17:47 +08:00
|
|
|
|
t.markLine.data = [
|
|
|
|
|
|
{ yAxis: echartsData[i].analysis.max }
|
|
|
|
|
|
]
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2022-07-21 10:19:03 +08:00
|
|
|
|
this.chartOption.tooltip.formatter = (params) => {
|
|
|
|
|
|
params.forEach(t => {
|
|
|
|
|
|
t.seriesName = this.$t(t.seriesName)
|
2022-10-20 11:19:58 +08:00
|
|
|
|
this.mpackets.forEach(e => {
|
|
|
|
|
|
if (this.$t(e.name) === t.seriesName) {
|
|
|
|
|
|
t.borderColor = chartColor3[e.positioning]
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2022-07-21 10:19:03 +08:00
|
|
|
|
})
|
2022-12-05 15:28:28 +08:00
|
|
|
|
return stackedLineTooltipFormatter(params)
|
2022-07-21 10:19:03 +08:00
|
|
|
|
}
|
2022-08-08 18:30:41 +08:00
|
|
|
|
this.showMarkLine = true
|
2022-12-05 15:28:28 +08:00
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.myChart = echarts.init(dom)
|
|
|
|
|
|
this.myChart.setOption(this.chartOption)
|
|
|
|
|
|
// 设置参见官网:https://echarts.apache.org/zh/api.html#action.brush.brush
|
|
|
|
|
|
this.myChart.dispatchAction({
|
|
|
|
|
|
// 刷选模式的开关。使用此 action 可将当前鼠标变为可刷选状态。事实上,点击 toolbox 中的 brush 按钮时,就是通过这个 action,将当前普通鼠标变为刷选器的。
|
|
|
|
|
|
type: 'takeGlobalCursor',
|
|
|
|
|
|
// 如果想变为“可刷选状态”,必须设置。不设置则会关闭“可刷选状态”。
|
|
|
|
|
|
key: 'brush',
|
|
|
|
|
|
brushOption: {
|
|
|
|
|
|
// 参见 brush 组件的 brushType。如果设置为 false 则关闭“可刷选状态”。
|
|
|
|
|
|
brushType: 'lineX',
|
|
|
|
|
|
xAxisIndex: 'all',
|
|
|
|
|
|
// 单击清除选框
|
|
|
|
|
|
brushMode: 'single',
|
|
|
|
|
|
// 选择完毕再返回所选数据
|
|
|
|
|
|
throttleType: 'debounce'
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2022-11-09 17:23:31 +08:00
|
|
|
|
|
2022-12-05 15:28:28 +08:00
|
|
|
|
const self = this
|
2022-11-09 17:23:31 +08:00
|
|
|
|
|
2022-12-05 15:28:28 +08:00
|
|
|
|
this.myChart.on('brushEnd', function (params) {
|
|
|
|
|
|
self.myChart.dispatchAction({
|
|
|
|
|
|
type: 'brush',
|
|
|
|
|
|
areas: [] // 删除选框
|
|
|
|
|
|
})
|
|
|
|
|
|
if (!self.mouseDownFlag) {
|
|
|
|
|
|
// 避免点击空白区域报错
|
|
|
|
|
|
if (params.areas !== undefined && params.areas.length > 0) {
|
|
|
|
|
|
self.brushHistory.unshift({
|
|
|
|
|
|
startTime: _.cloneDeep(self.timeFilter.startTime) * 1000,
|
|
|
|
|
|
endTime: _.cloneDeep(self.timeFilter.endTime) * 1000
|
|
|
|
|
|
})
|
2022-11-09 17:23:31 +08:00
|
|
|
|
|
2022-12-05 15:28:28 +08:00
|
|
|
|
const rangeObj = {
|
|
|
|
|
|
startTime: Math.ceil(params.areas[0].coordRange[0]),
|
|
|
|
|
|
endTime: Math.ceil(params.areas[0].coordRange[1])
|
|
|
|
|
|
}
|
2022-11-09 17:23:31 +08:00
|
|
|
|
|
2022-12-05 15:28:28 +08:00
|
|
|
|
// todo 目前暂定框选最小范围为5分钟,后续可能会变动
|
|
|
|
|
|
if (rangeObj.endTime - rangeObj.startTime < 5 * 60 * 1000) {
|
|
|
|
|
|
rangeObj.startTime = rangeObj.endTime - 5 * 60 * 1000
|
|
|
|
|
|
}
|
|
|
|
|
|
_this.$store.commit('setRangeEchartsData', rangeObj)
|
2022-11-09 17:23:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-12-05 15:28:28 +08:00
|
|
|
|
})
|
2022-11-09 17:23:31 +08:00
|
|
|
|
})
|
2022-07-21 10:19:03 +08:00
|
|
|
|
},
|
|
|
|
|
|
activeChange (item, index) {
|
2022-11-22 17:58:15 +08:00
|
|
|
|
if (this.isNoData) return
|
2022-09-08 18:05:24 +08:00
|
|
|
|
this.lineTab = item.class
|
2022-08-08 18:30:41 +08:00
|
|
|
|
this.legendSelectChange(item, index, 'active')
|
|
|
|
|
|
this.showMarkLine = !item.invertTab
|
2022-11-01 19:23:17 +08:00
|
|
|
|
this.init(this.metric, this.showMarkLine, 'active')
|
2022-07-21 10:19:03 +08:00
|
|
|
|
},
|
|
|
|
|
|
mouseenter (item) {
|
2022-11-22 17:58:15 +08:00
|
|
|
|
if (this.isNoData) return
|
2022-07-21 10:19:03 +08:00
|
|
|
|
this.mousemoveCursor = item.class
|
|
|
|
|
|
this.handleActiveBar(item.class)
|
|
|
|
|
|
},
|
|
|
|
|
|
mouseleave () {
|
|
|
|
|
|
this.mousemoveCursor = ''
|
|
|
|
|
|
},
|
|
|
|
|
|
dispatchLegendSelectAction (name) {
|
2022-08-11 09:42:26 +08:00
|
|
|
|
this.myChart && this.myChart.dispatchAction({
|
2022-07-21 10:19:03 +08:00
|
|
|
|
type: 'legendSelect',
|
|
|
|
|
|
name: name
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
dispatchLegendUnSelectAction (name) {
|
2022-08-11 09:42:26 +08:00
|
|
|
|
this.myChart && this.myChart.dispatchAction({
|
2022-07-21 10:19:03 +08:00
|
|
|
|
type: 'legendUnSelect',
|
|
|
|
|
|
name: name
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
2022-08-08 18:30:41 +08:00
|
|
|
|
legendSelectChange (item, index, val) {
|
2022-08-02 20:17:47 +08:00
|
|
|
|
if (index === 'index') {
|
|
|
|
|
|
this.dispatchLegendSelectAction(item.name)
|
2022-09-08 18:05:24 +08:00
|
|
|
|
} else if (this.mpackets[index] && this.mpackets[index].name === item.name) {
|
2022-08-02 20:17:47 +08:00
|
|
|
|
this.dispatchLegendSelectAction(item.name)
|
2022-07-21 10:19:03 +08:00
|
|
|
|
this.mpackets.forEach((t) => {
|
2022-08-02 20:17:47 +08:00
|
|
|
|
if (t.name !== item.name) {
|
|
|
|
|
|
this.dispatchLegendUnSelectAction(t.name)
|
|
|
|
|
|
}
|
2022-07-21 10:19:03 +08:00
|
|
|
|
})
|
|
|
|
|
|
}
|
2022-08-08 18:30:41 +08:00
|
|
|
|
if (val === 'active') {
|
|
|
|
|
|
this.mpackets.forEach(t => {
|
|
|
|
|
|
if (item.name === t.name) {
|
|
|
|
|
|
t.invertTab = !t.invertTab
|
|
|
|
|
|
} else {
|
|
|
|
|
|
t.invertTab = true
|
|
|
|
|
|
}
|
|
|
|
|
|
if (t.invertTab && item.name === t.name) {
|
2022-09-08 18:05:24 +08:00
|
|
|
|
if (this.lineTab) {
|
|
|
|
|
|
this.lineTab = ''
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.lineTab = t.class
|
|
|
|
|
|
}
|
2022-08-08 18:30:41 +08:00
|
|
|
|
this.mpackets.forEach((e) => {
|
|
|
|
|
|
this.dispatchLegendSelectAction(e.name)
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2022-07-21 10:19:03 +08:00
|
|
|
|
},
|
2022-11-09 17:41:19 +08:00
|
|
|
|
handleActiveBar () {
|
2022-08-02 20:17:47 +08:00
|
|
|
|
if (document.querySelector('.network .line-value-mpackets.is-active')) {
|
|
|
|
|
|
const { offsetLeft, clientWidth, clientLeft } = document.querySelector('.network .line-value-mpackets.is-active')
|
|
|
|
|
|
const activeBar = document.querySelector('.network .line-value-active')
|
|
|
|
|
|
activeBar.style.cssText += `width: ${clientWidth}px; left: ${offsetLeft + this.leftOffset + clientLeft}px;`
|
|
|
|
|
|
}
|
2022-07-21 10:19:03 +08:00
|
|
|
|
},
|
|
|
|
|
|
resize () {
|
|
|
|
|
|
this.myChart.resize()
|
|
|
|
|
|
},
|
2022-07-30 15:30:03 +08:00
|
|
|
|
referenceSelectChange (val) {
|
2022-09-08 18:05:24 +08:00
|
|
|
|
this.lineRefer = val
|
2022-12-22 09:48:10 +08:00
|
|
|
|
let echartsData
|
|
|
|
|
|
const chartOption = this.myChart.getOption()
|
|
|
|
|
|
if (this.lineTab) {
|
|
|
|
|
|
echartsData = this.mpackets.filter(t => t.show === true && t.invertTab === false)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
echartsData = this.mpackets.filter(t => t.show === true)
|
|
|
|
|
|
}
|
|
|
|
|
|
if (this.lineRefer === 'Average' && this.showMarkLine) {
|
|
|
|
|
|
chartOption.series.forEach((t, i) => {
|
|
|
|
|
|
if (t.name === echartsData[0].name) {
|
|
|
|
|
|
t.markLine.data = [{ yAxis: echartsData[0].analysis.avg }]
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
} else if (this.lineRefer === '95th Percentile' && this.showMarkLine) {
|
|
|
|
|
|
chartOption.series.forEach((t, i) => {
|
|
|
|
|
|
if (t.name === echartsData[0].name) {
|
|
|
|
|
|
t.markLine.data = [{ yAxis: echartsData[0].analysis.p95 }]
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
} else if (this.lineRefer === 'Maximum' && this.showMarkLine) {
|
|
|
|
|
|
chartOption.series.forEach((t, i) => {
|
|
|
|
|
|
if (t.name === echartsData[0].name) {
|
|
|
|
|
|
t.markLine.data = [{ yAxis: echartsData[0].analysis.max }]
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
this.myChart.setOption(chartOption)
|
2022-07-30 15:30:03 +08:00
|
|
|
|
},
|
2022-07-21 10:19:03 +08:00
|
|
|
|
symbolSizeSortChange (index, time) {
|
|
|
|
|
|
const dataIntegrationArray = []
|
|
|
|
|
|
if (stackedLineChartOption.series[0]) {
|
|
|
|
|
|
const totalData = stackedLineChartOption.series[0].data.find(t => t[0] === time) // [time, value]
|
2022-09-14 14:29:19 +08:00
|
|
|
|
if (totalData) {
|
|
|
|
|
|
dataIntegrationArray.push(totalData)
|
|
|
|
|
|
totalData[2] = 0
|
|
|
|
|
|
}
|
2022-07-21 10:19:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (stackedLineChartOption.series[1]) {
|
|
|
|
|
|
const inboundData = stackedLineChartOption.series[1].data.find(t => t[0] === time)
|
2022-09-14 14:29:19 +08:00
|
|
|
|
if (inboundData) {
|
|
|
|
|
|
dataIntegrationArray.push(inboundData)
|
|
|
|
|
|
inboundData[2] = 1
|
|
|
|
|
|
}
|
2022-07-21 10:19:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (stackedLineChartOption.series[2]) {
|
|
|
|
|
|
const outboundData = stackedLineChartOption.series[2].data.find(t => t[0] === time)
|
2022-09-14 14:29:19 +08:00
|
|
|
|
if (outboundData) {
|
|
|
|
|
|
dataIntegrationArray.push(outboundData)
|
|
|
|
|
|
outboundData[2] = 2
|
|
|
|
|
|
}
|
2022-07-21 10:19:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (stackedLineChartOption.series[3]) {
|
|
|
|
|
|
const internalData = stackedLineChartOption.series[3].data.find(t => t[0] === time)
|
2022-09-14 14:29:19 +08:00
|
|
|
|
if (internalData) {
|
|
|
|
|
|
dataIntegrationArray.push(internalData)
|
|
|
|
|
|
internalData[2] = 3
|
|
|
|
|
|
}
|
2022-07-21 10:19:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (stackedLineChartOption.series[4]) {
|
|
|
|
|
|
const throughData = stackedLineChartOption.series[4].data.find(t => t[0] === time)
|
2022-09-14 14:29:19 +08:00
|
|
|
|
if (throughData) {
|
|
|
|
|
|
dataIntegrationArray.push(throughData)
|
|
|
|
|
|
throughData[2] = 4
|
|
|
|
|
|
}
|
2022-07-21 10:19:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (stackedLineChartOption.series[5]) {
|
|
|
|
|
|
const otherData = stackedLineChartOption.series[5].data.find(t => t[0] === time)
|
2022-09-14 14:29:19 +08:00
|
|
|
|
if (otherData) {
|
|
|
|
|
|
dataIntegrationArray.push(otherData)
|
|
|
|
|
|
otherData[2] = 5
|
|
|
|
|
|
}
|
2022-07-21 10:19:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
dataIntegrationArray.sort((a, b) => { return a[1] - b[1] })
|
|
|
|
|
|
const sortIndex = dataIntegrationArray.findIndex(a => a[2] === index)
|
|
|
|
|
|
return this.sizes[sortIndex]
|
2022-11-09 17:23:31 +08:00
|
|
|
|
},
|
2023-01-10 12:25:49 +08:00
|
|
|
|
initData (data, val, active, show, n) {
|
|
|
|
|
|
let bytes = []
|
|
|
|
|
|
let packets = []
|
|
|
|
|
|
let sessions = []
|
|
|
|
|
|
if (data !== undefined && data.length > 0) {
|
|
|
|
|
|
data.forEach((item) => {
|
|
|
|
|
|
if (item.type.indexOf('bytes') > -1) {
|
|
|
|
|
|
bytes = Object.keys(item).map(t => {
|
|
|
|
|
|
return {
|
|
|
|
|
|
...item[t]
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
} else if (item.type.indexOf('packets') > -1) {
|
|
|
|
|
|
packets = Object.keys(item).map(t => {
|
|
|
|
|
|
return {
|
|
|
|
|
|
...item[t]
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
} else if (item.type.indexOf('sessions') > -1) {
|
|
|
|
|
|
sessions = Object.keys(item).map(t => {
|
|
|
|
|
|
return {
|
|
|
|
|
|
...item[t]
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
bytes.splice(0, 1)
|
|
|
|
|
|
packets.splice(0, 1)
|
|
|
|
|
|
sessions.splice(0, 1)
|
|
|
|
|
|
if (val === 'Bits/s') {
|
|
|
|
|
|
this.legendInit(bytes, active, show, 'bps', n)
|
|
|
|
|
|
} else if (val === 'Packets/s') {
|
|
|
|
|
|
this.legendInit(packets, active, show, 'packets/s', n)
|
|
|
|
|
|
} else if (val === 'Sessions/s') {
|
|
|
|
|
|
const mpackets = _.cloneDeep(this.mpackets)
|
|
|
|
|
|
sessions.forEach((d, i) => {
|
|
|
|
|
|
mpackets[i].data = d.values
|
|
|
|
|
|
mpackets[i].analysis = d.analysis
|
|
|
|
|
|
})
|
|
|
|
|
|
mpackets.forEach((e, i) => {
|
|
|
|
|
|
if (i !== 0) {
|
|
|
|
|
|
e.show = false
|
|
|
|
|
|
}
|
|
|
|
|
|
e.unitType = 'sessions/s'
|
|
|
|
|
|
e.invertTab = false
|
|
|
|
|
|
this.lineTab = 'total'
|
|
|
|
|
|
this.legendSelectChange(e, 0)
|
|
|
|
|
|
})
|
|
|
|
|
|
this.mpackets = mpackets
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.echartsInit(this.mpackets, true)
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
legendInit (data, active, show, type, n) {
|
|
|
|
|
|
const mpackets = _.cloneDeep(this.mpackets)
|
|
|
|
|
|
data.forEach((d, i) => {
|
|
|
|
|
|
mpackets[i].data = d.values
|
|
|
|
|
|
mpackets[i].analysis = d.analysis
|
|
|
|
|
|
})
|
|
|
|
|
|
let num = 0
|
|
|
|
|
|
mpackets.forEach(e => {
|
|
|
|
|
|
e.unitType = type
|
|
|
|
|
|
if (e.name !== 'network.total' && parseFloat(e.analysis.avg) === 0) {
|
|
|
|
|
|
e.show = false
|
|
|
|
|
|
num += 1
|
|
|
|
|
|
} else {
|
|
|
|
|
|
e.show = true
|
|
|
|
|
|
if (!active && show !== this.lineRefer) {
|
|
|
|
|
|
this.legendSelectChange(e, 'index')
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (this.lineTab === e.class) {
|
|
|
|
|
|
if (parseFloat(e.analysis.avg) <= 0) {
|
|
|
|
|
|
this.lineTab = ''
|
|
|
|
|
|
this.lineRefer = ''
|
|
|
|
|
|
this.init()
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
this.mpackets = mpackets
|
|
|
|
|
|
if (num === 5) {
|
|
|
|
|
|
mpackets[0].invertTab = false
|
|
|
|
|
|
this.lineTab = 'total'
|
|
|
|
|
|
this.legendSelectChange(mpackets[0], 0)
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.echartsInit(this.mpackets, true)
|
|
|
|
|
|
})
|
|
|
|
|
|
} else {
|
|
|
|
|
|
if (n) this.lineTab = ''
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.echartsInit(this.mpackets, show)
|
|
|
|
|
|
if (!this.lineRefer) this.lineRefer = 'Average'
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2022-11-09 17:23:31 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 鼠标右键返回框选的时间范围
|
|
|
|
|
|
*/
|
|
|
|
|
|
backBrushHistory () {
|
|
|
|
|
|
this.myChart.dispatchAction({
|
|
|
|
|
|
type: 'brush',
|
|
|
|
|
|
areas: [] // 删除选框
|
|
|
|
|
|
})
|
|
|
|
|
|
if (this.brushHistory.length > 0) {
|
|
|
|
|
|
this.$store.commit('setRangeEchartsData', _.cloneDeep(this.brushHistory[0]))
|
|
|
|
|
|
this.brushHistory.shift()
|
|
|
|
|
|
}
|
|
|
|
|
|
this.mouseDownFlag = false
|
2022-07-21 10:19:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
mounted () {
|
2022-11-09 17:23:31 +08:00
|
|
|
|
// todo 初始化鼠标事件,开启右键返回
|
|
|
|
|
|
// this.domInit()
|
2022-11-29 17:21:01 +08:00
|
|
|
|
this.myChart = null
|
|
|
|
|
|
this.chartOption = null
|
2022-07-14 17:07:07 +08:00
|
|
|
|
this.timer = setTimeout(() => {
|
2023-01-10 09:20:26 +08:00
|
|
|
|
if (this.lineTab && this.metric !== 'Sessions/s') {
|
|
|
|
|
|
const data = this.mpackets.find(t => t.class === this.lineTab)
|
2023-01-10 12:25:49 +08:00
|
|
|
|
this.activeChange(data, data.positioning)
|
2022-09-08 18:05:24 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
this.init()
|
|
|
|
|
|
}
|
2022-07-26 17:18:54 +08:00
|
|
|
|
}, 200)
|
2022-07-14 17:15:34 +08:00
|
|
|
|
window.addEventListener('resize', this.resize)
|
2022-07-14 17:07:07 +08:00
|
|
|
|
},
|
|
|
|
|
|
beforeUnmount () {
|
|
|
|
|
|
clearTimeout(this.timer)
|
2022-08-17 10:46:10 +08:00
|
|
|
|
window.removeEventListener('resize', this.resize)
|
2022-11-29 17:21:01 +08:00
|
|
|
|
|
|
|
|
|
|
let myChart = echarts.getInstanceByDom(document.getElementById('overviewLineChart'))
|
|
|
|
|
|
if (myChart) {
|
|
|
|
|
|
echarts.dispose(myChart)
|
|
|
|
|
|
}
|
|
|
|
|
|
this.myChart = null
|
|
|
|
|
|
// 检测时发现该方法占用较大内存,且未被释放
|
|
|
|
|
|
this.unitConvert = null
|
|
|
|
|
|
myChart = null
|
2022-07-08 09:34:09 +08:00
|
|
|
|
}
|
2022-07-06 21:08:12 +08:00
|
|
|
|
}
|
|
|
|
|
|
</script>
|