2021-12-14 16:42:45 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<div
|
|
|
|
|
|
class="entity-explorer"
|
|
|
|
|
|
:class="{'entity-explorer--show-list': showList}">
|
|
|
|
|
|
<!-- 顶部工具栏,在列表页显示 -->
|
2023-07-07 17:22:51 +08:00
|
|
|
|
<div class="explorer-top-tools explorer-top-tools-new" style="margin: 2px 0;" v-show="showList">
|
2023-11-08 14:28:37 +08:00
|
|
|
|
<div class="explorer-entity-top-tools">
|
2023-07-07 17:22:51 +08:00
|
|
|
|
<div class="explorer-top-tools-title" style="padding: 0;margin-left: -10px;">{{$t('network.entity')}}</div>
|
2023-11-08 14:28:37 +08:00
|
|
|
|
<date-time-range
|
|
|
|
|
|
class="date-time-range"
|
|
|
|
|
|
:start-time="timeFilter.startTime"
|
|
|
|
|
|
:end-time="timeFilter.endTime"
|
|
|
|
|
|
:date-range="timeFilter.dateRangeValue"
|
|
|
|
|
|
ref="dateTimeRange"
|
|
|
|
|
|
@change="reload"
|
|
|
|
|
|
/>
|
2023-06-15 18:48:47 +08:00
|
|
|
|
</div>
|
2023-07-07 17:22:51 +08:00
|
|
|
|
</div>
|
2021-12-14 16:42:45 +08:00
|
|
|
|
<!-- 搜索组件 -->
|
|
|
|
|
|
<explorer-search
|
2023-07-07 17:22:51 +08:00
|
|
|
|
v-if="!showList"
|
2021-12-31 10:55:49 +08:00
|
|
|
|
ref="search"
|
2021-12-14 16:42:45 +08:00
|
|
|
|
:class="{'explorer-search--show-list': showList}"
|
|
|
|
|
|
:show-list="showList"
|
|
|
|
|
|
@search="search"
|
|
|
|
|
|
></explorer-search>
|
|
|
|
|
|
<!-- 内容区 -->
|
2023-10-22 20:21:32 +08:00
|
|
|
|
<div v-if="showList" style="display: flex;flex-direction: row;padding-bottom: 20px;">
|
2023-07-07 17:22:51 +08:00
|
|
|
|
<entity-filter
|
|
|
|
|
|
:filter-data="newFilterData"
|
|
|
|
|
|
:loading-left="loadingLeft"
|
|
|
|
|
|
:q="q"
|
|
|
|
|
|
:time-filter="timeFilter"
|
|
|
|
|
|
@filter="filter"
|
|
|
|
|
|
></entity-filter>
|
2023-08-04 15:47:47 +08:00
|
|
|
|
<div class="explorer-container explorer-container-new">
|
2023-07-07 17:22:51 +08:00
|
|
|
|
<explorer-search
|
|
|
|
|
|
ref="search"
|
|
|
|
|
|
:class="{'explorer-search--show-list': showList}"
|
|
|
|
|
|
:show-list="showList"
|
|
|
|
|
|
@search="search"
|
|
|
|
|
|
></explorer-search>
|
|
|
|
|
|
|
|
|
|
|
|
<div style="display: flex;flex-direction: column;height: calc(100% - 42px);">
|
2023-07-10 18:54:43 +08:00
|
|
|
|
<div class="explorer-result" v-if="showList" style="position: relative;">
|
|
|
|
|
|
<loading :loading="loadingCount" style="width: 240px"></loading>
|
2023-10-31 15:47:50 +08:00
|
|
|
|
<span>{{ summaryCount.totalCount }} </span>{{$t('overall.results')}},IP
|
|
|
|
|
|
<span>{{ summaryCount.ipCount }}</span>,{{$t('overall.domain')}}
|
2023-07-12 15:47:22 +08:00
|
|
|
|
<span>{{ summaryCount.domainCount }}</span>,APP
|
2023-07-07 17:22:51 +08:00
|
|
|
|
<span>{{ summaryCount.appCount }}</span>
|
2023-11-10 18:26:24 +08:00
|
|
|
|
|
|
|
|
|
|
<span class="entity-hide-entity">
|
|
|
|
|
|
<el-checkbox
|
|
|
|
|
|
v-model="isHideRelatedEntities"
|
|
|
|
|
|
:label="$t('entity.hideRelatedEntities')"
|
|
|
|
|
|
:disabled="listData.length===0"
|
|
|
|
|
|
@change="hideRelatedEntities"
|
|
|
|
|
|
size="large" />
|
|
|
|
|
|
</span>
|
2023-07-07 17:22:51 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<entity-list
|
|
|
|
|
|
style="width: 100%;"
|
|
|
|
|
|
:list-data="listData"
|
|
|
|
|
|
:list-mode="listMode"
|
2023-11-06 19:50:29 +08:00
|
|
|
|
:keywordList="keywordList"
|
2023-07-07 17:22:51 +08:00
|
|
|
|
:pageObj="pageObj"
|
|
|
|
|
|
:time-filter="timeFilter"
|
|
|
|
|
|
@pageSize="pageSize"
|
|
|
|
|
|
@pageNo="pageNo"
|
|
|
|
|
|
:loading="listLoading"
|
|
|
|
|
|
></entity-list>
|
|
|
|
|
|
</div>
|
2022-01-06 15:32:24 +08:00
|
|
|
|
</div>
|
2021-12-14 16:42:45 +08:00
|
|
|
|
</div>
|
2023-07-07 17:22:51 +08:00
|
|
|
|
|
|
|
|
|
|
<div class="explorer-foot" v-if="!showList">
|
2021-12-14 16:42:45 +08:00
|
|
|
|
<div>
|
|
|
|
|
|
<el-divider direction="vertical"></el-divider>
|
|
|
|
|
|
<div class="entity-overview">
|
|
|
|
|
|
<div class="overview-left">
|
2022-04-27 14:52:25 +08:00
|
|
|
|
<span class="overview-left-loading">
|
2023-08-11 17:53:51 +08:00
|
|
|
|
<span class="overview-left-loading-span">APP</span>
|
2022-04-27 14:52:25 +08:00
|
|
|
|
</span>
|
2021-12-14 16:42:45 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="overview-right">
|
2023-08-11 17:53:51 +08:00
|
|
|
|
<div class="right-row margin-b-6">
|
2023-08-30 17:26:42 +08:00
|
|
|
|
<i class="cn-icon cn-icon-proportion entity-explorer-total__icon"></i>
|
2023-08-11 17:53:51 +08:00
|
|
|
|
<div class="right-label">{{ $t('network.total') }}</div>
|
|
|
|
|
|
<div class="right-label-loading">
|
2023-08-28 14:15:39 +08:00
|
|
|
|
<loading :loading="loadingApp" size="small"></loading>
|
2023-08-11 17:53:51 +08:00
|
|
|
|
<div class="right-value">{{ numberWithCommas(entityAppTotal) }}</div>
|
|
|
|
|
|
</div>
|
2021-12-14 16:42:45 +08:00
|
|
|
|
</div>
|
2023-08-11 17:53:51 +08:00
|
|
|
|
|
2021-12-14 16:42:45 +08:00
|
|
|
|
<div class="right-row">
|
|
|
|
|
|
<i class="cn-icon cn-icon-active"></i>
|
2023-08-11 17:53:51 +08:00
|
|
|
|
<div class="right-label">{{ $t('entity.active') }}</div>
|
2022-05-06 11:16:25 +08:00
|
|
|
|
<div class="right-label-loading">
|
2022-09-02 09:40:47 +08:00
|
|
|
|
<loading :loading="loadingAppActive" size="small"></loading>
|
2023-08-11 17:53:51 +08:00
|
|
|
|
<div class="right-value-block">
|
|
|
|
|
|
<span class="margin-r-6">{{ numberWithCommas(entityAppActive) }}</span>
|
|
|
|
|
|
<span class="last-hour">{{ $t('entity.inLastHour') }}</span>
|
|
|
|
|
|
</div>
|
2022-05-06 11:16:25 +08:00
|
|
|
|
</div>
|
2021-12-14 16:42:45 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<el-divider direction="vertical"></el-divider>
|
|
|
|
|
|
<div class="entity-overview">
|
|
|
|
|
|
<div class="overview-left">
|
2022-04-27 14:52:25 +08:00
|
|
|
|
<span class="overview-left-loading">
|
2023-10-31 15:47:50 +08:00
|
|
|
|
<span class="overview-left-loading-span">{{$t('overall.domain')}}</span>
|
2022-04-27 14:52:25 +08:00
|
|
|
|
</span>
|
2021-12-14 16:42:45 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="overview-right">
|
2023-08-11 17:53:51 +08:00
|
|
|
|
<div class="right-row margin-b-6">
|
2023-08-30 17:26:42 +08:00
|
|
|
|
<i class="cn-icon cn-icon-proportion entity-explorer-total__icon"></i>
|
2023-08-11 17:53:51 +08:00
|
|
|
|
<div class="right-label">{{ $t('network.total') }}</div>
|
|
|
|
|
|
<div class="right-label-loading">
|
2023-08-28 14:15:39 +08:00
|
|
|
|
<loading :loading="loadingDomain" size="small"></loading>
|
2023-08-11 17:53:51 +08:00
|
|
|
|
<div class="right-value">{{ numberWithCommas(entityDomainTotal) }}</div>
|
|
|
|
|
|
</div>
|
2021-12-14 16:42:45 +08:00
|
|
|
|
</div>
|
2023-08-11 17:53:51 +08:00
|
|
|
|
|
2021-12-14 16:42:45 +08:00
|
|
|
|
<div class="right-row">
|
|
|
|
|
|
<i class="cn-icon cn-icon-active"></i>
|
2023-08-11 17:53:51 +08:00
|
|
|
|
<div class="right-label">{{ $t('entity.active') }}</div>
|
2022-05-06 11:16:25 +08:00
|
|
|
|
<div class="right-label-loading">
|
2022-09-02 09:40:47 +08:00
|
|
|
|
<loading :loading="loadingDomainActive" size="small"></loading>
|
2023-08-11 17:53:51 +08:00
|
|
|
|
<div class="right-value-block">
|
|
|
|
|
|
<span class="margin-r-6">{{ numberWithCommas(entityDomainActive) }}</span>
|
|
|
|
|
|
<span class="last-hour">{{ $t('entity.inLastHour') }}</span>
|
|
|
|
|
|
</div>
|
2022-05-06 11:16:25 +08:00
|
|
|
|
</div>
|
2021-12-14 16:42:45 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<el-divider direction="vertical"></el-divider>
|
|
|
|
|
|
<div class="entity-overview">
|
|
|
|
|
|
<div class="overview-left">
|
2022-04-27 14:52:25 +08:00
|
|
|
|
<span class="overview-left-loading">
|
2023-08-11 17:53:51 +08:00
|
|
|
|
<span class="overview-left-loading-span">IP</span>
|
2022-04-27 14:52:25 +08:00
|
|
|
|
</span>
|
2021-12-14 16:42:45 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="overview-right">
|
2023-08-11 17:53:51 +08:00
|
|
|
|
<div class="right-row margin-b-6">
|
2023-08-30 17:26:42 +08:00
|
|
|
|
<i class="cn-icon cn-icon-proportion entity-explorer-total__icon"></i>
|
2023-08-11 17:53:51 +08:00
|
|
|
|
<div class="right-label">{{ $t('network.total') }}</div>
|
|
|
|
|
|
<div class="right-label-loading">
|
2023-08-28 14:15:39 +08:00
|
|
|
|
<loading :loading="loadingIp" size="small"></loading>
|
2023-08-11 17:53:51 +08:00
|
|
|
|
<div class="right-value">{{ numberWithCommas(entityIpTotal) }}</div>
|
|
|
|
|
|
</div>
|
2021-12-14 16:42:45 +08:00
|
|
|
|
</div>
|
2023-08-11 17:53:51 +08:00
|
|
|
|
|
2021-12-14 16:42:45 +08:00
|
|
|
|
<div class="right-row">
|
|
|
|
|
|
<i class="cn-icon cn-icon-active"></i>
|
2023-08-11 17:53:51 +08:00
|
|
|
|
<div class="right-label">{{ $t('entity.active') }}</div>
|
2022-05-06 11:16:25 +08:00
|
|
|
|
<div class="right-label-loading">
|
2022-09-02 09:40:47 +08:00
|
|
|
|
<loading :loading="loadingIpActive" size="small"></loading>
|
2023-08-11 17:53:51 +08:00
|
|
|
|
<div class="right-value-block">
|
|
|
|
|
|
<span class="margin-r-6">{{ numberWithCommas(entityIpActive) }}</span>
|
|
|
|
|
|
<span class="last-hour">{{ $t('entity.inLastHour') }}</span>
|
|
|
|
|
|
</div>
|
2022-05-06 11:16:25 +08:00
|
|
|
|
</div>
|
2021-12-14 16:42:45 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<el-divider direction="vertical"></el-divider>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
import ExplorerSearch from '@/views/entityExplorer/search/ExplorerSearch'
|
|
|
|
|
|
import EntityFilter from '@/views/entityExplorer/EntityFilter'
|
|
|
|
|
|
import EntityList from '@/views/entityExplorer/entityList/EntityList'
|
2023-08-28 11:54:50 +08:00
|
|
|
|
import { defaultPageSize, riskLevelMapping } from '@/utils/constants'
|
2023-08-24 17:15:41 +08:00
|
|
|
|
import axios from 'axios'
|
2021-12-31 10:40:37 +08:00
|
|
|
|
import { api } from '@/utils/api'
|
2022-01-25 19:47:08 +08:00
|
|
|
|
import { getNowTime, getSecond } from '@/utils/date-util'
|
2022-01-05 20:24:02 +08:00
|
|
|
|
import { ref } from 'vue'
|
2022-06-06 17:34:55 +08:00
|
|
|
|
import _ from 'lodash'
|
2022-04-27 14:52:25 +08:00
|
|
|
|
import Loading from '@/components/common/Loading'
|
2023-08-18 09:32:58 +08:00
|
|
|
|
import {
|
|
|
|
|
|
overwriteUrl,
|
|
|
|
|
|
urlParamsHandler,
|
2023-09-08 11:11:56 +08:00
|
|
|
|
numberWithCommas
|
2023-08-18 09:32:58 +08:00
|
|
|
|
} from '@/utils/tools'
|
2023-06-16 16:33:58 +08:00
|
|
|
|
import Parser from '@/components/advancedSearch/meta/parser'
|
|
|
|
|
|
import { handleErrorTip } from '@/components/advancedSearch/meta/error'
|
|
|
|
|
|
import { columnList } from '@/utils/static-data'
|
|
|
|
|
|
import { useRoute } from 'vue-router'
|
2023-11-06 19:50:29 +08:00
|
|
|
|
import { columnType } from '@/components/advancedSearch/meta/meta'
|
2023-11-08 14:28:37 +08:00
|
|
|
|
import DateTimeRange from '@/components/common/TimeRange/DateTimeRange'
|
2021-12-14 16:42:45 +08:00
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
|
name: 'entity-explorer',
|
|
|
|
|
|
components: {
|
2022-04-27 14:52:25 +08:00
|
|
|
|
Loading,
|
2021-12-14 16:42:45 +08:00
|
|
|
|
ExplorerSearch,
|
|
|
|
|
|
EntityFilter,
|
2023-11-08 14:28:37 +08:00
|
|
|
|
EntityList,
|
|
|
|
|
|
DateTimeRange
|
2021-12-14 16:42:45 +08:00
|
|
|
|
},
|
|
|
|
|
|
data () {
|
|
|
|
|
|
return {
|
|
|
|
|
|
showList: false,
|
2021-12-17 20:56:25 +08:00
|
|
|
|
listMode: 'list', // entity列表的模式,list|block
|
2021-12-14 16:42:45 +08:00
|
|
|
|
|
2021-12-31 10:40:37 +08:00
|
|
|
|
entityAppTotal: '-',
|
|
|
|
|
|
entityAppNew: '-',
|
|
|
|
|
|
entityAppActive: '-',
|
|
|
|
|
|
|
|
|
|
|
|
entityDomainTotal: '-',
|
|
|
|
|
|
entityDomainNew: '-',
|
|
|
|
|
|
entityDomainActive: '-',
|
|
|
|
|
|
|
|
|
|
|
|
entityIpTotal: '-',
|
|
|
|
|
|
entityIpNew: '-',
|
|
|
|
|
|
entityIpActive: '-',
|
|
|
|
|
|
|
2023-07-07 17:22:51 +08:00
|
|
|
|
newFilterData: [
|
|
|
|
|
|
{
|
|
|
|
|
|
icon: 'cn-icon cn-icon-registration-country',
|
2023-09-22 11:21:06 +08:00
|
|
|
|
title: this.$t('entity.topCountries'),
|
2023-08-28 11:54:50 +08:00
|
|
|
|
topColumn: 'ip.country',
|
2023-07-07 17:22:51 +08:00
|
|
|
|
totalCount: 0,
|
|
|
|
|
|
data: []
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
icon: 'cn-icon cn-icon-city',
|
2023-09-22 11:21:06 +08:00
|
|
|
|
title: this.$t('entity.topCities'),
|
2023-08-28 11:54:50 +08:00
|
|
|
|
topColumn: 'ip.city',
|
2023-07-07 17:22:51 +08:00
|
|
|
|
totalCount: 0,
|
|
|
|
|
|
data: []
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
icon: 'cn-icon cn-icon-as',
|
2023-09-22 11:21:06 +08:00
|
|
|
|
title: this.$t('entity.topASNs'),
|
2023-08-28 11:54:50 +08:00
|
|
|
|
topColumn: 'ip.asn',
|
2023-08-22 10:34:18 +08:00
|
|
|
|
totalCount: 0,
|
|
|
|
|
|
data: []
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
icon: 'cn-icon cn-icon-operator',
|
2023-09-22 11:21:06 +08:00
|
|
|
|
title: this.$t('entity.topISPs'),
|
2023-08-28 11:54:50 +08:00
|
|
|
|
topColumn: 'ip.isp',
|
2023-08-22 10:34:18 +08:00
|
|
|
|
totalCount: 0,
|
|
|
|
|
|
data: []
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
icon: 'cn-icon cn-icon-open-port',
|
2023-09-22 11:21:06 +08:00
|
|
|
|
title: this.$t('entity.topPorts'),
|
2023-08-28 11:54:50 +08:00
|
|
|
|
topColumn: 'ip.port',
|
|
|
|
|
|
topColumn1: 'ip.protocol',
|
2023-08-22 10:34:18 +08:00
|
|
|
|
totalCount: 0,
|
|
|
|
|
|
data: []
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
icon: 'cn-icon cn-icon-FQDN',
|
2023-09-22 11:21:06 +08:00
|
|
|
|
title: this.$t('entity.topFQDNCategories'),
|
2023-08-28 11:54:50 +08:00
|
|
|
|
topColumn: 'domain.category',
|
2023-08-22 10:34:18 +08:00
|
|
|
|
totalCount: 0,
|
|
|
|
|
|
data: []
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
icon: 'cn-icon cn-icon-category2',
|
2023-09-22 11:21:06 +08:00
|
|
|
|
title: this.$t('entity.topAppCategories'),
|
2023-08-28 11:54:50 +08:00
|
|
|
|
topColumn: 'app.category',
|
2023-08-22 10:34:18 +08:00
|
|
|
|
totalCount: 0,
|
|
|
|
|
|
data: []
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
icon: 'cn-icon cn-icon-tag1',
|
2023-09-22 11:21:06 +08:00
|
|
|
|
title: this.$t('entity.topTags'),
|
2023-08-28 11:54:50 +08:00
|
|
|
|
topColumn: 'tag',
|
2023-07-07 17:22:51 +08:00
|
|
|
|
totalCount: 0,
|
|
|
|
|
|
data: []
|
|
|
|
|
|
}
|
|
|
|
|
|
],
|
2022-01-05 23:56:27 +08:00
|
|
|
|
listData: [],
|
2022-01-25 19:47:08 +08:00
|
|
|
|
q: '',
|
2022-02-07 16:11:49 +08:00
|
|
|
|
metaList: [],
|
2022-04-27 14:52:25 +08:00
|
|
|
|
listLoading: false,
|
2022-05-06 11:16:25 +08:00
|
|
|
|
// 实体详情搜索页面 底部列表
|
|
|
|
|
|
loadingApp: false,
|
|
|
|
|
|
loadingDomain: false,
|
|
|
|
|
|
loadingIp: false,
|
|
|
|
|
|
// Active
|
|
|
|
|
|
loadingAppActive: false,
|
|
|
|
|
|
loadingDomainActive: false,
|
|
|
|
|
|
loadingIpActive: false,
|
|
|
|
|
|
|
|
|
|
|
|
// 实体详情列表页面 左侧筛选条件
|
2022-10-24 18:37:10 +08:00
|
|
|
|
loadingLeft: false,
|
2023-09-06 14:10:54 +08:00
|
|
|
|
initFlag: true, // 初始化标志,避免初始化时pageSize和pageNo会调用搜索
|
2023-07-07 17:22:51 +08:00
|
|
|
|
timer: null, // 初始化标志的延时器,需要销毁
|
|
|
|
|
|
summaryCount: {
|
2023-11-08 14:28:37 +08:00
|
|
|
|
totalCount: 0,
|
2023-07-12 15:47:22 +08:00
|
|
|
|
domainCount: 0,
|
2023-07-07 17:22:51 +08:00
|
|
|
|
ipCount: 0,
|
|
|
|
|
|
appCount: 0
|
|
|
|
|
|
},
|
2023-11-06 19:50:29 +08:00
|
|
|
|
loadingCount: false, // 实体基数统计的loading
|
|
|
|
|
|
keywordList: []
|
2021-12-14 16:42:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
2023-06-25 10:33:57 +08:00
|
|
|
|
numberWithCommas,
|
2021-12-14 16:42:45 +08:00
|
|
|
|
timeRefreshChange () {
|
2022-01-04 17:04:05 +08:00
|
|
|
|
if (!this.$refs.dateTimeRange.isCustom) {
|
|
|
|
|
|
const value = this.timeFilter.dateRangeValue
|
|
|
|
|
|
this.$refs.dateTimeRange.quickChange(value)
|
|
|
|
|
|
}
|
2021-12-14 16:42:45 +08:00
|
|
|
|
},
|
2022-01-04 17:04:05 +08:00
|
|
|
|
reload (s, e, v) {
|
|
|
|
|
|
this.dateTimeRangeChange(s, e, v)
|
|
|
|
|
|
},
|
|
|
|
|
|
// methods
|
|
|
|
|
|
dateTimeRangeChange (s, e, v) {
|
|
|
|
|
|
this.timeFilter = { startTime: s, endTime: e, dateRangeValue: v }
|
2021-12-14 16:42:45 +08:00
|
|
|
|
},
|
2022-02-14 16:04:08 +08:00
|
|
|
|
// sql特殊字段转换
|
|
|
|
|
|
specialColumnHandle (sql) {
|
|
|
|
|
|
const columns = [
|
|
|
|
|
|
{
|
|
|
|
|
|
target: "app_risk='1'",
|
|
|
|
|
|
original: `app_risk='${riskLevelMapping[0].name.toLowerCase()}'`
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
target: "app_risk='2'",
|
|
|
|
|
|
original: `app_risk='${riskLevelMapping[1].name.toLowerCase()}'`
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
target: "app_risk='3'",
|
|
|
|
|
|
original: `app_risk='${riskLevelMapping[2].name.toLowerCase()}'`
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
target: "app_risk='4'",
|
|
|
|
|
|
original: `app_risk='${riskLevelMapping[3].name.toLowerCase()}'`
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
target: "app_risk='5'",
|
|
|
|
|
|
original: `app_risk='${riskLevelMapping[4].name.toLowerCase()}'`
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
target: "=''",
|
|
|
|
|
|
original: "='unknown'"
|
|
|
|
|
|
}
|
|
|
|
|
|
]
|
|
|
|
|
|
let result = sql
|
|
|
|
|
|
columns.forEach(c => {
|
2022-06-06 17:34:55 +08:00
|
|
|
|
result = _.replace(result, c.original, c.target)
|
2022-02-14 16:04:08 +08:00
|
|
|
|
})
|
|
|
|
|
|
return result
|
|
|
|
|
|
},
|
2022-06-09 18:20:28 +08:00
|
|
|
|
search (param) {
|
2023-07-07 17:22:51 +08:00
|
|
|
|
// todo 下版本08版本删除 ---- start
|
|
|
|
|
|
if (param && param.q.indexOf("QUERY('") > -1) {
|
|
|
|
|
|
this.$message.error(this.$t('overall.versionNotSupportThisFormat'))
|
|
|
|
|
|
return true
|
|
|
|
|
|
}
|
|
|
|
|
|
// 下版本08版本删除 ---- end
|
2022-06-09 18:20:28 +08:00
|
|
|
|
let q
|
|
|
|
|
|
let metaList
|
|
|
|
|
|
if (param) {
|
|
|
|
|
|
q = param.q
|
|
|
|
|
|
metaList = param.metaList
|
|
|
|
|
|
}
|
2022-06-06 17:34:55 +08:00
|
|
|
|
if (q) {
|
|
|
|
|
|
this.q = this.specialColumnHandle(q)
|
2022-02-07 16:11:49 +08:00
|
|
|
|
this.metaList = metaList
|
2022-01-25 19:47:08 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
this.q = ''
|
2022-02-07 16:11:49 +08:00
|
|
|
|
this.metaList = []
|
2022-01-04 17:04:05 +08:00
|
|
|
|
}
|
2023-11-06 19:50:29 +08:00
|
|
|
|
this.getKeyword(param.keywordList)
|
2022-01-25 19:47:08 +08:00
|
|
|
|
|
2023-09-06 17:11:09 +08:00
|
|
|
|
// 参数q,避免切换页码时,地址栏参数q为空
|
|
|
|
|
|
let urlQ = ''
|
|
|
|
|
|
if (param.str) {
|
|
|
|
|
|
urlQ = encodeURI(param.str)
|
|
|
|
|
|
} else if (this.q) {
|
|
|
|
|
|
urlQ = encodeURI(this.q)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-06-16 16:33:58 +08:00
|
|
|
|
// 在非列表模式下选择tag模式,在地址栏输入内容时将mode添加到地址栏
|
|
|
|
|
|
const mode = this.$route.query.mode || 'text'
|
2023-09-06 14:10:54 +08:00
|
|
|
|
if (this.pageObj.resetPageNo && !this.initFlag) {
|
|
|
|
|
|
this.pageObj.pageNo = 1
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.pageObj.resetPageNo = true
|
|
|
|
|
|
}
|
2023-06-16 16:33:58 +08:00
|
|
|
|
|
|
|
|
|
|
this.reloadUrl({
|
|
|
|
|
|
listMode: this.listMode,
|
2023-09-06 17:11:09 +08:00
|
|
|
|
q: urlQ,
|
2023-06-16 16:33:58 +08:00
|
|
|
|
mode: mode,
|
2023-09-01 15:55:03 +08:00
|
|
|
|
pageNo: this.pageObj.pageNo,
|
|
|
|
|
|
pageSize: this.pageObj.pageSize
|
2023-06-16 16:33:58 +08:00
|
|
|
|
})
|
|
|
|
|
|
|
2021-12-14 16:42:45 +08:00
|
|
|
|
if (!this.showList) {
|
2023-06-16 16:33:58 +08:00
|
|
|
|
// 首页进入搜索时重载页面,视觉上进入列表页面
|
|
|
|
|
|
this.$router.push({
|
2023-11-09 16:17:25 +08:00
|
|
|
|
path: '/entity',
|
2023-06-16 16:33:58 +08:00
|
|
|
|
query: {
|
|
|
|
|
|
listMode: this.listMode,
|
2023-09-06 17:11:09 +08:00
|
|
|
|
q: urlQ,
|
2023-06-16 16:33:58 +08:00
|
|
|
|
mode: mode,
|
2023-09-01 15:55:03 +08:00
|
|
|
|
range: this.timeFilter.dateRangeValue,
|
|
|
|
|
|
pageNo: this.pageObj.pageNo,
|
|
|
|
|
|
pageSize: this.pageObj.pageSize
|
2023-06-16 16:33:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
2021-12-14 16:42:45 +08:00
|
|
|
|
this.showList = true
|
2023-06-16 16:33:58 +08:00
|
|
|
|
// 跳转页面,则不执行搜索功能
|
|
|
|
|
|
return true
|
2021-12-14 16:42:45 +08:00
|
|
|
|
}
|
2022-10-24 18:37:10 +08:00
|
|
|
|
|
2023-09-06 17:11:09 +08:00
|
|
|
|
this.queryFilterNew({ q: this.q, ...this.pageObj, ...this.timeFilter })
|
|
|
|
|
|
this.queryList({ q: this.q, ...this.pageObj, ...this.timeFilter })
|
|
|
|
|
|
this.queryCount({ q: this.q, ...this.pageObj, ...this.timeFilter })
|
|
|
|
|
|
|
|
|
|
|
|
// 延时一秒,避免初始化时pageSize为20,pageNo为1也会调用“搜索”的情况
|
|
|
|
|
|
if (this.initFlag) {
|
|
|
|
|
|
this.timer = setTimeout(() => {
|
|
|
|
|
|
this.initFlag = false
|
|
|
|
|
|
}, 1000)
|
2021-12-14 16:42:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2022-01-05 20:24:02 +08:00
|
|
|
|
pageSize (val) {
|
|
|
|
|
|
this.pageObj.pageSize = val
|
2023-11-10 18:15:33 +08:00
|
|
|
|
const keywordList = this.getKeywordListByMetaList(this.metaList)
|
2022-10-24 18:37:10 +08:00
|
|
|
|
if (this.initFlag) {
|
|
|
|
|
|
if (val !== 20) {
|
2023-11-10 18:15:33 +08:00
|
|
|
|
this.search({ metaList: this.metaList, q: this.q, keywordList: keywordList })
|
2022-10-24 18:37:10 +08:00
|
|
|
|
}
|
2023-09-06 14:10:54 +08:00
|
|
|
|
} else {
|
2023-11-10 18:15:33 +08:00
|
|
|
|
this.search({ metaList: this.metaList, q: this.q, keywordList: keywordList })
|
2022-10-24 18:37:10 +08:00
|
|
|
|
}
|
2022-01-05 20:24:02 +08:00
|
|
|
|
},
|
|
|
|
|
|
pageNo (val) {
|
2023-09-06 14:10:54 +08:00
|
|
|
|
if (!this.initFlag) {
|
|
|
|
|
|
this.pageObj.pageNo = val
|
|
|
|
|
|
this.pageObj.resetPageNo = false
|
2023-11-10 18:15:33 +08:00
|
|
|
|
const keywordList = this.getKeywordListByMetaList(this.metaList)
|
|
|
|
|
|
this.search({ metaList: this.metaList, q: this.q, keywordList: keywordList })
|
2022-10-24 18:37:10 +08:00
|
|
|
|
}
|
2022-01-05 20:24:02 +08:00
|
|
|
|
},
|
2022-01-06 15:32:24 +08:00
|
|
|
|
// 点击上一页箭头
|
|
|
|
|
|
prev () {
|
|
|
|
|
|
this.scrollbarToTop()
|
|
|
|
|
|
},
|
|
|
|
|
|
// 点击下一页箭头
|
|
|
|
|
|
next () {
|
|
|
|
|
|
this.scrollbarToTop()
|
|
|
|
|
|
},
|
|
|
|
|
|
// currentPage 改变时会触发
|
|
|
|
|
|
current (val) {
|
|
|
|
|
|
this.$emit('pageNo', val)
|
|
|
|
|
|
this.scrollbarToTop()
|
|
|
|
|
|
},
|
|
|
|
|
|
scrollbarToTop () {
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
const wraps = document.querySelector('#entityList')
|
|
|
|
|
|
wraps.scrollTop = 0
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
2021-12-31 10:55:49 +08:00
|
|
|
|
/* filter组件内点击后查询 */
|
|
|
|
|
|
filter (name, topData) {
|
2023-08-28 11:54:50 +08:00
|
|
|
|
if (topData.topColumn === 'ip.port') {
|
2023-08-22 10:34:18 +08:00
|
|
|
|
const params = [
|
|
|
|
|
|
{
|
|
|
|
|
|
column: topData.topColumn,
|
|
|
|
|
|
operator: '=',
|
|
|
|
|
|
value: topData.port
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
column: topData.topColumn1,
|
|
|
|
|
|
operator: '=',
|
|
|
|
|
|
value: topData.l7Protocol
|
|
|
|
|
|
}
|
|
|
|
|
|
]
|
|
|
|
|
|
this.$refs.search.addParams(params)
|
2023-08-31 14:40:16 +08:00
|
|
|
|
} else if (topData.topColumn === 'tag') {
|
|
|
|
|
|
const params = {
|
|
|
|
|
|
column: topData.topColumn,
|
|
|
|
|
|
operator: 'has',
|
|
|
|
|
|
value: name
|
|
|
|
|
|
}
|
|
|
|
|
|
this.$refs.search.addParams([params])
|
2023-08-22 10:34:18 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
const params = {
|
|
|
|
|
|
column: topData.topColumn,
|
|
|
|
|
|
operator: '=',
|
|
|
|
|
|
value: name
|
|
|
|
|
|
}
|
|
|
|
|
|
this.$refs.search.addParams([params])
|
2022-02-18 10:07:43 +08:00
|
|
|
|
}
|
2022-03-12 16:56:46 +08:00
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.emitter.emit('advanced-search')
|
|
|
|
|
|
})
|
2021-12-14 16:42:45 +08:00
|
|
|
|
},
|
2023-07-07 17:22:51 +08:00
|
|
|
|
/** 新版查询filter数据 */
|
|
|
|
|
|
queryFilterNew (params) {
|
|
|
|
|
|
const queryParams = {
|
2023-11-10 18:26:24 +08:00
|
|
|
|
startTime: getSecond(params.startTime),
|
|
|
|
|
|
endTime: getSecond(params.endTime),
|
2023-07-07 17:22:51 +08:00
|
|
|
|
resource: params.q || ''
|
|
|
|
|
|
}
|
|
|
|
|
|
this.loadingLeft = true
|
2023-08-24 17:15:41 +08:00
|
|
|
|
const aggCountry = axios.get(api.entity.entityList.aggCountry, { params: queryParams })
|
|
|
|
|
|
const aggCity = axios.get(api.entity.entityList.aggCity, { params: queryParams })
|
|
|
|
|
|
const aggIPAsn = axios.get(api.entity.entityList.aggIPAsn, { params: queryParams })
|
|
|
|
|
|
const aggIPIsp = axios.get(api.entity.entityList.aggIPIsp, { params: queryParams })
|
|
|
|
|
|
const aggPort = axios.get(api.entity.entityList.aggPort, { params: queryParams })
|
|
|
|
|
|
const aggDomain = axios.get(api.entity.entityList.aggDomain, { params: queryParams })
|
|
|
|
|
|
const aggAppCategory = axios.get(api.entity.entityList.aggAppCategory, { params: queryParams })
|
|
|
|
|
|
const aggTag = axios.get(api.entity.entityList.aggTag, { params: queryParams })
|
2023-07-07 17:22:51 +08:00
|
|
|
|
|
2023-08-22 10:34:18 +08:00
|
|
|
|
Promise.all([aggCountry, aggCity, aggIPAsn, aggIPIsp, aggPort, aggDomain, aggAppCategory, aggTag]).then(response => {
|
2023-09-11 16:57:47 +08:00
|
|
|
|
response.forEach((item1, index) => {
|
|
|
|
|
|
if (item1.status === 200 && item1.data.data.list) {
|
2023-09-18 11:57:14 +08:00
|
|
|
|
if (item1.data.data.list.length >= 5) {
|
|
|
|
|
|
this.newFilterData[index].showNum = 5
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.newFilterData[index].showNum = item1.data.data.list.length
|
|
|
|
|
|
}
|
2023-07-07 17:22:51 +08:00
|
|
|
|
this.newFilterData[index].data = []
|
2023-09-11 16:57:47 +08:00
|
|
|
|
item1.data.data.list.forEach((item, i) => {
|
2023-09-18 11:57:14 +08:00
|
|
|
|
let obj = {
|
|
|
|
|
|
label: item.value,
|
|
|
|
|
|
topColumn: this.newFilterData[index].topColumn,
|
|
|
|
|
|
value: item.uniqueEntities,
|
|
|
|
|
|
showNum: 5
|
|
|
|
|
|
}
|
|
|
|
|
|
if (index === 0) {
|
|
|
|
|
|
obj.flag = item.value // 接口字段名称为'China',svg名称为'CN',通过countryNameIdMapping进行转换
|
|
|
|
|
|
}
|
|
|
|
|
|
if (index === 4) {
|
|
|
|
|
|
obj = {
|
2023-08-22 10:34:18 +08:00
|
|
|
|
topColumn: this.newFilterData[index].topColumn,
|
2023-09-18 11:57:14 +08:00
|
|
|
|
topColumn1: this.newFilterData[index].topColumn1,
|
|
|
|
|
|
port: item.port,
|
|
|
|
|
|
l7Protocol: item.l7Protocol,
|
|
|
|
|
|
value: item.uniqueEntities,
|
|
|
|
|
|
showNum: 5
|
2023-09-11 16:57:47 +08:00
|
|
|
|
}
|
2023-07-07 17:22:51 +08:00
|
|
|
|
}
|
2023-09-18 11:57:14 +08:00
|
|
|
|
this.newFilterData[index].data.push(obj)
|
2023-07-07 17:22:51 +08:00
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}).catch(e => {
|
2023-09-14 18:17:52 +08:00
|
|
|
|
this.$message.error(e.response.data.message)
|
2023-07-07 17:22:51 +08:00
|
|
|
|
}).finally(() => {
|
|
|
|
|
|
this.loadingLeft = false
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
/** 实体列表查询 */
|
2021-12-31 10:55:49 +08:00
|
|
|
|
queryList (params) {
|
2022-01-06 16:28:16 +08:00
|
|
|
|
this.listLoading = true
|
2022-01-04 17:04:05 +08:00
|
|
|
|
const queryParams = {
|
2023-07-11 16:37:53 +08:00
|
|
|
|
pageSize: params.pageSize,
|
|
|
|
|
|
pageNo: params.pageNo,
|
2023-11-08 14:28:37 +08:00
|
|
|
|
startTime: getSecond(params.startTime),
|
|
|
|
|
|
endTime: getSecond(params.endTime),
|
2023-11-10 18:26:24 +08:00
|
|
|
|
resource: params.q || '',
|
|
|
|
|
|
hideRelated: this.isHideRelatedEntities
|
2022-01-04 17:04:05 +08:00
|
|
|
|
}
|
2023-08-24 17:15:41 +08:00
|
|
|
|
axios.get(api.entity.entityList.list, { params: queryParams }).then(response => {
|
|
|
|
|
|
if (response.status === 200) {
|
2022-01-06 16:28:16 +08:00
|
|
|
|
this.listData = []
|
|
|
|
|
|
this.$nextTick(() => {
|
2023-08-24 17:15:41 +08:00
|
|
|
|
this.listData = response.data.data.list
|
2022-01-06 16:28:16 +08:00
|
|
|
|
})
|
2023-06-07 15:58:59 +08:00
|
|
|
|
} else {
|
2023-08-24 17:15:41 +08:00
|
|
|
|
this.$message.error(response.data.message)
|
2022-01-05 20:24:02 +08:00
|
|
|
|
}
|
2022-01-05 23:56:27 +08:00
|
|
|
|
}).finally(() => {
|
|
|
|
|
|
this.listLoading = false
|
2022-01-05 20:24:02 +08:00
|
|
|
|
})
|
|
|
|
|
|
},
|
2023-07-07 17:22:51 +08:00
|
|
|
|
/** 实体基数统计 */
|
|
|
|
|
|
queryCount (params) {
|
|
|
|
|
|
this.loadingCount = true
|
|
|
|
|
|
const queryParams = {
|
2023-11-08 14:28:37 +08:00
|
|
|
|
startTime: getSecond(params.startTime),
|
|
|
|
|
|
endTime: getSecond(params.endTime),
|
2023-11-10 18:26:24 +08:00
|
|
|
|
resource: params.q || '',
|
|
|
|
|
|
hideRelated: this.isHideRelatedEntities
|
2023-07-07 17:22:51 +08:00
|
|
|
|
}
|
2023-08-24 17:15:41 +08:00
|
|
|
|
axios.get(api.entity.entityList.summaryCount, { params: queryParams }).then(response => {
|
|
|
|
|
|
if (response.status === 200) {
|
|
|
|
|
|
this.summaryCount = response.data.data
|
2023-11-08 14:28:37 +08:00
|
|
|
|
this.pageObj.total = response.data.data.totalCount
|
2023-07-07 17:22:51 +08:00
|
|
|
|
} else {
|
2023-11-08 14:28:37 +08:00
|
|
|
|
this.summaryCount = { totalCount: 0, domainCount: 0, ipCount: 0, appCount: 0 }
|
2023-07-07 17:22:51 +08:00
|
|
|
|
}
|
|
|
|
|
|
}).catch(e => {
|
2023-11-06 19:50:29 +08:00
|
|
|
|
console.error(e)
|
2023-11-08 14:28:37 +08:00
|
|
|
|
this.summaryCount = { totalCount: 0, domainCount: 0, ipCount: 0, appCount: 0 }
|
2023-07-07 17:22:51 +08:00
|
|
|
|
}).finally(() => {
|
|
|
|
|
|
this.loadingCount = false
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
2022-01-05 20:24:02 +08:00
|
|
|
|
|
|
|
|
|
|
queryListTotal (params) {
|
|
|
|
|
|
const queryParams = {
|
2022-05-14 21:53:52 +08:00
|
|
|
|
...params,
|
2022-06-23 16:37:58 +08:00
|
|
|
|
startTime: getSecond(params.startTime),
|
|
|
|
|
|
endTime: getSecond(params.endTime)
|
2022-01-05 20:24:02 +08:00
|
|
|
|
}
|
2023-08-24 17:15:41 +08:00
|
|
|
|
axios.get(api.entityListTotal, { params: queryParams }).then(response => {
|
|
|
|
|
|
if (response.status === 200) {
|
|
|
|
|
|
this.pageObj.total = response.data.data.result
|
2022-01-05 20:24:02 +08:00
|
|
|
|
}
|
2021-12-31 10:55:49 +08:00
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
handleQ (params) {
|
|
|
|
|
|
return Object.keys(params).map(param => {
|
2022-01-05 23:56:27 +08:00
|
|
|
|
return `${param}='${params[param]}'`
|
2021-12-31 10:55:49 +08:00
|
|
|
|
}).join(' AND ')
|
2021-12-31 10:40:37 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
getEntityIndexData () {
|
|
|
|
|
|
// Total
|
2022-05-06 11:16:25 +08:00
|
|
|
|
this.loadingApp = true
|
|
|
|
|
|
this.loadingDomain = true
|
|
|
|
|
|
this.loadingIp = true
|
|
|
|
|
|
// Active
|
|
|
|
|
|
this.loadingAppActive = true
|
|
|
|
|
|
this.loadingDomainActive = true
|
|
|
|
|
|
this.loadingIpActive = true
|
|
|
|
|
|
|
2023-08-28 14:15:39 +08:00
|
|
|
|
axios.get(api.entity.entityList.entityTotal).then(response => {
|
2023-08-24 17:15:41 +08:00
|
|
|
|
if (response.status === 200) {
|
|
|
|
|
|
this.entityDomainTotal = response.data.data.domainCount
|
|
|
|
|
|
this.entityIpTotal = response.data.data.ipCount
|
|
|
|
|
|
this.entityAppTotal = response.data.data.appCount
|
2021-12-31 10:40:37 +08:00
|
|
|
|
}
|
2022-05-06 11:16:25 +08:00
|
|
|
|
this.loadingDomain = false
|
|
|
|
|
|
this.loadingIp = false
|
2023-07-07 17:22:51 +08:00
|
|
|
|
this.loadingApp = false
|
2021-12-31 10:55:49 +08:00
|
|
|
|
})
|
2021-12-31 10:40:37 +08:00
|
|
|
|
// Active
|
2023-08-24 17:15:41 +08:00
|
|
|
|
axios.get(api.entity.entityList.entityActive).then(response => {
|
|
|
|
|
|
if (response.status === 200) {
|
|
|
|
|
|
this.entityDomainActive = response.data.data.domainCount
|
|
|
|
|
|
this.entityIpActive = response.data.data.ipCount
|
|
|
|
|
|
this.entityAppActive = response.data.data.appCount
|
2021-12-31 10:40:37 +08:00
|
|
|
|
}
|
2022-05-06 11:16:25 +08:00
|
|
|
|
this.loadingDomainActive = false
|
|
|
|
|
|
this.loadingIpActive = false
|
2023-07-07 17:22:51 +08:00
|
|
|
|
this.loadingAppActive = false
|
2021-12-31 10:40:37 +08:00
|
|
|
|
})
|
2022-01-25 19:47:08 +08:00
|
|
|
|
},
|
2023-06-16 16:33:58 +08:00
|
|
|
|
setListMode (mode) {
|
|
|
|
|
|
this.listMode = mode
|
|
|
|
|
|
const newParam = {
|
|
|
|
|
|
listMode: mode
|
|
|
|
|
|
}
|
|
|
|
|
|
this.reloadUrl(newParam)
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 向地址栏添加/删除参数
|
|
|
|
|
|
*/
|
|
|
|
|
|
reloadUrl (newParam, clean) {
|
|
|
|
|
|
const { query } = this.$route
|
|
|
|
|
|
let newUrl = urlParamsHandler(window.location.href, query, newParam)
|
|
|
|
|
|
if (clean) {
|
|
|
|
|
|
newUrl = urlParamsHandler(window.location.href, query, newParam, clean)
|
|
|
|
|
|
}
|
|
|
|
|
|
overwriteUrl(newUrl)
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 初始化搜索,分享url或者刷新界面,保留本次搜索结果
|
|
|
|
|
|
* @param q
|
|
|
|
|
|
*/
|
|
|
|
|
|
initSearch (q) {
|
2023-06-27 10:41:00 +08:00
|
|
|
|
let str = q
|
2023-06-16 16:33:58 +08:00
|
|
|
|
// 此处的mode不做text和tag区分,是因为text和tag构造搜索参数过程不一样,但结果的参数一致
|
|
|
|
|
|
// 故采用text的参数形式进行搜索,tag形式在tagMode.vue的mounted里根据地址栏的参数q构造metaList
|
|
|
|
|
|
if (str) {
|
2023-06-27 10:41:00 +08:00
|
|
|
|
// 为避免地址栏任意输入导致全查询的q带QUERY,解析时不识别导致的语法错误
|
|
|
|
|
|
// 如地址栏输入116.178.222.171,此时的q很长,刷新界面时需要把q里的116.178.222.171拿出来进行搜索
|
|
|
|
|
|
if (str.indexOf('QUERY') > -1) {
|
|
|
|
|
|
const strList = str.split(' ')
|
|
|
|
|
|
if (strList.length > 0) {
|
|
|
|
|
|
// 此时strList[1]为ip_addr:116.178.222.171,获取116.178.222.171
|
|
|
|
|
|
str = strList[1].slice(8)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-06-16 16:33:58 +08:00
|
|
|
|
const parser = new Parser(columnList)
|
2023-11-06 19:50:29 +08:00
|
|
|
|
const metaList = parser.parseStr(_.cloneDeep(str)).metaList
|
2023-11-10 18:15:33 +08:00
|
|
|
|
const keywordList = this.getKeywordListByMetaList(metaList)
|
2023-09-08 11:11:56 +08:00
|
|
|
|
const keyInfo = parser.comparedEntityKey(parser.handleEntityTypeByStr(str))
|
2023-08-09 16:58:04 +08:00
|
|
|
|
if (keyInfo.isKey) {
|
|
|
|
|
|
const errorList = parser.validateStr(keyInfo.key)
|
|
|
|
|
|
if (_.isEmpty(errorList)) {
|
2023-11-06 19:50:29 +08:00
|
|
|
|
this.search({ ...parser.parseStr(keyInfo.key), str: str, keywordList: keywordList })
|
2023-08-09 16:58:04 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
this.$message.error(handleErrorTip(errorList[0]))
|
|
|
|
|
|
}
|
2023-06-16 16:33:58 +08:00
|
|
|
|
} else {
|
2023-08-18 09:32:58 +08:00
|
|
|
|
this.$message.error(this.$t('tip.invalidQueryField') + ' ' + keyInfo.key)
|
2023-06-16 16:33:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.search({ q: '', str: '', metaList: [] })
|
|
|
|
|
|
}
|
2023-10-22 20:21:32 +08:00
|
|
|
|
},
|
|
|
|
|
|
queryScoreBase () {
|
|
|
|
|
|
const { startTime, endTime } = getNowTime(60 * 24)
|
|
|
|
|
|
const params = {
|
|
|
|
|
|
startTime: getSecond(startTime),
|
|
|
|
|
|
endTime: getSecond(endTime)
|
|
|
|
|
|
}
|
|
|
|
|
|
const tcp = axios.get(api.npm.overview.tcpSessionDelay, { params: params })
|
|
|
|
|
|
const http = axios.get(api.npm.overview.httpResponseDelay, { params: params })
|
|
|
|
|
|
const ssl = axios.get(api.npm.overview.sslConDelay, { params: params })
|
|
|
|
|
|
const tcpPercent = axios.get(api.npm.overview.tcpLostlenPercent, { params: params })
|
|
|
|
|
|
const packetPercent = axios.get(api.npm.overview.packetRetransPercent, { params: params })
|
|
|
|
|
|
Promise.all([tcp, http, ssl, tcpPercent, packetPercent]).then(res => {
|
|
|
|
|
|
const scoreBase = {}
|
|
|
|
|
|
res.forEach((t, i) => {
|
|
|
|
|
|
if (t.status === 200) {
|
|
|
|
|
|
if (i === 0) {
|
|
|
|
|
|
scoreBase.establishLatencyMsP10 = _.get(t.data, 'data.result.establishLatencyMsP10', null)
|
|
|
|
|
|
scoreBase.establishLatencyMsP90 = _.get(t.data, 'data.result.establishLatencyMsP90', null)
|
|
|
|
|
|
} else if (i === 1) {
|
|
|
|
|
|
scoreBase.httpResponseLatencyP10 = _.get(t.data, 'data.result.httpResponseLatencyP10', null)
|
|
|
|
|
|
scoreBase.httpResponseLatencyP90 = _.get(t.data, 'data.result.httpResponseLatencyP90', null)
|
|
|
|
|
|
} else if (i === 2) {
|
|
|
|
|
|
scoreBase.sslConLatencyP10 = _.get(t.data, 'data.result.sslConLatencyP10', null)
|
|
|
|
|
|
scoreBase.sslConLatencyP90 = _.get(t.data, 'data.result.sslConLatencyP90', null)
|
|
|
|
|
|
} else if (i === 3) {
|
|
|
|
|
|
scoreBase.tcpLostlenPercentP10 = _.get(t.data, 'data.result.tcpLostlenPercentP10', null)
|
|
|
|
|
|
scoreBase.tcpLostlenPercentP90 = _.get(t.data, 'data.result.tcpLostlenPercentP90', null)
|
|
|
|
|
|
} else if (i === 4) {
|
|
|
|
|
|
scoreBase.pktRetransPercentP10 = _.get(t.data, 'data.result.pktRetransPercentP10', null)
|
|
|
|
|
|
scoreBase.pktRetransPercentP90 = _.get(t.data, 'data.result.pktRetransPercentP90', null)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
this.$store.commit('setScoreBase', scoreBase)
|
|
|
|
|
|
}).catch((e) => {
|
|
|
|
|
|
}).finally(() => {
|
|
|
|
|
|
})
|
2023-11-06 19:50:29 +08:00
|
|
|
|
},
|
2023-11-10 18:15:33 +08:00
|
|
|
|
getKeywordListByMetaList (metaList) {
|
|
|
|
|
|
if (metaList) {
|
|
|
|
|
|
const keywordList = []
|
|
|
|
|
|
metaList.forEach(item => {
|
|
|
|
|
|
if (item.column && item.column.type === columnType.fullText) {
|
|
|
|
|
|
keywordList.push({ type: item.column.type, value: item.column.label })
|
|
|
|
|
|
} else if (item.column && item.column.type === columnType.string) {
|
|
|
|
|
|
keywordList.push({ type: item.column.type, value: item.value.value })
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
return keywordList
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2023-11-06 19:50:29 +08:00
|
|
|
|
getKeyword (list) {
|
|
|
|
|
|
if (list) {
|
|
|
|
|
|
const metaList = JSON.parse(JSON.stringify(list))
|
|
|
|
|
|
const keyList = []
|
|
|
|
|
|
metaList.forEach(item => {
|
|
|
|
|
|
if (item.value) {
|
|
|
|
|
|
keyList.push({ type: item.type, value: this.getKeyValue(item.value) })
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
this.keywordList = keyList
|
2023-11-08 14:28:37 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
this.keywordList = []
|
2023-11-06 19:50:29 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
getKeyValue (str) {
|
|
|
|
|
|
if (str[0] === "'" && str[str.length - 1] === "'") {
|
|
|
|
|
|
str = str.substring(1, str.length)
|
|
|
|
|
|
str = str.substring(0, str.length - 1)
|
|
|
|
|
|
}
|
|
|
|
|
|
if (str[0] === '%') {
|
|
|
|
|
|
str = str.substring(1, str.length)
|
|
|
|
|
|
}
|
|
|
|
|
|
if (str[str.length - 1] === '%') {
|
|
|
|
|
|
str = str.substring(0, str.length - 1)
|
|
|
|
|
|
}
|
|
|
|
|
|
return str
|
2023-11-10 18:26:24 +08:00
|
|
|
|
},
|
|
|
|
|
|
hideRelatedEntities (e) {
|
|
|
|
|
|
this.isHideRelatedEntities = e
|
|
|
|
|
|
this.reloadUrl({ hideRelated: e })
|
|
|
|
|
|
this.queryList({ q: this.q, ...this.pageObj, ...this.timeFilter })
|
|
|
|
|
|
this.queryCount({ q: this.q, ...this.pageObj, ...this.timeFilter })
|
2021-12-14 16:42:45 +08:00
|
|
|
|
}
|
2021-12-31 10:40:37 +08:00
|
|
|
|
},
|
|
|
|
|
|
mounted () {
|
2023-09-06 17:11:09 +08:00
|
|
|
|
let { q, listMode } = this.$route.query
|
2023-06-16 16:33:58 +08:00
|
|
|
|
|
|
|
|
|
|
// 如果地址栏有listMode,即列表页,并非首页,则开始搜索
|
|
|
|
|
|
if (listMode) {
|
|
|
|
|
|
this.showList = true
|
2023-09-27 17:27:23 +08:00
|
|
|
|
// %位置为0是输入中文时能解码,%20,25%分别是空格和%的情况
|
|
|
|
|
|
if (q && (q.indexOf('%') === 0 || q.indexOf('%20') > -1 || q.indexOf('%25') > -1)) {
|
2023-09-06 17:11:09 +08:00
|
|
|
|
q = decodeURI(q)
|
|
|
|
|
|
}
|
2023-10-08 17:26:32 +08:00
|
|
|
|
// %位置不为0,即内容包含非英文时
|
2023-10-31 18:08:23 +08:00
|
|
|
|
let str1 = ''
|
|
|
|
|
|
if (q) {
|
|
|
|
|
|
str1 = q.substring(q.indexOf('%'), q.indexOf('%') + 3)
|
|
|
|
|
|
}
|
2023-11-10 18:15:33 +08:00
|
|
|
|
if (q.indexOf('+') > -1) {
|
|
|
|
|
|
q = q.replace('+', '')
|
|
|
|
|
|
}
|
2023-10-08 17:26:32 +08:00
|
|
|
|
if (q && q.indexOf('%') > 0 && (str1 !== '%20' || str1 === '%25')) {
|
|
|
|
|
|
q = decodeURI(q)
|
|
|
|
|
|
}
|
2023-06-16 16:33:58 +08:00
|
|
|
|
this.initSearch(q)
|
|
|
|
|
|
this.listMode = listMode
|
2023-10-22 20:21:32 +08:00
|
|
|
|
// 查询评分基准
|
|
|
|
|
|
this.$store.commit('resetScoreBase')
|
|
|
|
|
|
this.queryScoreBase()
|
2023-06-16 16:33:58 +08:00
|
|
|
|
}
|
2023-11-10 18:15:33 +08:00
|
|
|
|
|
|
|
|
|
|
if (!this.showList) {
|
|
|
|
|
|
this.getEntityIndexData()
|
|
|
|
|
|
}
|
2022-01-04 17:04:05 +08:00
|
|
|
|
},
|
2022-05-14 21:53:52 +08:00
|
|
|
|
watch: {
|
2023-06-16 16:33:58 +08:00
|
|
|
|
timeFilter () {
|
2022-06-06 17:34:55 +08:00
|
|
|
|
this.search({ metaList: this.metaList, q: this.q })
|
2022-01-04 17:04:05 +08:00
|
|
|
|
}
|
2022-05-14 21:53:52 +08:00
|
|
|
|
},
|
2022-01-04 17:04:05 +08:00
|
|
|
|
setup () {
|
2023-06-16 16:33:58 +08:00
|
|
|
|
const { query } = useRoute()
|
|
|
|
|
|
// 获取url携带的range、startTime、endTime
|
|
|
|
|
|
const rangeParam = query.range
|
|
|
|
|
|
const startTimeParam = query.startTime
|
|
|
|
|
|
const endTimeParam = query.endTime
|
|
|
|
|
|
// 若url携带了,使用携带的值,否则使用默认值。
|
|
|
|
|
|
const dateRangeValue = rangeParam ? parseInt(query.range) : 60
|
|
|
|
|
|
const timeFilter = ref({ dateRangeValue })
|
|
|
|
|
|
if (!startTimeParam || !endTimeParam) {
|
|
|
|
|
|
const { startTime, endTime } = getNowTime(60)
|
|
|
|
|
|
timeFilter.value.startTime = startTime
|
|
|
|
|
|
timeFilter.value.endTime = endTime
|
|
|
|
|
|
} else {
|
|
|
|
|
|
timeFilter.value.startTime = parseInt(startTimeParam)
|
|
|
|
|
|
timeFilter.value.endTime = parseInt(endTimeParam)
|
|
|
|
|
|
}
|
2023-09-06 14:10:54 +08:00
|
|
|
|
const pageObj = ref({
|
|
|
|
|
|
pageNo: query.pageNo ? parseInt(query.pageNo) : 1,
|
|
|
|
|
|
// 是否重置pageNo,在执行新搜索时是true
|
|
|
|
|
|
resetPageNo: true,
|
|
|
|
|
|
pageSize: query.pageSize ? parseInt(query.pageSize) : defaultPageSize,
|
|
|
|
|
|
total: 0
|
|
|
|
|
|
})
|
2023-11-10 18:26:24 +08:00
|
|
|
|
const isHideRelatedEntities = ref(query.hideRelated ? JSON.parse(query.hideRelated) : false) // 隐藏相关实体,默认false不隐藏
|
2022-01-04 17:04:05 +08:00
|
|
|
|
return {
|
2023-09-06 14:10:54 +08:00
|
|
|
|
timeFilter,
|
2023-11-10 18:26:24 +08:00
|
|
|
|
pageObj,
|
|
|
|
|
|
isHideRelatedEntities
|
2022-01-04 17:04:05 +08:00
|
|
|
|
}
|
2022-10-24 18:37:10 +08:00
|
|
|
|
},
|
|
|
|
|
|
beforeUnmount () {
|
|
|
|
|
|
clearTimeout(this.timer)
|
2021-12-14 16:42:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|