2022-07-12 17:17:38 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<div class="tabs">
|
|
|
|
|
|
<el-tabs v-model="activeTab"
|
|
|
|
|
|
class="cn-chart__tabs"
|
2022-08-05 15:46:31 +08:00
|
|
|
|
:class="showTabs?'':'tab-hide'"
|
2022-07-12 17:17:38 +08:00
|
|
|
|
@tab-click="handleClick"
|
|
|
|
|
|
>
|
2022-08-08 20:54:35 +08:00
|
|
|
|
<template v-for="(tab,index) in list">
|
|
|
|
|
|
<el-tab-pane v-if="tab.checked"
|
|
|
|
|
|
:name="tab.label"
|
|
|
|
|
|
:key="index"
|
|
|
|
|
|
:ref="`chart-tab-${index}`"
|
|
|
|
|
|
class="tab-pane"
|
2022-07-12 17:17:38 +08:00
|
|
|
|
>
|
2022-08-08 20:54:35 +08:00
|
|
|
|
<template #label>
|
|
|
|
|
|
{{$t(tab.label)}}
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<el-table
|
|
|
|
|
|
:id="`tabTable_${index}`"
|
|
|
|
|
|
:ref="`dataTable_${index}`"
|
|
|
|
|
|
:data="tableData"
|
|
|
|
|
|
border
|
|
|
|
|
|
v-loading="loading"
|
|
|
|
|
|
:cell-style="tableCellStyle"
|
|
|
|
|
|
:header-cell-style="tableHeaderCellStyle"
|
|
|
|
|
|
class="tab-table"
|
|
|
|
|
|
height="100%"
|
|
|
|
|
|
>
|
|
|
|
|
|
<template v-for="(item,index) in customTableTitles">
|
2022-07-22 18:22:00 +08:00
|
|
|
|
<el-table-column
|
2022-08-08 20:54:35 +08:00
|
|
|
|
v-if="item.checked"
|
|
|
|
|
|
class="data-column"
|
|
|
|
|
|
>
|
|
|
|
|
|
<template #header>
|
|
|
|
|
|
<span class="data-column__span">{{$t(item.label)}}</span>
|
2022-08-05 15:46:31 +08:00
|
|
|
|
</template>
|
2022-08-08 20:54:35 +08:00
|
|
|
|
<template #default="scope" :column="item">
|
2022-08-19 10:46:24 +08:00
|
|
|
|
<template v-if="item.columnType === tableColumnType.chainRatio" >
|
2022-08-08 20:54:35 +08:00
|
|
|
|
<div class="data-total" >
|
|
|
|
|
|
{{scope.row[item.prop] ? unitConvert(scope.row[item.prop], unitTypes.number).join(' ') : '-'}}
|
|
|
|
|
|
<div v-if="scope.row['trend'] === 'up'" class="data-total-trend data-total-trend-red">
|
2022-08-09 15:35:36 +08:00
|
|
|
|
<i class="cn-icon-rise1 cn-icon"></i><span>{{scope.row['trendValue']}}</span>
|
2022-08-08 20:54:35 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div v-else-if="scope.row['trend'] === 'down'" class="data-total-trend data-total-trend-green">
|
2022-08-09 15:35:36 +08:00
|
|
|
|
<i class="cn-icon-decline cn-icon"></i><span>{{scope.row['trendValue']}}</span>
|
2022-08-08 20:54:35 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div v-else-if="scope.row['trend'] === 'noChange'" class="data-total-trend data-total-trend-black">
|
2022-08-19 10:46:24 +08:00
|
|
|
|
<i class="cn-icon-constant cn-icon"></i>
|
2022-08-08 20:54:35 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
2022-08-19 10:46:24 +08:00
|
|
|
|
<template v-else-if="item.columnType === tableColumnType.dillDown" >
|
|
|
|
|
|
<div class="data-click" @click="handleTabValue(item.label,scope.row['tab'])">{{scope.row['tab']}}</div>
|
2022-08-08 20:54:35 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
<template v-else>
|
|
|
|
|
|
{{scope.row[item.prop] ? unitConvert(scope.row[item.prop], unitTypes.number).join(' ') : '-'}}
|
|
|
|
|
|
</template>
|
2022-08-05 15:46:31 +08:00
|
|
|
|
</template>
|
2022-08-08 20:54:35 +08:00
|
|
|
|
</el-table-column>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-table>
|
2022-07-12 17:17:38 +08:00
|
|
|
|
|
2022-08-08 20:54:35 +08:00
|
|
|
|
</el-tab-pane>
|
|
|
|
|
|
</template>
|
2022-07-12 17:17:38 +08:00
|
|
|
|
|
|
|
|
|
|
</el-tabs>
|
2022-08-19 10:46:24 +08:00
|
|
|
|
<div class="tab-search" >
|
|
|
|
|
|
<div class="search-select" v-if="hasMetricSearch">
|
2022-07-14 17:46:06 +08:00
|
|
|
|
<span>{{$t('network.metric')}}:</span>
|
2022-07-12 17:17:38 +08:00
|
|
|
|
<el-select v-model="metric"
|
|
|
|
|
|
class="option__select select-column"
|
2022-07-21 10:19:03 +08:00
|
|
|
|
popper-class="option-popper metric-select"
|
2022-07-14 17:46:06 +08:00
|
|
|
|
:popper-append-to-body="false"
|
2022-08-05 15:46:31 +08:00
|
|
|
|
key="tabMetric"
|
|
|
|
|
|
@change="changeMetric"
|
2022-07-12 17:17:38 +08:00
|
|
|
|
size="mini">
|
|
|
|
|
|
<el-option
|
|
|
|
|
|
v-for="item in options"
|
2022-08-05 15:46:31 +08:00
|
|
|
|
:key="item.label"
|
2022-07-12 17:17:38 +08:00
|
|
|
|
:label="item.label"
|
|
|
|
|
|
:value="item.value"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</el-select>
|
|
|
|
|
|
</div>
|
2022-07-22 18:22:00 +08:00
|
|
|
|
<el-popover placement="bottom-end"
|
|
|
|
|
|
:width="240"
|
2022-07-20 19:47:53 +08:00
|
|
|
|
:show-arrow="false"
|
2022-07-22 18:22:00 +08:00
|
|
|
|
:append-to-body="true"
|
2022-07-20 19:47:53 +08:00
|
|
|
|
:hide-after="0"
|
|
|
|
|
|
popper-class="customize-tab__popper"
|
2022-07-22 18:22:00 +08:00
|
|
|
|
@show="handleCustomizeButton(true)"
|
|
|
|
|
|
@hide="handleCustomizeButton(false)"
|
2022-07-20 19:47:53 +08:00
|
|
|
|
trigger="click">
|
|
|
|
|
|
<template #reference>
|
2022-07-22 18:22:00 +08:00
|
|
|
|
<div class="search-customize-tab " :class="showBackground?'search-customize-tab__active':''" >
|
|
|
|
|
|
<i class="cn-icon-gear cn-icon icon-gear"></i> <span> {{$t('network.customize')}}</span>
|
2022-07-20 19:47:53 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
2022-07-12 17:17:38 +08:00
|
|
|
|
|
2022-08-08 20:54:35 +08:00
|
|
|
|
<el-tabs v-model="activeCustomize"
|
|
|
|
|
|
@tab-click="handleCustomizeClick"
|
|
|
|
|
|
type="card"
|
|
|
|
|
|
>
|
|
|
|
|
|
<el-tab-pane :label="$t('network.tabs')" name="tabs" width="50%" v-if="showTabs" >
|
|
|
|
|
|
<transition-group name="dragTabs" class="list" tag="ul" ref="tabs">
|
|
|
|
|
|
<li v-for="(item, index) in list"
|
|
|
|
|
|
:key="item.label"
|
|
|
|
|
|
class="list-item"
|
|
|
|
|
|
@dragenter="dragenter($event, index)"
|
|
|
|
|
|
@dragover="dragover($event, index)"
|
|
|
|
|
|
@dragstart="dragstart(index)"
|
|
|
|
|
|
draggable="true"
|
|
|
|
|
|
>
|
|
|
|
|
|
<i class="cn-icon-sort cn-icon icon-drag"
|
|
|
|
|
|
:key="item.label"
|
|
|
|
|
|
></i> <el-checkbox @change="tabChange(index)" :disabled="item.disabled" v-model="item.checked" :label="$t(item.label) " size="small" :key="item.label"/>
|
|
|
|
|
|
</li>
|
|
|
|
|
|
</transition-group>
|
|
|
|
|
|
</el-tab-pane>
|
|
|
|
|
|
<el-tab-pane :label="$t('network.metric')" name="metrics" width="50%" >
|
|
|
|
|
|
<transition-group name="dragMetric" class="list" tag="ul" ref="metric">
|
|
|
|
|
|
<template v-for="(item, index) in customTableTitles">
|
|
|
|
|
|
<li v-if="item.tabColumn != true"
|
2022-07-20 19:47:53 +08:00
|
|
|
|
:key="item.label"
|
|
|
|
|
|
class="list-item"
|
2022-08-08 20:54:35 +08:00
|
|
|
|
@dragenter="dragMetricEnter($event, index)"
|
|
|
|
|
|
@dragover="dragMetricOver($event, index)"
|
|
|
|
|
|
@dragstart="dragMetricStart(index)"
|
2022-07-22 18:22:00 +08:00
|
|
|
|
draggable="true"
|
|
|
|
|
|
>
|
|
|
|
|
|
<i class="cn-icon-sort cn-icon icon-drag"
|
|
|
|
|
|
:key="item.label"
|
2022-08-08 20:54:35 +08:00
|
|
|
|
></i> <el-checkbox @change="metricChange" v-model="item.checked" :label="$t(item.label) " size="small" :key="item.label"/>
|
2022-07-22 18:22:00 +08:00
|
|
|
|
</li>
|
2022-08-08 20:54:35 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
</transition-group>
|
|
|
|
|
|
</el-tab-pane>
|
|
|
|
|
|
</el-tabs>
|
2022-07-20 19:47:53 +08:00
|
|
|
|
</el-popover>
|
2022-07-12 17:17:38 +08:00
|
|
|
|
</div>
|
2022-08-19 10:46:24 +08:00
|
|
|
|
|
2022-07-12 17:17:38 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
|
|
|
import { ref } from 'vue'
|
2022-08-19 10:46:24 +08:00
|
|
|
|
import {operationType, unitTypes,networkTable,tableColumnType } from '@/utils/constants'
|
2022-08-05 15:46:31 +08:00
|
|
|
|
import { get } from '@/utils/http'
|
2022-08-08 20:54:35 +08:00
|
|
|
|
import unitConvert from '@/utils/unit-convert'
|
2022-08-19 10:46:24 +08:00
|
|
|
|
import { getChainRatio } from '@/utils/tools'
|
2022-07-12 17:17:38 +08:00
|
|
|
|
|
|
|
|
|
|
export default {
|
2022-07-14 17:46:06 +08:00
|
|
|
|
name: 'NetworkOverviewTabs',
|
2022-07-12 17:17:38 +08:00
|
|
|
|
data () {
|
|
|
|
|
|
return {
|
2022-08-19 10:46:24 +08:00
|
|
|
|
dragIndex: '',
|
|
|
|
|
|
dragMetricIndex: '',
|
2022-08-05 15:46:31 +08:00
|
|
|
|
metric: 'Bits/s',
|
|
|
|
|
|
orderBy: 'bytesTotal',
|
|
|
|
|
|
tab: 'ip',
|
2022-08-08 20:54:35 +08:00
|
|
|
|
unitConvert,
|
|
|
|
|
|
unitTypes,
|
2022-07-12 17:17:38 +08:00
|
|
|
|
options: [
|
|
|
|
|
|
{
|
2022-08-05 15:46:31 +08:00
|
|
|
|
value: 'Bits/s',
|
|
|
|
|
|
label: 'Bits/s'
|
2022-07-12 17:17:38 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
2022-08-05 15:46:31 +08:00
|
|
|
|
value: 'Packets/s',
|
|
|
|
|
|
label: 'Packets/s'
|
2022-07-12 17:17:38 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
2022-08-05 15:46:31 +08:00
|
|
|
|
value: 'Sessions/s',
|
|
|
|
|
|
label: 'Sessions/s'
|
2022-07-12 17:17:38 +08:00
|
|
|
|
}
|
|
|
|
|
|
],
|
2022-08-19 10:46:24 +08:00
|
|
|
|
customTableTitles: [],
|
|
|
|
|
|
list: [],//当前状态列表
|
|
|
|
|
|
networkTabList: [],//原始状态列表
|
2022-08-05 15:46:31 +08:00
|
|
|
|
showBackground: false,
|
|
|
|
|
|
tableData: [],
|
|
|
|
|
|
showTabs: true,
|
|
|
|
|
|
columnNameGroup: {
|
|
|
|
|
|
total: 'bytesTotal',
|
|
|
|
|
|
inbound: 'inboundBitsRate',
|
|
|
|
|
|
outbound: 'outboundBitsRate',
|
|
|
|
|
|
internal: 'internalBitsRate',
|
|
|
|
|
|
through: 'throughBitsRate'
|
|
|
|
|
|
},
|
|
|
|
|
|
metricUnit: 'bytes',
|
2022-08-05 16:42:01 +08:00
|
|
|
|
loading: false,
|
2022-08-19 10:46:24 +08:00
|
|
|
|
drillDown: false,
|
|
|
|
|
|
tableColumnType:tableColumnType,
|
|
|
|
|
|
curTable:{},//当前的表格类型
|
|
|
|
|
|
tableType:'',
|
|
|
|
|
|
hasMetricSearch:true,
|
|
|
|
|
|
activeTab:'',
|
|
|
|
|
|
activeCustomize:'',
|
|
|
|
|
|
networkSearchUrl:{}
|
2022-07-12 17:17:38 +08:00
|
|
|
|
}
|
2022-07-20 19:47:53 +08:00
|
|
|
|
},
|
2022-08-05 15:46:31 +08:00
|
|
|
|
props: {
|
|
|
|
|
|
chartData: Array,
|
|
|
|
|
|
timeFilter: Object,
|
|
|
|
|
|
chart: Object
|
|
|
|
|
|
},
|
2022-07-20 19:47:53 +08:00
|
|
|
|
components: {
|
|
|
|
|
|
|
2022-08-05 15:46:31 +08:00
|
|
|
|
},
|
|
|
|
|
|
watch: {
|
|
|
|
|
|
chartData: {
|
|
|
|
|
|
deep: true,
|
|
|
|
|
|
handler (n) {
|
|
|
|
|
|
if (this.chartData) {
|
|
|
|
|
|
this.initData()
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-07-12 17:17:38 +08:00
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
2022-08-05 15:46:31 +08:00
|
|
|
|
changeMetric () {
|
|
|
|
|
|
const beforeType = this.$store.getters.getTabOperationBeforeType
|
|
|
|
|
|
if (beforeType != operationType.thirdMenu) {
|
|
|
|
|
|
this.$store.commit('setTabOperationBeforeType', this.$store.getters.getTabOperationType)
|
|
|
|
|
|
}
|
|
|
|
|
|
this.$store.commit('setTabOperationType', operationType.changeMetric)
|
|
|
|
|
|
const curTab = this.getCurTab()
|
|
|
|
|
|
const label = curTab.label
|
|
|
|
|
|
if (this.metric === 'Bits/s') {
|
2022-08-19 10:46:24 +08:00
|
|
|
|
this.columnNameGroup = this.curTable.bytesColumnNameGroup
|
2022-08-05 15:46:31 +08:00
|
|
|
|
this.orderBy = 'bytesTotal'
|
|
|
|
|
|
this.metricUnit = 'bytes'
|
2022-08-19 10:46:24 +08:00
|
|
|
|
const titleGroup = []
|
2022-08-05 15:46:31 +08:00
|
|
|
|
if (this.customTableTitles.length === 2) {
|
2022-08-19 10:46:24 +08:00
|
|
|
|
this.curTable.column.forEach((item,index) => {
|
|
|
|
|
|
if (item.tabColumn) {
|
|
|
|
|
|
item.label = label
|
|
|
|
|
|
}
|
|
|
|
|
|
if(index===1){
|
|
|
|
|
|
item.checked = this.customTableTitles[1].checked
|
|
|
|
|
|
}
|
|
|
|
|
|
titleGroup.push(item)
|
|
|
|
|
|
})
|
2022-08-05 15:46:31 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
this.customTableTitles.forEach(item => {
|
|
|
|
|
|
if (item.tabColumn) {
|
|
|
|
|
|
item.label = label
|
|
|
|
|
|
}
|
|
|
|
|
|
titleGroup.push(item)
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2022-08-19 10:46:24 +08:00
|
|
|
|
this.customTableTitles = titleGroup
|
|
|
|
|
|
|
2022-08-05 15:46:31 +08:00
|
|
|
|
} else if (this.metric === 'Packets/s') {
|
2022-08-19 10:46:24 +08:00
|
|
|
|
this.columnNameGroup = this.curTable.packetsColumnNameGroup
|
2022-08-05 15:46:31 +08:00
|
|
|
|
this.orderBy = 'packetsTotal'
|
|
|
|
|
|
this.metricUnit = 'packets'
|
2022-08-19 10:46:24 +08:00
|
|
|
|
const titleGroup = []
|
2022-08-05 15:46:31 +08:00
|
|
|
|
if (this.customTableTitles.length === 2) {
|
2022-08-19 10:46:24 +08:00
|
|
|
|
this.curTable.column.forEach((item,index) => {
|
|
|
|
|
|
if (item.tabColumn) {
|
|
|
|
|
|
item.label = label
|
|
|
|
|
|
}
|
|
|
|
|
|
if(index===1){
|
|
|
|
|
|
item.checked = this.customTableTitles[1].checked
|
|
|
|
|
|
}
|
|
|
|
|
|
titleGroup.push(item)
|
|
|
|
|
|
})
|
2022-08-05 15:46:31 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
this.customTableTitles.forEach(item => {
|
|
|
|
|
|
if (item.tabColumn) {
|
|
|
|
|
|
item.label = label
|
|
|
|
|
|
}
|
|
|
|
|
|
titleGroup.push(item)
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2022-08-19 10:46:24 +08:00
|
|
|
|
this.customTableTitles = titleGroup
|
2022-08-05 15:46:31 +08:00
|
|
|
|
} else if (this.metric === 'Sessions/s') {
|
2022-08-19 10:46:24 +08:00
|
|
|
|
this.columnNameGroup = this.curTable.sessionsColumnNameGroup
|
2022-08-05 15:46:31 +08:00
|
|
|
|
this.orderBy = 'sessions'
|
|
|
|
|
|
this.metricUnit = 'sessions'
|
|
|
|
|
|
let totalChecked = true
|
|
|
|
|
|
this.customTableTitles.forEach(item => {
|
|
|
|
|
|
if (item.prop === 'total') {
|
|
|
|
|
|
totalChecked = item.checked
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
this.customTableTitles = [
|
2022-08-19 10:46:24 +08:00
|
|
|
|
{ label: label, prop: 'tab', checked: true, tabColumn: true,columnType:this.curTable.column[0].columnType},
|
|
|
|
|
|
{ label: 'network.total', prop: 'total', checked: totalChecked, tabColumn: false,columnType:this.curTable.column[1].columnType}
|
2022-08-05 15:46:31 +08:00
|
|
|
|
]
|
|
|
|
|
|
}
|
|
|
|
|
|
let queryParams = {
|
|
|
|
|
|
orderBy: this.orderBy,
|
|
|
|
|
|
limit: 10,
|
|
|
|
|
|
type: curTab.prop
|
|
|
|
|
|
}
|
|
|
|
|
|
const condition = this.$store.getters.getQueryCondition
|
|
|
|
|
|
if (condition) {
|
|
|
|
|
|
queryParams = {
|
|
|
|
|
|
orderBy: this.orderBy,
|
|
|
|
|
|
limit: 10,
|
|
|
|
|
|
type: curTab.prop,
|
|
|
|
|
|
q: condition
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
this.loading = true
|
|
|
|
|
|
this.$emit('getChartData', this.getCurUrl(), queryParams)
|
2022-07-20 19:47:53 +08:00
|
|
|
|
},
|
2022-07-22 18:22:00 +08:00
|
|
|
|
handleCustomizeButton (status) {
|
|
|
|
|
|
this.showBackground = status
|
2022-08-05 15:46:31 +08:00
|
|
|
|
if (!this.showTabs) {
|
|
|
|
|
|
this.activeCustomize = 'metrics'
|
|
|
|
|
|
}
|
2022-07-22 18:22:00 +08:00
|
|
|
|
},
|
2022-08-05 15:46:31 +08:00
|
|
|
|
getDefaultTab () {
|
|
|
|
|
|
let tabObjGroup = this.list.filter(item => item.checked)
|
|
|
|
|
|
if (tabObjGroup && tabObjGroup.length > 0) {
|
|
|
|
|
|
return tabObjGroup[0]
|
|
|
|
|
|
} else {
|
2022-08-19 10:46:24 +08:00
|
|
|
|
return tabObjGroup = this.networkTabList.filter(item => item.checked)[0]
|
2022-08-05 15:46:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
initData () {
|
|
|
|
|
|
const curTab = this.getCurTab()
|
|
|
|
|
|
const columnName = this.$store.getters.getBreadcrumbColumnName
|
|
|
|
|
|
|
|
|
|
|
|
this.list.forEach(item => {
|
|
|
|
|
|
const tabDom = document.getElementById('tab-' + item.label)
|
|
|
|
|
|
if (tabDom) {
|
|
|
|
|
|
tabDom.style.display = ''
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
const curOperationType = this.$store.getters.getTabOperationType
|
|
|
|
|
|
if (curOperationType === operationType.changeTab) { // 切换tab
|
|
|
|
|
|
if (curTab) { // tab切换
|
|
|
|
|
|
this.activeTab = curTab.label
|
|
|
|
|
|
this.customTableTitles[0].label = curTab.label
|
|
|
|
|
|
this.$store.commit('setNetworkOverviewCurrentTab', curTab)
|
|
|
|
|
|
}
|
|
|
|
|
|
this.showTabs = true
|
|
|
|
|
|
} else if (curOperationType === operationType.thirdMenu) { // 点击的为第三级菜单
|
2022-08-19 10:46:24 +08:00
|
|
|
|
// 此处的id为tab-name
|
2022-08-05 15:46:31 +08:00
|
|
|
|
this.list.forEach(item => {
|
|
|
|
|
|
const tabDom = document.getElementById('tab-' + item.label)
|
|
|
|
|
|
const paneDom = document.getElementById('pane-' + item.label)
|
|
|
|
|
|
if (tabDom) {
|
|
|
|
|
|
tabDom.style.display = 'none'
|
|
|
|
|
|
}
|
|
|
|
|
|
if (paneDom) {
|
|
|
|
|
|
if (curTab.label === item.label) {
|
|
|
|
|
|
paneDom.style.display = ''
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
this.customTableTitles[0].label = curTab.label
|
|
|
|
|
|
this.showTabs = false
|
|
|
|
|
|
} else if (curOperationType === operationType.fourthMenu) { // 点击的为第四级菜单
|
|
|
|
|
|
const curTab = this.getDefaultTab()
|
|
|
|
|
|
if (curTab) {
|
|
|
|
|
|
this.activeTab = curTab.label
|
|
|
|
|
|
this.customTableTitles[0].label = curTab.label
|
|
|
|
|
|
this.$store.commit('setNetworkOverviewCurrentTab', curTab)
|
|
|
|
|
|
}
|
|
|
|
|
|
this.showTabs = true
|
|
|
|
|
|
} else if (curOperationType === operationType.secondMenu) { // 点击的为第二级菜单、或者点击菜单进入、
|
|
|
|
|
|
if (curTab) { // tab切换
|
|
|
|
|
|
this.activeTab = curTab.label
|
|
|
|
|
|
this.customTableTitles[0].label = curTab.label
|
|
|
|
|
|
this.$store.commit('setNetworkOverviewCurrentTab', curTab)
|
|
|
|
|
|
}
|
|
|
|
|
|
this.showTabs = true
|
|
|
|
|
|
} else if (curOperationType === operationType.changeMetric) { // 切换metric
|
|
|
|
|
|
const beforeOperationType = this.$store.getters.getTabOperationBeforeType
|
|
|
|
|
|
if (beforeOperationType === operationType.thirdMenu) {
|
|
|
|
|
|
this.list.forEach(item => {
|
|
|
|
|
|
const tabDom = document.getElementById('tab-' + item.label)
|
|
|
|
|
|
const paneDom = document.getElementById('pane-' + item.label)
|
|
|
|
|
|
if (tabDom) {
|
|
|
|
|
|
tabDom.style.display = 'none'
|
|
|
|
|
|
}
|
|
|
|
|
|
if (paneDom) {
|
|
|
|
|
|
if (curTab.label === item.label) {
|
|
|
|
|
|
paneDom.style.display = ''
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
this.customTableTitles[0].label = curTab.label
|
|
|
|
|
|
this.showTabs = false
|
|
|
|
|
|
}
|
|
|
|
|
|
} else if (curOperationType === operationType.customize) { // customize
|
|
|
|
|
|
const beforeOperationType = this.$store.getters.getTabOperationBeforeType
|
|
|
|
|
|
if (beforeOperationType === operationType.thirdMenu) {
|
|
|
|
|
|
this.list.forEach(item => {
|
|
|
|
|
|
const tabDom = document.getElementById('tab-' + item.label)
|
|
|
|
|
|
const paneDom = document.getElementById('pane-' + item.label)
|
|
|
|
|
|
if (tabDom) {
|
|
|
|
|
|
tabDom.style.display = 'none'
|
|
|
|
|
|
}
|
|
|
|
|
|
if (paneDom) {
|
|
|
|
|
|
if (curTab.label === item.label) {
|
|
|
|
|
|
paneDom.style.display = ''
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
this.customTableTitles[0].label = curTab.label
|
|
|
|
|
|
this.showTabs = false
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.list.forEach(item => {
|
|
|
|
|
|
const tabDom = document.getElementById('tab-' + item.label)
|
|
|
|
|
|
const paneDom = document.getElementById('pane-' + item.label)
|
|
|
|
|
|
if (tabDom) {
|
|
|
|
|
|
tabDom.style.display = ''
|
|
|
|
|
|
}
|
|
|
|
|
|
if (paneDom) {
|
|
|
|
|
|
if (curTab.label === item.label) {
|
|
|
|
|
|
paneDom.style.display = ''
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
this.activeTab = curTab.label
|
|
|
|
|
|
this.customTableTitles[0].label = curTab.label
|
|
|
|
|
|
this.showTabs = true
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.tableData = []
|
|
|
|
|
|
const tabList = []
|
|
|
|
|
|
const tableDataTmp = this.chartData.map(item => {
|
|
|
|
|
|
tabList.push(item[curTab.prop])
|
|
|
|
|
|
return {
|
|
|
|
|
|
tab: item[curTab.prop],
|
|
|
|
|
|
total: item[this.columnNameGroup.total],
|
|
|
|
|
|
inbound: item[this.columnNameGroup.inbound],
|
|
|
|
|
|
outbound: item[this.columnNameGroup.outbound],
|
|
|
|
|
|
internal: item[this.columnNameGroup.internal],
|
|
|
|
|
|
through: item[this.columnNameGroup.through]
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
const queryParams = {}
|
|
|
|
|
|
if (tabList.length > 0) {
|
|
|
|
|
|
const conditionStr = tabList.filter(item => item != '')
|
|
|
|
|
|
queryParams.params = conditionStr.toString()
|
|
|
|
|
|
queryParams.type = curTab.prop
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 获取上一周期的总流量
|
|
|
|
|
|
let cycleTotalList = []
|
|
|
|
|
|
const condition = this.$store.getters.getQueryCondition
|
|
|
|
|
|
if (condition) {
|
|
|
|
|
|
queryParams.q = condition
|
|
|
|
|
|
}
|
|
|
|
|
|
get(this.gerCycleUrl(), queryParams).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
cycleTotalList = response.data.result
|
|
|
|
|
|
tableDataTmp.forEach(item => {
|
|
|
|
|
|
const cycle = cycleTotalList.find(i => i[curTab.prop] === item.tab)
|
2022-08-19 10:46:24 +08:00
|
|
|
|
let trend = ''//空:无图标;up:向上的图标;down:向下的图标;noChange:横向箭头图标
|
2022-08-05 15:46:31 +08:00
|
|
|
|
let trendPercent = ''
|
|
|
|
|
|
if (cycle) {
|
|
|
|
|
|
const totalDiff = item.total - cycle[this.metricUnit]
|
2022-08-19 10:46:24 +08:00
|
|
|
|
if (cycle[this.metricUnit] && cycle[this.metricUnit]!=0) {
|
|
|
|
|
|
let chainRatio = getChainRatio(item.total, cycle[this.metricUnit])
|
|
|
|
|
|
if (chainRatio === '-') {
|
|
|
|
|
|
trend = ''
|
2022-08-09 11:46:48 +08:00
|
|
|
|
trendPercent = ''
|
2022-08-19 10:46:24 +08:00
|
|
|
|
}else {
|
|
|
|
|
|
trendPercent = Math.round(Math.abs(chainRatio)* 100)
|
|
|
|
|
|
if (totalDiff > 0) {
|
|
|
|
|
|
trend = 'up'
|
|
|
|
|
|
trendPercent = trendPercent + '%'
|
|
|
|
|
|
} else if (totalDiff < 0) {
|
|
|
|
|
|
trend = 'down'
|
|
|
|
|
|
trendPercent = trendPercent + '%'
|
|
|
|
|
|
} else {
|
|
|
|
|
|
trend = 'noChange'//横向图标
|
|
|
|
|
|
}
|
|
|
|
|
|
if (trendPercent === '0%') {
|
|
|
|
|
|
trend = 'noChange'
|
|
|
|
|
|
trendPercent = ''
|
|
|
|
|
|
}
|
2022-08-09 11:46:48 +08:00
|
|
|
|
}
|
2022-08-05 15:46:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
this.tableData.push({
|
|
|
|
|
|
tab: item.tab,
|
|
|
|
|
|
total: item.total,
|
|
|
|
|
|
trend: trend,
|
|
|
|
|
|
trendValue: trendPercent,
|
|
|
|
|
|
inbound: item.inbound,
|
|
|
|
|
|
outbound: item.outbound,
|
|
|
|
|
|
internal: item.internal,
|
|
|
|
|
|
through: item.through
|
|
|
|
|
|
})
|
|
|
|
|
|
})
|
|
|
|
|
|
this.loading = false
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.tableData = tableDataTmp
|
|
|
|
|
|
this.loading = false
|
|
|
|
|
|
}
|
|
|
|
|
|
}).catch(e => {
|
|
|
|
|
|
this.loading = false
|
|
|
|
|
|
}).finally(e => {
|
|
|
|
|
|
this.loading = false
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
tabChange (index) {
|
|
|
|
|
|
const beforeType = this.$store.getters.getTabOperationBeforeType
|
|
|
|
|
|
if (beforeType != operationType.thirdMenu) {
|
|
|
|
|
|
this.$store.commit('setTabOperationBeforeType', this.$store.getters.getTabOperationType)
|
|
|
|
|
|
}
|
|
|
|
|
|
this.$store.commit('setTabOperationType', operationType.customize)
|
|
|
|
|
|
const handleTab = this.list[index]
|
|
|
|
|
|
const tabList = this.list.filter(item => item.checked === true)
|
|
|
|
|
|
const defaultTab = tabList.length > 0 ? tabList[0] : {}
|
|
|
|
|
|
if (handleTab.label === defaultTab.label && handleTab.checked) {
|
|
|
|
|
|
this.activeTab = handleTab.label
|
2022-07-22 18:22:00 +08:00
|
|
|
|
this.customTableTitles.forEach(item => {
|
|
|
|
|
|
if (item.tabColumn) {
|
2022-08-05 15:46:31 +08:00
|
|
|
|
item.label = handleTab.label
|
2022-07-22 18:22:00 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
2022-07-20 19:47:53 +08:00
|
|
|
|
}
|
2022-08-05 15:46:31 +08:00
|
|
|
|
if (tabList.length === 1) { // 当前操作之后,只有1个tab被选中,则这一个不允许取消选中
|
|
|
|
|
|
defaultTab.disabled = true
|
|
|
|
|
|
} else if (tabList.length > 1) {
|
|
|
|
|
|
this.list.forEach(item => {
|
|
|
|
|
|
item.disabled = false
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.$store.commit('setNetworkOverviewCurrentTab', tabList[0])
|
|
|
|
|
|
|
|
|
|
|
|
let queryParams = {
|
|
|
|
|
|
orderBy: this.orderBy,
|
|
|
|
|
|
limit: 10,
|
|
|
|
|
|
type: tabList[0].prop
|
|
|
|
|
|
}
|
|
|
|
|
|
const condition = this.$store.getters.getQueryCondition
|
|
|
|
|
|
if (condition) {
|
|
|
|
|
|
queryParams = {
|
|
|
|
|
|
orderBy: this.orderBy,
|
|
|
|
|
|
limit: 10,
|
|
|
|
|
|
type: tabList[0].prop,
|
|
|
|
|
|
q: condition
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
this.loading = true
|
|
|
|
|
|
this.$emit('getChartData', this.getCurUrl(), queryParams)
|
|
|
|
|
|
},
|
|
|
|
|
|
handleTabValue (columnName, columnValue) {
|
|
|
|
|
|
const oldCurTab = this.$store.getters.getNetworkOverviewBeforeTab
|
|
|
|
|
|
const tabGroup = this.list.filter(item => item.label === columnName)
|
|
|
|
|
|
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 + "='" + columnValue + "'")
|
|
|
|
|
|
})
|
|
|
|
|
|
this.$store.commit('setQueryCondition', queryCondition.join(' OR '))
|
|
|
|
|
|
/*
|
2022-08-08 20:54:35 +08:00
|
|
|
|
* 点击表格第一列后
|
|
|
|
|
|
1.顶部面包屑增加两级,分别是列名和值;
|
|
|
|
|
|
2.panel标题变更为值;
|
|
|
|
|
|
3.当前panel只保留折线图和表格;
|
|
|
|
|
|
4.面包屑上的值可点击下拉,切换内容;
|
|
|
|
|
|
* */
|
2022-08-05 15:46:31 +08:00
|
|
|
|
this.$store.getters.menuList.forEach(menu => {
|
|
|
|
|
|
if (this.$_.isEmpty(menu.children) && menu.route) {
|
|
|
|
|
|
if (this.$route.path === menu.route) {
|
|
|
|
|
|
menu.columnName = columnName
|
|
|
|
|
|
menu.columnValue = columnValue
|
|
|
|
|
|
this.$store.commit('setPanelName', columnValue)
|
|
|
|
|
|
this.$store.commit('setBreadcrumbColumnName', columnName)
|
|
|
|
|
|
this.$store.commit('setBreadcrumbColumnValue', columnValue)
|
|
|
|
|
|
}
|
|
|
|
|
|
} else if (!this.$_.isEmpty(menu.children)) {
|
|
|
|
|
|
menu.children.forEach(child => {
|
|
|
|
|
|
if (this.$route.path === child.route) {
|
|
|
|
|
|
child.columnName = columnName
|
|
|
|
|
|
child.columnValue = columnValue
|
|
|
|
|
|
this.$store.commit('setPanelName', columnValue)
|
|
|
|
|
|
this.$store.commit('setBreadcrumbColumnName', columnName)
|
|
|
|
|
|
this.$store.commit('setBreadcrumbColumnValue', columnValue)
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2022-08-19 10:46:24 +08:00
|
|
|
|
let toPanel = null
|
2022-08-05 15:46:31 +08:00
|
|
|
|
this.list.forEach((item, index) => {
|
|
|
|
|
|
if (item.label === columnName) {
|
|
|
|
|
|
item.checked = false
|
2022-08-19 10:46:24 +08:00
|
|
|
|
toPanel = item.panelId
|
2022-08-05 15:46:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (oldCurTab && (item.label === oldCurTab.label)) {
|
|
|
|
|
|
item.checked = true
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
this.$store.commit('setNetworkOverviewTabList', this.list)
|
|
|
|
|
|
this.handleSearchParams(columnValue)
|
|
|
|
|
|
|
|
|
|
|
|
const tabObjGroup = this.list.filter(item => item.checked)
|
|
|
|
|
|
if (tabObjGroup && tabObjGroup.length > 0) {
|
|
|
|
|
|
const curTab = tabObjGroup[0]
|
|
|
|
|
|
this.$store.commit('setNetworkOverviewCurrentTab', curTab)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const tab = this.list.filter(item => item.checked)
|
|
|
|
|
|
|
|
|
|
|
|
// 如果面包屑的columnValue有值,则不更新valueList
|
|
|
|
|
|
const valueList = []
|
|
|
|
|
|
this.tableData.map(item => {
|
|
|
|
|
|
valueList.push(item.tab)
|
|
|
|
|
|
})
|
|
|
|
|
|
this.$store.commit('setBreadcrumbColumnValueList', valueList)
|
|
|
|
|
|
this.$router.push({
|
2022-08-19 10:46:24 +08:00
|
|
|
|
name:'panel',
|
2022-08-05 15:46:31 +08:00
|
|
|
|
path: this.$route.path,
|
|
|
|
|
|
query: {
|
|
|
|
|
|
t: +new Date()
|
2022-08-19 10:46:24 +08:00
|
|
|
|
},
|
|
|
|
|
|
params:{
|
|
|
|
|
|
thirdPanel:this.curTable.panelIdOfThirdMenu,
|
|
|
|
|
|
fourthPanel:toPanel
|
2022-08-05 15:46:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
handleSearchParams (columnValue) {
|
|
|
|
|
|
const queryCondition = []
|
|
|
|
|
|
const curTab = this.getCurTab()
|
|
|
|
|
|
const searchProps = curTab.dillDownProp
|
|
|
|
|
|
searchProps.forEach(item => {
|
|
|
|
|
|
queryCondition.push(item + "='" + columnValue + "'")
|
|
|
|
|
|
})
|
|
|
|
|
|
this.$store.commit('setQueryCondition', queryCondition.join(' OR '))
|
2022-07-20 19:47:53 +08:00
|
|
|
|
},
|
2022-07-22 18:22:00 +08:00
|
|
|
|
metricChange () {
|
|
|
|
|
|
},
|
2022-07-20 19:47:53 +08:00
|
|
|
|
dragstart (index) {
|
|
|
|
|
|
this.dragIndex = index
|
|
|
|
|
|
},
|
|
|
|
|
|
dragenter (e, index) {
|
|
|
|
|
|
e.preventDefault()
|
|
|
|
|
|
if (this.dragIndex !== index) {
|
|
|
|
|
|
const moving = this.list[this.dragIndex]
|
|
|
|
|
|
this.list.splice(this.dragIndex, 1)
|
|
|
|
|
|
this.list.splice(index, 0, moving)
|
|
|
|
|
|
this.dragIndex = index
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
dragover (e, index) {
|
|
|
|
|
|
e.preventDefault()
|
|
|
|
|
|
},
|
2022-07-22 18:22:00 +08:00
|
|
|
|
dragMetricStart (index) {
|
|
|
|
|
|
this.dragMetricIndex = index
|
|
|
|
|
|
},
|
|
|
|
|
|
dragMetricEnter (e, index) {
|
|
|
|
|
|
e.preventDefault()
|
|
|
|
|
|
if (this.dragMetricIndex !== index) {
|
|
|
|
|
|
const moving = this.customTableTitles[this.dragMetricIndex]
|
|
|
|
|
|
this.customTableTitles.splice(this.dragMetricIndex, 1)
|
|
|
|
|
|
this.customTableTitles.splice(index, 0, moving)
|
|
|
|
|
|
this.dragMetricIndex = index
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
dragMetricOver (e, index) {
|
|
|
|
|
|
e.preventDefault()
|
|
|
|
|
|
},
|
2022-07-12 17:17:38 +08:00
|
|
|
|
handleClick (tab) {
|
2022-08-05 15:46:31 +08:00
|
|
|
|
this.tableData = []
|
|
|
|
|
|
this.$store.commit('setTabOperationBeforeType', this.$store.getters.getTabOperationType)
|
|
|
|
|
|
this.$store.commit('setTabOperationType', operationType.changeTab)
|
|
|
|
|
|
this.customTableTitles[0].label = tab.paneName
|
|
|
|
|
|
|
|
|
|
|
|
const tabObjGroup = this.list.filter(item => item.label == tab.paneName)
|
|
|
|
|
|
if (tabObjGroup && tabObjGroup.length > 0) {
|
|
|
|
|
|
const curTab = tabObjGroup[0]
|
|
|
|
|
|
this.$store.commit('setNetworkOverviewCurrentTab', curTab)
|
|
|
|
|
|
this.tab = curTab.prop
|
|
|
|
|
|
|
|
|
|
|
|
let queryParams = {
|
|
|
|
|
|
orderBy: this.orderBy,
|
|
|
|
|
|
limit: 10,
|
|
|
|
|
|
type: curTab.prop
|
2022-07-22 18:22:00 +08:00
|
|
|
|
}
|
2022-08-05 15:46:31 +08:00
|
|
|
|
const condition = this.$store.getters.getQueryCondition
|
|
|
|
|
|
if (condition) {
|
|
|
|
|
|
queryParams = {
|
|
|
|
|
|
orderBy: this.orderBy,
|
|
|
|
|
|
limit: 10,
|
|
|
|
|
|
type: curTab.prop,
|
|
|
|
|
|
q: condition
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
this.loading = true
|
2022-08-05 17:40:39 +08:00
|
|
|
|
this.$emit('getChartData', this.getCurUrl(), queryParams, queryParams.q)
|
2022-08-05 15:46:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
getCurUrl () {
|
|
|
|
|
|
const condition = this.$store.getters.getQueryCondition
|
|
|
|
|
|
if (condition) {
|
2022-08-19 10:46:24 +08:00
|
|
|
|
return this.networkSearchUrl.drilldownCurUrl
|
2022-08-05 15:46:31 +08:00
|
|
|
|
} else {
|
2022-08-19 10:46:24 +08:00
|
|
|
|
return this.networkSearchUrl.curUrl
|
2022-08-05 15:46:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
handleQueryParams (extraParams) {
|
|
|
|
|
|
let queryType = ''
|
|
|
|
|
|
const name = this.$store.getters.getBreadcrumbColumnName
|
|
|
|
|
|
let tabList = this.$store.getters.getNetworkOverviewTabList
|
|
|
|
|
|
if (tabList.length === 0 || !tabList) {
|
2022-08-19 10:46:24 +08:00
|
|
|
|
tabList = this.$_.cloneDeep(this.networkTabList)
|
2022-08-05 15:46:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const curOperationType = this.$store.getters.getTabOperationType
|
|
|
|
|
|
if (curOperationType === operationType.fourthMenu) { // 点击的为第四级菜单
|
|
|
|
|
|
const tabCheckedGroup = []
|
|
|
|
|
|
tabList.forEach(item => {
|
|
|
|
|
|
if (item.checked) {
|
|
|
|
|
|
tabCheckedGroup.push(item)
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
if (tabCheckedGroup && tabCheckedGroup.length > 0) {
|
|
|
|
|
|
queryType = tabCheckedGroup[0].prop
|
|
|
|
|
|
this.$store.commit('setNetworkOverviewCurrentTab', tabCheckedGroup[0])
|
|
|
|
|
|
this.customTableTitles[0].label = tabCheckedGroup[0].label
|
|
|
|
|
|
}
|
|
|
|
|
|
} else if (curOperationType === operationType.thirdMenu) { // 点击的为第三级菜单
|
2022-08-19 10:46:24 +08:00
|
|
|
|
const networkTabList = []
|
2022-08-05 15:46:31 +08:00
|
|
|
|
tabList.forEach(item => {
|
|
|
|
|
|
if (this.$t(item.label) === name) {
|
|
|
|
|
|
item.checked = true
|
|
|
|
|
|
}
|
2022-08-19 10:46:24 +08:00
|
|
|
|
networkTabList.push(item)
|
2022-08-05 15:46:31 +08:00
|
|
|
|
})
|
2022-08-19 10:46:24 +08:00
|
|
|
|
this.$store.commit('setNetworkOverviewTabList', networkTabList)
|
2022-08-05 15:46:31 +08:00
|
|
|
|
|
|
|
|
|
|
const breadcrumbColumnNameUrl = tabList.filter(item => this.$t(item.label) === name)
|
|
|
|
|
|
if (breadcrumbColumnNameUrl && breadcrumbColumnNameUrl.length > 0) {
|
|
|
|
|
|
queryType = breadcrumbColumnNameUrl[0].prop
|
|
|
|
|
|
this.$store.commit('setNetworkOverviewCurrentTab', breadcrumbColumnNameUrl[0])
|
|
|
|
|
|
this.customTableTitles[0].label = breadcrumbColumnNameUrl[0].label
|
|
|
|
|
|
}
|
|
|
|
|
|
} else if (curOperationType === operationType.changeTab) { // 切换tab
|
|
|
|
|
|
let curTab = this.$store.getters.getNetworkOverviewCurrentTab
|
|
|
|
|
|
if (!curTab) {
|
|
|
|
|
|
const list = this.$store.getters.getNetworkOverviewTabList
|
|
|
|
|
|
const tabObjGroup = list.filter(item => item.checked)
|
|
|
|
|
|
if (tabObjGroup && tabObjGroup.length > 0) {
|
|
|
|
|
|
curTab = tabObjGroup[0]
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (curTab) {
|
|
|
|
|
|
queryType = curTab.prop
|
|
|
|
|
|
this.customTableTitles[0].label = curTab.label
|
|
|
|
|
|
this.$store.commit('setNetworkOverviewCurrentTab', curTab)
|
|
|
|
|
|
}
|
|
|
|
|
|
} else if (curOperationType === operationType.secondMenu) { // 点击第二级菜单,点击菜单
|
2022-08-19 10:46:24 +08:00
|
|
|
|
const list = this.$_.cloneDeep(this.networkTabList)
|
2022-08-05 15:46:31 +08:00
|
|
|
|
const tabObjGroup = list.filter(item => item.checked)
|
|
|
|
|
|
if (tabObjGroup && tabObjGroup.length > 0) {
|
|
|
|
|
|
const curTab = tabObjGroup[0]
|
|
|
|
|
|
queryType = curTab.prop
|
|
|
|
|
|
this.customTableTitles[0].label = curTab.label
|
|
|
|
|
|
this.$store.commit('setNetworkOverviewCurrentTab', curTab)
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
let curTab = this.$store.getters.getNetworkOverviewCurrentTab
|
|
|
|
|
|
if (!curTab) {
|
|
|
|
|
|
let list = this.$store.getters.getNetworkOverviewTabList
|
|
|
|
|
|
if (list.length === 0 || !list) {
|
2022-08-19 10:46:24 +08:00
|
|
|
|
list = this.$_.cloneDeep(this.networkTabList)
|
2022-08-05 15:46:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
const tabObjGroup = list.filter(item => item.checked)
|
|
|
|
|
|
if (tabObjGroup && tabObjGroup.length > 0) {
|
|
|
|
|
|
curTab = tabObjGroup[0]
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (curTab) {
|
|
|
|
|
|
queryType = curTab.prop
|
|
|
|
|
|
this.customTableTitles[0].label = curTab.label
|
|
|
|
|
|
this.$store.commit('setNetworkOverviewCurrentTab', curTab)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (JSON.stringify(extraParams) === '{}') {
|
|
|
|
|
|
extraParams = {
|
2022-08-19 10:46:24 +08:00
|
|
|
|
type: queryType || this.networkTabList[0].prop,
|
2022-08-05 15:46:31 +08:00
|
|
|
|
orderBy: this.orderBy ? this.orderBy : 'bytesTotal',
|
|
|
|
|
|
limit: 10
|
|
|
|
|
|
}
|
|
|
|
|
|
const condition = this.$store.getters.getQueryCondition
|
|
|
|
|
|
if (condition) {
|
|
|
|
|
|
extraParams.q = condition
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return extraParams
|
|
|
|
|
|
},
|
|
|
|
|
|
gerCycleUrl () {
|
|
|
|
|
|
const condition = this.$store.getters.getQueryCondition
|
|
|
|
|
|
if (condition) {
|
2022-08-19 10:46:24 +08:00
|
|
|
|
return this.networkSearchUrl.drilldownCycleUrl
|
2022-08-05 15:46:31 +08:00
|
|
|
|
} else {
|
2022-08-19 10:46:24 +08:00
|
|
|
|
return this.networkSearchUrl.cycleUrl
|
2022-08-05 15:46:31 +08:00
|
|
|
|
}
|
2022-07-12 17:17:38 +08:00
|
|
|
|
},
|
2022-07-22 18:22:00 +08:00
|
|
|
|
handleCustomizeClick (tab) {
|
|
|
|
|
|
this.activeCustomize = tab.paneName
|
|
|
|
|
|
},
|
2022-07-12 17:17:38 +08:00
|
|
|
|
tableCellStyle ({ row, column, rowIndex, columnIndex }) {
|
2022-07-14 17:46:06 +08:00
|
|
|
|
let style = 'border-right:0px;font-size:12px;padding:7px 0 !important;border-bottom: 1px solid #ECECEC;'
|
2022-07-12 17:17:38 +08:00
|
|
|
|
if (rowIndex === this.tableData.length - 1) {
|
2022-08-05 15:46:31 +08:00
|
|
|
|
// style = style + 'border-bottom:0px !important;'
|
2022-07-12 17:17:38 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (columnIndex === 0) {
|
2022-07-14 17:46:06 +08:00
|
|
|
|
style = style + 'color:#046ECA;'
|
2022-07-12 17:17:38 +08:00
|
|
|
|
}
|
|
|
|
|
|
return style
|
|
|
|
|
|
},
|
|
|
|
|
|
tableHeaderCellStyle ({ row, column, rowIndex, columnIndex }) {
|
2022-07-14 17:46:06 +08:00
|
|
|
|
return 'border-right:0px;font-size:12px;font-weight:500;padding:4px 0 !important;border-bottom: 1px solid #E2E5EC;'
|
2022-08-05 15:46:31 +08:00
|
|
|
|
},
|
|
|
|
|
|
getCurTab () {
|
|
|
|
|
|
let curTab = this.$store.getters.getNetworkOverviewCurrentTab
|
|
|
|
|
|
if (!curTab) {
|
|
|
|
|
|
const tabObjGroup = this.list.filter(item => item.checked)
|
|
|
|
|
|
if (tabObjGroup && tabObjGroup.length > 0) {
|
|
|
|
|
|
curTab = tabObjGroup[0]
|
|
|
|
|
|
} else {
|
2022-08-19 10:46:24 +08:00
|
|
|
|
curTab = this.networkTabList[0]
|
2022-08-05 15:46:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
this.$store.commit('setNetworkOverviewCurrentTab', curTab)
|
|
|
|
|
|
}
|
|
|
|
|
|
return curTab
|
2022-07-12 17:17:38 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2022-07-20 19:47:53 +08:00
|
|
|
|
mounted () {
|
2022-08-08 20:54:35 +08:00
|
|
|
|
if (this.chart.params && this.chart.params.drillDown) {
|
2022-08-05 16:42:01 +08:00
|
|
|
|
this.drillDown = this.chart.params.drillDown
|
|
|
|
|
|
}
|
2022-08-19 10:46:24 +08:00
|
|
|
|
//当前表格相关数据初始化
|
|
|
|
|
|
this.tableType = this.chart.params?this.chart.params.name:'networkOverview'
|
|
|
|
|
|
this.curTable = networkTable[this.tableType]?networkTable[this.tableType]:networkTable[0]
|
|
|
|
|
|
this.hasMetricSearch = this.curTable.hasMetricSearch
|
|
|
|
|
|
this.customTableTitles = this.$_.cloneDeep(this.curTable.column)
|
|
|
|
|
|
this.list = this.$_.cloneDeep(this.curTable.tabList)
|
|
|
|
|
|
this.networkTabList = this.curTable.tabList
|
|
|
|
|
|
this.activeTab = this.networkTabList[0].label
|
|
|
|
|
|
this.activeCustomize = ref('tabs')
|
|
|
|
|
|
this.networkSearchUrl = this.curTable.url
|
2022-08-05 16:42:01 +08:00
|
|
|
|
|
2022-08-05 15:46:31 +08:00
|
|
|
|
if (this.$store.getters.getNetworkOverviewTabList.length > 0) {
|
|
|
|
|
|
this.list = this.$store.getters.getNetworkOverviewTabList
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.$store.commit('setNetworkOverviewTabList', this.list)
|
|
|
|
|
|
}
|
|
|
|
|
|
const curOperationType = this.$store.getters.getTabOperationType
|
|
|
|
|
|
if (curOperationType === operationType.thirdMenu) { // 点击的为第三级菜单
|
|
|
|
|
|
const curTab = this.getCurTab()
|
|
|
|
|
|
this.customTableTitles[0].label = curTab.label
|
|
|
|
|
|
this.showTabs = false
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.list.forEach(item => {
|
|
|
|
|
|
const tabDom = document.getElementById('tab-' + item.label)
|
|
|
|
|
|
const paneDom = document.getElementById('pane-' + item.label)
|
|
|
|
|
|
if (tabDom) {
|
|
|
|
|
|
tabDom.style.display = 'none'
|
|
|
|
|
|
}
|
|
|
|
|
|
if (paneDom) {
|
|
|
|
|
|
if (curTab.label === item.label) {
|
|
|
|
|
|
paneDom.style.display = ''
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2022-07-20 19:47:53 +08:00
|
|
|
|
},
|
2022-08-19 10:46:24 +08:00
|
|
|
|
setup (props) {},
|
2022-08-05 15:46:31 +08:00
|
|
|
|
destroyed () {
|
2022-08-19 10:46:24 +08:00
|
|
|
|
this.$store.commit('setNetworkOverviewTabList', this.list)//保存状态
|
2022-07-12 17:17:38 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|