2022-07-19 10:16:44 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<div class="network-overview-apps">
|
|
|
|
|
|
<div class="line-select-metric">
|
|
|
|
|
|
<span>{{$t('network.metric')}}:</span>
|
|
|
|
|
|
<div class="line-select__operation">
|
|
|
|
|
|
<el-select
|
|
|
|
|
|
size="mini"
|
|
|
|
|
|
v-model="metricFilter"
|
|
|
|
|
|
placeholder=""
|
2022-08-24 09:40:05 +08:00
|
|
|
|
popper-class="common-select"
|
2022-07-21 15:06:24 +08:00
|
|
|
|
:popper-append-to-body="false"
|
2022-08-05 17:50:06 +08:00
|
|
|
|
@change="metricChange"
|
2022-07-19 10:16:44 +08:00
|
|
|
|
>
|
|
|
|
|
|
<el-option v-for="item in metricOptions" :key="item.value" :label="item.label" :value="item.value"></el-option>
|
|
|
|
|
|
</el-select>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="app-cards">
|
2022-07-19 17:53:22 +08:00
|
|
|
|
<div class="app-card" v-for="(app, index) in appData" :key="index">
|
|
|
|
|
|
<div class="app-card-title">
|
|
|
|
|
|
<div class="app-card-title-name">
|
2022-07-26 13:54:09 +08:00
|
|
|
|
<i class="cn-icon" :class="app.type === 'provider' ? 'cn-icon-entity' : 'cn-icon-app2'"></i>
|
2022-08-30 16:45:13 +08:00
|
|
|
|
<span @click="drillDownData(app.type,app.name)">{{app.name}}</span>
|
2022-07-19 17:53:22 +08:00
|
|
|
|
</div>
|
2022-08-03 20:13:33 +08:00
|
|
|
|
<div class="app-card-title-more" v-ele-click-outside="clickOutSide">
|
2022-07-26 13:54:09 +08:00
|
|
|
|
<span><i class="cn-icon cn-icon-more-dark" @click="moreChange(app)"></i></span>
|
2022-08-08 22:31:08 +08:00
|
|
|
|
<span class="app-card-title-more-delete" @click="del(app, index)" v-show="app.moreOptions"><i class="cn-icon cn-icon-delete"></i>{{$t('overall.delete')}}</span>
|
2022-07-26 11:20:29 +08:00
|
|
|
|
</div>
|
2022-07-19 17:53:22 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="app-card__bodys">
|
|
|
|
|
|
<div class="app-card__body">
|
|
|
|
|
|
<div class="app-card__body-content">
|
|
|
|
|
|
<div class="app-card__body-content-value">
|
2022-08-05 17:50:06 +08:00
|
|
|
|
<div class="app-card__body-content-number">{{unitConvert(app.rate, unitTypes.number).join(' ')}}</div>
|
2022-08-10 15:31:34 +08:00
|
|
|
|
<div class="app-card__body-content-percent red" v-if="app.value > 0">
|
|
|
|
|
|
+{{unitConvert(app.value, unitTypes.percent).join('')}}
|
2022-07-19 17:53:22 +08:00
|
|
|
|
</div>
|
2022-08-10 15:31:34 +08:00
|
|
|
|
<div class="app-card__body-content-percent green" v-else-if="app.value < 0">
|
|
|
|
|
|
-{{unitConvert(app.value, unitTypes.percent).join('').replaceAll('-', '')}}
|
|
|
|
|
|
</div>
|
2022-08-16 09:48:16 +08:00
|
|
|
|
<div v-else-if="app.value === '-' || app.value === 0" class="app-card__body-content-percent">0</div>
|
2022-07-19 17:53:22 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="app-card__body-previous">
|
2022-07-26 13:54:09 +08:00
|
|
|
|
<div>Total</div>
|
2022-08-05 17:50:06 +08:00
|
|
|
|
<div>{{unitConvert(app.total, unitTypes.number).join(' ')}}</div>
|
2022-07-19 17:53:22 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2022-07-26 13:54:09 +08:00
|
|
|
|
<div class="chart__drawing" :id="`chart-${app.name}-${app.type}`"></div>
|
2022-07-19 17:53:22 +08:00
|
|
|
|
</div>
|
2022-07-19 10:16:44 +08:00
|
|
|
|
</div>
|
2022-07-21 15:06:19 +08:00
|
|
|
|
<div class="app-card app-card--create">
|
|
|
|
|
|
<i class="cn-icon cn-icon-add1" @click="addApp"></i>
|
|
|
|
|
|
<span @click="addApp">{{$t('overall.add')}}</span>
|
|
|
|
|
|
</div>
|
2022-07-19 10:16:44 +08:00
|
|
|
|
</div>
|
2022-07-21 15:06:19 +08:00
|
|
|
|
<el-drawer
|
|
|
|
|
|
v-model="showAddApp"
|
|
|
|
|
|
direction="btt"
|
|
|
|
|
|
custom-class="add-app-drawer"
|
|
|
|
|
|
:with-header="false"
|
|
|
|
|
|
:show-close="false"
|
|
|
|
|
|
>
|
|
|
|
|
|
<div class="add-app">
|
|
|
|
|
|
<div class="add-app__header">
|
|
|
|
|
|
<div class="header__title">{{$t('overall.add')}}</div>
|
|
|
|
|
|
<div class="header__operations">
|
2022-07-21 18:23:33 +08:00
|
|
|
|
<div class="header__operation header__operation--cancel" @click="cancelApp">{{$t('overall.cancel')}}</div>
|
2022-07-26 13:54:09 +08:00
|
|
|
|
<div class="header__operation header__operation--save" @click="save">{{$t('overall.save')}}</div>
|
2022-07-21 15:06:19 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="add-app__body">
|
2022-07-21 18:23:33 +08:00
|
|
|
|
<el-tabs v-model="appTypeTab" @tab-click="appTypeTabChange">
|
2022-07-21 15:06:19 +08:00
|
|
|
|
<el-tab-pane :label="$t('networkOverview.appType.provider')" :name="0">
|
2022-08-18 16:19:19 +08:00
|
|
|
|
<div class="body__apps" :class="{'body__apps-no-grid': providerOptions.length === 0}">
|
2022-08-23 17:16:54 +08:00
|
|
|
|
<loading :loading="loadingBody"></loading>
|
|
|
|
|
|
<chart-no-data v-if="providerOptions.length === 0 && !loadingBody"></chart-no-data>
|
2022-08-18 16:19:19 +08:00
|
|
|
|
<div class="body__app" v-else :class="{'provide-show': app.provideShow}" v-for="(app, index) in providerOptions" :key="index" @click="appCheckedChange(app, 0)">
|
2022-07-21 19:24:55 +08:00
|
|
|
|
<div class="body__app-content">
|
|
|
|
|
|
<div class="body__app-left">
|
2022-08-18 16:19:19 +08:00
|
|
|
|
<span><i class="cn-icon" :class="app.icon"></i></span>
|
|
|
|
|
|
<span class="body__app-left-title">{{app.value}}</span>
|
2022-07-21 18:23:33 +08:00
|
|
|
|
</div>
|
2022-07-21 19:24:55 +08:00
|
|
|
|
<div class="body__app-content-right" v-if="app.provideShow"><span><i class="cn-icon cn-icon-a-allclear"></i></span></div>
|
2022-07-21 18:23:33 +08:00
|
|
|
|
</div>
|
2022-08-18 16:19:19 +08:00
|
|
|
|
<div class="body__app-value" v-if="app.remark" :title="app.remark">{{app.remark}}</div>
|
|
|
|
|
|
<div v-else>-</div>
|
2022-07-21 18:23:33 +08:00
|
|
|
|
</div>
|
2022-07-21 15:06:19 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</el-tab-pane>
|
|
|
|
|
|
<el-tab-pane :label="$t('networkOverview.appType.app')" :name="1">
|
2022-08-18 16:19:19 +08:00
|
|
|
|
<div class="body__apps" :class="{'body__apps-no-grid': appOptions.length === 0}">
|
2022-08-23 17:16:54 +08:00
|
|
|
|
<loading :loading="loadingBody"></loading>
|
|
|
|
|
|
<chart-no-data v-if="appOptions.length === 0 && !loadingBody"></chart-no-data>
|
2022-08-18 16:19:19 +08:00
|
|
|
|
<div class="body__app" v-else :class="{'app-show': app.appShow}" v-for="(app, index) in appOptions" :key="index" @click="appCheckedChange(app, 1)">
|
2022-07-21 19:24:55 +08:00
|
|
|
|
<div class="body__app-content">
|
|
|
|
|
|
<div class="body__app-left">
|
2022-08-18 16:19:19 +08:00
|
|
|
|
<span><i class="cn-icon" :class="app.icon"></i></span>
|
|
|
|
|
|
<span class="body__app-left-title">{{app.value}}</span>
|
2022-07-21 18:23:33 +08:00
|
|
|
|
</div>
|
2022-07-21 19:24:55 +08:00
|
|
|
|
<div class="body__app-content-right" v-if="app.appShow"><span><i class="cn-icon cn-icon-a-allclear"></i></span></div>
|
2022-07-21 18:23:33 +08:00
|
|
|
|
</div>
|
2022-08-18 16:19:19 +08:00
|
|
|
|
<div class="body__app-value" v-if="app.remark" :title="app.remark">{{app.remark}}</div>
|
|
|
|
|
|
<div v-else>-</div>
|
2022-07-21 18:23:33 +08:00
|
|
|
|
</div>
|
2022-07-21 15:06:19 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</el-tab-pane>
|
|
|
|
|
|
</el-tabs>
|
|
|
|
|
|
<div class="body__searcher">
|
2022-07-26 13:54:09 +08:00
|
|
|
|
<el-input v-model="searcherApp" @input="searcherAppChange" size="mini" :placeholder="$t('networkOverview.search')" prefix-icon="el-icon-search"></el-input>
|
2022-07-21 15:06:19 +08:00
|
|
|
|
</div>
|
2022-08-20 14:52:55 +08:00
|
|
|
|
<div class="body__loading"><loading :loading="loading"></loading></div>
|
2022-07-21 15:06:19 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</el-drawer>
|
2022-07-19 10:16:44 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
2022-07-19 17:53:22 +08:00
|
|
|
|
import unitConvert from '@/utils/unit-convert'
|
2022-08-30 16:45:13 +08:00
|
|
|
|
import { storageKey, unitTypes, networkTable, operationType } from '@/utils/constants'
|
2022-07-19 17:53:22 +08:00
|
|
|
|
import * as echarts from 'echarts'
|
2022-08-30 16:45:13 +08:00
|
|
|
|
import { appListChartOption } from '@/views/charts2/charts/options/echartOption'
|
2022-09-07 20:17:38 +08:00
|
|
|
|
import { ref, shallowRef } from 'vue'
|
2022-08-30 16:45:13 +08:00
|
|
|
|
import { get, put } from '@/utils/http'
|
|
|
|
|
|
import { api } from '@/utils/api'
|
2022-07-26 13:54:09 +08:00
|
|
|
|
import _ from 'lodash'
|
2022-08-30 16:45:13 +08:00
|
|
|
|
import { getSecond } from '@/utils/date-util'
|
|
|
|
|
|
import { getChainRatio } from '@/utils/tools'
|
2022-08-18 16:19:19 +08:00
|
|
|
|
import loading from '@/components/common/Loading'
|
|
|
|
|
|
import ChartNoData from '@/views/charts/charts/ChartNoData'
|
2022-08-30 16:45:13 +08:00
|
|
|
|
import { appStackedLineTooltipFormatter } from '@/views/charts/charts/tools'
|
2022-08-21 22:11:53 +08:00
|
|
|
|
import chartMixin from '@/views/charts2/chart-mixin'
|
2022-09-07 20:17:38 +08:00
|
|
|
|
import { useRoute } from 'vue-router'
|
2022-08-23 21:42:42 +08:00
|
|
|
|
|
2022-07-19 10:16:44 +08:00
|
|
|
|
export default {
|
|
|
|
|
|
name: 'NetworkOverviewApps',
|
2022-08-18 16:19:19 +08:00
|
|
|
|
components: {
|
|
|
|
|
|
loading,
|
|
|
|
|
|
ChartNoData
|
|
|
|
|
|
},
|
2022-08-21 22:11:53 +08:00
|
|
|
|
mixins: [chartMixin],
|
2022-07-19 17:53:22 +08:00
|
|
|
|
setup () {
|
2022-09-07 20:17:38 +08:00
|
|
|
|
const { query } = useRoute()
|
|
|
|
|
|
const metricFilter = ref(query.appListMetric || 'Bits/s')
|
2022-07-19 17:53:22 +08:00
|
|
|
|
return {
|
2022-09-07 20:17:38 +08:00
|
|
|
|
metricFilter,
|
2022-07-21 18:23:33 +08:00
|
|
|
|
myChart: shallowRef([])
|
2022-07-19 17:53:22 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2022-07-19 10:16:44 +08:00
|
|
|
|
data () {
|
|
|
|
|
|
return {
|
2022-08-04 12:03:15 +08:00
|
|
|
|
metricOptions: [
|
|
|
|
|
|
{
|
|
|
|
|
|
value: 'Bits/s',
|
|
|
|
|
|
label: 'Bits/s'
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
value: 'Packets/s',
|
|
|
|
|
|
label: 'Packets/s'
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
value: 'Sessions/s',
|
|
|
|
|
|
label: 'Sessions/s'
|
|
|
|
|
|
}
|
|
|
|
|
|
],
|
2022-07-21 15:06:19 +08:00
|
|
|
|
appData: [],
|
|
|
|
|
|
// 假数据
|
2022-08-05 17:50:06 +08:00
|
|
|
|
appTempData: [],
|
2022-07-19 17:53:22 +08:00
|
|
|
|
unitTypes,
|
|
|
|
|
|
timer: null,
|
2022-07-21 15:06:19 +08:00
|
|
|
|
showAddApp: false,
|
|
|
|
|
|
// add弹框中的可选项
|
|
|
|
|
|
providerOptions: [],
|
|
|
|
|
|
appOptions: [],
|
2022-07-21 18:23:33 +08:00
|
|
|
|
appTypeTab: 0,
|
|
|
|
|
|
searcherApp: '',
|
2022-07-26 13:54:09 +08:00
|
|
|
|
// 选中的app,不区分app和provider
|
|
|
|
|
|
toSaveApp: [],
|
2022-08-18 16:19:19 +08:00
|
|
|
|
appShowType: 'bytes',
|
|
|
|
|
|
pageObj: { // 分页对象
|
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
|
pageSize: 24,
|
|
|
|
|
|
pages: 0
|
|
|
|
|
|
},
|
|
|
|
|
|
loading: false,
|
|
|
|
|
|
timerScroll: null,
|
|
|
|
|
|
offset: 0,
|
|
|
|
|
|
flag: false,
|
2022-08-20 14:52:55 +08:00
|
|
|
|
timerSearc: null,
|
2022-08-23 17:16:54 +08:00
|
|
|
|
loadingBody: false
|
2022-08-18 16:19:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
watch: {
|
|
|
|
|
|
showAddApp: {
|
|
|
|
|
|
deep: true,
|
|
|
|
|
|
handler (n) {
|
2022-08-20 14:52:55 +08:00
|
|
|
|
this.searcherApp = ''
|
2022-08-18 16:19:19 +08:00
|
|
|
|
if (n) {
|
|
|
|
|
|
window.addEventListener('scroll', this.handleScroll, true)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
window.removeEventListener('scroll', this.handleScroll, true)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-08-23 21:42:42 +08:00
|
|
|
|
},
|
|
|
|
|
|
timeFilter: {
|
|
|
|
|
|
deep: true,
|
|
|
|
|
|
handler (n) {
|
|
|
|
|
|
this.init()
|
|
|
|
|
|
}
|
2022-07-19 17:53:22 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
2022-07-21 15:06:19 +08:00
|
|
|
|
unitConvert,
|
2022-08-03 20:13:33 +08:00
|
|
|
|
clickOutSide () {
|
|
|
|
|
|
this.appData.forEach(t => {
|
2022-08-08 22:31:08 +08:00
|
|
|
|
t.moreOptions = false
|
2022-08-03 20:13:33 +08:00
|
|
|
|
})
|
|
|
|
|
|
},
|
2022-07-21 15:06:19 +08:00
|
|
|
|
init () {
|
2022-08-08 22:31:08 +08:00
|
|
|
|
const appCards = []
|
|
|
|
|
|
const providerCards = []
|
|
|
|
|
|
this.appData.forEach(d => {
|
|
|
|
|
|
if (d.type === 'app') {
|
|
|
|
|
|
appCards.push(d)
|
|
|
|
|
|
} else if (d.type === 'provider') {
|
|
|
|
|
|
providerCards.push(d)
|
2022-08-05 17:50:06 +08:00
|
|
|
|
}
|
2022-07-21 15:06:19 +08:00
|
|
|
|
})
|
2022-08-08 22:31:08 +08:00
|
|
|
|
let prevRequest
|
|
|
|
|
|
let request
|
|
|
|
|
|
let params
|
|
|
|
|
|
if (appCards.length > 0) {
|
|
|
|
|
|
params = {
|
2022-08-05 17:50:06 +08:00
|
|
|
|
startTime: getSecond(this.timeFilter.startTime),
|
|
|
|
|
|
endTime: getSecond(this.timeFilter.endTime),
|
2022-08-08 22:31:08 +08:00
|
|
|
|
appLabels: appCards.map(item => {
|
|
|
|
|
|
return item.name
|
|
|
|
|
|
}).join(',')
|
2022-08-05 17:50:06 +08:00
|
|
|
|
}
|
2022-08-08 22:31:08 +08:00
|
|
|
|
prevRequest = get(api.netWorkOverview.applicationCycleTrafficTotal, params)
|
|
|
|
|
|
request = get(api.netWorkOverview.applicationTrafficAnalysis, params)
|
|
|
|
|
|
this.handleData(prevRequest, request, 'app')
|
2022-08-05 17:50:06 +08:00
|
|
|
|
}
|
2022-08-08 22:31:08 +08:00
|
|
|
|
if (providerCards.length > 0) {
|
|
|
|
|
|
params = {
|
2022-08-05 17:50:06 +08:00
|
|
|
|
startTime: getSecond(this.timeFilter.startTime),
|
|
|
|
|
|
endTime: getSecond(this.timeFilter.endTime),
|
2022-08-09 21:19:21 +08:00
|
|
|
|
appCompanies: providerCards.map(item => {
|
2022-08-08 22:31:08 +08:00
|
|
|
|
return item.name
|
|
|
|
|
|
}).join(',')
|
2022-08-05 17:50:06 +08:00
|
|
|
|
}
|
2022-08-08 22:31:08 +08:00
|
|
|
|
prevRequest = get(api.netWorkOverview.appCompanyCycleTrafficTotal, params)
|
|
|
|
|
|
request = get(api.netWorkOverview.appCompanyTrafficAnalysis, params)
|
|
|
|
|
|
this.handleData(prevRequest, request, 'provider')
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
handleData (prevRequest, request, _t) {
|
2022-08-22 19:54:41 +08:00
|
|
|
|
this.toggleLoading(true)
|
2022-08-08 22:31:08 +08:00
|
|
|
|
Promise.all([prevRequest, request]).then(res => {
|
2022-08-09 21:19:21 +08:00
|
|
|
|
if (res[0].code === 200 && res[1].code === 200) {
|
|
|
|
|
|
const prevData = res[0].data.result
|
|
|
|
|
|
const data = res[1].data.result
|
2022-08-08 22:31:08 +08:00
|
|
|
|
let toCompareType = 'bytes'
|
|
|
|
|
|
if (this.metricFilter === 'Sessions/s') {
|
|
|
|
|
|
toCompareType = 'sessions'
|
|
|
|
|
|
} else if (this.metricFilter === 'Packets/s') {
|
|
|
|
|
|
toCompareType = 'packets'
|
2022-08-05 17:50:06 +08:00
|
|
|
|
}
|
2022-08-08 22:31:08 +08:00
|
|
|
|
data.forEach(d => {
|
|
|
|
|
|
if (d.type === toCompareType) {
|
|
|
|
|
|
const prevTypeData = prevData.find(p => p.type === toCompareType)
|
|
|
|
|
|
Object.keys(d).forEach(app => {
|
|
|
|
|
|
if (app !== 'type') {
|
|
|
|
|
|
this.appData.forEach(d2 => {
|
|
|
|
|
|
if (d2.type === _t && d2.name === app) {
|
|
|
|
|
|
d2.rate = d[app].analysis.rate
|
|
|
|
|
|
d2.pRate = prevTypeData ? (prevTypeData[app] ? prevTypeData[app].rate : 0) : 0
|
|
|
|
|
|
d2.total = d[app].analysis.total
|
|
|
|
|
|
d2.lineData = d[app].values.map(v => [Number(v[0]), Number(v[1]), 'time'])
|
2022-08-10 15:31:34 +08:00
|
|
|
|
d2.value = getChainRatio(d2.rate, d2.pRate)
|
2022-08-08 22:31:08 +08:00
|
|
|
|
this.initChart(d2)
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2022-08-05 17:50:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
2022-08-08 22:31:08 +08:00
|
|
|
|
}
|
2022-08-22 15:49:38 +08:00
|
|
|
|
}).finally(() => {
|
|
|
|
|
|
this.toggleLoading(false)
|
2022-08-08 22:31:08 +08:00
|
|
|
|
})
|
2022-08-05 17:50:06 +08:00
|
|
|
|
},
|
|
|
|
|
|
metricChange (value) {
|
|
|
|
|
|
if (value === 'Bits/s') {
|
|
|
|
|
|
this.appShowType = 'bytes'
|
|
|
|
|
|
} else if (value === 'Packets/s') {
|
|
|
|
|
|
this.appShowType = 'packets'
|
|
|
|
|
|
} else if (value === 'Sessions/s') {
|
|
|
|
|
|
this.appShowType = 'sessions'
|
|
|
|
|
|
}
|
|
|
|
|
|
this.init()
|
2022-07-21 15:06:19 +08:00
|
|
|
|
},
|
2022-08-30 16:45:13 +08:00
|
|
|
|
drillDownData (type, value) {
|
|
|
|
|
|
let tabType = ''
|
|
|
|
|
|
if (type === 'provider') {
|
|
|
|
|
|
tabType = 'network.providers'
|
|
|
|
|
|
} else if (type === 'app') {
|
|
|
|
|
|
tabType = 'network.applications'
|
|
|
|
|
|
}
|
|
|
|
|
|
if (tabType) {
|
|
|
|
|
|
const oldCurTab = this.$store.getters.getNetworkOverviewBeforeTab
|
|
|
|
|
|
const curTable = networkTable.networkOverview
|
|
|
|
|
|
const list = this.$store.getters.getNetworkOverviewTabList
|
|
|
|
|
|
const tabGroup = list.filter(item => item.label === tabType)
|
|
|
|
|
|
if (tabGroup && tabGroup.length > 0) {
|
|
|
|
|
|
this.$store.commit('setNetworkOverviewBeforeTab', tabGroup[0])
|
|
|
|
|
|
}
|
|
|
|
|
|
this.$store.commit('setTabOperationBeforeType', this.$store.getters.getTabOperationType)
|
|
|
|
|
|
this.$store.commit('setTabOperationType', operationType.fourthMenu)
|
|
|
|
|
|
|
|
|
|
|
|
const queryCondition = []
|
|
|
|
|
|
const searchProps = tabGroup[0].dillDownProp
|
|
|
|
|
|
searchProps.forEach(item => {
|
|
|
|
|
|
queryCondition.push(item + "='" + value + "'")
|
|
|
|
|
|
})
|
|
|
|
|
|
this.$store.commit('setQueryCondition', queryCondition.join(' OR '))
|
|
|
|
|
|
|
|
|
|
|
|
this.$store.getters.menuList.forEach(menu => {
|
|
|
|
|
|
if (this.$_.isEmpty(menu.children) && menu.route) {
|
|
|
|
|
|
if (this.$route.path === menu.route) {
|
|
|
|
|
|
menu.columnName = tabType
|
|
|
|
|
|
menu.columnValue = value
|
|
|
|
|
|
this.$store.commit('setPanelName', value)
|
|
|
|
|
|
this.$store.commit('setBreadcrumbColumnName', tabType)
|
|
|
|
|
|
this.$store.commit('setDimensionType', tabGroup[0] ? tabGroup[0].prop : '')
|
|
|
|
|
|
this.$store.commit('setBreadcrumbColumnValue', value)
|
|
|
|
|
|
}
|
|
|
|
|
|
} else if (!this.$_.isEmpty(menu.children)) {
|
|
|
|
|
|
menu.children.forEach(child => {
|
|
|
|
|
|
if (this.$route.path === child.route) {
|
|
|
|
|
|
child.columnName = tabType
|
|
|
|
|
|
child.columnValue = value
|
|
|
|
|
|
this.$store.commit('setPanelName', value)
|
|
|
|
|
|
this.$store.commit('setBreadcrumbColumnName', tabType)
|
|
|
|
|
|
this.$store.commit('setDimensionType', tabGroup[0] ? tabGroup[0].prop : '')
|
|
|
|
|
|
this.$store.commit('setBreadcrumbColumnValue', value)
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
let toPanel = null
|
|
|
|
|
|
list.forEach((item, index) => {
|
|
|
|
|
|
if (item.label === tabType) {
|
|
|
|
|
|
item.checked = false
|
|
|
|
|
|
toPanel = item.panelId
|
|
|
|
|
|
}
|
|
|
|
|
|
if (oldCurTab && (item.label === oldCurTab.label)) {
|
|
|
|
|
|
item.checked = true
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
this.$store.commit('setNetworkOverviewTabList', list)
|
|
|
|
|
|
const tabObjGroup = list.filter(item => item.checked)
|
|
|
|
|
|
if (tabObjGroup && tabObjGroup.length > 0) {
|
|
|
|
|
|
const curTab = tabObjGroup[0]
|
|
|
|
|
|
this.$store.commit('setNetworkOverviewCurrentTab', curTab)
|
|
|
|
|
|
}
|
|
|
|
|
|
this.$router.push({
|
|
|
|
|
|
params: {
|
|
|
|
|
|
thirdPanel: curTable.panelIdOfThirdMenu ? curTable.panelIdOfThirdMenu : '',
|
|
|
|
|
|
fourthPanel: toPanel || ''
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2022-07-21 15:06:19 +08:00
|
|
|
|
initChart (obj) {
|
2022-07-26 13:54:09 +08:00
|
|
|
|
let chart = this.myChart.find(m => m.name === obj.name && m.type === obj.type)
|
|
|
|
|
|
if (!chart) {
|
|
|
|
|
|
chart = echarts.init(document.getElementById(`chart-${obj.name}-${obj.type}`))
|
|
|
|
|
|
const chartOption = _.cloneDeep(appListChartOption)
|
|
|
|
|
|
chartOption.series = [{
|
|
|
|
|
|
...chartOption.series[0],
|
2022-08-20 14:52:55 +08:00
|
|
|
|
data: obj.lineData.map(v => [Number(v[0]) * 1000, Number(v[1]), 'number']),
|
2022-07-26 10:24:38 +08:00
|
|
|
|
lineStyle: {
|
|
|
|
|
|
color: obj.trend === 'up' ? '#7FA054' : '#35ADDA'
|
|
|
|
|
|
},
|
|
|
|
|
|
areaStyle: {
|
|
|
|
|
|
opacity: 0.1,
|
|
|
|
|
|
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
|
|
|
|
{
|
|
|
|
|
|
offset: 0,
|
|
|
|
|
|
color: obj.trend === 'up' ? '#7FA054' : '#35ADDA'
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
offset: 1,
|
|
|
|
|
|
color: obj.trend === 'up' ? '#7FA054' : '#35ADDA'
|
|
|
|
|
|
}
|
|
|
|
|
|
])
|
|
|
|
|
|
}
|
2022-07-26 13:54:09 +08:00
|
|
|
|
}]
|
2022-08-20 14:52:55 +08:00
|
|
|
|
chartOption.tooltip.formatter = (params) => {
|
|
|
|
|
|
params.forEach(t => {
|
|
|
|
|
|
t.seriesName = this.$t(t.seriesName)
|
|
|
|
|
|
})
|
2022-08-23 21:42:42 +08:00
|
|
|
|
return appStackedLineTooltipFormatter(params)
|
2022-08-20 14:52:55 +08:00
|
|
|
|
}
|
2022-07-26 13:54:09 +08:00
|
|
|
|
chart.setOption(chartOption)
|
|
|
|
|
|
this.myChart.push(chart)
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
chart.resize()
|
|
|
|
|
|
})
|
2022-07-26 10:24:38 +08:00
|
|
|
|
}
|
2022-07-19 17:53:22 +08:00
|
|
|
|
},
|
2022-08-18 16:19:19 +08:00
|
|
|
|
handleScroll (e) {
|
|
|
|
|
|
const clientHeight = e.target.clientHeight
|
|
|
|
|
|
const scrollTop = e.target.scrollTop
|
|
|
|
|
|
const scrollHeight = e.target.scrollHeight
|
|
|
|
|
|
if (scrollTop && (clientHeight + scrollTop) >= scrollHeight) {
|
|
|
|
|
|
if (this.pageObj.pages > this.pageObj.pageNo) {
|
|
|
|
|
|
this.loading = true
|
2022-08-20 14:52:55 +08:00
|
|
|
|
this.pageObj.pageNo = this.pageObj.pageNo + 1
|
|
|
|
|
|
this.addApp(this.pageObj.pageNo, this.searcherApp, this.loading)
|
2022-08-18 16:19:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2022-08-20 14:52:55 +08:00
|
|
|
|
addApp (pageNo, val, show) {
|
2022-07-21 15:06:19 +08:00
|
|
|
|
this.showAddApp = true
|
|
|
|
|
|
const letter = 'abcdefghijklmnopqrstuvwxyz'
|
2022-08-18 16:19:19 +08:00
|
|
|
|
const params = {
|
|
|
|
|
|
startTime: getSecond(this.timeFilter.startTime),
|
|
|
|
|
|
endTime: getSecond(this.timeFilter.endTime),
|
|
|
|
|
|
pageSize: this.pageObj.pageSize,
|
2022-08-20 14:52:55 +08:00
|
|
|
|
q: ''
|
|
|
|
|
|
}
|
|
|
|
|
|
if (val && show) { // 搜索有值 并且 true
|
|
|
|
|
|
params.q = val
|
|
|
|
|
|
params.pageNo = pageNo
|
|
|
|
|
|
} else if (!val && show) { // 搜索无值 并且 true
|
|
|
|
|
|
val = ''
|
|
|
|
|
|
params.pageNo = pageNo
|
|
|
|
|
|
} else if (val && !show) { // 搜索有值 并且 false
|
|
|
|
|
|
params.q = val
|
|
|
|
|
|
params.pageNo = 1
|
|
|
|
|
|
} else {
|
|
|
|
|
|
params.pageNo = 1
|
2022-08-18 16:19:19 +08:00
|
|
|
|
}
|
2022-08-20 14:52:55 +08:00
|
|
|
|
if (this.appTypeTab == 0) {
|
2022-08-18 16:19:19 +08:00
|
|
|
|
params.type = 'overviewProvide'
|
|
|
|
|
|
get(api.dict, params).then(res => {
|
|
|
|
|
|
if (res.code === 200) {
|
2022-08-24 16:40:03 +08:00
|
|
|
|
res.data.list = res.data.list.filter(l => !this.appData.some(pd => pd.type === 'provider' && pd.name === l.value))
|
2022-08-18 16:19:19 +08:00
|
|
|
|
this.pageObj.pages = res.data.pages
|
2022-08-20 14:52:55 +08:00
|
|
|
|
res.data.list.forEach(t => {
|
|
|
|
|
|
this.toSaveApp.forEach(e => {
|
|
|
|
|
|
if (t.value === e.name) {
|
|
|
|
|
|
t.provideShow = e.provideShow
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
})
|
2022-08-23 17:16:54 +08:00
|
|
|
|
if (val) {
|
|
|
|
|
|
this.providerOptions = res.data.list
|
|
|
|
|
|
} else if (!val && !show) {
|
2022-08-20 14:52:55 +08:00
|
|
|
|
this.providerOptions = res.data.list
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.providerOptions.push(...res.data.list)
|
|
|
|
|
|
this.appListData([], this.providerOptions)
|
|
|
|
|
|
}
|
2022-08-18 16:19:19 +08:00
|
|
|
|
}
|
2022-08-20 14:52:55 +08:00
|
|
|
|
this.loading = false
|
2022-08-23 17:16:54 +08:00
|
|
|
|
this.loadingBody = false
|
2022-07-21 15:06:19 +08:00
|
|
|
|
})
|
2022-08-20 14:52:55 +08:00
|
|
|
|
} else if (this.appTypeTab == 1) {
|
2022-08-18 16:19:19 +08:00
|
|
|
|
params.type = 'overviewApp'
|
|
|
|
|
|
get(api.dict, params).then(res => {
|
2022-08-24 16:40:03 +08:00
|
|
|
|
res.data.list = res.data.list.filter(l => !this.appData.some(pd => pd.type === 'app' && pd.name === l.value))
|
2022-08-18 16:19:19 +08:00
|
|
|
|
if (res.code === 200) {
|
|
|
|
|
|
this.pageObj.pages = res.data.pages
|
2022-08-20 14:52:55 +08:00
|
|
|
|
res.data.list.forEach(t => {
|
|
|
|
|
|
this.toSaveApp.forEach(e => {
|
|
|
|
|
|
if (t.value === e.name) {
|
|
|
|
|
|
t.appShow = e.appShow
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
})
|
2022-08-23 17:16:54 +08:00
|
|
|
|
if (val) {
|
|
|
|
|
|
this.appOptions = res.data.list
|
|
|
|
|
|
} else if (!val && !show) {
|
2022-08-20 14:52:55 +08:00
|
|
|
|
this.appOptions = res.data.list
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.appOptions.push(...res.data.list)
|
|
|
|
|
|
this.appListData(this.appOptions, [])
|
|
|
|
|
|
}
|
2022-08-18 16:19:19 +08:00
|
|
|
|
}
|
2022-08-20 14:52:55 +08:00
|
|
|
|
this.loading = false
|
2022-08-23 17:16:54 +08:00
|
|
|
|
this.loadingBody = false
|
2022-07-21 18:23:33 +08:00
|
|
|
|
})
|
|
|
|
|
|
}
|
2022-08-18 16:19:19 +08:00
|
|
|
|
},
|
|
|
|
|
|
appListData (appOptions, providerOptions) {
|
2022-08-04 12:03:15 +08:00
|
|
|
|
const oldApps = this.appData ? this.appData.filter(a => a.type === 'app') : []
|
|
|
|
|
|
const oldProviders = this.appData ? this.appData.filter(a => a.type === 'provider') : []
|
2022-07-26 13:54:09 +08:00
|
|
|
|
this.appOptions = appOptions.filter(a => {
|
2022-08-18 16:19:19 +08:00
|
|
|
|
return !oldApps.some(o => o.name === a.value)
|
2022-07-26 13:54:09 +08:00
|
|
|
|
})
|
|
|
|
|
|
this.providerOptions = providerOptions.filter(a => {
|
2022-08-18 16:19:19 +08:00
|
|
|
|
return !oldProviders.some(o => o.name === a.value)
|
2022-07-26 13:54:09 +08:00
|
|
|
|
})
|
2022-07-21 18:23:33 +08:00
|
|
|
|
},
|
|
|
|
|
|
cancelApp () {
|
|
|
|
|
|
this.showAddApp = false
|
|
|
|
|
|
},
|
2022-07-22 18:10:42 +08:00
|
|
|
|
appTypeTabChange (val) {
|
2022-08-20 14:52:55 +08:00
|
|
|
|
this.pageObj.pageNo = 1
|
2022-07-21 18:52:15 +08:00
|
|
|
|
this.searcherApp = ''
|
2022-08-20 14:52:55 +08:00
|
|
|
|
this.addApp()
|
2022-08-23 17:16:54 +08:00
|
|
|
|
this.loadingBody = true
|
2022-08-18 16:19:19 +08:00
|
|
|
|
window.addEventListener('scroll', this.scrollChange, true)
|
|
|
|
|
|
this.timerScroll = setTimeout(() => {
|
|
|
|
|
|
window.removeEventListener('scroll', this.scrollChange, true)
|
2022-08-20 14:52:55 +08:00
|
|
|
|
}, 500)
|
2022-08-18 16:19:19 +08:00
|
|
|
|
},
|
|
|
|
|
|
scrollChange (e) {
|
|
|
|
|
|
e.target.scrollTop = 0
|
2022-07-21 18:23:33 +08:00
|
|
|
|
},
|
|
|
|
|
|
searcherAppChange (val) {
|
2022-08-18 16:19:19 +08:00
|
|
|
|
clearTimeout(this.timerSearc)
|
2022-08-20 14:52:55 +08:00
|
|
|
|
window.addEventListener('scroll', this.scrollChange, true)
|
2022-08-18 16:19:19 +08:00
|
|
|
|
this.timerSearc = setTimeout(() => {
|
|
|
|
|
|
if (this.flag) {
|
|
|
|
|
|
return false
|
|
|
|
|
|
}
|
|
|
|
|
|
this.flag = true
|
2022-08-20 14:52:55 +08:00
|
|
|
|
this.pageObj.pageNo = 1
|
|
|
|
|
|
this.searcherApp = val
|
|
|
|
|
|
this.addApp(this.pageObj.pageNo, val)
|
2022-08-18 16:19:19 +08:00
|
|
|
|
this.flag = false
|
2022-08-20 14:52:55 +08:00
|
|
|
|
window.removeEventListener('scroll', this.scrollChange, true)
|
2022-08-18 16:19:19 +08:00
|
|
|
|
}, 500)
|
2022-07-21 18:23:33 +08:00
|
|
|
|
},
|
2022-07-26 13:54:09 +08:00
|
|
|
|
// 保存变更,并且在增、删app后,根据当前app数量更改整体高度
|
2022-08-04 12:03:15 +08:00
|
|
|
|
saveChart (toSaveChart) {
|
2022-07-26 13:54:09 +08:00
|
|
|
|
return new Promise(resolve => {
|
|
|
|
|
|
put(api.chart, toSaveChart).then(res => {
|
|
|
|
|
|
if (res.code === 200) {
|
|
|
|
|
|
this.emitter.emit('reloadChartList')
|
|
|
|
|
|
resolve()
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
del (app, index) {
|
|
|
|
|
|
const appData = _.cloneDeep(this.appData)
|
|
|
|
|
|
appData.splice(index, 1)
|
2022-08-04 12:03:15 +08:00
|
|
|
|
const toSaveParams = this.chart.params.app ? this.chart.params : { app: [] }
|
|
|
|
|
|
if (toSaveParams.app.some(p => p.user === parseInt(localStorage.getItem(storageKey.userId)))) {
|
|
|
|
|
|
toSaveParams.app.forEach(p => {
|
|
|
|
|
|
if (p.user === parseInt(localStorage.getItem(storageKey.userId))) {
|
|
|
|
|
|
p.list = appData.map(p => {
|
|
|
|
|
|
return {
|
|
|
|
|
|
type: p.type,
|
|
|
|
|
|
name: p.name
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
} else {
|
|
|
|
|
|
toSaveParams.app.push({
|
|
|
|
|
|
user: parseInt(localStorage.getItem(storageKey.userId)),
|
|
|
|
|
|
list: appData.map(p => {
|
|
|
|
|
|
return {
|
|
|
|
|
|
type: p.type,
|
|
|
|
|
|
name: p.name
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2022-07-26 13:54:09 +08:00
|
|
|
|
const toSaveChart = {
|
|
|
|
|
|
...this.chart,
|
2022-08-04 12:03:15 +08:00
|
|
|
|
params: JSON.stringify(toSaveParams)
|
2022-07-26 13:54:09 +08:00
|
|
|
|
}
|
2022-08-04 12:03:15 +08:00
|
|
|
|
this.saveChart(toSaveChart).then(res => {
|
2022-07-26 13:54:09 +08:00
|
|
|
|
this.appData.splice(index, 1)
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
2022-08-24 16:40:03 +08:00
|
|
|
|
deleteDuplicate (arr) {
|
|
|
|
|
|
const arr1 = []
|
|
|
|
|
|
arr.forEach(a => {
|
|
|
|
|
|
if (!arr1.find(a1 => a.name === a1.name && a.type === a1.type)) {
|
|
|
|
|
|
arr1.push(a)
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
return arr1
|
|
|
|
|
|
},
|
2022-07-26 13:54:09 +08:00
|
|
|
|
save () {
|
|
|
|
|
|
if (this.toSaveApp.length > 0) {
|
|
|
|
|
|
const toSaveParams = this.chart.params.app ? this.chart.params : { app: [] }
|
2022-08-04 12:03:15 +08:00
|
|
|
|
if (toSaveParams.app.some(p => p.user === parseInt(localStorage.getItem(storageKey.userId)))) {
|
|
|
|
|
|
toSaveParams.app.forEach(p => {
|
|
|
|
|
|
if (p.user === parseInt(localStorage.getItem(storageKey.userId))) {
|
2022-08-24 16:40:03 +08:00
|
|
|
|
p.list = this.deleteDuplicate([...p.list, ...this.toSaveApp])
|
2022-08-04 12:03:15 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
} else {
|
|
|
|
|
|
const defaultApp = toSaveParams.app.find(p => p.user === 'default')
|
|
|
|
|
|
toSaveParams.app.push({
|
|
|
|
|
|
user: parseInt(localStorage.getItem(storageKey.userId)),
|
2022-08-24 16:40:03 +08:00
|
|
|
|
list: this.deleteDuplicate([...defaultApp.list, ...this.toSaveApp])
|
2022-08-04 12:03:15 +08:00
|
|
|
|
})
|
|
|
|
|
|
}
|
2022-07-26 13:54:09 +08:00
|
|
|
|
const toSaveChart = {
|
|
|
|
|
|
...this.chart,
|
|
|
|
|
|
params: JSON.stringify(toSaveParams)
|
|
|
|
|
|
}
|
2022-08-04 12:03:15 +08:00
|
|
|
|
this.saveChart(toSaveChart).then(res => {
|
|
|
|
|
|
this.appData = _.cloneDeep(toSaveParams.app.find(p => p.user === parseInt(localStorage.getItem(storageKey.userId))).list)
|
2022-07-26 13:54:09 +08:00
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.init()
|
|
|
|
|
|
this.showAddApp = false
|
|
|
|
|
|
this.toSaveApp = []
|
|
|
|
|
|
})
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2022-07-21 18:23:33 +08:00
|
|
|
|
appCheckedChange (app, num) {
|
|
|
|
|
|
if (num === 0) {
|
|
|
|
|
|
this.providerOptions.forEach(t => {
|
2022-08-18 16:19:19 +08:00
|
|
|
|
if (t.value === app.value) {
|
2022-07-21 18:23:33 +08:00
|
|
|
|
t.provideShow = !t.provideShow
|
2022-07-26 13:54:09 +08:00
|
|
|
|
if (t.provideShow) {
|
2022-08-18 16:19:19 +08:00
|
|
|
|
this.toSaveApp.push({ type: 'provider', name: app.value, provideShow: t.provideShow })
|
2022-07-26 13:54:09 +08:00
|
|
|
|
} else {
|
2022-08-18 16:19:19 +08:00
|
|
|
|
const index = this.toSaveApp.findIndex(a => a.name === app.value)
|
2022-07-26 13:54:09 +08:00
|
|
|
|
if (index > -1) {
|
|
|
|
|
|
this.toSaveApp.splice(index, 1)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-07-21 18:23:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
} else if (num === 1) {
|
|
|
|
|
|
this.appOptions.forEach(t => {
|
2022-08-18 16:19:19 +08:00
|
|
|
|
if (t.value === app.value) {
|
2022-07-21 18:23:33 +08:00
|
|
|
|
t.appShow = !t.appShow
|
2022-07-26 13:54:09 +08:00
|
|
|
|
if (t.appShow) {
|
2022-08-18 16:19:19 +08:00
|
|
|
|
this.toSaveApp.push({ type: 'app', name: app.value, appShow: t.appShow })
|
2022-07-26 13:54:09 +08:00
|
|
|
|
} else {
|
2022-08-18 16:19:19 +08:00
|
|
|
|
const index = this.toSaveApp.findIndex(a => a.name === app.value)
|
2022-07-26 13:54:09 +08:00
|
|
|
|
if (index > -1) {
|
|
|
|
|
|
this.toSaveApp.splice(index, 1)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-07-21 18:23:33 +08:00
|
|
|
|
}
|
2022-07-21 15:06:19 +08:00
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2022-07-26 13:54:09 +08:00
|
|
|
|
moreChange (app) {
|
|
|
|
|
|
this.appData.forEach(t => {
|
|
|
|
|
|
if (t.name === app.name && t.type === app.type) {
|
2022-08-08 22:31:08 +08:00
|
|
|
|
t.moreOptions = !t.moreOptions
|
2022-07-26 11:20:29 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
2022-07-19 17:53:22 +08:00
|
|
|
|
resize () {
|
2022-07-26 13:54:09 +08:00
|
|
|
|
this.myChart.forEach(t => {
|
2022-07-21 18:23:33 +08:00
|
|
|
|
t.resize()
|
|
|
|
|
|
})
|
2022-07-19 17:53:22 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
mounted () {
|
2022-07-26 13:54:09 +08:00
|
|
|
|
if (this.chart.params && this.chart.params.app) {
|
2022-08-04 12:03:15 +08:00
|
|
|
|
const userId = parseInt(localStorage.getItem(storageKey.userId))
|
|
|
|
|
|
const apps = _.cloneDeep(this.chart.params.app)
|
|
|
|
|
|
let app = apps.find(p => p.user === userId)
|
|
|
|
|
|
if (!app) {
|
|
|
|
|
|
app = apps.find(p => p.user === 'default')
|
|
|
|
|
|
}
|
|
|
|
|
|
this.appData = app.list
|
2022-07-21 15:06:19 +08:00
|
|
|
|
this.init()
|
2022-08-08 22:31:08 +08:00
|
|
|
|
window.addEventListener('resize', this.resize)
|
|
|
|
|
|
}
|
2022-08-18 16:19:19 +08:00
|
|
|
|
},
|
|
|
|
|
|
beforeUnmount () {
|
|
|
|
|
|
window.removeEventListener('resize', this.resize)
|
|
|
|
|
|
clearTimeout(this.timerScroll)
|
|
|
|
|
|
clearTimeout(this.timerSearc)
|
2022-07-19 10:16:44 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|