2022-07-12 17:17:38 +08:00
|
|
|
|
<template>
|
2022-11-09 15:22:09 +08:00
|
|
|
|
<div class="tabs" :style="showCustomizeTabs ? (tableData.length > 10 && showRecordNum === 10 ? 'height: calc(100% - 36px);'
|
2022-08-30 09:34:38 +08:00
|
|
|
|
: 'height: calc(100% - 2px)')
|
2022-11-09 15:22:09 +08:00
|
|
|
|
: (tableData.length > 10 && showRecordNum === 10 ? 'height: calc(100% - 77px);'
|
2022-08-30 17:37:21 +08:00
|
|
|
|
: 'height: calc(100% - 26px);')">
|
2022-07-12 17:17:38 +08:00
|
|
|
|
<el-tabs v-model="activeTab"
|
2022-09-16 17:46:20 +08:00
|
|
|
|
:class="showCustomizeTabs?'cn-chart__tabs':'tab-hide cn-chart__tabs cn-chart__tabs-hide-tab'"
|
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"
|
2022-09-16 17:46:20 +08:00
|
|
|
|
:key="tab.label"
|
2022-08-08 20:54:35 +08:00
|
|
|
|
:ref="`chart-tab-${index}`"
|
|
|
|
|
|
class="tab-pane"
|
2022-09-16 17:46:20 +08:00
|
|
|
|
><!-- key原来设置的值为index,导致自定义拖拽时,选中tab下方的蓝色线不随着拖拽移动,key修改为label后,此问题消失 -->
|
2022-08-08 20:54:35 +08:00
|
|
|
|
<template #label>
|
|
|
|
|
|
{{$t(tab.label)}}
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<el-table
|
|
|
|
|
|
:id="`tabTable_${index}`"
|
2022-09-16 17:46:20 +08:00
|
|
|
|
:ref="`dataTable_${tab.prop}`"
|
2022-08-26 16:26:31 +08:00
|
|
|
|
:data="tableData.slice(0,showRecordNum)"
|
2022-08-08 20:54:35 +08:00
|
|
|
|
border
|
|
|
|
|
|
:cell-style="tableCellStyle"
|
|
|
|
|
|
:header-cell-style="tableHeaderCellStyle"
|
2022-08-30 09:34:38 +08:00
|
|
|
|
:class="tableClass"
|
2022-08-08 20:54:35 +08:00
|
|
|
|
height="100%"
|
2022-08-22 19:54:41 +08:00
|
|
|
|
empty-text=" "
|
2022-09-16 17:46:20 +08:00
|
|
|
|
@sort-change="((column) => {sortChange(column,tab.prop)})"
|
2022-09-06 08:45:26 +08:00
|
|
|
|
:key="index"
|
2022-08-08 20:54:35 +08:00
|
|
|
|
>
|
2022-10-07 21:04:08 +08:00
|
|
|
|
<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"
|
2022-12-01 16:11:21 +08:00
|
|
|
|
:sortable="item.showError ? false : sortable(item)"
|
2022-08-26 16:26:31 +08:00
|
|
|
|
align="center"
|
|
|
|
|
|
:prop="item.prop"
|
2022-08-08 20:54:35 +08:00
|
|
|
|
class="data-column"
|
2022-09-06 08:45:26 +08:00
|
|
|
|
:ref="item.prop"
|
2022-10-07 21:04:08 +08:00
|
|
|
|
:key="index"
|
2022-08-08 20:54:35 +08:00
|
|
|
|
>
|
2022-09-06 08:45:26 +08:00
|
|
|
|
<template #header >
|
|
|
|
|
|
<span class="data-column__span" >{{$t(item.label)}}</span>
|
2022-12-01 16:11:21 +08:00
|
|
|
|
<chart-error v-if="item.showError" tooltip :content="item.errorMsg" width="300" />
|
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" >
|
2022-08-26 16:26:31 +08:00
|
|
|
|
<div class="data-value">
|
2022-10-12 11:11:22 +08:00
|
|
|
|
<template v-if="showUnit && item.unit">
|
|
|
|
|
|
{{scope.row[item.prop]?((scope.row[item.prop][0]||scope.row[item.prop][0]===0)? unitConvert(scope.row[item.prop][0], item.unit).join(' ') : '-'):'' }}
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template v-else>
|
|
|
|
|
|
{{scope.row[item.prop]?((scope.row[item.prop][0]||scope.row[item.prop][0]===0)? unitConvert(scope.row[item.prop][0], unitTypes.number).join(' ') : '-'):'' }}
|
|
|
|
|
|
</template>
|
2022-08-26 16:26:31 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="data-trend">
|
|
|
|
|
|
<template v-if="scope.row[item.prop]">
|
|
|
|
|
|
<div v-if="scope.row[item.prop][1] === 'up'" class="data-total-trend data-total-trend-red">
|
|
|
|
|
|
<i class="cn-icon-rise1 cn-icon"></i><span>{{scope.row[item.prop][2]}}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div v-else-if="scope.row[item.prop][1] === 'down'" class="data-total-trend data-total-trend-green">
|
|
|
|
|
|
<i class="cn-icon-decline cn-icon"></i><span>{{scope.row[item.prop][2]}}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div v-else-if="scope.row[item.prop][1] === 'noChange'" class="data-total-trend data-total-trend-black">
|
|
|
|
|
|
<i class="cn-icon-constant cn-icon"></i>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template v-else>
|
|
|
|
|
|
-
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</div>
|
2022-08-08 20:54:35 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
2022-08-19 10:46:24 +08:00
|
|
|
|
<template v-else-if="item.columnType === tableColumnType.dillDown" >
|
2022-11-04 12:18:26 +08:00
|
|
|
|
<div v-if="isOnlyRead" >
|
|
|
|
|
|
<template v-if="tableType === fromRoute.dnsServiceInsights && isDnsMapType">
|
|
|
|
|
|
{{dnsMapData.get(scope.row['tab'])}}
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template v-else>
|
|
|
|
|
|
{{scope.row['tab']}}
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div v-else class="data-click" @click="handleTabValue(item.name,scope.row['tab'])">
|
2022-11-09 15:22:09 +08:00
|
|
|
|
<template v-if="tableType === fromRoute.dnsServiceInsights && isDnsMapType">
|
2022-11-04 12:18:26 +08:00
|
|
|
|
{{dnsMapData.get(scope.row['tab'])}}
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template v-else>
|
|
|
|
|
|
{{scope.row['tab']}}
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</div>
|
2022-08-08 20:54:35 +08:00
|
|
|
|
</template>
|
2022-10-09 08:24:07 +08:00
|
|
|
|
<template v-else-if="item.columnType === tableColumnType.percent" >
|
|
|
|
|
|
<div class="dns-in-ex">
|
2022-10-12 11:11:22 +08:00
|
|
|
|
<div class="dns-percent-pic">
|
2022-10-09 20:43:45 +08:00
|
|
|
|
<div v-if="scope.row[item.prop][0] !== false" class="div-green" id="green" :style="`width:${scope.row[item.prop][0]}`"></div>
|
|
|
|
|
|
<div v-if="scope.row[item.prop][0] !== false" class="div-yellow" id="yellow" :style="`width:${scope.row[item.prop][1]}`"></div>
|
2022-10-09 08:24:07 +08:00
|
|
|
|
</div>
|
2022-10-12 11:11:22 +08:00
|
|
|
|
<div class="dns-percent">{{scope.row[item.prop][2]}}</div>
|
2022-10-09 08:24:07 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
2022-08-24 16:50:18 +08:00
|
|
|
|
<template v-else-if="item.prop === 'score'" >
|
2022-11-02 16:26:31 +08:00
|
|
|
|
<div class="score-cell">
|
|
|
|
|
|
<div v-if="scope.row.score <= 2" class="data-score data-score-red" >
|
|
|
|
|
|
{{scope.row[item.prop] ? unitConvert(scope.row[item.prop], unitTypes.number).join(' ') : '0'}}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div v-else-if="scope.row.score <= 4" class="data-score data-score-yellow" >
|
|
|
|
|
|
{{scope.row[item.prop] ? unitConvert(scope.row[item.prop], unitTypes.number).join(' ') : '0'}}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div v-else-if="scope.row.score <= 6" class="data-score data-score-green" >
|
|
|
|
|
|
{{scope.row[item.prop] ? unitConvert(scope.row[item.prop], unitTypes.number).join(' ') : '0'}}
|
|
|
|
|
|
</div>
|
2022-11-01 10:33:23 +08:00
|
|
|
|
</div>
|
2022-08-24 16:50:18 +08:00
|
|
|
|
</template>
|
2022-08-08 20:54:35 +08:00
|
|
|
|
<template v-else>
|
2022-10-12 11:11:22 +08:00
|
|
|
|
<template v-if="showUnit && item.unit">
|
2022-10-21 10:08:49 +08:00
|
|
|
|
{{(scope.row[item.prop] || scope.row[item.prop]===0) ? unitConvert(scope.row[item.prop], item.unit).join(' ') : '-'}}
|
2022-10-12 11:11:22 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
<template v-else>
|
2022-10-21 10:08:49 +08:00
|
|
|
|
{{(scope.row[item.prop] || scope.row[item.prop]===0)? unitConvert(scope.row[item.prop], unitTypes.number).join(' ') : '-'}}
|
2022-10-12 11:11:22 +08:00
|
|
|
|
</template>
|
2022-08-08 20:54:35 +08:00
|
|
|
|
</template>
|
2022-08-05 15:46:31 +08:00
|
|
|
|
</template>
|
2022-08-08 20:54:35 +08:00
|
|
|
|
</el-table-column>
|
|
|
|
|
|
</template>
|
2022-12-01 16:11:21 +08:00
|
|
|
|
<template v-slot:empty >
|
|
|
|
|
|
<chart-error v-if="showError" :content="errorMsg" />
|
|
|
|
|
|
<div class="table-no-data" v-else-if="isNoData">
|
2022-08-24 16:50:18 +08:00
|
|
|
|
<div class="table-no-data__title">{{ $t('npm.noData') }}</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
2022-08-08 20:54:35 +08:00
|
|
|
|
</el-table>
|
|
|
|
|
|
</el-tab-pane>
|
2022-07-12 17:17:38 +08:00
|
|
|
|
|
2022-08-26 16:26:31 +08:00
|
|
|
|
</template>
|
2022-07-12 17:17:38 +08:00
|
|
|
|
</el-tabs>
|
2022-08-19 10:46:24 +08:00
|
|
|
|
<div class="tab-search" >
|
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"
|
|
|
|
|
|
>
|
2022-09-16 17:46:20 +08:00
|
|
|
|
<el-tab-pane :label="$t('network.tabs')" name="tabs" width="50%" v-if="showCustomizeTabs" >
|
2022-08-08 20:54:35 +08:00
|
|
|
|
<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>
|
2022-11-14 14:35:14 +08:00
|
|
|
|
<el-tab-pane :label="tableType==='networkOverview'?$t('network.direction'):$t('network.metrics')" name="metrics" width="50%" >
|
2022-08-08 20:54:35 +08:00
|
|
|
|
<transition-group name="dragMetric" class="list" tag="ul" ref="metric">
|
2022-09-23 19:01:30 +08:00
|
|
|
|
<template v-for="(item, index) in customTableTitles" :key="item.label">
|
|
|
|
|
|
<li v-if="index>0"
|
2022-10-02 16:21:39 +08:00
|
|
|
|
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-09-23 19:01:30 +08:00
|
|
|
|
></i> <el-checkbox @change="metricChange" :disabled="item.disabled" 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>
|
|
|
|
|
|
</div>
|
2022-08-30 09:34:38 +08:00
|
|
|
|
<div class="fixed-row" v-if="tableData.length > 10 && showRecordNum===10 ">
|
|
|
|
|
|
<div class="fixed-button" @click="showMore" >{{$t('network.showTop50Results')}}</div>
|
2022-08-26 16:26:31 +08:00
|
|
|
|
</div>
|
2022-07-12 17:17:38 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
|
|
|
import { ref } from 'vue'
|
2022-11-09 15:22:09 +08:00
|
|
|
|
import { operationType, unitTypes, networkTable, tableColumnType, networkDefaultLimit, curTabState, storageKey, dbDrilldownTableConfig, fromRoute } 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-12-08 16:09:46 +08:00
|
|
|
|
import { getChainRatio, computeScore, urlParamsHandler, overwriteUrl, readDrilldownTableConfigByUser, combinDrilldownTableWithUserConfig, getDnsMapData, handleSpecialValue, getConfigVersion } from '@/utils/tools'
|
2022-08-24 07:29:40 +08:00
|
|
|
|
import { getSecond } from '@/utils/date-util'
|
2022-08-22 09:57:40 +08:00
|
|
|
|
import chartMixin from '@/views/charts2/chart-mixin'
|
2022-09-30 07:35:09 +08:00
|
|
|
|
import { db } from '@/indexedDB'
|
2022-12-08 16:09:46 +08:00
|
|
|
|
import _ from 'lodash'
|
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-11-01 09:12:14 +08:00
|
|
|
|
orderBy: 'totalBytes',
|
2022-08-05 15:46:31 +08:00
|
|
|
|
tab: 'ip',
|
2022-08-08 20:54:35 +08:00
|
|
|
|
unitConvert,
|
|
|
|
|
|
unitTypes,
|
2022-08-24 16:50:18 +08:00
|
|
|
|
networkTable,
|
|
|
|
|
|
isNoData: false,
|
2022-09-23 19:01:30 +08:00
|
|
|
|
customTableTitlesForTab: [],
|
2022-08-19 10:46:24 +08:00
|
|
|
|
customTableTitles: [],
|
2022-09-23 19:01:30 +08:00
|
|
|
|
commonTabList: [],
|
|
|
|
|
|
commonColumnList: [],
|
2022-11-01 09:12:14 +08:00
|
|
|
|
tables: [],
|
2022-08-24 07:29:40 +08:00
|
|
|
|
list: [], // 当前状态列表
|
2022-09-23 19:01:30 +08:00
|
|
|
|
allList: [], // 包含2级标签的所有状态的列表
|
2022-08-24 07:29:40 +08:00
|
|
|
|
networkTabList: [], // 原始状态列表
|
2022-08-05 15:46:31 +08:00
|
|
|
|
showBackground: false,
|
|
|
|
|
|
tableData: [],
|
2022-09-05 16:00:42 +08:00
|
|
|
|
tableDataBackup: [],
|
2022-08-26 16:26:31 +08:00
|
|
|
|
showRecordNum: 10,
|
2022-09-16 17:46:20 +08:00
|
|
|
|
showCustomizeTabs: true,
|
2022-08-24 07:29:40 +08:00
|
|
|
|
columnNameGroup: {},
|
|
|
|
|
|
cycleColumnNameGroup: {},
|
2022-09-23 19:01:30 +08:00
|
|
|
|
// metricUnit: 'bytes',
|
2022-08-26 16:26:31 +08:00
|
|
|
|
// loading: false,
|
2022-08-24 07:29:40 +08:00
|
|
|
|
tableColumnType: tableColumnType,
|
2022-09-23 19:01:30 +08:00
|
|
|
|
metricsList: [],
|
2022-09-16 17:46:20 +08:00
|
|
|
|
curTabState: curTabState,
|
2022-08-24 07:29:40 +08:00
|
|
|
|
curTable: {}, // 当前的表格类型
|
2022-10-09 19:58:30 +08:00
|
|
|
|
isOnlyRead: false,
|
2022-09-23 19:01:30 +08:00
|
|
|
|
curTableInCode: {}, // 代码中的配置
|
2022-08-24 07:29:40 +08:00
|
|
|
|
tableType: '',
|
2022-09-30 07:35:09 +08:00
|
|
|
|
userId: null,
|
|
|
|
|
|
drillDownTableConfigs: [],
|
2022-08-24 07:29:40 +08:00
|
|
|
|
activeTab: '',
|
|
|
|
|
|
activeCustomize: '',
|
2022-09-06 08:45:26 +08:00
|
|
|
|
networkSearchUrl: {},
|
|
|
|
|
|
column: {},
|
2022-09-16 17:46:20 +08:00
|
|
|
|
index: 0,
|
|
|
|
|
|
chartData: [],
|
2022-11-09 15:22:09 +08:00
|
|
|
|
dnsMapData: new Map(),
|
|
|
|
|
|
dnsQtypeMapData: new Map(),
|
|
|
|
|
|
dnsRcodeMapData: new Map(),
|
|
|
|
|
|
isDnsMapType: false,
|
2022-09-16 17:46:20 +08:00
|
|
|
|
tableSortColumn: '',
|
|
|
|
|
|
tableSortType: '',
|
2022-10-02 16:21:39 +08:00
|
|
|
|
tableSortTab: '',
|
2022-10-12 11:11:22 +08:00
|
|
|
|
urlChangeParams: {},
|
2022-11-04 12:18:26 +08:00
|
|
|
|
showUnit: false,
|
2022-12-01 16:11:21 +08:00
|
|
|
|
fromRoute: fromRoute,
|
|
|
|
|
|
showError: false,
|
|
|
|
|
|
errorMsg: ''
|
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: {
|
|
|
|
|
|
timeFilter: Object,
|
2022-11-01 09:12:14 +08:00
|
|
|
|
chart: Object,
|
|
|
|
|
|
metric: {
|
|
|
|
|
|
type: String,
|
|
|
|
|
|
default: 'Bits/s'
|
|
|
|
|
|
}
|
2022-08-05 15:46:31 +08:00
|
|
|
|
},
|
|
|
|
|
|
watch: {
|
2022-08-24 11:54:09 +08:00
|
|
|
|
timeFilter: {
|
|
|
|
|
|
handler (n) {
|
2022-10-13 16:14:15 +08:00
|
|
|
|
// console.log('watch')
|
2022-08-24 11:54:09 +08:00
|
|
|
|
const curTab = this.getCurTab()
|
|
|
|
|
|
let queryParams = {
|
|
|
|
|
|
orderBy: this.orderBy,
|
2022-08-26 16:26:31 +08:00
|
|
|
|
limit: networkDefaultLimit,
|
2022-08-24 11:54:09 +08:00
|
|
|
|
type: curTab.prop
|
|
|
|
|
|
}
|
2022-09-23 19:01:30 +08:00
|
|
|
|
const condition = this.getQueryCondition()
|
2022-08-24 11:54:09 +08:00
|
|
|
|
if (condition) {
|
|
|
|
|
|
queryParams = {
|
|
|
|
|
|
orderBy: this.orderBy,
|
2022-08-26 16:26:31 +08:00
|
|
|
|
limit: networkDefaultLimit,
|
2022-08-24 11:54:09 +08:00
|
|
|
|
type: curTab.prop,
|
|
|
|
|
|
q: condition
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-10-02 16:21:39 +08:00
|
|
|
|
this.changeUrlTabState()
|
2022-09-16 17:46:20 +08:00
|
|
|
|
this.getChartData(queryParams)
|
2022-08-24 11:54:09 +08:00
|
|
|
|
}
|
2022-11-02 16:26:31 +08:00
|
|
|
|
},
|
|
|
|
|
|
metric (n) {
|
|
|
|
|
|
this.changeMetric()
|
2022-08-05 15:46:31 +08:00
|
|
|
|
}
|
2022-07-12 17:17:38 +08:00
|
|
|
|
},
|
2022-08-30 09:34:38 +08:00
|
|
|
|
computed: {
|
|
|
|
|
|
tableClass () {
|
|
|
|
|
|
let className
|
|
|
|
|
|
if (this.showRecordNum >= 10) {
|
|
|
|
|
|
className = 'tab-table__average'
|
|
|
|
|
|
} else {
|
|
|
|
|
|
className = 'tab-table'
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!(this.tableData.length > 10 && this.showRecordNum === 10)) {
|
|
|
|
|
|
className = 'tab-table tab-table__no-bottom'
|
|
|
|
|
|
}
|
|
|
|
|
|
return className
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2022-08-22 09:57:40 +08:00
|
|
|
|
mixins: [chartMixin],
|
2022-07-12 17:17:38 +08:00
|
|
|
|
methods: {
|
2022-09-16 17:46:20 +08:00
|
|
|
|
/* 参数 extraParams 额外请求参数 */
|
|
|
|
|
|
getChartData (extraParams = {}) {
|
2022-10-11 17:08:25 +08:00
|
|
|
|
this.initState()
|
|
|
|
|
|
const queryParams = {
|
|
|
|
|
|
...this.handleQueryParams(extraParams),
|
|
|
|
|
|
startTime: getSecond(this.timeFilter.startTime),
|
|
|
|
|
|
endTime: getSecond(this.timeFilter.endTime)
|
|
|
|
|
|
}
|
|
|
|
|
|
const requestUrl = this.getCurUrl()
|
|
|
|
|
|
get(requestUrl, queryParams).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
2022-12-01 16:11:21 +08:00
|
|
|
|
this.showError = false
|
|
|
|
|
|
this.errorMsg = ''
|
2022-10-11 17:08:25 +08:00
|
|
|
|
this.chartData = response.data.result
|
|
|
|
|
|
this.initData()
|
|
|
|
|
|
} else {
|
2022-12-01 16:11:21 +08:00
|
|
|
|
this.showError = true
|
2022-12-05 16:57:44 +08:00
|
|
|
|
this.errorMsg = response.message || 'Unknown'
|
2022-10-11 17:08:25 +08:00
|
|
|
|
this.isNoData = true
|
|
|
|
|
|
this.toggleLoading(false)
|
2022-08-05 15:46:31 +08:00
|
|
|
|
}
|
2022-10-11 17:08:25 +08:00
|
|
|
|
}).catch(e => {
|
2022-09-16 17:46:20 +08:00
|
|
|
|
console.error(e)
|
2022-12-01 16:11:21 +08:00
|
|
|
|
this.showError = true
|
2022-12-05 16:57:44 +08:00
|
|
|
|
this.errorMsg = e.message || 'Unknown'
|
2022-10-11 17:08:25 +08:00
|
|
|
|
}).finally(() => {
|
2022-10-02 16:21:39 +08:00
|
|
|
|
this.changeUrlTabState()
|
2022-10-09 08:24:07 +08:00
|
|
|
|
this.toggleLoading(false)
|
2022-10-11 17:08:25 +08:00
|
|
|
|
})
|
2022-07-22 18:22:00 +08:00
|
|
|
|
},
|
2022-10-07 21:04:08 +08:00
|
|
|
|
sortable (title) {
|
|
|
|
|
|
const excludeName = ['queriesFromIE']
|
|
|
|
|
|
return excludeName.indexOf(title.name) > -1 ? false : 'custom'
|
|
|
|
|
|
},
|
2022-11-02 16:26:31 +08:00
|
|
|
|
// 切换metric:bit、packet、session
|
|
|
|
|
|
changeMetric () {
|
|
|
|
|
|
this.tableData = []
|
|
|
|
|
|
this.tableDataBackup = []
|
|
|
|
|
|
this.setShowNum(10)
|
|
|
|
|
|
const beforeType = this.getUrlParam(this.curTabState.tabOperationBeforeType, '', true)
|
|
|
|
|
|
if (beforeType && beforeType != operationType.thirdMenu) {
|
|
|
|
|
|
this.urlChangeParams[this.curTabState.tabOperationBeforeType] = this.getUrlParam(this.curTabState.tabOperationType, '', true)
|
|
|
|
|
|
}
|
|
|
|
|
|
this.urlChangeParams[this.curTabState.tabOperationType] = operationType.changeMetric
|
|
|
|
|
|
this.urlChangeParams[this.curTabState.tableMetric] = this.metric
|
|
|
|
|
|
|
|
|
|
|
|
const curTab = this.getCurTab()
|
|
|
|
|
|
this.initMetric()
|
2022-12-09 14:46:08 +08:00
|
|
|
|
this.combineColumnList(curTab.name)
|
2022-11-02 16:26:31 +08:00
|
|
|
|
|
|
|
|
|
|
let queryParams = {
|
|
|
|
|
|
orderBy: this.orderBy,
|
|
|
|
|
|
limit: networkDefaultLimit,
|
|
|
|
|
|
type: curTab.prop
|
|
|
|
|
|
}
|
|
|
|
|
|
const condition = this.getQueryCondition()
|
|
|
|
|
|
if (condition) {
|
|
|
|
|
|
queryParams = {
|
|
|
|
|
|
orderBy: this.orderBy,
|
|
|
|
|
|
limit: networkDefaultLimit,
|
|
|
|
|
|
type: curTab.prop,
|
|
|
|
|
|
q: condition
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
this.changeUrlTabState()
|
|
|
|
|
|
this.getChartData(queryParams)
|
|
|
|
|
|
},
|
2022-09-16 17:46:20 +08:00
|
|
|
|
cancleSortArrow () {
|
2022-09-06 08:45:26 +08:00
|
|
|
|
// 取消表格排序高亮的箭头
|
|
|
|
|
|
if (this.column.prop) {
|
2022-09-30 07:35:09 +08:00
|
|
|
|
// const table = this.$refs['dataTable_' + this.index]
|
2022-09-16 17:46:20 +08:00
|
|
|
|
const tableHeaer = this.$refs['dataTable_' + this.index]
|
|
|
|
|
|
? (Array.isArray(this.$refs['dataTable_' + this.index])
|
|
|
|
|
|
? this.$refs['dataTable_' + this.index][0].$refs.tableHeader
|
|
|
|
|
|
: this.$refs['dataTable_' + this.index].$refs.tableHeader)
|
|
|
|
|
|
: []
|
2022-09-06 17:20:16 +08:00
|
|
|
|
const columns = tableHeaer.columns
|
2022-09-16 17:46:20 +08:00
|
|
|
|
if (columns) {
|
2022-09-06 17:20:16 +08:00
|
|
|
|
columns.forEach(item => {
|
|
|
|
|
|
item.order = ''
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2022-09-06 08:45:26 +08:00
|
|
|
|
this.column = {}
|
|
|
|
|
|
this.index = 0
|
|
|
|
|
|
}
|
2022-09-16 17:46:20 +08:00
|
|
|
|
},
|
2022-09-23 19:01:30 +08:00
|
|
|
|
isThirdMenu () { // 当前是否为3级
|
2022-10-12 11:11:22 +08:00
|
|
|
|
if (this.isOnlyRead) {
|
2022-10-09 19:58:30 +08:00
|
|
|
|
return false
|
2022-10-12 11:11:22 +08:00
|
|
|
|
} else {
|
2022-10-09 19:58:30 +08:00
|
|
|
|
const thirdMenu = this.getUrlParam(this.curTabState.thirdMenu, '')
|
|
|
|
|
|
const fourthMenu = this.getUrlParam(this.curTabState.fourthMenu, '')
|
|
|
|
|
|
return thirdMenu && !fourthMenu
|
|
|
|
|
|
}
|
2022-09-23 19:01:30 +08:00
|
|
|
|
},
|
|
|
|
|
|
isFourthMenu () { // 当前是否为4级
|
2022-10-12 11:11:22 +08:00
|
|
|
|
if (this.isOnlyRead) {
|
2022-10-09 19:58:30 +08:00
|
|
|
|
return false
|
2022-10-12 11:11:22 +08:00
|
|
|
|
} else {
|
2022-10-09 19:58:30 +08:00
|
|
|
|
const thirdMenu = this.getUrlParam(this.curTabState.thirdMenu, '')
|
|
|
|
|
|
const fourthMenu = this.getUrlParam(this.curTabState.fourthMenu, '')
|
|
|
|
|
|
return thirdMenu && fourthMenu
|
|
|
|
|
|
}
|
2022-09-23 19:01:30 +08:00
|
|
|
|
},
|
2022-09-16 17:46:20 +08:00
|
|
|
|
initState () {
|
2022-10-13 16:14:15 +08:00
|
|
|
|
// console.log('InitState:开始')
|
2022-09-20 11:44:39 +08:00
|
|
|
|
let curTab = this.getCurTab()
|
2022-09-23 19:01:30 +08:00
|
|
|
|
if (curTab) { // 显示当前tab
|
2022-11-01 09:12:14 +08:00
|
|
|
|
const realTab = this.list.find(item => item.name === curTab.name)
|
2022-09-23 19:01:30 +08:00
|
|
|
|
if (realTab) {
|
|
|
|
|
|
realTab.checked = true
|
2022-09-20 11:44:39 +08:00
|
|
|
|
}
|
2022-09-23 19:01:30 +08:00
|
|
|
|
this.showTab(curTab)
|
2022-09-16 17:46:20 +08:00
|
|
|
|
}
|
2022-09-23 19:01:30 +08:00
|
|
|
|
|
2022-09-16 17:46:20 +08:00
|
|
|
|
this.isNoData = false
|
|
|
|
|
|
this.tableData = []
|
|
|
|
|
|
this.tableDataBackup = []
|
|
|
|
|
|
this.toggleLoading(true)
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
// 取消表格排序高亮的箭头
|
|
|
|
|
|
this.cancleSortArrow()
|
|
|
|
|
|
// 设置默认排序
|
|
|
|
|
|
if (this.tableSortColumn) {
|
|
|
|
|
|
const refName = 'dataTable_' + this.tableSortTab
|
|
|
|
|
|
const table = this.$refs[refName]
|
|
|
|
|
|
const tableHeaer = table
|
|
|
|
|
|
? (Array.isArray(table)
|
|
|
|
|
|
? table[0].$refs.tableHeader
|
|
|
|
|
|
: table.$refs.tableHeader)
|
|
|
|
|
|
: []
|
|
|
|
|
|
const columns = tableHeaer.columns
|
|
|
|
|
|
if (columns) {
|
|
|
|
|
|
columns.forEach(item => {
|
|
|
|
|
|
if (item.property === this.tableSortColumn) {
|
|
|
|
|
|
item.order = this.tableSortType
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
this.sortChange({ prop: this.tableSortColumn, order: this.tableSortType }, this.tableSortTab)
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2022-09-06 08:45:26 +08:00
|
|
|
|
|
2022-08-30 16:45:13 +08:00
|
|
|
|
// 针对network overview – app list 点击标题触发下钻,相关内容处理
|
2022-09-20 09:33:49 +08:00
|
|
|
|
const thirdMenu = this.getUrlParam(this.curTabState.thirdMenu, '')
|
2022-10-09 19:58:30 +08:00
|
|
|
|
if (this.isFourthMenu()) {
|
2022-08-30 16:45:13 +08:00
|
|
|
|
this.list.forEach(item => {
|
2022-09-20 09:33:49 +08:00
|
|
|
|
if (item.label === thirdMenu) {
|
2022-10-12 11:11:22 +08:00
|
|
|
|
// item.checked = false
|
2022-08-30 16:45:13 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
2022-10-09 19:58:30 +08:00
|
|
|
|
} else if (this.isThirdMenu()) {
|
2022-09-20 09:33:49 +08:00
|
|
|
|
this.list.forEach(item => {
|
|
|
|
|
|
if (item.label === thirdMenu) {
|
|
|
|
|
|
item.checked = true
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2022-08-30 16:45:13 +08:00
|
|
|
|
}
|
2022-09-23 19:01:30 +08:00
|
|
|
|
// 选中的都进行展示
|
2022-08-05 15:46:31 +08:00
|
|
|
|
this.list.forEach(item => {
|
2022-09-20 09:33:49 +08:00
|
|
|
|
if (item.checked) {
|
|
|
|
|
|
const tabDom = document.getElementById('tab-' + item.label)
|
|
|
|
|
|
if (tabDom) {
|
|
|
|
|
|
tabDom.style.display = ''
|
|
|
|
|
|
}
|
2022-08-05 15:46:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
|
2022-09-23 19:01:30 +08:00
|
|
|
|
const curOperationType = this.getUrlParam(this.curTabState.tabOperationType, '', true)
|
|
|
|
|
|
if (this.isFourthMenu()) { // 点击的为第四级菜单
|
|
|
|
|
|
curTab = this.getCurTab()
|
|
|
|
|
|
if (curTab) {
|
2022-09-16 17:46:20 +08:00
|
|
|
|
this.showTab(curTab)
|
2022-10-02 16:21:39 +08:00
|
|
|
|
this.urlChangeParams[this.curTabState.curTab] = curTab.prop
|
2022-08-05 15:46:31 +08:00
|
|
|
|
}
|
2022-09-16 17:46:20 +08:00
|
|
|
|
this.showCustomizeTabs = true
|
2022-09-23 19:01:30 +08:00
|
|
|
|
} else if (this.isThirdMenu()) { // 点击的为第三级菜单
|
2022-09-20 09:33:49 +08:00
|
|
|
|
const name = this.getUrlParam(this.curTabState.thirdMenu, '')
|
2022-09-23 19:01:30 +08:00
|
|
|
|
// const networkTabList = []
|
2022-09-16 17:46:20 +08:00
|
|
|
|
this.list.forEach(item => {
|
2022-09-20 09:33:49 +08:00
|
|
|
|
if (item.label === name) {
|
2022-09-16 17:46:20 +08:00
|
|
|
|
item.checked = true
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2022-09-20 09:33:49 +08:00
|
|
|
|
const breadcrumbColumnTab = this.list.find(item => item.label === name)
|
2022-10-02 16:21:39 +08:00
|
|
|
|
this.urlChangeParams[this.curTabState.curTab] = breadcrumbColumnTab.prop
|
2022-09-16 17:46:20 +08:00
|
|
|
|
|
|
|
|
|
|
this.hideTabs(breadcrumbColumnTab)
|
2022-11-01 09:12:14 +08:00
|
|
|
|
this.combineColumnList(breadcrumbColumnTab.name)
|
2022-09-16 17:46:20 +08:00
|
|
|
|
this.showCustomizeTabs = false
|
2022-09-23 19:01:30 +08:00
|
|
|
|
} else if (curOperationType === operationType.changeTab) { // 切换tab
|
2022-09-16 17:46:20 +08:00
|
|
|
|
this.showCustomizeTabs = true
|
2022-10-12 11:11:22 +08:00
|
|
|
|
} else if (curOperationType === operationType.secondMenu || curOperationType === operationType.mainMenu) { // 点击的为第二级菜单、或者点击菜单进入、
|
2022-09-16 17:46:20 +08:00
|
|
|
|
if (curTab) {
|
|
|
|
|
|
this.showTab(curTab)
|
2022-10-02 16:21:39 +08:00
|
|
|
|
this.urlChangeParams[this.curTabState.curTab] = curTab.prop
|
2022-08-05 15:46:31 +08:00
|
|
|
|
}
|
2022-10-09 19:58:30 +08:00
|
|
|
|
if (this.isFourthMenu()) {
|
2022-09-20 09:33:49 +08:00
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.list.forEach(item => {
|
|
|
|
|
|
if (item.label === thirdMenu) {
|
|
|
|
|
|
item.checked = false
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
})
|
2022-10-09 19:58:30 +08:00
|
|
|
|
} else if (this.isThirdMenu()) {
|
2022-09-20 09:33:49 +08:00
|
|
|
|
this.list.forEach(item => {
|
|
|
|
|
|
if (item.label === thirdMenu) {
|
|
|
|
|
|
item.checked = true
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.hideTabs(item)
|
|
|
|
|
|
})
|
2022-11-01 09:12:14 +08:00
|
|
|
|
this.combineColumnList(item.name)
|
2022-09-20 09:33:49 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
this.activeTab = ''
|
|
|
|
|
|
}
|
|
|
|
|
|
this.list = Object.assign({}, this.list)
|
2022-09-16 17:46:20 +08:00
|
|
|
|
this.showCustomizeTabs = true
|
2022-08-05 15:46:31 +08:00
|
|
|
|
} else if (curOperationType === operationType.changeMetric) { // 切换metric
|
2022-09-23 19:01:30 +08:00
|
|
|
|
if (this.isThirdMenu()) {
|
2022-08-26 16:26:31 +08:00
|
|
|
|
this.hideTabs(curTab)
|
2022-11-01 09:12:14 +08:00
|
|
|
|
this.combineColumnList(curTab.name)
|
2022-09-16 17:46:20 +08:00
|
|
|
|
this.showCustomizeTabs = false
|
2022-08-05 15:46:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
} else if (curOperationType === operationType.customize) { // customize
|
2022-09-23 19:01:30 +08:00
|
|
|
|
if (this.isThirdMenu()) {
|
2022-08-26 16:26:31 +08:00
|
|
|
|
this.hideTabs(curTab)
|
2022-11-01 09:12:14 +08:00
|
|
|
|
this.combineColumnList(curTab.name)
|
2022-09-16 17:46:20 +08:00
|
|
|
|
this.showCustomizeTabs = false
|
2022-08-05 15:46:31 +08:00
|
|
|
|
} else {
|
2022-09-16 17:46:20 +08:00
|
|
|
|
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 = ''
|
2022-08-05 15:46:31 +08:00
|
|
|
|
}
|
2022-09-16 17:46:20 +08:00
|
|
|
|
if (paneDom) {
|
2022-11-01 09:12:14 +08:00
|
|
|
|
if (curTab.name === item.name) {
|
2022-09-16 17:46:20 +08:00
|
|
|
|
paneDom.style.display = ''
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
this.showTab(curTab)
|
|
|
|
|
|
this.showCustomizeTabs = true
|
2022-08-05 15:46:31 +08:00
|
|
|
|
})
|
|
|
|
|
|
}
|
2022-10-12 11:11:22 +08:00
|
|
|
|
} else {
|
2022-10-09 19:58:30 +08:00
|
|
|
|
this.showCustomizeTabs = true
|
2022-08-05 15:46:31 +08:00
|
|
|
|
}
|
2022-10-02 16:21:39 +08:00
|
|
|
|
this.changeUrlTabState()
|
2022-10-13 16:14:15 +08:00
|
|
|
|
// console.log('InitState: 结束')
|
2022-09-16 17:46:20 +08:00
|
|
|
|
},
|
2022-11-03 17:51:53 +08:00
|
|
|
|
async initData () {
|
2022-08-05 15:46:31 +08:00
|
|
|
|
const tabList = []
|
2022-09-16 17:46:20 +08:00
|
|
|
|
const curTab = this.getCurTab()
|
2022-08-05 15:46:31 +08:00
|
|
|
|
const tableDataTmp = this.chartData.map(item => {
|
|
|
|
|
|
tabList.push(item[curTab.prop])
|
2022-08-24 07:29:40 +08:00
|
|
|
|
const otherData = { tab: item[curTab.prop] }
|
2022-10-21 10:08:49 +08:00
|
|
|
|
otherData[curTab.prop] = item[curTab.prop]
|
2022-08-24 07:29:40 +08:00
|
|
|
|
Object.keys(this.columnNameGroup).forEach(i => {
|
2022-10-09 08:24:07 +08:00
|
|
|
|
const propName = this.columnNameGroup[i]
|
|
|
|
|
|
const column = this.customTableTitles.find(tableColumn => { return tableColumn.prop === i })
|
|
|
|
|
|
if (column && column.columnType === tableColumnType.percent) {
|
|
|
|
|
|
let sum = 0
|
|
|
|
|
|
const propGroup = propName.split(',')
|
|
|
|
|
|
propGroup.forEach(prop => {
|
|
|
|
|
|
sum = sum + Number(item[prop])
|
|
|
|
|
|
})
|
|
|
|
|
|
const resultGroup = []
|
|
|
|
|
|
propGroup.forEach(prop => {
|
|
|
|
|
|
resultGroup.push(unitConvert(Number(item[prop]) / sum, unitTypes.percent, null, null, 0).join(''))
|
|
|
|
|
|
})
|
|
|
|
|
|
otherData[i] = []
|
|
|
|
|
|
if (resultGroup[0] === '-') {
|
|
|
|
|
|
otherData[i][0] = false
|
|
|
|
|
|
otherData[i][1] = resultGroup[1]
|
|
|
|
|
|
otherData[i][2] = resultGroup.join(' / ')
|
|
|
|
|
|
} else {
|
|
|
|
|
|
otherData[i][0] = resultGroup[0]
|
|
|
|
|
|
otherData[i][1] = resultGroup[1]
|
|
|
|
|
|
otherData[i][2] = resultGroup.join(' / ')
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
otherData[i] = item[propName]
|
|
|
|
|
|
}
|
2022-08-24 07:29:40 +08:00
|
|
|
|
})
|
|
|
|
|
|
return otherData
|
2022-08-05 15:46:31 +08:00
|
|
|
|
})
|
2022-08-24 16:50:18 +08:00
|
|
|
|
|
2022-08-26 16:26:31 +08:00
|
|
|
|
if (!this.chartData || this.chartData.length === 0) {
|
2022-08-24 16:50:18 +08:00
|
|
|
|
this.isNoData = true
|
2022-08-25 15:14:39 +08:00
|
|
|
|
this.toggleLoading(false)
|
2022-08-26 16:26:31 +08:00
|
|
|
|
} else {
|
2022-08-24 16:50:18 +08:00
|
|
|
|
this.isNoData = false
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-08-24 07:29:40 +08:00
|
|
|
|
const queryParams = {
|
|
|
|
|
|
startTime: getSecond(this.timeFilter.startTime),
|
|
|
|
|
|
endTime: getSecond(this.timeFilter.endTime)
|
|
|
|
|
|
}
|
2022-08-05 15:46:31 +08:00
|
|
|
|
if (tabList.length > 0) {
|
2022-12-08 16:09:46 +08:00
|
|
|
|
const conditionGroup = tabList.filter(item => item != '')
|
|
|
|
|
|
const conditionHandleRlt = []
|
2022-11-16 16:59:52 +08:00
|
|
|
|
conditionGroup.forEach(condition => {
|
2022-12-08 16:09:46 +08:00
|
|
|
|
condition = handleSpecialValue(condition)// condition.replaceAll("'", "\\\\'")
|
|
|
|
|
|
condition = "'" + condition + "'"
|
2022-11-16 16:59:52 +08:00
|
|
|
|
conditionHandleRlt.push(condition)
|
|
|
|
|
|
})
|
2022-12-08 16:09:46 +08:00
|
|
|
|
queryParams.params = conditionHandleRlt.join(',')
|
2022-08-05 15:46:31 +08:00
|
|
|
|
queryParams.type = curTab.prop
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
let cycleTotalList = []
|
2022-09-20 09:33:49 +08:00
|
|
|
|
const condition = this.getQueryCondition()
|
2022-08-05 15:46:31 +08:00
|
|
|
|
if (condition) {
|
|
|
|
|
|
queryParams.q = condition
|
|
|
|
|
|
}
|
2022-08-24 07:29:40 +08:00
|
|
|
|
|
|
|
|
|
|
const self = this
|
2022-09-30 07:35:09 +08:00
|
|
|
|
if (this.customTableTitles && this.customTableTitles.length > 0) {
|
2022-09-23 19:01:30 +08:00
|
|
|
|
this.customTableTitles.forEach(tableColumn => {
|
|
|
|
|
|
if (tableColumn.columnType === tableColumnType.chainRatio && tableColumn.isInMainUrl && tableDataTmp && tableDataTmp.length > 0) {
|
|
|
|
|
|
get(self.gerCycleUrl(), queryParams).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
2022-12-01 16:11:21 +08:00
|
|
|
|
tableColumn.showError = false
|
|
|
|
|
|
tableColumn.errorMsg = ''
|
2022-09-23 19:01:30 +08:00
|
|
|
|
cycleTotalList = response.data.result
|
|
|
|
|
|
tableDataTmp.forEach(item => {
|
|
|
|
|
|
const cycle = cycleTotalList.find(i => i[curTab.prop] === item.tab)
|
|
|
|
|
|
let trend = ''// 空:无图标;up:向上的图标;down:向下的图标;noChange:横向箭头图标
|
|
|
|
|
|
let trendPercent = ''
|
|
|
|
|
|
if (cycle) {
|
|
|
|
|
|
const curVal = Number(item[tableColumn.prop])
|
|
|
|
|
|
const preVal = Number(cycle[self.cycleColumnNameGroup[tableColumn.prop]])
|
|
|
|
|
|
if (preVal && preVal != 0) {
|
|
|
|
|
|
const totalDiff = curVal - preVal
|
|
|
|
|
|
const chainRatio = getChainRatio(curVal, preVal)
|
|
|
|
|
|
if (chainRatio === '-') {
|
|
|
|
|
|
trend = ''
|
|
|
|
|
|
trendPercent = ''
|
|
|
|
|
|
} else {
|
2022-10-21 10:08:49 +08:00
|
|
|
|
trendPercent = parseFloat(Math.abs(chainRatio) * 100).toFixed(2)
|
2022-09-23 19:01:30 +08:00
|
|
|
|
if (totalDiff > 0) {
|
|
|
|
|
|
trend = 'up'
|
|
|
|
|
|
if (trendPercent <= 500) {
|
|
|
|
|
|
trendPercent = trendPercent + '%'
|
|
|
|
|
|
} else {
|
|
|
|
|
|
trendPercent = '>500%'
|
|
|
|
|
|
}
|
|
|
|
|
|
} else if (totalDiff < 0) {
|
|
|
|
|
|
trend = 'down'
|
|
|
|
|
|
if (trendPercent <= 500) {
|
|
|
|
|
|
trendPercent = trendPercent + '%'
|
|
|
|
|
|
} else {
|
|
|
|
|
|
trendPercent = '>500%'
|
|
|
|
|
|
}
|
|
|
|
|
|
} else if (totalDiff === 0) {
|
|
|
|
|
|
trend = 'noChange'// 横向图标
|
2022-09-19 10:26:24 +08:00
|
|
|
|
} else {
|
2022-09-23 19:01:30 +08:00
|
|
|
|
trend = ''
|
2022-09-19 10:26:24 +08:00
|
|
|
|
}
|
2022-09-23 19:01:30 +08:00
|
|
|
|
if (trendPercent === '0%') {
|
|
|
|
|
|
trend = 'noChange'
|
|
|
|
|
|
trendPercent = ''
|
2022-09-19 10:26:24 +08:00
|
|
|
|
}
|
2022-08-24 07:29:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-08-19 10:46:24 +08:00
|
|
|
|
}
|
2022-10-21 10:08:49 +08:00
|
|
|
|
item[tableColumn.prop] = [(item[tableColumn.prop] || item[tableColumn.prop] === 0) ? item[tableColumn.prop] : '', trend, trendPercent]
|
2022-09-23 19:01:30 +08:00
|
|
|
|
})
|
2022-12-08 16:09:46 +08:00
|
|
|
|
} else {
|
2022-12-01 16:11:21 +08:00
|
|
|
|
tableColumn.showError = true
|
2022-12-05 16:57:44 +08:00
|
|
|
|
tableColumn.errorMsg = response.message || 'Unknown'
|
2022-09-23 19:01:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
}).catch(e => {
|
|
|
|
|
|
console.log(e)
|
2022-12-01 16:11:21 +08:00
|
|
|
|
tableColumn.showError = true
|
2022-12-05 16:57:44 +08:00
|
|
|
|
tableColumn.errorMsg = e.message || 'Unknown'
|
2022-09-23 19:01:30 +08:00
|
|
|
|
}).finally(e => {
|
|
|
|
|
|
this.tableData = tableDataTmp
|
|
|
|
|
|
this.tableDataBackup = tableDataTmp
|
|
|
|
|
|
if (this.tableSortColumn) { // 执行url中指定的排序
|
|
|
|
|
|
this.sortChange({ prop: this.tableSortColumn, order: this.tableSortType }, this.tableSortTab)
|
|
|
|
|
|
}
|
|
|
|
|
|
this.toggleLoading(false)
|
|
|
|
|
|
// 查询需要单独查询的,且需要展示环比图标,列的当前周期的数据
|
|
|
|
|
|
this.customTableTitles.forEach(tableColumn => {
|
|
|
|
|
|
if (tableColumn.columnType === tableColumnType.chainRatio && !tableColumn.isInMainUrl) {
|
|
|
|
|
|
get(self.gerColumnUrl(tableColumn), queryParams).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
2022-12-05 16:57:44 +08:00
|
|
|
|
if (!tableColumn.showError) {
|
2022-12-02 15:50:21 +08:00
|
|
|
|
tableColumn.showError = false
|
|
|
|
|
|
tableColumn.errorMsg = ''
|
|
|
|
|
|
}
|
2022-09-23 19:01:30 +08:00
|
|
|
|
const columnList = response.data.result
|
|
|
|
|
|
self.tableData.forEach((item, i) => {
|
|
|
|
|
|
const data = columnList.find(i => i[curTab.prop] === item.tab)
|
2022-11-02 16:26:31 +08:00
|
|
|
|
if (!item.scoreGroup) {
|
|
|
|
|
|
item.scoreGroup = {}
|
|
|
|
|
|
}
|
2022-08-24 07:29:40 +08:00
|
|
|
|
if (data) {
|
2022-09-23 19:01:30 +08:00
|
|
|
|
item[tableColumn.prop] = data[self.columnNameGroup[tableColumn.prop]]
|
2022-11-02 16:26:31 +08:00
|
|
|
|
item.scoreGroup[self.columnNameGroup[tableColumn.prop]] = data[self.columnNameGroup[tableColumn.prop]]
|
2022-09-23 19:01:30 +08:00
|
|
|
|
} else {
|
2022-11-02 16:26:31 +08:00
|
|
|
|
item.scoreGroup[self.columnNameGroup[tableColumn.prop]] = 0
|
2022-08-24 07:29:40 +08:00
|
|
|
|
}
|
2022-11-02 16:26:31 +08:00
|
|
|
|
if (Object.keys(item.scoreGroup).length >= 5) {
|
|
|
|
|
|
item.score = computeScore(item.scoreGroup)
|
2022-12-08 16:09:46 +08:00
|
|
|
|
if (!_.isNumber(item.score)) {
|
2022-11-29 16:36:58 +08:00
|
|
|
|
item.score = 0
|
|
|
|
|
|
}
|
2022-08-24 07:29:40 +08:00
|
|
|
|
}
|
2022-09-23 19:01:30 +08:00
|
|
|
|
})
|
2022-12-08 16:09:46 +08:00
|
|
|
|
} else {
|
2022-12-01 16:11:21 +08:00
|
|
|
|
tableColumn.showError = true
|
2022-12-05 16:57:44 +08:00
|
|
|
|
tableColumn.errorMsg = response.message || 'Unknown'
|
2022-08-24 07:29:40 +08:00
|
|
|
|
}
|
2022-09-23 19:01:30 +08:00
|
|
|
|
}).catch(e => {
|
|
|
|
|
|
console.log(e)
|
2022-12-01 16:11:21 +08:00
|
|
|
|
tableColumn.showError = true
|
2022-12-05 16:57:44 +08:00
|
|
|
|
tableColumn.errorMsg = e.message || 'Unknown'
|
2022-09-23 19:01:30 +08:00
|
|
|
|
}).finally(e => {
|
|
|
|
|
|
// 查询需要单独查询的,且需要展示环比图标,列的前一周期的数据
|
|
|
|
|
|
if (tableColumn.cycle && self.tableData && self.tableData.length > 0) {
|
|
|
|
|
|
const queryCycleParams = {
|
|
|
|
|
|
...queryParams,
|
|
|
|
|
|
cycle: tableColumn.cycle
|
|
|
|
|
|
}
|
|
|
|
|
|
get(self.gerColumnUrl(tableColumn), queryCycleParams).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
2022-12-08 16:09:46 +08:00
|
|
|
|
if (!tableColumn.showError) {
|
2022-12-02 15:50:21 +08:00
|
|
|
|
tableColumn.showError = false
|
|
|
|
|
|
tableColumn.errorMsg = ''
|
|
|
|
|
|
}
|
2022-09-23 19:01:30 +08:00
|
|
|
|
cycleTotalList = response.data.result
|
|
|
|
|
|
self.tableData.forEach(item => {
|
|
|
|
|
|
const cycle = cycleTotalList.find(i => i[curTab.prop] === item.tab)
|
|
|
|
|
|
let trend = ''// 空:无图标;up:向上的图标;down:向下的图标;noChange:横向箭头图标
|
|
|
|
|
|
let trendPercent = ''
|
|
|
|
|
|
if (cycle) {
|
|
|
|
|
|
const curVal = Number(item[tableColumn.prop])
|
|
|
|
|
|
// let preVal = Number(cycle[self.metricUnit])
|
|
|
|
|
|
const preVal = Number(cycle[self.columnNameGroup[tableColumn.prop]])
|
|
|
|
|
|
if (preVal && preVal != 0) {
|
|
|
|
|
|
const totalDiff = curVal - preVal
|
|
|
|
|
|
const chainRatio = getChainRatio(curVal, preVal)
|
|
|
|
|
|
if (chainRatio === '-') {
|
|
|
|
|
|
trend = ''
|
|
|
|
|
|
trendPercent = ''
|
|
|
|
|
|
} else {
|
2022-10-21 10:08:49 +08:00
|
|
|
|
trendPercent = parseFloat(Math.abs(chainRatio) * 100).toFixed(2)
|
2022-09-23 19:01:30 +08:00
|
|
|
|
if (totalDiff > 0) {
|
|
|
|
|
|
trend = 'up'
|
|
|
|
|
|
if (trendPercent <= 500) {
|
|
|
|
|
|
trendPercent = trendPercent + '%'
|
|
|
|
|
|
} else {
|
|
|
|
|
|
trendPercent = '>500%'
|
|
|
|
|
|
}
|
|
|
|
|
|
} else if (totalDiff < 0) {
|
|
|
|
|
|
trend = 'down'
|
|
|
|
|
|
if (trendPercent <= 500) {
|
|
|
|
|
|
trendPercent = trendPercent + '%'
|
|
|
|
|
|
} else {
|
|
|
|
|
|
trendPercent = '>500%'
|
|
|
|
|
|
}
|
|
|
|
|
|
} else if (totalDiff === 0) {
|
|
|
|
|
|
trend = 'noChange'// 横向图标
|
2022-09-19 10:26:24 +08:00
|
|
|
|
} else {
|
2022-09-23 19:01:30 +08:00
|
|
|
|
trend = ''
|
2022-09-19 10:26:24 +08:00
|
|
|
|
}
|
2022-09-23 19:01:30 +08:00
|
|
|
|
if (trendPercent === '0%') {
|
|
|
|
|
|
trend = 'noChange'
|
|
|
|
|
|
trendPercent = ''
|
2022-09-19 10:26:24 +08:00
|
|
|
|
}
|
2022-08-24 07:29:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-09-23 19:01:30 +08:00
|
|
|
|
if (!(item[tableColumn.prop] && item[tableColumn.prop].length >= 3)) {
|
2022-10-21 10:08:49 +08:00
|
|
|
|
item[tableColumn.prop] = [(item[tableColumn.prop] || item[tableColumn.prop] === 0) ? item[tableColumn.prop] : '', trend, trendPercent]
|
2022-09-23 19:01:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
2022-12-08 16:09:46 +08:00
|
|
|
|
} else {
|
2022-12-01 16:11:21 +08:00
|
|
|
|
tableColumn.showError = true
|
2022-12-05 16:57:44 +08:00
|
|
|
|
tableColumn.errorMsg = response.message || 'Unknown'
|
2022-09-23 19:01:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
}).catch(e => {
|
|
|
|
|
|
console.log(e)
|
2022-12-01 16:11:21 +08:00
|
|
|
|
tableColumn.showError = true
|
2022-12-05 16:57:44 +08:00
|
|
|
|
tableColumn.errorMsg = e.message || 'Unknown'
|
2022-09-23 19:01:30 +08:00
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2022-09-16 17:46:20 +08:00
|
|
|
|
})
|
2022-09-23 19:01:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
2022-09-30 07:35:09 +08:00
|
|
|
|
} else {
|
2022-10-21 10:08:49 +08:00
|
|
|
|
this.tableData = tableDataTmp
|
|
|
|
|
|
this.tableDataBackup = tableDataTmp
|
2022-09-30 07:35:09 +08:00
|
|
|
|
this.toggleLoading(false)
|
2022-09-23 19:01:30 +08:00
|
|
|
|
}
|
2022-10-02 16:21:39 +08:00
|
|
|
|
this.changeUrlTabState()
|
2022-09-16 17:46:20 +08:00
|
|
|
|
},
|
|
|
|
|
|
showMore () {
|
|
|
|
|
|
this.setShowNum(50)
|
|
|
|
|
|
this.sortChange(this.column, this.index)// 当前选中的tab????
|
2022-10-02 16:21:39 +08:00
|
|
|
|
this.changeUrlTabState()
|
2022-09-16 17:46:20 +08:00
|
|
|
|
},
|
|
|
|
|
|
setShowNum (num) {
|
2022-09-23 19:01:30 +08:00
|
|
|
|
this.showRecordNum = Number(num)
|
2022-10-02 16:21:39 +08:00
|
|
|
|
this.urlChangeParams[curTabState.tableShowMore] = this.showRecordNum
|
2022-09-16 17:46:20 +08:00
|
|
|
|
},
|
|
|
|
|
|
rowClass (row, column, rowIndex, columnIndex) {
|
|
|
|
|
|
if (rowIndex === 49) {
|
|
|
|
|
|
return 'fixed-row'
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
getChartType (char) {
|
|
|
|
|
|
// 数字可按照排序的要求进行自定义,我这边产品的要求是
|
|
|
|
|
|
// 数字(0->9)->大写字母(A->Z)->小写字母(a->z)->中文拼音(a->z)
|
|
|
|
|
|
if (/^[\u4e00-\u9fa5]$/.test(char)) {
|
|
|
|
|
|
return ['zh', 300]
|
|
|
|
|
|
}
|
|
|
|
|
|
if (/^[a-zA-Z]$/.test(char)) {
|
|
|
|
|
|
return ['en', 200]
|
|
|
|
|
|
}
|
|
|
|
|
|
if (/^[0-9]$/.test(char)) {
|
|
|
|
|
|
return ['number', 100]
|
|
|
|
|
|
}
|
|
|
|
|
|
return ['others', 999]
|
|
|
|
|
|
},
|
|
|
|
|
|
sortChange (column, index) {
|
2022-10-02 16:21:39 +08:00
|
|
|
|
if (column.prop) {
|
|
|
|
|
|
this.urlChangeParams[this.curTabState.tableSortColumn] = column.prop
|
|
|
|
|
|
}
|
|
|
|
|
|
if (column.order) {
|
|
|
|
|
|
this.urlChangeParams[this.curTabState.tableSortType] = column.order
|
|
|
|
|
|
}
|
|
|
|
|
|
if (index || index === 0) {
|
|
|
|
|
|
this.urlChangeParams[this.curTabState.tableSortTab] = index
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-16 17:46:20 +08:00
|
|
|
|
this.index = index
|
|
|
|
|
|
this.column = column
|
|
|
|
|
|
const arr = []
|
2022-11-09 15:22:09 +08:00
|
|
|
|
this.tableData.forEach(val => {
|
2022-09-16 17:46:20 +08:00
|
|
|
|
arr.push(val)
|
|
|
|
|
|
})
|
2022-12-08 16:09:46 +08:00
|
|
|
|
if (column.order === 'descending') {
|
2022-10-21 10:08:49 +08:00
|
|
|
|
arr.sort((a, b) => {
|
|
|
|
|
|
const str1 = Array.isArray(a[column.prop]) ? a[column.prop][0] : a[column.prop]
|
|
|
|
|
|
const str2 = Array.isArray(b[column.prop]) ? b[column.prop][0] : b[column.prop]
|
|
|
|
|
|
if ((_.isNumber(str1)) || str1 === '') {
|
2022-09-16 17:46:20 +08:00
|
|
|
|
return str2 - str1
|
|
|
|
|
|
} else {
|
2022-10-21 10:08:49 +08:00
|
|
|
|
let aObj = a[column.prop] ? a[column.prop] : a[index]
|
|
|
|
|
|
let bObj = b[column.prop] ? b[column.prop] : b[index]
|
|
|
|
|
|
if (!aObj) {
|
|
|
|
|
|
const curTab = this.getCurTab()
|
|
|
|
|
|
aObj = a[curTab.prop]
|
|
|
|
|
|
bObj = b[curTab.prop]
|
|
|
|
|
|
}
|
2022-09-16 17:46:20 +08:00
|
|
|
|
let res = 0
|
2022-10-21 10:08:49 +08:00
|
|
|
|
if (aObj && bObj) {
|
|
|
|
|
|
const len = aObj.length < bObj.length ? aObj.length : bObj.length
|
|
|
|
|
|
for (let i = 0; i < len; i++) {
|
|
|
|
|
|
const char1 = aObj[i]
|
|
|
|
|
|
const char2 = bObj[i]
|
|
|
|
|
|
const char1Type = this.getChartType(char1)
|
2022-12-08 16:09:46 +08:00
|
|
|
|
// const char2Type = this.getChartType(char2)
|
2022-10-21 10:08:49 +08:00
|
|
|
|
if (char1 === char2) {
|
|
|
|
|
|
continue
|
2022-09-16 17:46:20 +08:00
|
|
|
|
} else {
|
2022-10-21 10:08:49 +08:00
|
|
|
|
if (char1Type[0] === 'zh') {
|
|
|
|
|
|
res = char2.localeCompare(char1)
|
|
|
|
|
|
} else if (char1Type[0] === 'en') {
|
|
|
|
|
|
res = char2.charCodeAt(0) - char1.charCodeAt(0)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
res = char2 - char1
|
|
|
|
|
|
}
|
|
|
|
|
|
break
|
2022-09-16 17:46:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return res
|
|
|
|
|
|
}
|
2022-10-21 10:08:49 +08:00
|
|
|
|
})
|
2022-11-09 15:22:09 +08:00
|
|
|
|
this.tableData = arr
|
2022-12-08 16:09:46 +08:00
|
|
|
|
} else if (column.order === 'ascending') {
|
2022-10-21 10:08:49 +08:00
|
|
|
|
arr.sort((a, b) => {
|
|
|
|
|
|
const str1 = Array.isArray(a[column.prop]) ? a[column.prop][0] : a[column.prop]
|
|
|
|
|
|
const str2 = Array.isArray(b[column.prop]) ? b[column.prop][0] : b[column.prop]
|
|
|
|
|
|
if ((_.isNumber(str1)) || str1 === '') {
|
|
|
|
|
|
return str1 - str2
|
|
|
|
|
|
} else {
|
|
|
|
|
|
let aObj = a[column.prop] ? a[column.prop] : a[index]
|
|
|
|
|
|
let bObj = b[column.prop] ? b[column.prop] : b[index]
|
|
|
|
|
|
if (!aObj) {
|
|
|
|
|
|
const curTab = this.getCurTab()
|
|
|
|
|
|
aObj = a[curTab.prop]
|
|
|
|
|
|
bObj = b[curTab.prop]
|
|
|
|
|
|
}
|
2022-09-16 17:46:20 +08:00
|
|
|
|
let res = 0
|
2022-10-21 10:08:49 +08:00
|
|
|
|
if (aObj && bObj) {
|
|
|
|
|
|
const len = aObj.length < bObj.length ? aObj.length : bObj.length
|
|
|
|
|
|
for (let i = 0; i < len; i++) {
|
|
|
|
|
|
const char1 = aObj[i]
|
|
|
|
|
|
const char2 = bObj[i]
|
|
|
|
|
|
const char1Type = this.getChartType(char1)
|
2022-12-08 16:09:46 +08:00
|
|
|
|
// const char2Type = this.getChartType(char2)
|
2022-10-21 10:08:49 +08:00
|
|
|
|
if (char1 === char2) {
|
|
|
|
|
|
continue
|
2022-09-16 17:46:20 +08:00
|
|
|
|
} else {
|
2022-10-21 10:08:49 +08:00
|
|
|
|
if (char1Type[0] === 'zh') {
|
|
|
|
|
|
res = char1.localeCompare(char2)
|
|
|
|
|
|
} else if (char1Type[0] === 'en') {
|
|
|
|
|
|
res = char1.charCodeAt(0) - char2.charCodeAt(0)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
res = char1 - char2
|
|
|
|
|
|
}
|
|
|
|
|
|
break
|
2022-09-16 17:46:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return res
|
|
|
|
|
|
}
|
2022-10-21 10:08:49 +08:00
|
|
|
|
})
|
2022-11-09 15:22:09 +08:00
|
|
|
|
this.tableData = arr
|
2022-10-21 10:08:49 +08:00
|
|
|
|
} else if (!column.order) {
|
|
|
|
|
|
this.tableData = this.tableDataBackup
|
2022-09-16 17:46:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
handleCustomizeButton (status) {
|
|
|
|
|
|
this.showBackground = status
|
|
|
|
|
|
if (!this.showCustomizeTabs) {
|
|
|
|
|
|
this.activeCustomize = 'metrics'
|
|
|
|
|
|
}
|
|
|
|
|
|
const tabList = this.list.filter(item => item.checked === true)
|
|
|
|
|
|
const defaultTab = tabList.length > 0 ? tabList[0] : {}
|
2022-09-20 09:33:49 +08:00
|
|
|
|
const columnName = this.getUrlParam(this.curTabState.thirdMenu, '')
|
|
|
|
|
|
const columnValue = this.getUrlParam(this.curTabState.fourthMenu, '')
|
2022-09-16 17:46:20 +08:00
|
|
|
|
if (tabList.length === 1) {
|
|
|
|
|
|
defaultTab.disabled = true
|
|
|
|
|
|
} else if (tabList.length > 1) {
|
|
|
|
|
|
this.list.forEach(item => {
|
|
|
|
|
|
item.disabled = false
|
|
|
|
|
|
if (columnValue) {
|
|
|
|
|
|
if (item.label === columnName) {
|
2022-10-12 11:11:22 +08:00
|
|
|
|
// item.disabled = true
|
2022-09-16 17:46:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
// 隐藏tabs的标题
|
|
|
|
|
|
hideTabs (curTab) {
|
|
|
|
|
|
// 此处的id为tab-name
|
|
|
|
|
|
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) {
|
2022-11-01 09:12:14 +08:00
|
|
|
|
if (curTab.name === item.name) {
|
2022-09-16 17:46:20 +08:00
|
|
|
|
paneDom.style.display = ''
|
|
|
|
|
|
}
|
2022-08-05 15:46:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
2022-09-16 17:46:20 +08:00
|
|
|
|
// tab改变
|
2022-10-02 16:21:39 +08:00
|
|
|
|
changeUrlTabState () {
|
|
|
|
|
|
if (this.urlChangeParams && JSON.stringify(this.urlChangeParams) !== '{}') {
|
2022-09-20 09:33:49 +08:00
|
|
|
|
const { query } = this.$route
|
2022-10-02 16:21:39 +08:00
|
|
|
|
const newUrl = urlParamsHandler(window.location.href, query, this.urlChangeParams)
|
2022-09-20 09:33:49 +08:00
|
|
|
|
overwriteUrl(newUrl)
|
|
|
|
|
|
}
|
2022-10-02 16:21:39 +08:00
|
|
|
|
this.urlChangeParams = {}
|
2022-09-16 17:46:20 +08:00
|
|
|
|
},
|
|
|
|
|
|
// 激活tab修改的内容:第一列的列名,list中此tab为checked=true
|
|
|
|
|
|
showTab (curTab) {
|
2022-09-23 19:01:30 +08:00
|
|
|
|
if (curTab) {
|
|
|
|
|
|
this.activeTab = ref(curTab.label)
|
2022-11-01 09:12:14 +08:00
|
|
|
|
this.combineColumnList(curTab.name)
|
2022-09-23 19:01:30 +08:00
|
|
|
|
}
|
2022-09-16 17:46:20 +08:00
|
|
|
|
},
|
2022-09-30 07:35:09 +08:00
|
|
|
|
// 配置tab:显示隐藏与顺序
|
2022-10-02 16:21:39 +08:00
|
|
|
|
tabChange (index) {
|
2022-08-24 16:50:18 +08:00
|
|
|
|
this.isNoData = false
|
2022-08-30 09:34:38 +08:00
|
|
|
|
// 操作类型设置
|
2022-09-23 19:01:30 +08:00
|
|
|
|
const beforeType = this.getUrlParam(this.curTabState.tabOperationBeforeType, '', true)
|
2022-08-05 15:46:31 +08:00
|
|
|
|
if (beforeType != operationType.thirdMenu) {
|
2022-10-02 16:21:39 +08:00
|
|
|
|
this.urlChangeParams[this.curTabState.tabOperationBeforeType] = this.getUrlParam(this.curTabState.tabOperationType, '', true)
|
2022-08-05 15:46:31 +08:00
|
|
|
|
}
|
2022-10-02 16:21:39 +08:00
|
|
|
|
this.urlChangeParams[this.curTabState.tabOperationType] = operationType.customize
|
2022-08-30 09:34:38 +08:00
|
|
|
|
// 获得操作tab和当前选中的所有tab
|
2022-08-05 15:46:31 +08:00
|
|
|
|
const handleTab = this.list[index]
|
|
|
|
|
|
const tabList = this.list.filter(item => item.checked === true)
|
|
|
|
|
|
const defaultTab = tabList.length > 0 ? tabList[0] : {}
|
2022-08-30 09:34:38 +08:00
|
|
|
|
// 当前操作之后,只有1个tab被选中,则这一个不允许取消选中
|
2022-09-20 09:33:49 +08:00
|
|
|
|
const columnName = this.getUrlParam(this.curTabState.thirdMenu, '')
|
|
|
|
|
|
const columnValue = this.getUrlParam(this.curTabState.fourthMenu, '')
|
2022-08-30 09:34:38 +08:00
|
|
|
|
if (tabList.length === 1) {
|
2022-08-05 15:46:31 +08:00
|
|
|
|
defaultTab.disabled = true
|
|
|
|
|
|
} else if (tabList.length > 1) {
|
|
|
|
|
|
this.list.forEach(item => {
|
|
|
|
|
|
item.disabled = false
|
2022-08-30 16:45:13 +08:00
|
|
|
|
if (columnValue) {
|
|
|
|
|
|
if (item.label === columnName) {
|
2022-10-12 11:11:22 +08:00
|
|
|
|
// item.disabled = true
|
2022-08-30 16:45:13 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-08-05 15:46:31 +08:00
|
|
|
|
})
|
2022-09-23 19:01:30 +08:00
|
|
|
|
}
|
2022-10-02 16:21:39 +08:00
|
|
|
|
this.saveUserLocalConfig()
|
2022-08-30 09:34:38 +08:00
|
|
|
|
// 如果取消tab,则如果取消的是当前选中的tab,则当前tab就需要修改为第一个默认的tab,否则不用
|
|
|
|
|
|
const curTab = this.getCurTab()
|
2022-11-01 09:12:14 +08:00
|
|
|
|
if (!handleTab.checked && handleTab.name === curTab.name) {
|
2022-09-16 17:46:20 +08:00
|
|
|
|
this.setShowNum(10)
|
2022-10-02 16:21:39 +08:00
|
|
|
|
this.urlChangeParams[this.curTabState.curTab] = tabList[0].prop
|
2022-08-30 09:34:38 +08:00
|
|
|
|
let queryParams = {
|
2022-08-05 15:46:31 +08:00
|
|
|
|
orderBy: this.orderBy,
|
2022-08-26 16:26:31 +08:00
|
|
|
|
limit: networkDefaultLimit,
|
2022-08-30 09:34:38 +08:00
|
|
|
|
type: tabList[0].prop
|
2022-08-05 15:46:31 +08:00
|
|
|
|
}
|
2022-10-02 16:21:39 +08:00
|
|
|
|
this.changeUrlTabState()
|
2022-09-20 09:33:49 +08:00
|
|
|
|
// const condition = this.$store.getters.getQueryCondition
|
|
|
|
|
|
const condition = this.getQueryCondition()
|
2022-08-30 09:34:38 +08:00
|
|
|
|
if (condition) {
|
|
|
|
|
|
queryParams = {
|
|
|
|
|
|
orderBy: this.orderBy,
|
|
|
|
|
|
limit: networkDefaultLimit,
|
|
|
|
|
|
type: tabList[0].prop,
|
|
|
|
|
|
q: condition
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-09-16 17:46:20 +08:00
|
|
|
|
this.getChartData(queryParams)
|
2022-10-02 16:21:39 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
this.changeUrlTabState()
|
2022-08-05 15:46:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2022-09-16 17:46:20 +08:00
|
|
|
|
setOperationType (operationType) {
|
2022-10-02 16:21:39 +08:00
|
|
|
|
this.urlChangeParams[this.curTabState.tabOperationBeforeType] = this.getUrlParam(this.curTabState.tabOperationType, '', true)
|
|
|
|
|
|
this.urlChangeParams[this.curTabState.tabOperationType] = operationType
|
2022-09-16 17:46:20 +08:00
|
|
|
|
},
|
2022-11-01 09:12:14 +08:00
|
|
|
|
getTabByName (name) {
|
2022-09-16 17:46:20 +08:00
|
|
|
|
let tab = null
|
2022-11-01 09:12:14 +08:00
|
|
|
|
const tabGroup = this.list.filter(item => item.name === name)
|
2022-08-05 15:46:31 +08:00
|
|
|
|
if (tabGroup && tabGroup.length > 0) {
|
2022-09-16 17:46:20 +08:00
|
|
|
|
tab = tabGroup[0]
|
2022-08-05 15:46:31 +08:00
|
|
|
|
}
|
2022-09-16 17:46:20 +08:00
|
|
|
|
return tab
|
|
|
|
|
|
},
|
|
|
|
|
|
setBeforeTab (tab) {
|
2022-10-02 16:21:39 +08:00
|
|
|
|
this.urlChangeParams[this.curTabState.networkOverviewBeforeTab] = tab.prop
|
2022-09-16 17:46:20 +08:00
|
|
|
|
},
|
|
|
|
|
|
setQueryCondition (tab, value) {
|
2022-12-08 16:09:46 +08:00
|
|
|
|
value = handleSpecialValue(value)// value.replaceAll("'", "\\\\'")
|
2022-11-02 16:26:31 +08:00
|
|
|
|
const queryCondition = []
|
2022-09-16 17:46:20 +08:00
|
|
|
|
if (tab.prop === 'protocolPort') {
|
|
|
|
|
|
const valueGroup = value.split(':')
|
2022-08-24 11:54:09 +08:00
|
|
|
|
if (valueGroup) {
|
|
|
|
|
|
queryCondition.push("common_l7_protocol='" + valueGroup[0] + "'")
|
|
|
|
|
|
queryCondition.push('common_server_port=' + valueGroup[1])
|
|
|
|
|
|
}
|
2022-10-02 16:21:39 +08:00
|
|
|
|
this.urlChangeParams[this.curTabState.queryCondition] = queryCondition.join(' AND ')
|
2022-08-24 11:54:09 +08:00
|
|
|
|
} else {
|
2022-10-21 10:08:49 +08:00
|
|
|
|
if (tab.queryCondition) {
|
2022-10-19 15:45:31 +08:00
|
|
|
|
tab.queryCondition.forEach(item => {
|
2022-11-16 16:59:52 +08:00
|
|
|
|
queryCondition.push(item.replaceAll('$param', value))
|
2022-10-19 15:45:31 +08:00
|
|
|
|
})
|
2022-10-21 10:08:49 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
if (tab.dillDownProp) {
|
2022-10-19 15:45:31 +08:00
|
|
|
|
tab.dillDownProp.forEach(item => {
|
|
|
|
|
|
queryCondition.push(item + "='" + value + "'")
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-10-02 16:21:39 +08:00
|
|
|
|
this.urlChangeParams[this.curTabState.queryCondition] = queryCondition.join(' OR ')
|
2022-08-24 11:54:09 +08:00
|
|
|
|
}
|
2022-09-16 17:46:20 +08:00
|
|
|
|
},
|
|
|
|
|
|
getFirstCheckedTab () {
|
|
|
|
|
|
let tab = null
|
|
|
|
|
|
const tabObjGroup = this.list.filter(item => item.checked)
|
|
|
|
|
|
if (tabObjGroup && tabObjGroup.length > 0) {
|
|
|
|
|
|
tab = tabObjGroup[0]
|
|
|
|
|
|
}
|
|
|
|
|
|
return tab
|
|
|
|
|
|
},
|
|
|
|
|
|
/*
|
2022-10-02 16:21:39 +08:00
|
|
|
|
* 点击表格第一列数据后
|
|
|
|
|
|
1.设置beforeTab
|
|
|
|
|
|
2.设置OperationType
|
|
|
|
|
|
3.设置QueryCondition
|
|
|
|
|
|
4.设置菜单:第三级,第四级名称,并保存到store中
|
|
|
|
|
|
5.设置panel名称,表格维度类型:如ip,domain等(即查询参数中的type)
|
|
|
|
|
|
* */
|
2022-12-01 16:11:21 +08:00
|
|
|
|
async handleTabValue (columnName, columnValue) {
|
2022-10-13 16:14:15 +08:00
|
|
|
|
// console.log('NetworkOverview类------handleTabValue:下钻')
|
2022-11-07 15:28:25 +08:00
|
|
|
|
// 下钻前保存当前路由状态
|
|
|
|
|
|
this.beforeRouterPush()
|
2022-11-01 09:12:14 +08:00
|
|
|
|
const clickTab = this.getTabByName(columnName)// 下钻后,显示的下钻tab对应的drilldownTabs
|
|
|
|
|
|
const tabLable = clickTab.label
|
|
|
|
|
|
const tabName = clickTab.name
|
2022-09-16 17:46:20 +08:00
|
|
|
|
this.setBeforeTab(clickTab)
|
|
|
|
|
|
this.setOperationType(operationType.fourthMenu)
|
|
|
|
|
|
this.setQueryCondition(clickTab, columnValue)
|
2022-09-30 07:35:09 +08:00
|
|
|
|
const toPanel = clickTab.panelId
|
2022-10-02 16:21:39 +08:00
|
|
|
|
this.urlChangeParams[this.curTabState.curTab] = ''
|
|
|
|
|
|
this.changeUrlTabState()
|
2022-09-30 07:35:09 +08:00
|
|
|
|
const thirdMenu = this.getUrlParam(this.curTabState.thirdMenu, '')
|
|
|
|
|
|
const tabList = this.getAllTabList()
|
|
|
|
|
|
if (this.isDrilldown()) { // 点击之前就已经是下钻状态了
|
|
|
|
|
|
this.list.forEach(tab => {
|
|
|
|
|
|
if (tab.label === thirdMenu) {
|
2022-11-01 09:12:14 +08:00
|
|
|
|
// tab.checked = true
|
2022-09-30 07:35:09 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
2022-11-01 09:12:14 +08:00
|
|
|
|
this.list = this.getDrilldownTabList(tabName)
|
2022-09-30 07:35:09 +08:00
|
|
|
|
const curTab = this.getCurTab(clickTab)
|
|
|
|
|
|
tabList.forEach(tab => {
|
2022-11-01 09:12:14 +08:00
|
|
|
|
if (tab.name === curTab.name) {
|
|
|
|
|
|
this.combineColumnList(tab.name)
|
2022-09-30 07:35:09 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
} else {
|
2022-12-08 16:09:46 +08:00
|
|
|
|
const changeTab = tabList.find(item => item.name === tabName)// 下钻的tab
|
2022-09-30 07:35:09 +08:00
|
|
|
|
this.list = changeTab.drilldownTabs
|
2022-12-08 16:09:46 +08:00
|
|
|
|
/* this.list.forEach(tab => {
|
2022-11-01 09:12:14 +08:00
|
|
|
|
const hiddenTab = tabList.find(item => item.name == tab.name)
|
2022-12-08 16:09:46 +08:00
|
|
|
|
}) */
|
2022-09-30 07:35:09 +08:00
|
|
|
|
const curTab = this.getCurTab(clickTab)
|
|
|
|
|
|
tabList.forEach(tab => {
|
2022-11-01 09:12:14 +08:00
|
|
|
|
if (tab.name === curTab.name) {
|
|
|
|
|
|
this.combineColumnList(tab.name)
|
2022-09-30 07:35:09 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2022-11-01 09:12:14 +08:00
|
|
|
|
|
2022-12-01 16:11:21 +08:00
|
|
|
|
await this.saveUserLocalConfig()
|
2022-12-08 16:09:46 +08:00
|
|
|
|
/* let forthMenuName = ''
|
2022-11-09 15:22:09 +08:00
|
|
|
|
if (clickTab.prop === 'qtype') {
|
2022-11-04 12:18:26 +08:00
|
|
|
|
forthMenuName = this.dnsQtypeMapData.get(columnValue)
|
2022-11-09 15:22:09 +08:00
|
|
|
|
} else if (clickTab.prop === 'rcode') {
|
2022-11-04 12:18:26 +08:00
|
|
|
|
forthMenuName = this.dnsRcodeMapData.get(columnValue)
|
2022-11-09 15:22:09 +08:00
|
|
|
|
} else {
|
2022-11-04 12:18:26 +08:00
|
|
|
|
forthMenuName = columnValue
|
2022-12-08 16:09:46 +08:00
|
|
|
|
} */
|
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) {
|
2022-11-01 09:12:14 +08:00
|
|
|
|
menu.columnName = tabLable
|
2022-08-05 15:46:31 +08:00
|
|
|
|
menu.columnValue = columnValue
|
2022-10-02 16:21:39 +08:00
|
|
|
|
this.urlChangeParams[this.curTabState.panelName] = columnValue
|
2022-11-01 09:12:14 +08:00
|
|
|
|
this.urlChangeParams[this.curTabState.thirdMenu] = tabLable
|
2022-10-02 16:21:39 +08:00
|
|
|
|
this.urlChangeParams[this.curTabState.dimensionType] = clickTab ? clickTab.prop : ''
|
|
|
|
|
|
this.urlChangeParams[this.curTabState.fourthMenu] = columnValue
|
2022-08-05 15:46:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
} else if (!this.$_.isEmpty(menu.children)) {
|
|
|
|
|
|
menu.children.forEach(child => {
|
|
|
|
|
|
if (this.$route.path === child.route) {
|
2022-11-01 09:12:14 +08:00
|
|
|
|
child.columnName = tabLable
|
2022-08-05 15:46:31 +08:00
|
|
|
|
child.columnValue = columnValue
|
2022-10-02 16:21:39 +08:00
|
|
|
|
this.urlChangeParams[this.curTabState.panelName] = columnValue
|
2022-11-01 09:12:14 +08:00
|
|
|
|
this.urlChangeParams[this.curTabState.thirdMenu] = tabLable
|
2022-10-02 16:21:39 +08:00
|
|
|
|
this.urlChangeParams[this.curTabState.dimensionType] = clickTab ? clickTab.prop : ''
|
|
|
|
|
|
this.urlChangeParams[this.curTabState.fourthMenu] = columnValue
|
2022-08-05 15:46:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2022-12-02 13:44:49 +08:00
|
|
|
|
if (!this.getUrlParam(this.curTabState.tabIndex)) {
|
2022-12-08 16:09:46 +08:00
|
|
|
|
const thirdMenu = this.urlChangeParams[this.curTabState.thirdMenu]
|
|
|
|
|
|
if (thirdMenu === 'network.serverIps') {
|
2022-12-02 13:44:49 +08:00
|
|
|
|
this.urlChangeParams[this.curTabState.tabIndex] = 1
|
2022-12-08 16:09:46 +08:00
|
|
|
|
} else if (thirdMenu === 'network.clientIps' || thirdMenu === 'network.ips') {
|
2022-12-02 13:44:49 +08:00
|
|
|
|
this.urlChangeParams[this.curTabState.tabIndex] = 0
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-10-02 16:21:39 +08:00
|
|
|
|
this.changeUrlTabState()
|
2022-10-09 20:18:19 +08:00
|
|
|
|
this.$router.push({
|
|
|
|
|
|
path: this.$route.path,
|
|
|
|
|
|
query: {
|
|
|
|
|
|
...this.$route.query,
|
|
|
|
|
|
thirdPanel: this.curTable.panelIdOfThirdMenu,
|
|
|
|
|
|
fourthPanel: toPanel,
|
|
|
|
|
|
t: +new Date()
|
|
|
|
|
|
}
|
2022-08-05 15:46:31 +08:00
|
|
|
|
})
|
|
|
|
|
|
},
|
2022-11-07 15:28:25 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 在路由跳转前,即下钻前将路由数据保存起来,确保回退和前进保留当时状态
|
|
|
|
|
|
*/
|
|
|
|
|
|
beforeRouterPush () {
|
|
|
|
|
|
const currentRouter = this.$_.cloneDeep(this.$route.query)
|
2022-11-11 15:17:44 +08:00
|
|
|
|
const historyList = this.$_.cloneDeep(this.$store.getters.getRouterHistoryList)
|
2022-11-07 15:28:25 +08:00
|
|
|
|
|
|
|
|
|
|
const tempObj = {
|
|
|
|
|
|
t: currentRouter.t,
|
|
|
|
|
|
query: currentRouter,
|
|
|
|
|
|
path: this.$_.cloneDeep(this.$route.path),
|
|
|
|
|
|
params: this.$_.cloneDeep(this.$route.params)
|
|
|
|
|
|
}
|
2022-11-11 15:17:44 +08:00
|
|
|
|
if (historyList.length > 0) {
|
2022-11-07 15:28:25 +08:00
|
|
|
|
let flag = true
|
2022-11-11 15:17:44 +08:00
|
|
|
|
historyList.forEach((item, index) => {
|
2022-11-07 15:28:25 +08:00
|
|
|
|
if (item.t === currentRouter.t) {
|
2022-11-11 15:17:44 +08:00
|
|
|
|
historyList[index] = tempObj
|
2022-11-07 15:28:25 +08:00
|
|
|
|
flag = false
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!flag) {
|
|
|
|
|
|
return true
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2022-11-11 15:17:44 +08:00
|
|
|
|
if (flag) historyList.push(tempObj)
|
2022-11-07 15:28:25 +08:00
|
|
|
|
} else {
|
2022-11-11 15:17:44 +08:00
|
|
|
|
historyList.push(tempObj)
|
2022-11-07 15:28:25 +08:00
|
|
|
|
}
|
2022-11-11 15:17:44 +08:00
|
|
|
|
this.$store.commit('setRouterHistoryList', historyList)
|
2022-11-07 15:28:25 +08:00
|
|
|
|
},
|
2022-08-05 15:46:31 +08:00
|
|
|
|
handleSearchParams (columnValue) {
|
2022-12-08 16:09:46 +08:00
|
|
|
|
columnValue = handleSpecialValue(columnValue)// columnValue.replaceAll("'", "\\\\'")
|
2022-08-05 15:46:31 +08:00
|
|
|
|
const queryCondition = []
|
|
|
|
|
|
const curTab = this.getCurTab()
|
2022-08-24 11:54:09 +08:00
|
|
|
|
if (curTab.prop === 'protocolPort') {
|
|
|
|
|
|
const valueGroup = columnValue.split(':')
|
|
|
|
|
|
if (valueGroup) {
|
|
|
|
|
|
queryCondition.push("common_l7_protocol='" + valueGroup[0] + "'")
|
|
|
|
|
|
queryCondition.push('common_server_port=' + valueGroup[1])
|
|
|
|
|
|
}
|
2022-10-02 16:21:39 +08:00
|
|
|
|
this.urlChangeParams[this.curTabState.queryCondition] = queryCondition.join(' AND ')
|
2022-08-24 11:54:09 +08:00
|
|
|
|
} else {
|
2022-10-21 10:08:49 +08:00
|
|
|
|
if (curTab.queryCondition) {
|
2022-10-19 15:45:31 +08:00
|
|
|
|
curTab.queryCondition.forEach(item => {
|
2022-11-16 16:59:52 +08:00
|
|
|
|
queryCondition.push(item.replaceAll('$param', columnValue))
|
2022-10-19 15:45:31 +08:00
|
|
|
|
})
|
2022-10-21 10:08:49 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
if (curTab.dillDownProp) {
|
2022-10-19 15:45:31 +08:00
|
|
|
|
curTab.dillDownProp.forEach(item => {
|
|
|
|
|
|
queryCondition.push(item + "='" + columnValue + "'")
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-10-02 16:21:39 +08:00
|
|
|
|
this.urlChangeParams[this.curTabState.queryCondition] = queryCondition.join(' OR ')
|
2022-08-24 11:54:09 +08:00
|
|
|
|
}
|
2022-07-20 19:47:53 +08:00
|
|
|
|
},
|
2022-09-30 07:35:09 +08:00
|
|
|
|
async metricChange () {
|
|
|
|
|
|
// 需要将列设置到当前tab的"hiddenColumns": [],"disabledColumns": [],
|
|
|
|
|
|
await this.saveUserLocalConfig()
|
2022-07-22 18:22:00 +08:00
|
|
|
|
},
|
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
|
2022-11-01 09:12:14 +08:00
|
|
|
|
this.saveUserLocalConfig()
|
2022-07-20 19:47:53 +08:00
|
|
|
|
}
|
2022-09-16 17:46:20 +08:00
|
|
|
|
// 拖拽完毕需要把数据存入userId里??
|
2022-07-20 19:47:53 +08:00
|
|
|
|
},
|
|
|
|
|
|
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
|
2022-11-01 09:12:14 +08:00
|
|
|
|
this.saveUserLocalConfig()
|
2022-07-22 18:22:00 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
dragMetricOver (e, index) {
|
|
|
|
|
|
e.preventDefault()
|
|
|
|
|
|
},
|
2022-09-16 17:46:20 +08:00
|
|
|
|
clearSort () {
|
|
|
|
|
|
const table = this.$refs['dataTable_' + this.tableSortTab]
|
|
|
|
|
|
const tableHeaer = table
|
|
|
|
|
|
? (Array.isArray(table)
|
|
|
|
|
|
? table[0].$refs.tableHeader
|
|
|
|
|
|
: table.$refs.tableHeader)
|
|
|
|
|
|
: []
|
|
|
|
|
|
const columns = tableHeaer.columns
|
|
|
|
|
|
if (columns) {
|
|
|
|
|
|
columns.forEach(item => {
|
|
|
|
|
|
item.order = ''
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2022-11-09 15:22:09 +08:00
|
|
|
|
this.cancleSortArrow()
|
2022-09-16 17:46:20 +08:00
|
|
|
|
this.column = {}
|
|
|
|
|
|
this.index = 0
|
|
|
|
|
|
this.tableSortColumn = ''
|
|
|
|
|
|
this.tableSortType = ''
|
|
|
|
|
|
this.tableSortTab = ''
|
2022-10-02 16:21:39 +08:00
|
|
|
|
this.urlChangeParams = this.$_.omit(this.urlChangeParams, [this.curTabState.tableSortColumn, this.curTabState.tableSortType, this.curTabState.tableSortTab])
|
2022-09-16 17:46:20 +08:00
|
|
|
|
},
|
2022-10-09 19:58:30 +08:00
|
|
|
|
// 切换tab
|
2022-10-02 16:21:39 +08:00
|
|
|
|
handleClick (tab) {
|
2022-08-05 15:46:31 +08:00
|
|
|
|
this.tableData = []
|
2022-09-05 16:00:42 +08:00
|
|
|
|
this.tableDataBackup = []
|
2022-09-16 17:46:20 +08:00
|
|
|
|
this.setShowNum(10)
|
|
|
|
|
|
this.clearSort()
|
2022-10-02 16:21:39 +08:00
|
|
|
|
const tabOpeType = this.getUrlParam(this.curTabState.tabOperationType, '', true)
|
|
|
|
|
|
if (tabOpeType) {
|
|
|
|
|
|
this.urlChangeParams[this.curTabState.tabOperationBeforeType] = tabOpeType
|
|
|
|
|
|
}
|
|
|
|
|
|
this.urlChangeParams[this.curTabState.tabOperationType] = operationType.changeTab
|
2022-09-30 07:35:09 +08:00
|
|
|
|
// 下钻的tab觉得显示哪些tab,这些tab显示什么列,取决于tab本身
|
2022-08-05 15:46:31 +08:00
|
|
|
|
const tabObjGroup = this.list.filter(item => item.label == tab.paneName)
|
|
|
|
|
|
if (tabObjGroup && tabObjGroup.length > 0) {
|
|
|
|
|
|
const curTab = tabObjGroup[0]
|
2022-10-02 16:21:39 +08:00
|
|
|
|
this.urlChangeParams[this.curTabState.curTab] = curTab.prop
|
2022-11-01 09:12:14 +08:00
|
|
|
|
this.combineColumnList(curTab.name)
|
2022-10-02 16:21:39 +08:00
|
|
|
|
this.saveUserLocalConfig()
|
2022-08-05 15:46:31 +08:00
|
|
|
|
this.tab = curTab.prop
|
2022-11-04 12:18:26 +08:00
|
|
|
|
this.isDnsMapType = false
|
2022-11-09 15:22:09 +08:00
|
|
|
|
if (this.tab === 'qtype') {
|
|
|
|
|
|
this.dnsMapData = this.dnsQtypeMapData
|
2022-11-04 12:18:26 +08:00
|
|
|
|
this.isDnsMapType = true
|
2022-11-09 15:22:09 +08:00
|
|
|
|
} else if (this.tab === 'rcode') {
|
|
|
|
|
|
this.dnsMapData = this.dnsRcodeMapData
|
2022-11-04 12:18:26 +08:00
|
|
|
|
this.isDnsMapType = true
|
|
|
|
|
|
}
|
2022-08-05 15:46:31 +08:00
|
|
|
|
let queryParams = {
|
|
|
|
|
|
orderBy: this.orderBy,
|
2022-08-26 16:26:31 +08:00
|
|
|
|
limit: networkDefaultLimit,
|
2022-08-05 15:46:31 +08:00
|
|
|
|
type: curTab.prop
|
2022-07-22 18:22:00 +08:00
|
|
|
|
}
|
2022-09-20 09:33:49 +08:00
|
|
|
|
const condition = this.getQueryCondition()
|
2022-08-05 15:46:31 +08:00
|
|
|
|
if (condition) {
|
|
|
|
|
|
queryParams = {
|
|
|
|
|
|
orderBy: this.orderBy,
|
2022-08-26 16:26:31 +08:00
|
|
|
|
limit: networkDefaultLimit,
|
2022-08-05 15:46:31 +08:00
|
|
|
|
type: curTab.prop,
|
|
|
|
|
|
q: condition
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-10-02 16:21:39 +08:00
|
|
|
|
this.changeUrlTabState()
|
2022-08-25 15:14:39 +08:00
|
|
|
|
this.tableData = []
|
2022-09-05 16:00:42 +08:00
|
|
|
|
this.tableDataBackup = []
|
2022-08-22 09:57:40 +08:00
|
|
|
|
this.toggleLoading(true)
|
2022-09-16 17:46:20 +08:00
|
|
|
|
this.getChartData(queryParams)
|
2022-08-05 15:46:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
getCurUrl () {
|
2022-09-20 09:33:49 +08:00
|
|
|
|
const condition = this.getQueryCondition()
|
2022-08-05 15:46:31 +08:00
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
},
|
2022-08-24 07:29:40 +08:00
|
|
|
|
gerCycleUrl () {
|
2022-09-20 09:33:49 +08:00
|
|
|
|
const condition = this.getQueryCondition()
|
2022-08-24 07:29:40 +08:00
|
|
|
|
if (condition) {
|
|
|
|
|
|
return this.networkSearchUrl.drilldownCycleUrl
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return this.networkSearchUrl.cycleUrl
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
gerColumnUrl (tableColumn) {
|
2022-09-20 09:33:49 +08:00
|
|
|
|
const condition = this.getQueryCondition()
|
2022-08-24 07:29:40 +08:00
|
|
|
|
if (condition) {
|
|
|
|
|
|
return tableColumn.dillDownCycleDataUrl
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return tableColumn.cycleDataUrl
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2022-09-16 17:46:20 +08:00
|
|
|
|
handleQueryParams (extraParams) {
|
|
|
|
|
|
let queryType = ''
|
2022-11-01 09:12:14 +08:00
|
|
|
|
// const thirdMenu = this.getUrlParam(this.curTabState.thirdMenu, '')
|
|
|
|
|
|
// const fourthMenu = this.getUrlParam(this.curTabState.fourthMenu, '')
|
2022-09-20 09:33:49 +08:00
|
|
|
|
const name = this.getUrlParam(this.curTabState.thirdMenu, '')
|
2022-09-23 19:01:30 +08:00
|
|
|
|
const curOperationType = this.getUrlParam(this.curTabState.tabOperationType, '', true)
|
|
|
|
|
|
if (this.isFourthMenu()) { // 点击的为第四级菜单
|
2022-09-20 11:44:39 +08:00
|
|
|
|
const curTab = this.getCurTab()
|
2022-09-23 19:01:30 +08:00
|
|
|
|
if (curTab) {
|
2022-09-20 11:44:39 +08:00
|
|
|
|
queryType = curTab.prop
|
|
|
|
|
|
} else {
|
|
|
|
|
|
const checkedTab = this.list.find(item => item.checked)
|
|
|
|
|
|
queryType = checkedTab ? checkedTab.prop : ''
|
|
|
|
|
|
}
|
2022-09-23 19:01:30 +08:00
|
|
|
|
} else if (this.isThirdMenu()) { // 点击的为第三级菜单
|
2022-09-20 09:33:49 +08:00
|
|
|
|
const breadcrumbTab = this.list.find(item => item.label === name)
|
2022-09-16 17:46:20 +08:00
|
|
|
|
queryType = breadcrumbTab ? breadcrumbTab.prop : ''
|
2022-08-05 15:46:31 +08:00
|
|
|
|
} else if (curOperationType === operationType.changeTab) { // 切换tab
|
2022-09-16 17:46:20 +08:00
|
|
|
|
const curTab = this.getCurTab()
|
2022-09-23 19:01:30 +08:00
|
|
|
|
if (curTab) {
|
|
|
|
|
|
queryType = curTab.prop
|
|
|
|
|
|
}
|
2022-08-24 07:29:40 +08:00
|
|
|
|
} else if (curOperationType === operationType.secondMenu || curOperationType === operationType.mainMenu) { // 点击第二级菜单,点击菜单
|
2022-09-23 19:01:30 +08:00
|
|
|
|
this.list = this.$_.cloneDeep(this.allList)
|
2022-09-16 17:46:20 +08:00
|
|
|
|
const curTab = this.getCurTab()
|
2022-09-23 19:01:30 +08:00
|
|
|
|
if (curTab) {
|
|
|
|
|
|
queryType = curTab.prop
|
|
|
|
|
|
}
|
2022-08-05 15:46:31 +08:00
|
|
|
|
} else {
|
2022-09-16 17:46:20 +08:00
|
|
|
|
const curTab = this.getCurTab()
|
2022-09-23 19:01:30 +08:00
|
|
|
|
if (curTab) {
|
|
|
|
|
|
queryType = curTab.prop
|
|
|
|
|
|
}
|
2022-08-05 15:46:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (JSON.stringify(extraParams) === '{}') {
|
|
|
|
|
|
extraParams = {
|
2022-09-23 19:01:30 +08:00
|
|
|
|
type: queryType,
|
2022-11-01 09:12:14 +08:00
|
|
|
|
orderBy: this.orderBy ? this.orderBy : 'totalBytes',
|
2022-08-26 16:26:31 +08:00
|
|
|
|
limit: networkDefaultLimit
|
2022-08-05 15:46:31 +08:00
|
|
|
|
}
|
2022-09-20 09:33:49 +08:00
|
|
|
|
// const condition = this.$store.getters.getQueryCondition
|
|
|
|
|
|
const condition = this.getQueryCondition()
|
2022-08-05 15:46:31 +08:00
|
|
|
|
if (condition) {
|
|
|
|
|
|
extraParams.q = condition
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return extraParams
|
|
|
|
|
|
},
|
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-11-09 15:22:09 +08:00
|
|
|
|
let style = 'border-right:0px;font-size:12px;padding:7px 0 !important;border-bottom: 1px solid #ECECEC;height:41px !important;'
|
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-09-01 11:21:53 +08:00
|
|
|
|
style = style + 'color:#046ECA;text-align:left;'
|
2022-07-12 17:17:38 +08:00
|
|
|
|
}
|
|
|
|
|
|
return style
|
|
|
|
|
|
},
|
|
|
|
|
|
tableHeaderCellStyle ({ row, column, rowIndex, columnIndex }) {
|
2022-09-05 16:00:42 +08:00
|
|
|
|
if (columnIndex === 0) {
|
2022-09-01 11:21:53 +08:00
|
|
|
|
return 'text-align:left;border-right:0px;font-size:12px;font-weight:500;padding:4px 0 !important;border-bottom: 1px solid #E2E5EC;'
|
2022-09-05 16:00:42 +08:00
|
|
|
|
} else {
|
2022-09-01 11:21:53 +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
|
|
|
|
},
|
2022-09-20 09:33:49 +08:00
|
|
|
|
getQueryCondition () {
|
|
|
|
|
|
return this.$route.query.queryCondition ? this.$route.query.queryCondition : ''
|
|
|
|
|
|
},
|
2022-09-23 19:01:30 +08:00
|
|
|
|
getUrlParam (param, defaultValue, isNumber) {
|
|
|
|
|
|
if (isNumber) {
|
2022-09-20 11:44:39 +08:00
|
|
|
|
return this.$route.query[param] ? Number(this.$route.query[param]) : defaultValue
|
2022-09-23 19:01:30 +08:00
|
|
|
|
} else {
|
2022-09-20 11:44:39 +08:00
|
|
|
|
return this.$route.query[param] ? this.$route.query[param] : defaultValue
|
|
|
|
|
|
}
|
2022-09-20 09:33:49 +08:00
|
|
|
|
},
|
2022-09-23 19:01:30 +08:00
|
|
|
|
// 获取当前tab:url中的curTab,如果url中curTab为空,则从list中取第一个checked为true的tab,如果list里没有checked为true的,就选第一个tab,并更新url
|
2022-09-30 07:35:09 +08:00
|
|
|
|
getCurTab (excludeTab) {
|
2022-09-16 17:46:20 +08:00
|
|
|
|
const curTabProp = this.$route.query.curTab ? this.$route.query.curTab : null
|
|
|
|
|
|
let curTab = curTabProp ? this.list.find(item => item.prop === curTabProp) : null
|
2022-08-05 15:46:31 +08:00
|
|
|
|
if (!curTab) {
|
2022-09-30 07:35:09 +08:00
|
|
|
|
let tabObjGroup = []
|
|
|
|
|
|
if (excludeTab) {
|
|
|
|
|
|
tabObjGroup = this.list.filter(item => item.checked && (item.prop !== excludeTab.prop))
|
|
|
|
|
|
} else {
|
|
|
|
|
|
tabObjGroup = this.list.filter(item => item.checked)
|
|
|
|
|
|
}
|
2022-08-05 15:46:31 +08:00
|
|
|
|
if (tabObjGroup && tabObjGroup.length > 0) {
|
2022-09-23 19:01:30 +08:00
|
|
|
|
tabObjGroup[0].checked = true
|
2022-08-05 15:46:31 +08:00
|
|
|
|
curTab = tabObjGroup[0]
|
2022-10-02 16:21:39 +08:00
|
|
|
|
this.urlChangeParams[this.curTabState.curTab] = curTab.prop
|
|
|
|
|
|
this.changeUrlTabState()
|
2022-08-05 15:46:31 +08:00
|
|
|
|
} else {
|
2022-09-23 19:01:30 +08:00
|
|
|
|
if (this.list && this.list.length > 0) {
|
|
|
|
|
|
this.list[0].checked = true
|
|
|
|
|
|
curTab = this.list[0]
|
2022-10-02 16:21:39 +08:00
|
|
|
|
this.urlChangeParams[this.curTabState.curTab] = curTab.prop
|
|
|
|
|
|
this.changeUrlTabState()
|
2022-09-23 19:01:30 +08:00
|
|
|
|
}
|
2022-08-05 15:46:31 +08:00
|
|
|
|
}
|
2022-09-16 17:46:20 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
this.list.forEach(item => {
|
2022-11-01 09:12:14 +08:00
|
|
|
|
if (item.name === curTab.name) {
|
2022-09-16 17:46:20 +08:00
|
|
|
|
// item.checked = true
|
|
|
|
|
|
// this.showTab(curTab)
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2022-08-05 15:46:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
return curTab
|
2022-09-23 19:01:30 +08:00
|
|
|
|
},
|
2022-11-01 09:12:14 +08:00
|
|
|
|
combineTabList (tabList, isDrillDown) {
|
2022-11-02 16:26:31 +08:00
|
|
|
|
const listInCode = this.curTableInCode ? this.curTableInCode.tabList : []
|
2022-09-30 07:35:09 +08:00
|
|
|
|
tabList.forEach(tab => {
|
2022-11-02 16:26:31 +08:00
|
|
|
|
const tabName = tab ? (tab.name ? tab.name : tab) : ''
|
|
|
|
|
|
const commonTab = this.commonTabList.find(item => item.name === tabName)
|
2022-09-23 19:01:30 +08:00
|
|
|
|
tab.label = commonTab ? commonTab.i18n : ''
|
|
|
|
|
|
tab.prop = commonTab ? commonTab.prop : ''
|
2022-09-30 07:35:09 +08:00
|
|
|
|
if (!tab.hasOwnProperty('checked') || tab.checked === undefined || tab.checked === null) {
|
2022-09-23 19:01:30 +08:00
|
|
|
|
tab.checked = tab ? tab.show : true
|
|
|
|
|
|
}
|
2022-09-30 07:35:09 +08:00
|
|
|
|
if (!tab.hasOwnProperty('disabled') || tab.disabled === undefined || tab.disabled === null) {
|
2022-09-23 19:01:30 +08:00
|
|
|
|
tab.disabled = tab ? !tab.enable : false
|
|
|
|
|
|
}
|
2022-09-30 07:35:09 +08:00
|
|
|
|
if (!tab.hasOwnProperty('panelId') || tab.panelId === undefined || tab.panelId === null) {
|
2022-09-23 19:01:30 +08:00
|
|
|
|
tab.panelId = tab ? tab.panelIdOfFourthMenu : null
|
|
|
|
|
|
}
|
|
|
|
|
|
// 代码里写死的
|
2022-11-02 16:26:31 +08:00
|
|
|
|
const tabInCode = listInCode ? listInCode.find(item => item.label === tab.label) : {}
|
2022-09-23 19:01:30 +08:00
|
|
|
|
tab.queryCycleTotalProp = tabInCode ? tabInCode.queryCycleTotalProp : null
|
|
|
|
|
|
tab.dillDownProp = tabInCode ? tabInCode.dillDownProp : []
|
2022-10-19 15:45:31 +08:00
|
|
|
|
tab.queryCondition = tabInCode ? tabInCode.queryCondition : []
|
2022-09-23 19:01:30 +08:00
|
|
|
|
})
|
2022-09-30 07:35:09 +08:00
|
|
|
|
// 设置drilldownTabs:未下钻状态设置,已下钻状态无需设置
|
2022-11-01 09:12:14 +08:00
|
|
|
|
// let thirdMenu = this.getUrlParam(this.curTabState.thirdMenu, '')
|
2022-10-21 10:08:49 +08:00
|
|
|
|
// if (!thirdMenu) {
|
2022-11-02 16:26:31 +08:00
|
|
|
|
const oldList = this.$_.cloneDeep(tabList)
|
2022-10-21 10:08:49 +08:00
|
|
|
|
tabList.forEach(tab => {
|
2022-11-02 16:26:31 +08:00
|
|
|
|
const drilldownTabFull = []
|
|
|
|
|
|
const drilldownTabList = tab.drilldownTabs
|
2022-10-21 10:08:49 +08:00
|
|
|
|
drilldownTabList.forEach(drilldownTab => {
|
|
|
|
|
|
if (!drilldownTab.hasOwnProperty('name') || drilldownTab.name === undefined || drilldownTab.name === null) {
|
2022-11-02 16:26:31 +08:00
|
|
|
|
const drilldownTabName = drilldownTab ? (drilldownTab.name ? drilldownTab.name : drilldownTab) : ''
|
|
|
|
|
|
const fullTab = oldList.find(item => item.name === drilldownTabName)
|
|
|
|
|
|
const drilldownTabWithAllInfo = this.$_.cloneDeep(fullTab)
|
2022-10-21 10:08:49 +08:00
|
|
|
|
if (drilldownTabWithAllInfo) {
|
2022-11-02 16:26:31 +08:00
|
|
|
|
const commonTab = this.commonTabList.find(item => item.name === drilldownTabName)
|
2022-11-01 09:12:14 +08:00
|
|
|
|
drilldownTabWithAllInfo.name = drilldownTabName
|
2022-10-21 10:08:49 +08:00
|
|
|
|
drilldownTabWithAllInfo.label = commonTab ? commonTab.i18n : ''
|
|
|
|
|
|
drilldownTabWithAllInfo.prop = commonTab ? commonTab.prop : ''
|
|
|
|
|
|
// if (!drilldownTabWithAllInfo.hasOwnProperty('checked') || drilldownTabWithAllInfo.checked === undefined || drilldownTabWithAllInfo.checked === null) {
|
|
|
|
|
|
drilldownTabWithAllInfo.checked = !((tab.hiddenDrilldownTabs.indexOf(drilldownTabName) >= 0))
|
|
|
|
|
|
// }
|
|
|
|
|
|
// if (!drilldownTabWithAllInfo.hasOwnProperty('disabled') || drilldownTabWithAllInfo.disabled === undefined || drilldownTabWithAllInfo.disabled === null) {
|
|
|
|
|
|
drilldownTabWithAllInfo.disabled = (tab.disabledDrilldownTabs.indexOf(drilldownTabName) >= 0)
|
|
|
|
|
|
// }
|
|
|
|
|
|
// 代码里写死的
|
2022-11-02 16:26:31 +08:00
|
|
|
|
const tabInCode = listInCode ? listInCode.find(item => item.label === fullTab.label) : {}
|
2022-10-21 10:08:49 +08:00
|
|
|
|
drilldownTabWithAllInfo.queryCycleTotalProp = tabInCode ? tabInCode.queryCycleTotalProp : null
|
|
|
|
|
|
drilldownTabWithAllInfo.dillDownProp = tabInCode ? tabInCode.dillDownProp : []
|
|
|
|
|
|
drilldownTabWithAllInfo.queryCondition = tabInCode ? tabInCode.queryCondition : []
|
|
|
|
|
|
drilldownTabFull.push(drilldownTabWithAllInfo)
|
2022-09-23 19:01:30 +08:00
|
|
|
|
}
|
2022-09-30 09:32:36 +08:00
|
|
|
|
}
|
2022-09-23 19:01:30 +08:00
|
|
|
|
})
|
2022-10-21 10:08:49 +08:00
|
|
|
|
if (drilldownTabFull.length > 0) {
|
|
|
|
|
|
tab.drilldownTabs = drilldownTabFull
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2022-09-23 19:01:30 +08:00
|
|
|
|
},
|
2022-11-01 09:12:14 +08:00
|
|
|
|
getColumnsByTab (tab) {
|
|
|
|
|
|
let columns = []
|
|
|
|
|
|
if (tab && tab.hasMetricSearch === true) {
|
|
|
|
|
|
const columnsForMetric = tab.metrics.find(metric => metric.name === this.metric)
|
|
|
|
|
|
columns = columnsForMetric ? columnsForMetric.columns : []
|
|
|
|
|
|
} else {
|
|
|
|
|
|
columns = tab.columns
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return columns
|
|
|
|
|
|
},
|
|
|
|
|
|
setColumnsByTab (tab, columns) {
|
|
|
|
|
|
if (tab && tab.hasMetricSearch === true) {
|
|
|
|
|
|
const columnsForMetric = tab.metrics.find(metric => metric.name === this.metric)
|
|
|
|
|
|
columnsForMetric.columns = columns
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
combineColumnList (tabName) {
|
2022-09-30 07:35:09 +08:00
|
|
|
|
const allTabs = this.getAllTabList()
|
2022-11-01 09:12:14 +08:00
|
|
|
|
const curTab = allTabs.find(item => item.name === tabName)
|
|
|
|
|
|
const customTableTitles = this.getColumnsByTab(curTab)
|
|
|
|
|
|
const hiddenColumnList = this.curTable ? this.curTable.hiddenColumns : []
|
|
|
|
|
|
const disabledColumnList = this.curTable ? this.curTable.disabledColumns : []
|
2022-09-23 19:01:30 +08:00
|
|
|
|
const newColumnList = []
|
2022-09-30 07:35:09 +08:00
|
|
|
|
if (customTableTitles && customTableTitles.length > 0) {
|
|
|
|
|
|
customTableTitles.forEach(column => {
|
2022-11-01 09:12:14 +08:00
|
|
|
|
// if (!column.hasOwnProperty('checked') || column.checked === undefined || column.checked === null) {
|
|
|
|
|
|
const columnName = column ? (column.name ? column.name : column) : ''
|
|
|
|
|
|
// 配置的内容
|
|
|
|
|
|
const commonColumn = this.commonColumnList.find(item => item.name === columnName)
|
|
|
|
|
|
column = {}
|
|
|
|
|
|
column.name = commonColumn ? commonColumn.name : ''
|
|
|
|
|
|
column.label = commonColumn ? commonColumn.i18n : ''
|
|
|
|
|
|
column.prop = commonColumn ? commonColumn.prop : ''
|
|
|
|
|
|
column.unit = commonColumn ? commonColumn.unit : null
|
|
|
|
|
|
column.checked = !((hiddenColumnList.indexOf(columnName) >= 0))
|
|
|
|
|
|
column.disabled = (disabledColumnList.indexOf(columnName) >= 0)
|
|
|
|
|
|
column.columnType = commonColumn ? commonColumn.columnType : ''
|
|
|
|
|
|
// 代码里写死的
|
|
|
|
|
|
const listInCode = this.curTableInCode ? this.curTableInCode.column : []
|
|
|
|
|
|
const columnInCode = listInCode ? listInCode.find(item => item.label === column.label) : {}
|
|
|
|
|
|
column.cycleDataUrl = columnInCode ? columnInCode.cycleDataUrl : ''
|
|
|
|
|
|
column.isInMainUrl = columnInCode ? columnInCode.isInMainUrl : false
|
|
|
|
|
|
column.dillDownCycleDataUrl = columnInCode ? columnInCode.dillDownCycleDataUrl : ''
|
|
|
|
|
|
column.cycle = columnInCode ? columnInCode.cycle : 0
|
|
|
|
|
|
column.scoreType = columnInCode ? columnInCode.scoreType : 0
|
|
|
|
|
|
column.isScoreColumn = columnInCode ? columnInCode.isScoreColumn : true
|
|
|
|
|
|
newColumnList.push(column)
|
|
|
|
|
|
// }
|
2022-09-23 19:01:30 +08:00
|
|
|
|
})
|
2022-09-30 07:35:09 +08:00
|
|
|
|
if (newColumnList && newColumnList.length > 0) {
|
2022-11-01 09:12:14 +08:00
|
|
|
|
this.setColumnsByTab(curTab, newColumnList)
|
2022-09-30 07:35:09 +08:00
|
|
|
|
this.customTableTitles = newColumnList
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.customTableTitles = customTableTitles
|
|
|
|
|
|
}
|
2022-09-23 19:01:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2022-09-30 07:35:09 +08:00
|
|
|
|
isDrilldown () {
|
|
|
|
|
|
if (this.getUrlParam(this.curTabState.fourthMenu)) {
|
|
|
|
|
|
return true
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return false
|
2022-09-23 19:01:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2022-10-02 16:21:39 +08:00
|
|
|
|
isSetDrilldownTabInfo (tabList) {
|
|
|
|
|
|
let isSetDrilldownTabInfo = false
|
|
|
|
|
|
if (tabList && tabList.length > 0) {
|
|
|
|
|
|
const drilldownTab = tabList[0].drilldownTabs
|
|
|
|
|
|
if (drilldownTab && drilldownTab.length > 0 && drilldownTab.hasOwnProperty('name')) {
|
|
|
|
|
|
isSetDrilldownTabInfo = true
|
2022-09-23 19:01:30 +08:00
|
|
|
|
}
|
2022-10-02 16:21:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
return isSetDrilldownTabInfo
|
|
|
|
|
|
},
|
|
|
|
|
|
async saveUserLocalConfig () {
|
2022-11-01 09:12:14 +08:00
|
|
|
|
let curUserConfigs = await readDrilldownTableConfigByUser()
|
|
|
|
|
|
const hiddenColumns = this.getHiddenColumnNameGroup()
|
|
|
|
|
|
this.curTable.hiddenColumns = hiddenColumns
|
2022-11-18 14:21:23 +08:00
|
|
|
|
let version = ''
|
2022-11-01 09:12:14 +08:00
|
|
|
|
if (curUserConfigs && curUserConfigs.length > 0) { // 当前用户存在缓存配置
|
|
|
|
|
|
const currentRouteConfig = curUserConfigs.find(config => config.route === this.tableType)
|
|
|
|
|
|
if (currentRouteConfig) { // 用户的缓存中存在当前路径对应的下钻表格对应的配置
|
|
|
|
|
|
const currentTableConfig = currentRouteConfig.tables.find(table => table.id === this.tableType)
|
|
|
|
|
|
if (currentTableConfig) {
|
|
|
|
|
|
currentTableConfig.hiddenColumns = hiddenColumns
|
|
|
|
|
|
currentTableConfig.tabs.forEach(tab => {
|
|
|
|
|
|
const newTab = this.curTable.tabs.find(newTab => newTab.name === tab.name)
|
|
|
|
|
|
tab.hiddenDrilldownTabs = this.getHiddenDrilldownTabNameGroup(newTab)
|
|
|
|
|
|
tab.checked = newTab.checked
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
} else { // 用户的缓存中不存在当前路径对应的下钻表格对应的配置
|
|
|
|
|
|
curUserConfigs.push(this.handleInitDrilldownTableConfig())
|
|
|
|
|
|
}
|
2022-11-18 14:21:23 +08:00
|
|
|
|
version = await getConfigVersion(this.userId)
|
2022-11-01 09:12:14 +08:00
|
|
|
|
} else { // 当前用户不存在缓存配置
|
|
|
|
|
|
curUserConfigs = []
|
|
|
|
|
|
curUserConfigs.push(this.handleInitDrilldownTableConfig())
|
2022-11-18 14:21:23 +08:00
|
|
|
|
version = await getConfigVersion('default')
|
2022-11-01 09:12:14 +08:00
|
|
|
|
}
|
|
|
|
|
|
// 更新缓存中的配置
|
2022-09-30 07:35:09 +08:00
|
|
|
|
await db[dbDrilldownTableConfig].put({
|
|
|
|
|
|
id: this.userId,
|
2022-11-18 14:21:23 +08:00
|
|
|
|
version: version,
|
2022-11-01 09:12:14 +08:00
|
|
|
|
config: this.$_.cloneDeep(curUserConfigs)
|
2022-09-23 19:01:30 +08:00
|
|
|
|
})
|
2022-11-01 09:12:14 +08:00
|
|
|
|
// 更新使用的配置
|
|
|
|
|
|
const curCfg = this.drillDownTableConfigs.find(cfg => cfg.route === this.tableType)
|
|
|
|
|
|
if (curCfg) {
|
|
|
|
|
|
const curTable = curCfg.tables.find(table => table.id === this.tableType)
|
|
|
|
|
|
curTable.hiddenColumns = hiddenColumns
|
|
|
|
|
|
curTable.tabs.forEach(tab => {
|
|
|
|
|
|
const newTab = this.curTable.tabs.find(newTab => newTab.name === tab.name)
|
|
|
|
|
|
tab.hiddenDrilldownTabs = this.getHiddenDrilldownTabNameGroup(newTab)
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2022-09-30 07:35:09 +08:00
|
|
|
|
},
|
2022-11-01 09:12:14 +08:00
|
|
|
|
handleInitDrilldownTableConfig () {
|
|
|
|
|
|
let config = {}
|
|
|
|
|
|
const hiddenColumns = this.getHiddenColumnNameGroup()
|
|
|
|
|
|
config = {
|
|
|
|
|
|
route: this.tableType,
|
|
|
|
|
|
tables: [{
|
|
|
|
|
|
id: this.tableType,
|
|
|
|
|
|
hiddenColumns: hiddenColumns,
|
|
|
|
|
|
tabs: []
|
|
|
|
|
|
}]
|
|
|
|
|
|
}
|
|
|
|
|
|
this.curTable.tabs.forEach(tab => {
|
|
|
|
|
|
const hiddenTabsConfig = {
|
|
|
|
|
|
name: tab.name,
|
|
|
|
|
|
hiddenDrilldownTabs: this.getHiddenDrilldownTabNameGroup(tab),
|
|
|
|
|
|
checked: tab.checked
|
2022-09-23 19:01:30 +08:00
|
|
|
|
}
|
2022-11-01 09:12:14 +08:00
|
|
|
|
config.tables[0].tabs.push(hiddenTabsConfig)
|
|
|
|
|
|
})
|
|
|
|
|
|
return config
|
|
|
|
|
|
},
|
|
|
|
|
|
getHiddenColumnNameGroup () {
|
2022-11-02 16:26:31 +08:00
|
|
|
|
const hiddenColumns = []
|
2022-11-01 09:12:14 +08:00
|
|
|
|
this.customTableTitles.forEach(column => {
|
|
|
|
|
|
if (column.checked === false) {
|
|
|
|
|
|
hiddenColumns.push(column.name)
|
2022-09-30 07:35:09 +08:00
|
|
|
|
}
|
2022-11-01 09:12:14 +08:00
|
|
|
|
})
|
2022-11-02 16:26:31 +08:00
|
|
|
|
/*
|
2022-11-01 09:12:14 +08:00
|
|
|
|
if (hiddenColumns.length === 0) {
|
|
|
|
|
|
hiddenColumns = this.curTable.hiddenColumns
|
2022-11-02 16:26:31 +08:00
|
|
|
|
} */
|
2022-11-01 09:12:14 +08:00
|
|
|
|
return hiddenColumns
|
2022-09-30 07:35:09 +08:00
|
|
|
|
},
|
2022-11-01 09:12:14 +08:00
|
|
|
|
getHiddenDrilldownTabNameGroup (newTab) {
|
|
|
|
|
|
let hiddenDrilldownTabs = []
|
|
|
|
|
|
if (newTab && newTab.drilldownTabs) {
|
|
|
|
|
|
newTab.drilldownTabs.forEach(drilldownTab => {
|
|
|
|
|
|
if (drilldownTab.checked === false) {
|
|
|
|
|
|
hiddenDrilldownTabs.push(drilldownTab.name)
|
2022-09-30 07:35:09 +08:00
|
|
|
|
}
|
2022-11-01 09:12:14 +08:00
|
|
|
|
})
|
|
|
|
|
|
if (hiddenDrilldownTabs.length === 0) {
|
|
|
|
|
|
hiddenDrilldownTabs = newTab.hiddenDrilldownTabs
|
2022-09-23 19:01:30 +08:00
|
|
|
|
}
|
2022-11-01 09:12:14 +08:00
|
|
|
|
}
|
|
|
|
|
|
return hiddenDrilldownTabs
|
|
|
|
|
|
},
|
|
|
|
|
|
getAllTabList () {
|
|
|
|
|
|
let tabs = []
|
|
|
|
|
|
if (this.curTable.tabs) {
|
|
|
|
|
|
tabs = this.curTable.tabs
|
|
|
|
|
|
}
|
|
|
|
|
|
return tabs
|
|
|
|
|
|
},
|
|
|
|
|
|
getDrilldownTabList (name) {
|
|
|
|
|
|
let tabs = []
|
|
|
|
|
|
if (this.curTable.tabs) {
|
|
|
|
|
|
const firstTabs = this.curTable.tabs
|
|
|
|
|
|
if (firstTabs) {
|
|
|
|
|
|
firstTabs.forEach(tab => {
|
|
|
|
|
|
if (tab.name === name) {
|
|
|
|
|
|
tabs = tab.drilldownTabs
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2022-09-23 19:01:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-09-30 07:35:09 +08:00
|
|
|
|
return tabs
|
2022-11-02 16:26:31 +08:00
|
|
|
|
},
|
|
|
|
|
|
initMetric () {
|
|
|
|
|
|
if (this.metric === 'Bits/s') {
|
|
|
|
|
|
this.columnNameGroup = this.curTableInCode ? this.curTableInCode.bytesColumnNameGroup : []
|
|
|
|
|
|
this.cycleColumnNameGroup = this.curTableInCode ? this.curTableInCode.bytesCycleColumnNameGroup : []
|
|
|
|
|
|
this.orderBy = 'totalBytes'
|
|
|
|
|
|
this.metricUnit = 'bytes'
|
|
|
|
|
|
} else if (this.metric === 'Packets/s') {
|
|
|
|
|
|
this.columnNameGroup = this.curTableInCode ? this.curTableInCode.packetsColumnNameGroup : []
|
|
|
|
|
|
this.cycleColumnNameGroup = this.curTableInCode ? this.curTableInCode.packetsCycleColumnNameGroup : []
|
|
|
|
|
|
this.orderBy = 'totalPackets'
|
|
|
|
|
|
this.metricUnit = 'packets'
|
|
|
|
|
|
} else if (this.metric === 'Sessions/s') {
|
|
|
|
|
|
this.columnNameGroup = this.curTableInCode ? this.curTableInCode.sessionsColumnNameGroup : []
|
|
|
|
|
|
this.cycleColumnNameGroup = this.curTableInCode ? this.curTableInCode.sessionsCycleColumnNameGroup : []
|
|
|
|
|
|
this.orderBy = 'sessions'
|
|
|
|
|
|
this.metricUnit = 'sessions'
|
|
|
|
|
|
}
|
2022-07-12 17:17:38 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2022-09-30 07:35:09 +08:00
|
|
|
|
async mounted () {
|
2022-11-09 15:22:09 +08:00
|
|
|
|
console.log('mounted start...')
|
2022-11-29 17:21:01 +08:00
|
|
|
|
this.list = null
|
|
|
|
|
|
this.tabList = null
|
|
|
|
|
|
this.allList = null
|
|
|
|
|
|
this.drillDownTableConfigs = null
|
|
|
|
|
|
this.curTable = null
|
|
|
|
|
|
this.commonColumnList = null
|
|
|
|
|
|
|
2022-09-30 07:35:09 +08:00
|
|
|
|
this.userId = localStorage.getItem(storageKey.userId)
|
2022-11-01 09:12:14 +08:00
|
|
|
|
this.drillDownTableConfigs = await combinDrilldownTableWithUserConfig()
|
2022-09-23 19:01:30 +08:00
|
|
|
|
this.tableType = this.$route.params ? this.$route.params.typeName : 'networkOverview'
|
2022-11-21 11:28:56 +08:00
|
|
|
|
// 是否需要dns的qtype和rcode的数据字典
|
2022-12-08 16:09:46 +08:00
|
|
|
|
if (this.tableType === fromRoute.dnsServiceInsights) {
|
2022-11-21 11:28:56 +08:00
|
|
|
|
this.dnsQtypeMapData = this.$store.getters.getDnsQtypeMapData
|
|
|
|
|
|
this.dnsRcodeMapData = this.$store.getters.getDnsRcodeMapData
|
2022-12-08 16:09:46 +08:00
|
|
|
|
if (!this.dnsQtypeMapData || this.dnsQtypeMapData.size === 0) {
|
2022-11-21 11:28:56 +08:00
|
|
|
|
this.dnsQtypeMapData = await getDnsMapData('dnsQtype')
|
|
|
|
|
|
this.dnsRcodeMapData = await getDnsMapData('dnsRcode')
|
|
|
|
|
|
this.$store.commit('setDnsQtypeMapData', this.dnsQtypeMapData)
|
|
|
|
|
|
this.$store.commit('setDnsRcodeMapData', this.dnsRcodeMapData)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-09-23 19:01:30 +08:00
|
|
|
|
this.curTableInCode = this.networkTable[this.tableType] ? this.networkTable[this.tableType] : this.networkTable.networkOverview
|
|
|
|
|
|
// 表格状态初始化(url)
|
|
|
|
|
|
this.showRecordNum = Number(this.getUrlParam(this.curTabState.tableShowMore, 10))
|
|
|
|
|
|
this.tableSortColumn = this.getUrlParam(this.curTabState.tableSortColumn, '')
|
|
|
|
|
|
this.tableSortType = this.getUrlParam(this.curTabState.tableSortType, '')
|
|
|
|
|
|
this.tableSortTab = this.getUrlParam(this.curTabState.tableSortTab, '')
|
2022-09-30 07:35:09 +08:00
|
|
|
|
const currentTableConfig = this.drillDownTableConfigs.find(config => config.route === this.tableType)
|
|
|
|
|
|
// 开始设置当前table,当前tab,当前tab对应的列等信息
|
2022-09-23 19:01:30 +08:00
|
|
|
|
this.commonTabList = currentTableConfig ? currentTableConfig.tabs : []
|
|
|
|
|
|
this.commonColumnList = currentTableConfig ? currentTableConfig.columns : []
|
2022-11-01 09:12:14 +08:00
|
|
|
|
this.tables = currentTableConfig ? currentTableConfig.tables : []
|
|
|
|
|
|
if (this.tables && this.tables.length > 0) {
|
|
|
|
|
|
const curTableOldConfig = this.tables.find(table => table.id === this.tableType)
|
2022-09-30 07:35:09 +08:00
|
|
|
|
this.curTable = curTableOldConfig
|
2022-09-23 19:01:30 +08:00
|
|
|
|
if (this.curTable) {
|
2022-11-09 15:22:09 +08:00
|
|
|
|
let curTab = null
|
2022-09-30 07:35:09 +08:00
|
|
|
|
if (this.isDrilldown()) { // 下钻状态
|
|
|
|
|
|
const thirdMenu = this.getUrlParam(this.curTabState.thirdMenu, '')
|
|
|
|
|
|
const tabList = this.getAllTabList()
|
|
|
|
|
|
if (tabList && tabList.length > 0) {
|
2022-10-02 16:21:39 +08:00
|
|
|
|
if (!this.isSetDrilldownTabInfo(tabList)) { // 设否设置了下钻的详细信息
|
2022-11-01 09:12:14 +08:00
|
|
|
|
this.combineTabList(tabList, true)
|
2022-10-02 16:21:39 +08:00
|
|
|
|
}
|
2022-09-30 07:35:09 +08:00
|
|
|
|
const drilldownTab = tabList.find(item => item.label === thirdMenu)
|
|
|
|
|
|
this.list = drilldownTab ? drilldownTab.drilldownTabs : []
|
|
|
|
|
|
this.allList = this.$_.cloneDeep(tabList)// 备份所有配置,下钻及返回时使用
|
2022-11-09 15:22:09 +08:00
|
|
|
|
curTab = this.getCurTab()// 初始化完list,才能正确执行
|
2022-09-30 07:35:09 +08:00
|
|
|
|
const curTabColumns = tabList.find(item => item.prop === curTab.prop)
|
2022-11-01 09:12:14 +08:00
|
|
|
|
this.combineColumnList(curTabColumns.name)
|
2022-09-30 07:35:09 +08:00
|
|
|
|
this.activeTab = ref(curTab.label)
|
|
|
|
|
|
}
|
|
|
|
|
|
} else { // 非下钻状态
|
|
|
|
|
|
this.list = this.getAllTabList()
|
2022-10-09 19:58:30 +08:00
|
|
|
|
if (!this.isSetDrilldownTabInfo(this.list)) { // 是否设置了下钻的详细信息
|
2022-11-01 09:12:14 +08:00
|
|
|
|
this.combineTabList(this.list, true)
|
2022-10-02 16:21:39 +08:00
|
|
|
|
}
|
2022-09-30 07:35:09 +08:00
|
|
|
|
this.allList = this.$_.cloneDeep(this.list)// 备份所有配置,下钻及返回时使用
|
|
|
|
|
|
if (this.list && this.list.length > 0) {
|
2022-11-09 15:22:09 +08:00
|
|
|
|
curTab = this.getCurTab()// 初始化完list,才能正确执行
|
2022-11-01 09:12:14 +08:00
|
|
|
|
this.combineColumnList(curTab.name)
|
2022-09-30 07:35:09 +08:00
|
|
|
|
this.activeTab = ref(curTab.label)
|
2022-09-23 19:01:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-11-09 15:22:09 +08:00
|
|
|
|
if (curTab && curTab.prop) {
|
|
|
|
|
|
const tabName = curTab.prop
|
|
|
|
|
|
this.isDnsMapType = false
|
|
|
|
|
|
if (tabName === 'qtype') {
|
|
|
|
|
|
this.dnsMapData = this.dnsQtypeMapData
|
|
|
|
|
|
this.isDnsMapType = true
|
|
|
|
|
|
} else if (tabName === 'rcode') {
|
|
|
|
|
|
this.dnsMapData = this.dnsRcodeMapData
|
|
|
|
|
|
this.isDnsMapType = true
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-09-23 19:01:30 +08:00
|
|
|
|
this.activeCustomize = ref('tabs')
|
|
|
|
|
|
this.networkSearchUrl = this.curTable.url
|
2022-11-01 09:12:14 +08:00
|
|
|
|
// let metric = this.getUrlParam(this.curTabState.tableMetric, 'Bits/s')
|
2022-11-02 16:26:31 +08:00
|
|
|
|
this.initMetric()
|
2022-10-09 19:58:30 +08:00
|
|
|
|
this.isOnlyRead = this.curTable.isOnlyRead ? this.curTable.isOnlyRead : false
|
2022-10-12 11:11:22 +08:00
|
|
|
|
this.showUnit = this.curTable.showUnit ? this.curTable.showUnit : false
|
2022-10-09 08:24:07 +08:00
|
|
|
|
if (this.curTableInCode.defaultOrderBy) {
|
|
|
|
|
|
this.orderBy = this.curTableInCode.defaultOrderBy
|
|
|
|
|
|
}
|
2022-09-23 19:01:30 +08:00
|
|
|
|
}
|
2022-08-05 15:46:31 +08:00
|
|
|
|
}
|
2022-12-01 16:11:21 +08:00
|
|
|
|
await this.saveUserLocalConfig()
|
2022-09-16 17:46:20 +08:00
|
|
|
|
this.getChartData()
|
2022-07-20 19:47:53 +08:00
|
|
|
|
},
|
2022-08-25 15:14:39 +08:00
|
|
|
|
setup (props) {
|
|
|
|
|
|
},
|
2022-11-29 17:21:01 +08:00
|
|
|
|
beforeUnmount () {
|
|
|
|
|
|
// 以下元素,检测到内存并未释放
|
2022-12-02 13:44:49 +08:00
|
|
|
|
|
2022-11-29 17:21:01 +08:00
|
|
|
|
},
|
2022-10-02 16:21:39 +08:00
|
|
|
|
unmounted () {
|
2022-08-25 15:14:39 +08:00
|
|
|
|
this.isNoData = false
|
2022-07-12 17:17:38 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|