2022-02-14 17:40:29 +08:00
|
|
|
|
<template>
|
2023-10-22 18:29:34 +08:00
|
|
|
|
<div class="entity-explorer entity-explorer--show-list detections">
|
2022-02-14 22:22:31 +08:00
|
|
|
|
<!-- 顶部工具栏,在列表页显示 -->
|
2022-11-09 15:42:36 +08:00
|
|
|
|
<div class="explorer-top-tools explorer-detection-top-tools">
|
2022-11-07 15:25:00 +08:00
|
|
|
|
<div class="explorer-top-tools-title">{{$t('overall.detections')}}</div>
|
|
|
|
|
|
<div style="display: flex">
|
2023-11-10 11:43:11 +08:00
|
|
|
|
<div class="explorer-top-tools-block" @click="jumpNewDetetion" v-if="hasPermission('detectionPolicy')">
|
2023-05-30 17:28:49 +08:00
|
|
|
|
<i class="cn-icon cn-icon-configure-policies detection-icon-setting"></i>
|
2023-05-18 15:51:47 +08:00
|
|
|
|
<span>{{$t('config.detections.configurePolicies')}}</span>
|
2023-08-28 15:14:20 +08:00
|
|
|
|
</div>
|
2022-11-07 15:25:00 +08:00
|
|
|
|
<DateTimeRange
|
|
|
|
|
|
class="date-time-range"
|
|
|
|
|
|
:start-time="timeFilter.startTime"
|
|
|
|
|
|
:end-time="timeFilter.endTime"
|
|
|
|
|
|
:date-range="timeFilter.dateRangeValue"
|
|
|
|
|
|
ref="dateTimeRange"
|
|
|
|
|
|
@change="reload"/>
|
|
|
|
|
|
<TimeRefresh
|
|
|
|
|
|
class="date-time-range"
|
|
|
|
|
|
@change="timeRefreshChange"
|
|
|
|
|
|
:end-time="timeFilter.endTime"/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2023-11-16 19:45:43 +08:00
|
|
|
|
<div style="width: 100%; padding-bottom: 50px;">
|
2022-12-06 20:15:02 +08:00
|
|
|
|
<chart-tabs :data="tabsData" router></chart-tabs>
|
2022-02-14 22:22:31 +08:00
|
|
|
|
</div>
|
2022-11-07 15:25:00 +08:00
|
|
|
|
|
2022-02-14 22:22:31 +08:00
|
|
|
|
<!-- 搜索组件 -->
|
|
|
|
|
|
<detection-search
|
|
|
|
|
|
ref="search"
|
2022-05-11 17:50:40 +08:00
|
|
|
|
:page-type="pageType"
|
2022-02-14 22:22:31 +08:00
|
|
|
|
@search="search"
|
|
|
|
|
|
></detection-search>
|
|
|
|
|
|
<!-- 内容区 -->
|
2023-10-22 18:29:34 +08:00
|
|
|
|
<div class="detections__container">
|
2022-05-27 12:14:24 +08:00
|
|
|
|
<loading :loading="loading"></loading>
|
2022-03-03 18:01:26 +08:00
|
|
|
|
<template v-if="isEventSeverityNoData">
|
2022-12-08 10:17:13 +08:00
|
|
|
|
<div class="no-data detection__event-severity-bar" >{{ $t('npm.noData') }}</div>
|
2022-03-03 18:01:26 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
<template v-if="!isEventSeverityNoData">
|
2022-11-07 15:25:00 +08:00
|
|
|
|
<div class="detection__event-severity-bar detection-border" :id="`eventSeverityTrendBar${pageType}`">
|
2022-03-03 18:01:26 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
2022-06-09 21:55:28 +08:00
|
|
|
|
<div style="display: flex; flex-grow: 1; height: 100%;">
|
2022-02-14 22:22:31 +08:00
|
|
|
|
<detection-filter
|
2022-11-07 15:25:00 +08:00
|
|
|
|
class="detection-border"
|
2022-02-25 13:33:54 +08:00
|
|
|
|
:filter-data="filterData[pageType]"
|
2022-02-14 22:22:31 +08:00
|
|
|
|
:q="q"
|
|
|
|
|
|
:time-filter="timeFilter"
|
2023-11-10 14:11:46 +08:00
|
|
|
|
@filter="getFilter"
|
2022-02-14 22:22:31 +08:00
|
|
|
|
></detection-filter>
|
2022-02-15 23:27:55 +08:00
|
|
|
|
|
2022-02-14 22:22:31 +08:00
|
|
|
|
<div class="detection__list">
|
2022-11-07 15:25:00 +08:00
|
|
|
|
<div class="detection__list-statistics detection-border">
|
2022-02-21 10:52:14 +08:00
|
|
|
|
<div class="statistics__severity">
|
|
|
|
|
|
<div class="chart-header">
|
2023-10-20 15:45:11 +08:00
|
|
|
|
<div class="chart-header__title">{{$t('detections.severity')}}</div>
|
2022-02-17 19:28:48 +08:00
|
|
|
|
</div>
|
2022-03-03 18:01:26 +08:00
|
|
|
|
<template v-if="isStatisticsSeverityNoData">
|
2022-12-09 10:24:40 +08:00
|
|
|
|
<div class="no-data chart-content" >{{ $t('npm.noData') }}</div>
|
2022-03-03 18:01:26 +08:00
|
|
|
|
</template>
|
2022-03-30 15:37:55 +08:00
|
|
|
|
<template v-else>
|
2023-10-20 15:45:11 +08:00
|
|
|
|
<div class="chart-content" :id="`eventSeverityPie${pageType}`"></div>
|
2022-03-03 18:01:26 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
|
2022-02-17 19:28:48 +08:00
|
|
|
|
</div>
|
2022-02-21 10:52:14 +08:00
|
|
|
|
<div class="statistics__category">
|
|
|
|
|
|
<div class="chart-header">
|
2023-10-20 15:45:11 +08:00
|
|
|
|
<div class="chart-header__title">{{$t('detections.eventType')}}</div>
|
2022-02-17 19:28:48 +08:00
|
|
|
|
</div>
|
2022-03-03 18:01:26 +08:00
|
|
|
|
<template v-if="isStatisticsCategoryNoData">
|
2022-12-09 10:24:40 +08:00
|
|
|
|
<div class="no-data chart-content" >{{ $t('npm.noData') }}</div>
|
2022-03-03 18:01:26 +08:00
|
|
|
|
</template>
|
2022-03-30 15:37:55 +08:00
|
|
|
|
<template v-else>
|
2023-10-20 15:45:11 +08:00
|
|
|
|
<div class="chart-content" :id="`detectionCategoryPer${pageType}`"></div>
|
2022-03-03 18:01:26 +08:00
|
|
|
|
</template>
|
2022-02-17 19:28:48 +08:00
|
|
|
|
</div>
|
2022-02-21 10:52:14 +08:00
|
|
|
|
<div class="statistics__active-attack">
|
|
|
|
|
|
<div class="chart-header">
|
2023-10-20 15:45:11 +08:00
|
|
|
|
<div class="chart-header__title">{{pageType === detectionPageType.securityEvent ? $t('detection.activeOffender') : $t('detections.activeEntity')}}</div>
|
2022-02-17 19:28:48 +08:00
|
|
|
|
</div>
|
2022-03-03 18:01:26 +08:00
|
|
|
|
<template v-if="isStatisticsActiveAttackNoData">
|
2022-12-09 10:24:40 +08:00
|
|
|
|
<div class="no-data chart-content" >{{ $t('npm.noData') }}</div>
|
2022-03-03 18:01:26 +08:00
|
|
|
|
</template>
|
2022-03-30 15:37:55 +08:00
|
|
|
|
<template v-else>
|
2023-10-20 15:45:11 +08:00
|
|
|
|
<div class="chart-content" style="padding-left: 5px;" :id="`detectionActiveAttacker${pageType}`"></div>
|
2022-03-03 18:01:26 +08:00
|
|
|
|
</template>
|
2022-02-17 19:28:48 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2022-02-14 22:22:31 +08:00
|
|
|
|
<detection-list
|
|
|
|
|
|
:list-data="listData"
|
|
|
|
|
|
:pageObj="pageObj"
|
|
|
|
|
|
:time-filter="timeFilter"
|
2022-02-25 13:33:54 +08:00
|
|
|
|
:page-type="pageType"
|
2022-02-14 22:22:31 +08:00
|
|
|
|
@pageSize="pageSize"
|
|
|
|
|
|
@pageNo="pageNo"
|
|
|
|
|
|
:loading="listLoading"
|
|
|
|
|
|
></detection-list>
|
2022-06-09 21:55:28 +08:00
|
|
|
|
<div class="entity__pagination" >
|
|
|
|
|
|
<Pagination
|
2022-11-07 15:25:00 +08:00
|
|
|
|
ref="pagination"
|
|
|
|
|
|
:page-obj="pageObj"
|
|
|
|
|
|
@pageNo='pageNo'
|
|
|
|
|
|
@pageSize='pageSize'
|
|
|
|
|
|
@size-change="pageSize"
|
|
|
|
|
|
@prev-click="prev"
|
|
|
|
|
|
@next-click="next"
|
|
|
|
|
|
></Pagination>
|
2022-06-09 21:55:28 +08:00
|
|
|
|
</div>
|
2022-02-14 22:22:31 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2022-02-14 17:40:29 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
2022-02-14 22:22:31 +08:00
|
|
|
|
import DetectionSearch from '@/views/detections/DetectionSearch'
|
|
|
|
|
|
import DateTimeRange from '@/components/common/TimeRange/DateTimeRange'
|
|
|
|
|
|
import TimeRefresh from '@/components/common/TimeRange/TimeRefresh'
|
|
|
|
|
|
import DetectionFilter from '@/views/detections/DetectionFilter'
|
|
|
|
|
|
import DetectionList from '@/views/detections/DetectionList'
|
|
|
|
|
|
import Pagination from '@/components/common/Pagination'
|
2022-02-25 13:33:54 +08:00
|
|
|
|
import { defaultPageSize, detectionPageType } from '@/utils/constants'
|
2023-10-22 18:29:34 +08:00
|
|
|
|
import { getNowTime, getSecond, getMillisecond } from '@/utils/date-util'
|
2022-05-27 12:14:24 +08:00
|
|
|
|
import { ref, shallowRef } from 'vue'
|
2022-02-17 19:28:48 +08:00
|
|
|
|
import * as echarts from 'echarts'
|
2023-03-13 15:16:59 +08:00
|
|
|
|
import {
|
|
|
|
|
|
activeAttackBar,
|
|
|
|
|
|
getAttackColor,
|
|
|
|
|
|
getSeverityColor,
|
|
|
|
|
|
multipleBarOption,
|
|
|
|
|
|
pieForSeverity
|
|
|
|
|
|
} from '@/views/detections/options/detectionOptions'
|
2023-10-22 18:29:34 +08:00
|
|
|
|
import { api } from '@/utils/api'
|
2023-08-25 10:18:20 +08:00
|
|
|
|
import axios from 'axios'
|
2023-12-20 18:38:38 +08:00
|
|
|
|
import { urlParamsHandler, overwriteUrl, extensionEchartY, reverseSortBy, changeI18nOfSeverity } from '@/utils/tools'
|
2022-02-25 13:33:54 +08:00
|
|
|
|
import { useRoute } from 'vue-router'
|
2022-05-27 12:14:24 +08:00
|
|
|
|
import Loading from '@/components/common/Loading'
|
2022-12-06 20:15:02 +08:00
|
|
|
|
import ChartTabs from '@/components/common/ChartTabs'
|
2023-10-22 18:29:34 +08:00
|
|
|
|
import { useStore } from 'vuex'
|
2023-11-17 13:54:21 +08:00
|
|
|
|
import { tooLongFormatter } from '@/views/charts/charts/tools'
|
|
|
|
|
|
import { format } from 'echarts'
|
2023-12-12 10:06:21 +08:00
|
|
|
|
import Parser from '@/components/advancedSearch/meta/parser'
|
|
|
|
|
|
import { schemaDetectionSecurity } from '@/utils/static-data'
|
2022-02-17 19:28:48 +08:00
|
|
|
|
|
2022-02-14 17:40:29 +08:00
|
|
|
|
export default {
|
2022-02-14 22:22:31 +08:00
|
|
|
|
name: 'Index',
|
|
|
|
|
|
components: {
|
2022-05-27 12:14:24 +08:00
|
|
|
|
Loading,
|
2022-02-14 22:22:31 +08:00
|
|
|
|
DetectionSearch,
|
|
|
|
|
|
DateTimeRange,
|
|
|
|
|
|
TimeRefresh,
|
|
|
|
|
|
DetectionFilter,
|
|
|
|
|
|
DetectionList,
|
2022-03-01 15:28:46 +08:00
|
|
|
|
Pagination,
|
2022-12-06 20:15:02 +08:00
|
|
|
|
ChartTabs
|
2022-02-14 22:22:31 +08:00
|
|
|
|
},
|
|
|
|
|
|
data () {
|
|
|
|
|
|
return {
|
2022-11-07 15:25:00 +08:00
|
|
|
|
tabsData: [
|
|
|
|
|
|
{
|
|
|
|
|
|
i18n: 'entities.securityEvents',
|
|
|
|
|
|
path: '/detection/securityEvent',
|
2022-11-22 10:52:30 +08:00
|
|
|
|
icon: 'cn-icon cn-icon-a-SecurityEvent'
|
2023-10-20 15:45:11 +08:00
|
|
|
|
}
|
2023-01-05 15:23:31 +08:00
|
|
|
|
// {
|
|
|
|
|
|
// i18n: 'entities.regulatoryRiskEvents',
|
|
|
|
|
|
// path: '/detection/securityEvent',
|
|
|
|
|
|
// icon: 'cn-icon cn-icon-a-RegulatoryRiskEvent',
|
|
|
|
|
|
// disable: true
|
|
|
|
|
|
// },
|
2023-10-20 15:45:11 +08:00
|
|
|
|
// {
|
|
|
|
|
|
// i18n: 'overall.performanceEvents',
|
|
|
|
|
|
// path: '/detection/performanceEvent',
|
|
|
|
|
|
// icon: 'cn-icon cn-icon-a-PerformanceEvent'
|
|
|
|
|
|
// }
|
2022-11-07 15:25:00 +08:00
|
|
|
|
],
|
2022-04-25 15:29:44 +08:00
|
|
|
|
chartInit: [],
|
2023-10-31 14:43:29 +08:00
|
|
|
|
// pageObj: {
|
|
|
|
|
|
// pageNo: 1,
|
|
|
|
|
|
// pageSize: defaultPageSize,
|
|
|
|
|
|
// total: 0,
|
|
|
|
|
|
// resetPageNo: true
|
|
|
|
|
|
// },
|
2022-02-14 22:22:31 +08:00
|
|
|
|
q: '',
|
2022-02-25 13:33:54 +08:00
|
|
|
|
detectionPageType,
|
|
|
|
|
|
filterData: {
|
|
|
|
|
|
securityEvent: [
|
|
|
|
|
|
{
|
2023-10-20 15:45:11 +08:00
|
|
|
|
title: this.$t('overall.status'),
|
2023-10-24 16:02:25 +08:00
|
|
|
|
column: 'status',
|
|
|
|
|
|
topColumn: 'status',
|
2022-02-25 13:33:54 +08:00
|
|
|
|
collapse: false,
|
|
|
|
|
|
value: [], // value之间是or的关系
|
2023-11-10 14:11:46 +08:00
|
|
|
|
showMore: false,
|
2022-02-25 13:33:54 +08:00
|
|
|
|
data: [] // 从接口动态获取,本项在获得数据后需要特殊处理左边框颜色
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
2023-10-20 15:45:11 +08:00
|
|
|
|
title: this.$t('detections.severity'),
|
|
|
|
|
|
column: 'severity',
|
|
|
|
|
|
topColumn: 'severity',
|
2022-02-25 13:33:54 +08:00
|
|
|
|
collapse: false,
|
2023-10-20 15:45:11 +08:00
|
|
|
|
value: [], // value之间是or的关系
|
2023-11-10 14:11:46 +08:00
|
|
|
|
showMore: false,
|
2023-10-20 15:45:11 +08:00
|
|
|
|
data: [] // 从接口动态获取,本项在获得数据后需要特殊处理左边框颜色
|
2022-02-25 13:33:54 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
2023-10-20 15:45:11 +08:00
|
|
|
|
title: this.$t('detections.eventType'),
|
2023-10-22 18:29:34 +08:00
|
|
|
|
column: 'eventType',
|
2023-10-20 15:45:11 +08:00
|
|
|
|
topColumn: 'event_type',
|
2022-02-25 13:33:54 +08:00
|
|
|
|
collapse: false,
|
|
|
|
|
|
value: [],
|
2023-11-10 14:11:46 +08:00
|
|
|
|
showMore: true,
|
|
|
|
|
|
showDisabled: true,
|
|
|
|
|
|
showIndex: 5, // index作为showMore分割,从1开始而非0
|
2022-02-25 13:33:54 +08:00
|
|
|
|
data: [] // 从接口动态获取
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
2023-10-20 15:45:11 +08:00
|
|
|
|
title: this.$t('detections.victimIp'),
|
2023-10-22 18:29:34 +08:00
|
|
|
|
column: 'victimIP',
|
2023-10-20 15:45:11 +08:00
|
|
|
|
topColumn: 'victim_ip',
|
2022-02-25 13:33:54 +08:00
|
|
|
|
collapse: false,
|
|
|
|
|
|
value: [],
|
2023-10-20 15:45:11 +08:00
|
|
|
|
showMore: true,
|
2023-11-10 14:11:46 +08:00
|
|
|
|
showDisabled: true,
|
|
|
|
|
|
showIndex: 5,
|
2022-02-25 13:33:54 +08:00
|
|
|
|
data: [] // 从接口动态获取
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
2023-10-20 15:45:11 +08:00
|
|
|
|
title: this.$t('detections.offenderIp'),
|
2023-10-22 18:29:34 +08:00
|
|
|
|
column: 'offenderIP',
|
2023-10-20 15:45:11 +08:00
|
|
|
|
topColumn: 'offender_ip',
|
2022-02-25 13:33:54 +08:00
|
|
|
|
collapse: false,
|
|
|
|
|
|
value: [],
|
2023-11-10 14:11:46 +08:00
|
|
|
|
showMore: true,
|
|
|
|
|
|
showDisabled: true,
|
|
|
|
|
|
showIndex: 5,
|
2022-02-25 13:33:54 +08:00
|
|
|
|
data: [] // 从接口动态获取
|
|
|
|
|
|
}
|
|
|
|
|
|
],
|
|
|
|
|
|
performanceEvent: [
|
|
|
|
|
|
{
|
|
|
|
|
|
title: this.$t('detections.eventSeverity'),
|
|
|
|
|
|
column: 'eventSeverity',
|
|
|
|
|
|
collapse: false,
|
|
|
|
|
|
value: [], // value之间是or的关系
|
|
|
|
|
|
data: [] // 从接口动态获取,本项在获得数据后需要特殊处理左边框颜色
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
2022-03-04 15:46:30 +08:00
|
|
|
|
title: this.$t('detections.eventType'),
|
|
|
|
|
|
column: 'eventType',
|
2022-02-25 13:33:54 +08:00
|
|
|
|
collapse: false,
|
|
|
|
|
|
value: [],
|
|
|
|
|
|
data: [] // 从接口动态获取
|
|
|
|
|
|
}
|
|
|
|
|
|
]
|
|
|
|
|
|
},
|
2022-02-14 22:22:31 +08:00
|
|
|
|
listData: [],
|
2022-02-17 19:28:48 +08:00
|
|
|
|
listLoading: false,
|
|
|
|
|
|
severityPerOption: null,
|
2022-02-21 10:52:14 +08:00
|
|
|
|
severityPerData: [],
|
2022-02-17 19:28:48 +08:00
|
|
|
|
categoryPerOption: null,
|
2022-02-21 10:52:14 +08:00
|
|
|
|
categoryPerData: [],
|
2022-02-17 19:28:48 +08:00
|
|
|
|
activeAttackOption: null,
|
2022-03-01 15:28:46 +08:00
|
|
|
|
activeAttackData: [],
|
2022-03-04 15:46:30 +08:00
|
|
|
|
eventSeverityData: [],
|
|
|
|
|
|
statisticsSeverityData: [],
|
|
|
|
|
|
statisticsCategoryData: [],
|
|
|
|
|
|
statisticsActiveAttackData: [],
|
|
|
|
|
|
isEventSeverityNoData: false,
|
|
|
|
|
|
isStatisticsSeverityNoData: false,
|
|
|
|
|
|
isStatisticsCategoryNoData: false,
|
|
|
|
|
|
isStatisticsActiveAttackNoData: false,
|
2022-05-11 17:50:40 +08:00
|
|
|
|
loading: false,
|
2023-10-20 15:45:11 +08:00
|
|
|
|
oldActiveEntitySearchValue: '',
|
2023-11-17 15:21:20 +08:00
|
|
|
|
initFlag: true, // 初始化标识,初始化时保证mounted执行
|
|
|
|
|
|
detectionChart:shallowRef(null)
|
2022-02-14 22:22:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
2023-10-20 15:45:11 +08:00
|
|
|
|
initStatusData (params) {
|
2023-10-22 18:29:34 +08:00
|
|
|
|
axios.get(api.detection[this.pageType].statusStatistics, { params }).then(res => {
|
|
|
|
|
|
if (res.status === 200) {
|
|
|
|
|
|
const data = res.data.data.result
|
2023-11-10 17:00:19 +08:00
|
|
|
|
if (data && data.length > 0) {
|
|
|
|
|
|
data.sort((a, b) => {
|
|
|
|
|
|
return Number(b.count) - Number(a.count)
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2023-10-22 18:29:34 +08:00
|
|
|
|
this.filterData[this.pageType][0].data = data.map(r => {
|
|
|
|
|
|
let label = ''
|
|
|
|
|
|
if (r.status === '0') {
|
|
|
|
|
|
label = this.$t('detections.active')
|
|
|
|
|
|
} else if (r.status === '1') {
|
|
|
|
|
|
label = this.$t('detections.ended')
|
|
|
|
|
|
}
|
|
|
|
|
|
return { label, value: r.status, count: r.count }
|
|
|
|
|
|
})
|
2023-10-24 16:02:25 +08:00
|
|
|
|
this.isCheckFilterByQ(params, 0)
|
2023-10-22 18:29:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
}).catch(e => {
|
|
|
|
|
|
console.error(e)
|
|
|
|
|
|
this.filterData[this.pageType][0].data = []
|
2023-10-23 18:42:32 +08:00
|
|
|
|
this.$message.error(this.errorMsgHandler(e))
|
2023-10-20 15:45:11 +08:00
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
/** 初始化顶部大柱状图 */
|
2022-02-25 13:33:54 +08:00
|
|
|
|
initEventSeverityTrendData (params) {
|
2022-03-03 18:01:26 +08:00
|
|
|
|
this.loading = true
|
2023-10-22 18:29:34 +08:00
|
|
|
|
axios.get(api.detection[this.pageType].timeDistribution, { params }).then(res => {
|
|
|
|
|
|
const data = res.data.data.result
|
2022-03-03 18:01:26 +08:00
|
|
|
|
this.eventSeverityData = data
|
2022-03-01 15:28:46 +08:00
|
|
|
|
if (!this.$_.isEmpty(data)) {
|
2022-03-04 15:46:30 +08:00
|
|
|
|
const dataMap = new Map()
|
2022-03-01 15:28:46 +08:00
|
|
|
|
data.forEach(item => {
|
2023-12-20 18:38:38 +08:00
|
|
|
|
if (changeI18nOfSeverity(item.severity)) {
|
|
|
|
|
|
if (!dataMap.has(changeI18nOfSeverity(item.severity))) {
|
2023-10-22 18:29:34 +08:00
|
|
|
|
const count = [[getMillisecond(parseFloat(item.statTime)), item.count]]
|
2023-12-20 18:38:38 +08:00
|
|
|
|
dataMap.set(changeI18nOfSeverity(item.severity), count)
|
2022-03-04 15:46:30 +08:00
|
|
|
|
} else {
|
2023-12-20 18:38:38 +08:00
|
|
|
|
dataMap.get(changeI18nOfSeverity(item.severity)).push([getMillisecond(parseFloat(item.statTime)), item.count])
|
2022-03-03 18:01:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-03-01 15:28:46 +08:00
|
|
|
|
})
|
2022-03-10 13:54:09 +08:00
|
|
|
|
|
2022-03-03 18:01:26 +08:00
|
|
|
|
const chartDom = document.getElementById(`eventSeverityTrendBar${this.pageType}`)
|
|
|
|
|
|
const eventSeverityTrendOption = this.$_.cloneDeep(multipleBarOption)
|
2022-03-10 13:54:09 +08:00
|
|
|
|
|
2022-03-17 17:56:38 +08:00
|
|
|
|
const xData = []
|
2022-11-22 10:52:30 +08:00
|
|
|
|
dataMap.forEach(function (value) {
|
2022-03-17 17:56:38 +08:00
|
|
|
|
// eventSeverityTrendOption.series[Number(getSeriesIndex(key))].data = value.map(v => Number(v[1]))
|
2022-03-10 13:54:09 +08:00
|
|
|
|
value.forEach(item => {
|
2022-03-17 17:56:38 +08:00
|
|
|
|
if (xData.indexOf(item[0]) < 0) {
|
2022-03-10 13:54:09 +08:00
|
|
|
|
xData.push(item[0])
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2022-03-04 15:46:30 +08:00
|
|
|
|
})
|
2023-03-13 15:16:59 +08:00
|
|
|
|
|
2022-03-10 13:54:09 +08:00
|
|
|
|
eventSeverityTrendOption.series.forEach(serie => {
|
2023-12-20 18:38:38 +08:00
|
|
|
|
serie.name = changeI18nOfSeverity(serie.name)
|
2022-03-17 17:56:38 +08:00
|
|
|
|
const seriesData = []
|
2022-03-10 13:54:09 +08:00
|
|
|
|
xData.forEach(item => {
|
2022-03-17 17:56:38 +08:00
|
|
|
|
if (dataMap.has(serie.name)) {
|
2022-11-07 15:25:00 +08:00
|
|
|
|
// eslint-disable-next-line array-callback-return
|
2022-03-17 17:56:38 +08:00
|
|
|
|
const hasX = dataMap.get(serie.name).some(function (v) {
|
2022-11-07 15:25:00 +08:00
|
|
|
|
if (item === v[0]) {
|
2023-03-13 15:16:59 +08:00
|
|
|
|
seriesData.push([item, Number(v[1])])
|
2022-03-17 17:56:38 +08:00
|
|
|
|
return true
|
2022-03-10 13:54:09 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
2022-03-17 17:56:38 +08:00
|
|
|
|
if (!hasX) {
|
2023-03-13 15:16:59 +08:00
|
|
|
|
seriesData.push([item, 0])
|
2022-03-10 13:54:09 +08:00
|
|
|
|
}
|
2022-03-17 17:56:38 +08:00
|
|
|
|
} else {
|
2023-03-13 15:16:59 +08:00
|
|
|
|
seriesData.push([item, 0])
|
2022-03-10 13:54:09 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
serie.data = seriesData
|
|
|
|
|
|
})
|
|
|
|
|
|
|
2022-12-14 14:43:38 +08:00
|
|
|
|
let detectionChart = echarts.getInstanceByDom(chartDom)
|
|
|
|
|
|
if (detectionChart) {
|
|
|
|
|
|
echarts.dispose(detectionChart)
|
|
|
|
|
|
}
|
|
|
|
|
|
detectionChart = echarts.init(chartDom)
|
2022-04-25 15:29:44 +08:00
|
|
|
|
this.chartInit.push(shallowRef(detectionChart))
|
2022-03-03 18:01:26 +08:00
|
|
|
|
detectionChart.setOption(eventSeverityTrendOption)
|
2022-03-04 15:46:30 +08:00
|
|
|
|
// this.isEventSeverityNoData = false
|
|
|
|
|
|
} else {
|
|
|
|
|
|
// this.isEventSeverityNoData = true
|
2022-03-01 15:28:46 +08:00
|
|
|
|
}
|
2023-10-22 18:29:34 +08:00
|
|
|
|
}).catch(e => {
|
|
|
|
|
|
console.error(e)
|
2023-10-23 18:42:32 +08:00
|
|
|
|
this.$message.error(this.errorMsgHandler(e))
|
2022-03-04 10:55:12 +08:00
|
|
|
|
}).finally(() => {
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.loading = false
|
|
|
|
|
|
})
|
2023-10-20 15:45:11 +08:00
|
|
|
|
})
|
2022-02-17 19:28:48 +08:00
|
|
|
|
},
|
2023-10-20 15:45:11 +08:00
|
|
|
|
/** 初始化左侧事件严重等级和第一个小饼图 */
|
2022-02-25 13:33:54 +08:00
|
|
|
|
initEventSeverityData (params) {
|
2023-10-22 18:29:34 +08:00
|
|
|
|
axios.get(api.detection[this.pageType].severityStatistics, { params }).then(res => {
|
|
|
|
|
|
const data = res.data.data.result
|
2023-11-10 17:00:19 +08:00
|
|
|
|
if (data && data.length > 0) {
|
|
|
|
|
|
data.sort((a, b) => {
|
|
|
|
|
|
return Number(b.count) - Number(a.count)
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2022-03-03 18:01:26 +08:00
|
|
|
|
this.statisticsSeverityData = data
|
2022-03-01 15:28:46 +08:00
|
|
|
|
if (!this.$_.isEmpty(data)) {
|
2023-12-20 18:38:38 +08:00
|
|
|
|
this.filterData[this.pageType][1].data = data.map(r => ({ label: changeI18nOfSeverity(r.severity), value: r.severity, count: r.count }))
|
2023-10-24 16:02:25 +08:00
|
|
|
|
this.isCheckFilterByQ(params, 1)
|
2022-03-01 15:28:46 +08:00
|
|
|
|
const eventSeverityOption = this.$_.cloneDeep(pieForSeverity)
|
|
|
|
|
|
eventSeverityOption.series[0].data = data.map(d => {
|
2023-12-20 18:38:38 +08:00
|
|
|
|
return { value: d.count, name: changeI18nOfSeverity(d.severity), itemStyle: { color: getSeverityColor(d.severity) } }
|
2022-03-01 15:28:46 +08:00
|
|
|
|
})
|
|
|
|
|
|
const chartDom = document.getElementById(`eventSeverityPie${this.pageType}`)
|
2022-12-14 14:43:38 +08:00
|
|
|
|
let detectionChart = echarts.getInstanceByDom(chartDom)
|
|
|
|
|
|
if (detectionChart) {
|
|
|
|
|
|
echarts.dispose(detectionChart)
|
|
|
|
|
|
}
|
|
|
|
|
|
detectionChart = echarts.init(chartDom)
|
2022-04-25 15:29:44 +08:00
|
|
|
|
this.chartInit.push(shallowRef(detectionChart))
|
2022-03-01 15:28:46 +08:00
|
|
|
|
detectionChart.setOption(eventSeverityOption)
|
2022-03-30 15:37:55 +08:00
|
|
|
|
const vm = this
|
|
|
|
|
|
detectionChart.off('click')
|
|
|
|
|
|
detectionChart.on('click', e => {
|
|
|
|
|
|
if (this.pageType === 'performanceEvent') {
|
|
|
|
|
|
vm.filterData.performanceEvent[0].value = vm.triggerFilterDataValue(vm.filterData.performanceEvent[0].value, e.data.name)
|
|
|
|
|
|
} else if (this.pageType === 'securityEvent') {
|
2023-11-13 11:52:08 +08:00
|
|
|
|
this.getFilter(e.data.name, vm.filterData.securityEvent[1].column)
|
2023-10-24 16:02:25 +08:00
|
|
|
|
vm.filterData.securityEvent[1].value = vm.triggerFilterDataValue(vm.filterData.securityEvent[1].value, e.data.name)
|
2022-03-30 15:37:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
2022-03-01 15:28:46 +08:00
|
|
|
|
}
|
2023-10-22 18:29:34 +08:00
|
|
|
|
}).catch(e => {
|
|
|
|
|
|
console.error(e)
|
|
|
|
|
|
this.filterData[this.pageType][1].data = []
|
2023-10-23 18:42:32 +08:00
|
|
|
|
this.$message.error(this.errorMsgHandler(e))
|
2022-02-17 19:28:48 +08:00
|
|
|
|
})
|
|
|
|
|
|
},
|
2022-03-04 15:46:30 +08:00
|
|
|
|
initEventTypeData (params) {
|
2023-10-22 18:29:34 +08:00
|
|
|
|
axios.get(api.detection[this.pageType].eventType, { params }).then(res => {
|
|
|
|
|
|
const data = res.data.data.result
|
2022-03-04 15:46:30 +08:00
|
|
|
|
this.statisticsCategoryData = data
|
|
|
|
|
|
if (!this.$_.isEmpty(data)) {
|
2023-10-20 15:45:11 +08:00
|
|
|
|
this.filterData[this.pageType][2].data = data.map(r => ({
|
2022-03-04 15:46:30 +08:00
|
|
|
|
label: r.eventType,
|
|
|
|
|
|
value: r.eventType,
|
|
|
|
|
|
count: r.count
|
|
|
|
|
|
}))
|
2023-11-10 14:11:46 +08:00
|
|
|
|
const { showMore, showIndex, showDisabled } = this.computeFilterPage(this.filterData[this.pageType][2].data)
|
|
|
|
|
|
this.filterData[this.pageType][2].showMore = showMore
|
|
|
|
|
|
this.filterData[this.pageType][2].showIndex = showIndex
|
|
|
|
|
|
this.filterData[this.pageType][2].showDisabled = showDisabled
|
|
|
|
|
|
|
2022-03-04 15:46:30 +08:00
|
|
|
|
const chartDom = document.getElementById(`detectionCategoryPer${this.pageType}`)
|
2022-12-14 14:43:38 +08:00
|
|
|
|
let detectionChart = echarts.getInstanceByDom(chartDom)
|
|
|
|
|
|
if (detectionChart) {
|
|
|
|
|
|
echarts.dispose(detectionChart)
|
|
|
|
|
|
}
|
|
|
|
|
|
detectionChart = echarts.init(chartDom)
|
2022-04-25 15:29:44 +08:00
|
|
|
|
this.chartInit.push(shallowRef(detectionChart))
|
2022-03-04 15:46:30 +08:00
|
|
|
|
const securityTypeOption = this.$_.cloneDeep(pieForSeverity)
|
|
|
|
|
|
securityTypeOption.series[0].data = data.map(d => {
|
2022-03-04 18:16:06 +08:00
|
|
|
|
return { value: d.count, name: d.eventType }
|
2022-03-04 15:46:30 +08:00
|
|
|
|
})
|
2023-11-17 14:13:04 +08:00
|
|
|
|
if (chartDom) {
|
|
|
|
|
|
let oneColumnWidth = (chartDom.clientWidth * 0.56) - 30
|
|
|
|
|
|
if (data.length > 6) {
|
|
|
|
|
|
oneColumnWidth = (chartDom.clientWidth * 0.56) / 2 - 30
|
|
|
|
|
|
}
|
|
|
|
|
|
securityTypeOption.legend.formatter = function (name) {
|
|
|
|
|
|
return format.truncateText(name, oneColumnWidth, '12px')
|
2023-11-17 13:54:21 +08:00
|
|
|
|
}
|
2023-11-13 17:23:32 +08:00
|
|
|
|
}
|
2022-03-04 15:46:30 +08:00
|
|
|
|
detectionChart.setOption(securityTypeOption)
|
2022-03-30 15:37:55 +08:00
|
|
|
|
|
|
|
|
|
|
const vm = this
|
|
|
|
|
|
detectionChart.off('click')
|
|
|
|
|
|
detectionChart.on('click', e => {
|
|
|
|
|
|
vm.filterData.performanceEvent[1].value = vm.triggerFilterDataValue(vm.filterData.performanceEvent[1].value, e.data.name)
|
|
|
|
|
|
})
|
2022-03-04 15:46:30 +08:00
|
|
|
|
}
|
2023-10-22 18:29:34 +08:00
|
|
|
|
}).catch(e => {
|
|
|
|
|
|
console.error(e)
|
|
|
|
|
|
this.filterData[this.pageType][2].data = []
|
2023-11-10 14:11:46 +08:00
|
|
|
|
this.filterData[this.pageType][2].showMore = false
|
|
|
|
|
|
this.filterData[this.pageType][2].showIndex = 5
|
|
|
|
|
|
this.filterData[this.pageType][2].showDisabled = true
|
2023-10-23 18:42:32 +08:00
|
|
|
|
this.$message.error(this.errorMsgHandler(e))
|
2022-03-04 15:46:30 +08:00
|
|
|
|
})
|
|
|
|
|
|
},
|
2023-10-20 15:45:11 +08:00
|
|
|
|
/** 第二个饼图和左侧filter的eventType */
|
2022-03-04 15:46:30 +08:00
|
|
|
|
initSecurityTypeData (params) {
|
2023-10-22 18:29:34 +08:00
|
|
|
|
axios.get(api.detection[this.pageType].eventTypeStatistics, { params }).then(res => {
|
|
|
|
|
|
const data = res.data.data.result
|
2022-03-03 18:01:26 +08:00
|
|
|
|
this.statisticsCategoryData = data
|
2022-03-01 15:28:46 +08:00
|
|
|
|
if (!this.$_.isEmpty(data)) {
|
2023-10-20 15:45:11 +08:00
|
|
|
|
this.filterData[this.pageType][2].data = data.map(r => ({
|
|
|
|
|
|
label: r.eventType,
|
|
|
|
|
|
value: r.eventType,
|
2022-03-01 15:28:46 +08:00
|
|
|
|
count: r.count
|
|
|
|
|
|
}))
|
2023-10-24 16:02:25 +08:00
|
|
|
|
this.isCheckFilterByQ(params, 2)
|
2023-11-10 14:11:46 +08:00
|
|
|
|
const { showMore, showIndex, showDisabled } = this.computeFilterPage(this.filterData[this.pageType][2].data)
|
|
|
|
|
|
this.filterData[this.pageType][2].showMore = showMore
|
|
|
|
|
|
this.filterData[this.pageType][2].showIndex = showIndex
|
|
|
|
|
|
this.filterData[this.pageType][2].showDisabled = showDisabled
|
2022-03-01 15:28:46 +08:00
|
|
|
|
const chartDom = document.getElementById(`detectionCategoryPer${this.pageType}`)
|
2023-11-17 15:21:20 +08:00
|
|
|
|
this.detectionChart = echarts.getInstanceByDom(chartDom)
|
|
|
|
|
|
if (this.detectionChart) {
|
|
|
|
|
|
echarts.dispose(this.detectionChart)
|
2022-12-14 14:43:38 +08:00
|
|
|
|
}
|
2023-11-17 15:21:20 +08:00
|
|
|
|
this.detectionChart = echarts.init(chartDom)
|
|
|
|
|
|
//this.chartInit.push(shallowRef(detectionChart))
|
2022-03-01 15:28:46 +08:00
|
|
|
|
const securityTypeOption = this.$_.cloneDeep(pieForSeverity)
|
|
|
|
|
|
securityTypeOption.series[0].data = data.map(d => {
|
2023-10-20 15:45:11 +08:00
|
|
|
|
return { value: d.count, name: d.eventType, itemStyle: { color: getAttackColor(d.eventType) } }
|
2022-03-01 15:28:46 +08:00
|
|
|
|
})
|
2023-11-17 14:13:04 +08:00
|
|
|
|
if (chartDom) {
|
|
|
|
|
|
let oneColumnWidth = (chartDom.clientWidth * 0.56) - 30
|
|
|
|
|
|
if (data.length > 6) {
|
|
|
|
|
|
oneColumnWidth = (chartDom.clientWidth * 0.56) / 2 - 30
|
|
|
|
|
|
}
|
|
|
|
|
|
securityTypeOption.legend.formatter = function (name) {
|
|
|
|
|
|
return format.truncateText(name, oneColumnWidth, '12px')
|
2023-11-17 13:54:21 +08:00
|
|
|
|
}
|
2023-11-07 10:50:49 +08:00
|
|
|
|
}
|
2023-11-17 15:21:20 +08:00
|
|
|
|
this.detectionChart.setOption(securityTypeOption)
|
2022-03-30 15:37:55 +08:00
|
|
|
|
|
|
|
|
|
|
const vm = this
|
2023-11-17 15:21:20 +08:00
|
|
|
|
this.detectionChart.off('click')
|
|
|
|
|
|
this.detectionChart.on('click', e => {
|
2023-11-13 11:52:08 +08:00
|
|
|
|
this.getFilter(e.data.name, vm.filterData.securityEvent[2].column)
|
2023-10-27 15:49:20 +08:00
|
|
|
|
vm.filterData.securityEvent[2].value = vm.triggerFilterDataValue(vm.filterData.securityEvent[2].value, e.data.name)
|
2022-03-30 15:37:55 +08:00
|
|
|
|
})
|
2022-03-01 15:28:46 +08:00
|
|
|
|
}
|
2023-10-22 18:29:34 +08:00
|
|
|
|
}).catch(e => {
|
|
|
|
|
|
console.error(e)
|
|
|
|
|
|
this.filterData[this.pageType][2].data = []
|
2023-11-10 14:11:46 +08:00
|
|
|
|
this.filterData[this.pageType][2].showMore = false
|
|
|
|
|
|
this.filterData[this.pageType][2].showIndex = 5
|
|
|
|
|
|
this.filterData[this.pageType][2].showDisabled = true
|
2023-10-23 18:42:32 +08:00
|
|
|
|
this.$message.error(this.errorMsgHandler(e))
|
2022-02-17 19:28:48 +08:00
|
|
|
|
})
|
|
|
|
|
|
},
|
2023-10-20 15:45:11 +08:00
|
|
|
|
/** 横向柱状图和左侧filter的offenderIp */
|
2022-02-25 13:33:54 +08:00
|
|
|
|
initOffenderIpData (params) {
|
2023-10-22 18:29:34 +08:00
|
|
|
|
axios.get(api.detection[this.pageType].offenderIpStatistics, { params }).then(res => {
|
|
|
|
|
|
let data = res.data.data.result
|
2022-03-03 18:01:26 +08:00
|
|
|
|
this.statisticsActiveAttackData = data
|
2022-03-01 15:28:46 +08:00
|
|
|
|
if (!this.$_.isEmpty(data)) {
|
|
|
|
|
|
this.filterData[this.pageType][4].data = data.map(r => ({
|
|
|
|
|
|
label: r.offenderIp,
|
|
|
|
|
|
value: r.offenderIp,
|
|
|
|
|
|
count: r.count
|
|
|
|
|
|
}))
|
2023-10-24 16:02:25 +08:00
|
|
|
|
this.isCheckFilterByQ(params, 4)
|
2023-11-10 14:11:46 +08:00
|
|
|
|
const { showMore, showIndex, showDisabled } = this.computeFilterPage(this.filterData[this.pageType][4].data)
|
2022-03-01 15:28:46 +08:00
|
|
|
|
this.filterData[this.pageType][4].showMore = showMore
|
|
|
|
|
|
this.filterData[this.pageType][4].showIndex = showIndex
|
2023-11-10 14:11:46 +08:00
|
|
|
|
this.filterData[this.pageType][4].showDisabled = showDisabled
|
2022-02-17 19:28:48 +08:00
|
|
|
|
|
2022-03-01 15:28:46 +08:00
|
|
|
|
const chartDom = document.getElementById(`detectionActiveAttacker${this.pageType}`)
|
2022-12-14 14:43:38 +08:00
|
|
|
|
let detectionChart = echarts.getInstanceByDom(chartDom)
|
|
|
|
|
|
if (detectionChart) {
|
|
|
|
|
|
echarts.dispose(detectionChart)
|
|
|
|
|
|
}
|
|
|
|
|
|
detectionChart = echarts.init(chartDom)
|
2022-04-25 15:29:44 +08:00
|
|
|
|
this.chartInit.push(shallowRef(detectionChart))
|
2022-03-01 15:28:46 +08:00
|
|
|
|
const offenderIpOption = this.$_.cloneDeep(activeAttackBar)
|
2022-03-11 15:40:33 +08:00
|
|
|
|
data.sort(reverseSortBy('count'))
|
2022-03-04 15:46:30 +08:00
|
|
|
|
data = data.slice(0, 5)
|
2022-03-01 15:28:46 +08:00
|
|
|
|
offenderIpOption.series[0].data = data.map(d => {
|
|
|
|
|
|
return [d.count, d.offenderIp]
|
|
|
|
|
|
}).reverse()
|
|
|
|
|
|
detectionChart.setOption(offenderIpOption)
|
2022-03-30 15:37:55 +08:00
|
|
|
|
|
|
|
|
|
|
const vm = this
|
|
|
|
|
|
detectionChart.off('click')
|
|
|
|
|
|
detectionChart.on('click', e => {
|
2023-11-14 14:42:42 +08:00
|
|
|
|
if (e.data) {
|
|
|
|
|
|
vm.getFilter(e.data[1], vm.filterData.securityEvent[4].column)
|
|
|
|
|
|
vm.filterData.securityEvent[4].value = vm.triggerFilterDataValue(vm.filterData.securityEvent[4].value, e.data[1])
|
|
|
|
|
|
}
|
2022-03-30 15:37:55 +08:00
|
|
|
|
})
|
2022-03-01 15:28:46 +08:00
|
|
|
|
}
|
2023-10-22 18:29:34 +08:00
|
|
|
|
}).catch(e => {
|
|
|
|
|
|
console.error(e)
|
|
|
|
|
|
this.filterData[this.pageType][4].data = []
|
|
|
|
|
|
this.filterData[this.pageType][4].showMore = false
|
2023-11-10 14:11:46 +08:00
|
|
|
|
this.filterData[this.pageType][4].showIndex = 5
|
|
|
|
|
|
this.filterData[this.pageType][4].showDisabled = true
|
2023-10-23 18:42:32 +08:00
|
|
|
|
this.$message.error(this.errorMsgHandler(e))
|
2022-02-25 13:33:54 +08:00
|
|
|
|
})
|
|
|
|
|
|
},
|
2022-03-11 15:40:33 +08:00
|
|
|
|
|
2022-02-25 13:33:54 +08:00
|
|
|
|
initVictimIpData (params) {
|
2023-10-22 18:29:34 +08:00
|
|
|
|
axios.get(api.detection[this.pageType].victimIpStatistics, { params }).then(res => {
|
|
|
|
|
|
const data = res.data.data.result
|
2023-10-20 15:45:11 +08:00
|
|
|
|
this.filterData[this.pageType][3].data = data.map(r => ({ label: r.victimIp, value: r.victimIp, count: r.count }))
|
2023-10-24 16:02:25 +08:00
|
|
|
|
this.isCheckFilterByQ(params, 3)
|
2023-11-10 14:11:46 +08:00
|
|
|
|
const { showMore, showIndex, showDisabled } = this.computeFilterPage(this.filterData[this.pageType][3].data)
|
2023-10-20 15:45:11 +08:00
|
|
|
|
this.filterData[this.pageType][3].showMore = showMore
|
|
|
|
|
|
this.filterData[this.pageType][3].showIndex = showIndex
|
2023-11-10 14:11:46 +08:00
|
|
|
|
this.filterData[this.pageType][3].showDisabled = showDisabled
|
2023-10-22 18:29:34 +08:00
|
|
|
|
}).catch(e => {
|
|
|
|
|
|
console.error(e)
|
|
|
|
|
|
this.filterData[this.pageType][3].data = []
|
|
|
|
|
|
this.filterData[this.pageType][3].showMore = false
|
2023-11-10 14:11:46 +08:00
|
|
|
|
this.filterData[this.pageType][3].showIndex = 5
|
|
|
|
|
|
this.filterData[this.pageType][3].showDisabled = true
|
2023-10-23 18:42:32 +08:00
|
|
|
|
this.$message.error(this.errorMsgHandler(e))
|
2022-02-18 18:09:44 +08:00
|
|
|
|
})
|
|
|
|
|
|
},
|
2022-02-25 13:33:54 +08:00
|
|
|
|
initActiveEntity (params) {
|
2023-10-22 18:29:34 +08:00
|
|
|
|
axios.get(api.detection[this.pageType].activeEntity, { params }).then(res => {
|
|
|
|
|
|
let data = res.data.data.result
|
2022-03-03 18:01:26 +08:00
|
|
|
|
this.statisticsActiveAttackData = data
|
|
|
|
|
|
if (!this.$_.isEmpty(data)) {
|
|
|
|
|
|
const chartDom = document.getElementById(`detectionActiveAttacker${this.pageType}`)
|
2022-12-14 14:43:38 +08:00
|
|
|
|
let detectionChart = echarts.getInstanceByDom(chartDom)
|
|
|
|
|
|
if (detectionChart) {
|
|
|
|
|
|
echarts.dispose(detectionChart)
|
|
|
|
|
|
}
|
|
|
|
|
|
detectionChart = echarts.init(chartDom)
|
2022-04-25 15:29:44 +08:00
|
|
|
|
this.chartInit.push(shallowRef(detectionChart))
|
2022-03-03 18:01:26 +08:00
|
|
|
|
const option = this.$_.cloneDeep(activeAttackBar)
|
2022-03-11 15:40:33 +08:00
|
|
|
|
data.sort(reverseSortBy('count'))
|
|
|
|
|
|
data = data.slice(0, 5)
|
2022-03-03 18:01:26 +08:00
|
|
|
|
option.series[0].data = data.map(d => {
|
2022-05-11 17:50:40 +08:00
|
|
|
|
return [d.count, d.name, d.entityType]
|
2022-03-03 18:01:26 +08:00
|
|
|
|
}).reverse()
|
|
|
|
|
|
detectionChart.setOption(option)
|
2022-03-17 17:56:38 +08:00
|
|
|
|
extensionEchartY(detectionChart)// y轴标签过长时,鼠标悬浮,显示所有内容
|
2022-03-30 15:37:55 +08:00
|
|
|
|
|
|
|
|
|
|
const vm = this
|
|
|
|
|
|
detectionChart.off('click')
|
|
|
|
|
|
detectionChart.on('click', e => {
|
2022-05-11 17:50:40 +08:00
|
|
|
|
const entityType = e.data[2]
|
|
|
|
|
|
let column = ''
|
|
|
|
|
|
if (entityType) {
|
|
|
|
|
|
switch (entityType) {
|
|
|
|
|
|
case 'app': {
|
|
|
|
|
|
column = 'app_name'
|
|
|
|
|
|
break
|
|
|
|
|
|
}
|
|
|
|
|
|
case 'domain': {
|
|
|
|
|
|
column = 'domain'
|
|
|
|
|
|
break
|
|
|
|
|
|
}
|
|
|
|
|
|
case 'ip': {
|
|
|
|
|
|
column = 'server_ip'
|
|
|
|
|
|
break
|
|
|
|
|
|
}
|
|
|
|
|
|
default: {
|
|
|
|
|
|
break
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (column) {
|
|
|
|
|
|
// 点击的name和上次的name一致,则清空该项条件
|
|
|
|
|
|
if (vm.oldActiveEntitySearchValue === e.data[1]) {
|
|
|
|
|
|
vm.$refs.search.changeParams({ column: column, oldValue: [vm.oldActiveEntitySearchValue], newValue: [] })
|
|
|
|
|
|
vm.$nextTick(() => {
|
|
|
|
|
|
vm.oldActiveEntitySearchValue = ''
|
|
|
|
|
|
})
|
|
|
|
|
|
} else {
|
|
|
|
|
|
vm.$refs.search.changeParams({ column: column, oldValue: vm.oldActiveEntitySearchValue ? [vm.oldActiveEntitySearchValue] : [], newValue: [e.data[1]] })
|
|
|
|
|
|
vm.$nextTick(() => {
|
|
|
|
|
|
vm.oldActiveEntitySearchValue = e.data[1]
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-03-30 15:37:55 +08:00
|
|
|
|
})
|
2022-03-03 18:01:26 +08:00
|
|
|
|
}
|
2022-02-25 13:33:54 +08:00
|
|
|
|
}).catch(error => {
|
2023-10-22 18:29:34 +08:00
|
|
|
|
console.error(error)
|
2022-02-18 18:09:44 +08:00
|
|
|
|
})
|
|
|
|
|
|
},
|
2022-03-30 15:37:55 +08:00
|
|
|
|
triggerFilterDataValue (array, value) {
|
|
|
|
|
|
const r = [...array]
|
|
|
|
|
|
const index = array.indexOf(value)
|
|
|
|
|
|
if (index > -1) {
|
|
|
|
|
|
r.splice(index, 1)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
r.push(value)
|
|
|
|
|
|
}
|
|
|
|
|
|
return r
|
|
|
|
|
|
},
|
2022-02-21 10:52:14 +08:00
|
|
|
|
computeFilterPage (data) {
|
|
|
|
|
|
return {
|
2023-11-10 14:11:46 +08:00
|
|
|
|
showMore: data.length > 0,
|
|
|
|
|
|
showDisabled: data.length <= 5,
|
|
|
|
|
|
showIndex: 5
|
2022-02-21 10:52:14 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2023-10-20 15:45:11 +08:00
|
|
|
|
queryList (q) {
|
2022-02-28 11:53:37 +08:00
|
|
|
|
const params = {
|
|
|
|
|
|
startTime: getSecond(this.timeFilter.startTime),
|
|
|
|
|
|
endTime: getSecond(this.timeFilter.endTime),
|
2023-10-20 15:45:11 +08:00
|
|
|
|
resource: q,
|
2022-03-03 23:21:33 +08:00
|
|
|
|
pageSize: this.pageObj.pageSize,
|
|
|
|
|
|
pageNo: this.pageObj.pageNo
|
2022-02-28 11:53:37 +08:00
|
|
|
|
}
|
2023-10-20 15:45:11 +08:00
|
|
|
|
axios.get(api.detection[this.pageType].securityList, { params }).then(response => {
|
2023-08-25 10:18:20 +08:00
|
|
|
|
if (response.status === 200) {
|
2023-10-20 16:02:24 +08:00
|
|
|
|
const data = response.data.data.result
|
2023-10-22 18:29:34 +08:00
|
|
|
|
if (data.length > 0) {
|
|
|
|
|
|
data.forEach(item => {
|
|
|
|
|
|
item.eventInfoObj = JSON.parse(item.eventInfo)
|
|
|
|
|
|
item.startTime = parseFloat(item.startTime)
|
|
|
|
|
|
})
|
|
|
|
|
|
this.listData = data
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.listData = []
|
|
|
|
|
|
}
|
2023-06-07 17:44:49 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
this.listData = []
|
2023-08-25 10:18:20 +08:00
|
|
|
|
console.error(response.data.message)
|
|
|
|
|
|
this.$message.error(response.data.message)
|
2023-06-07 17:44:49 +08:00
|
|
|
|
}
|
2022-03-05 20:25:03 +08:00
|
|
|
|
})
|
2023-10-24 13:52:55 +08:00
|
|
|
|
axios.get(api.detection[this.pageType].securityCount, { params }).then(res => {
|
|
|
|
|
|
this.pageObj.total = parseInt(this.$_.get(res, 'data.data.result', 0))
|
2022-03-05 20:25:03 +08:00
|
|
|
|
}).catch(error => {
|
2023-10-22 18:29:34 +08:00
|
|
|
|
console.error(error)
|
2023-10-20 15:45:11 +08:00
|
|
|
|
})
|
2022-02-18 17:54:22 +08:00
|
|
|
|
},
|
2022-02-14 22:22:31 +08:00
|
|
|
|
timeRefreshChange () {
|
2023-10-22 18:29:34 +08:00
|
|
|
|
// 不是自选时间
|
|
|
|
|
|
if (this.$refs.dateTimeRange) {
|
|
|
|
|
|
if (!this.$refs.dateTimeRange.isCustom) {
|
|
|
|
|
|
const value = this.timeFilter.dateRangeValue
|
|
|
|
|
|
this.$refs.dateTimeRange.quickChange(value)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.timeFilter = JSON.parse(JSON.stringify(this.timeFilter))
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.timeFilter = JSON.parse(JSON.stringify(this.timeFilter))
|
2022-02-14 22:22:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2022-03-04 15:46:30 +08:00
|
|
|
|
initNoData () {
|
2022-03-03 18:01:26 +08:00
|
|
|
|
this.isEventSeverityNoData = false
|
|
|
|
|
|
this.isStatisticsSeverityNoData = false
|
|
|
|
|
|
this.isStatisticsCategoryNoData = false
|
|
|
|
|
|
this.isStatisticsActiveAttackNoData = false
|
|
|
|
|
|
},
|
2023-10-22 18:29:34 +08:00
|
|
|
|
reload (startTime, endTime, dateRangeValue) {
|
2022-03-03 18:01:26 +08:00
|
|
|
|
this.initNoData()
|
2023-10-22 18:29:34 +08:00
|
|
|
|
this.dateTimeRangeChange(startTime, endTime, dateRangeValue)
|
|
|
|
|
|
const { query } = this.$route
|
|
|
|
|
|
const newUrl = urlParamsHandler(window.location.href, query, {
|
|
|
|
|
|
startTime: this.timeFilter.startTime,
|
|
|
|
|
|
endTime: this.timeFilter.endTime,
|
|
|
|
|
|
range: dateRangeValue.value
|
|
|
|
|
|
})
|
|
|
|
|
|
overwriteUrl(newUrl)
|
2022-02-14 22:22:31 +08:00
|
|
|
|
},
|
|
|
|
|
|
// methods
|
|
|
|
|
|
dateTimeRangeChange (s, e, v) {
|
2023-12-06 16:37:49 +08:00
|
|
|
|
this.timeFilter = { startTime: s, endTime: e, dateRangeValue: v.value }
|
2022-02-14 22:22:31 +08:00
|
|
|
|
},
|
2022-06-09 16:01:47 +08:00
|
|
|
|
search (param) {
|
|
|
|
|
|
let q
|
|
|
|
|
|
let metaList
|
|
|
|
|
|
if (param) {
|
|
|
|
|
|
q = param.q
|
|
|
|
|
|
metaList = param.metaList
|
|
|
|
|
|
}
|
2022-03-03 18:01:26 +08:00
|
|
|
|
this.initNoData()
|
2022-06-06 17:34:55 +08:00
|
|
|
|
if (q) {
|
|
|
|
|
|
this.q = q
|
2022-02-18 18:09:44 +08:00
|
|
|
|
this.metaList = metaList
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.q = ''
|
|
|
|
|
|
this.metaList = []
|
|
|
|
|
|
}
|
2023-10-31 14:43:29 +08:00
|
|
|
|
if (this.pageObj.resetPageNo && !this.initFlag) {
|
2022-03-12 16:56:46 +08:00
|
|
|
|
this.pageObj.pageNo = 1
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.pageObj.resetPageNo = true
|
|
|
|
|
|
}
|
2023-10-20 15:45:11 +08:00
|
|
|
|
// 参数q,避免切换页码时,地址栏参数q为空
|
|
|
|
|
|
let urlQ = ''
|
2023-10-20 16:02:24 +08:00
|
|
|
|
if (param && param.str) {
|
2023-12-12 10:06:21 +08:00
|
|
|
|
urlQ = param.str.indexOf('%') > -1 ? encodeURI(param.str) : param.str
|
|
|
|
|
|
this.str = param.str
|
2023-10-20 15:45:11 +08:00
|
|
|
|
} else if (this.q) {
|
2023-10-24 16:02:25 +08:00
|
|
|
|
// urlQ = encodeURI(this.q)
|
2023-12-12 10:06:21 +08:00
|
|
|
|
urlQ = this.q.indexOf('%') > -1 ? encodeURI(this.q) : this.q
|
2023-10-20 15:45:11 +08:00
|
|
|
|
}
|
2023-10-24 16:02:25 +08:00
|
|
|
|
const mode = this.$route.query.mode || 'text'
|
|
|
|
|
|
const newUrl = urlParamsHandler(window.location.href, this.$route.query, {
|
|
|
|
|
|
startTime: this.timeFilter.startTime,
|
|
|
|
|
|
endTime: this.timeFilter.endTime,
|
2023-10-24 20:58:03 +08:00
|
|
|
|
range: this.timeFilter.dateRangeValue,
|
2023-10-24 16:02:25 +08:00
|
|
|
|
q: urlQ,
|
|
|
|
|
|
mode: mode
|
|
|
|
|
|
})
|
|
|
|
|
|
overwriteUrl(newUrl)
|
2023-12-12 10:06:21 +08:00
|
|
|
|
this.queryFilter(this.q)
|
|
|
|
|
|
this.queryList(this.q)
|
2022-02-18 18:09:44 +08:00
|
|
|
|
},
|
2022-03-03 23:21:33 +08:00
|
|
|
|
resetFilterData () {
|
|
|
|
|
|
this.filterData.securityEvent.forEach(d => {
|
|
|
|
|
|
d.data = []
|
|
|
|
|
|
})
|
|
|
|
|
|
this.filterData.performanceEvent.forEach(d => {
|
|
|
|
|
|
d.data = []
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
2023-10-20 15:45:11 +08:00
|
|
|
|
queryFilter (q) {
|
2022-03-03 23:21:33 +08:00
|
|
|
|
this.resetFilterData()
|
2022-02-25 13:33:54 +08:00
|
|
|
|
const params = {
|
|
|
|
|
|
startTime: getSecond(this.timeFilter.startTime),
|
|
|
|
|
|
endTime: getSecond(this.timeFilter.endTime),
|
2023-10-20 15:45:11 +08:00
|
|
|
|
resource: q
|
2022-02-25 13:33:54 +08:00
|
|
|
|
}
|
2023-10-20 15:45:11 +08:00
|
|
|
|
this.initStatusData(params)
|
2022-02-25 13:33:54 +08:00
|
|
|
|
this.initEventSeverityTrendData(params)
|
2023-10-20 15:45:11 +08:00
|
|
|
|
this.initEventSeverityData(params)
|
2022-02-25 13:33:54 +08:00
|
|
|
|
if (this.pageType === detectionPageType.securityEvent) {
|
2023-10-20 15:45:11 +08:00
|
|
|
|
this.initOffenderIpData(params)
|
|
|
|
|
|
this.initVictimIpData(params)
|
|
|
|
|
|
this.initSecurityTypeData(params)
|
2022-02-25 13:33:54 +08:00
|
|
|
|
} else if (this.pageType === detectionPageType.performanceEvent) {
|
2023-10-24 16:02:25 +08:00
|
|
|
|
this.initActiveEntity(params)
|
|
|
|
|
|
this.initEventTypeData(params)
|
2022-02-25 13:33:54 +08:00
|
|
|
|
}
|
2022-02-14 22:22:31 +08:00
|
|
|
|
},
|
|
|
|
|
|
pageSize (val) {
|
2022-03-08 22:06:58 +08:00
|
|
|
|
this.pageObj.pageSize = val || 20
|
2022-02-14 22:22:31 +08:00
|
|
|
|
this.search(this.metaList, this.q)
|
|
|
|
|
|
},
|
|
|
|
|
|
pageNo (val) {
|
2023-10-20 15:45:11 +08:00
|
|
|
|
// 初始化时,mounted和pageNo都会调用列表接口,且pageNo先执行,
|
|
|
|
|
|
// 初始化保证mounted执行,后续pageNo变动则不影响接口调用
|
|
|
|
|
|
if (!this.initFlag) {
|
2023-10-31 14:43:29 +08:00
|
|
|
|
this.pageObj.pageNo = val || 1
|
|
|
|
|
|
this.pageObj.resetPageNo = false
|
2023-10-20 15:45:11 +08:00
|
|
|
|
this.search(this.metaList, this.q)
|
|
|
|
|
|
}
|
2022-02-14 22:22:31 +08:00
|
|
|
|
},
|
|
|
|
|
|
// 点击上一页箭头
|
|
|
|
|
|
prev () {
|
|
|
|
|
|
this.scrollbarToTop()
|
|
|
|
|
|
},
|
|
|
|
|
|
// 点击下一页箭头
|
|
|
|
|
|
next () {
|
|
|
|
|
|
this.scrollbarToTop()
|
|
|
|
|
|
},
|
|
|
|
|
|
// currentPage 改变时会触发
|
|
|
|
|
|
current (val) {
|
|
|
|
|
|
this.$emit('pageNo', val)
|
|
|
|
|
|
this.scrollbarToTop()
|
|
|
|
|
|
},
|
|
|
|
|
|
scrollbarToTop () {
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
const wraps = document.querySelector('#detectionList')
|
|
|
|
|
|
wraps.scrollTop = 0
|
|
|
|
|
|
})
|
2022-04-19 18:17:12 +08:00
|
|
|
|
},
|
2022-04-25 15:29:44 +08:00
|
|
|
|
resize () {
|
|
|
|
|
|
this.chartInit.forEach(e => { e.value.resize() })
|
2023-11-17 13:54:21 +08:00
|
|
|
|
|
2023-11-17 15:21:20 +08:00
|
|
|
|
const chartDom = document.getElementById(`detectionCategoryPer${this.pageType}`)
|
|
|
|
|
|
this.detectionChart = echarts.getInstanceByDom(chartDom)
|
|
|
|
|
|
if(this.detectionChart){
|
|
|
|
|
|
let securityTypeOption = this.$_.cloneDeep(this.detectionChart.getOption())
|
|
|
|
|
|
echarts.dispose(this.detectionChart)
|
|
|
|
|
|
if (chartDom) {
|
|
|
|
|
|
this.detectionChart = echarts.init(chartDom)
|
|
|
|
|
|
let oneColumnWidth = (chartDom.clientWidth * 0.56) - 30
|
|
|
|
|
|
if (this.statisticsCategoryData.length > 6) {
|
|
|
|
|
|
oneColumnWidth = (chartDom.clientWidth * 0.56) / 2 - 30
|
|
|
|
|
|
}
|
|
|
|
|
|
securityTypeOption.legend[0].formatter = function (name) {
|
2023-11-17 13:54:21 +08:00
|
|
|
|
return format.truncateText(name, oneColumnWidth, '12px')
|
|
|
|
|
|
}
|
2023-11-17 15:21:20 +08:00
|
|
|
|
this.detectionChart.setOption(securityTypeOption)
|
2023-11-17 13:54:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-08-28 15:14:20 +08:00
|
|
|
|
},
|
|
|
|
|
|
jumpNewDetetion () {
|
|
|
|
|
|
this.$router.push({
|
2023-11-09 16:17:25 +08:00
|
|
|
|
path: '/detection/policy',
|
2023-08-28 15:14:20 +08:00
|
|
|
|
query: {
|
|
|
|
|
|
t: +new Date()
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2023-10-24 16:02:25 +08:00
|
|
|
|
},
|
|
|
|
|
|
isCheckFilterByQ (params, index) {
|
|
|
|
|
|
if (params.resource) {
|
|
|
|
|
|
let obj
|
|
|
|
|
|
if (index === 0) {
|
|
|
|
|
|
obj = this.filterData[this.pageType][index].data.find(d => params.resource.indexOf(d.value) > -1 && params.resource.indexOf('status') > -1)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
obj = this.filterData[this.pageType][index].data.find(d => params.resource.indexOf(d.value) > -1)
|
|
|
|
|
|
}
|
|
|
|
|
|
if (obj) {
|
|
|
|
|
|
this.filterData[this.pageType][index].value = [obj.value]
|
|
|
|
|
|
this.filterData[this.pageType][index].flag = true
|
2023-10-31 14:04:51 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
this.filterData[this.pageType][index].value = []
|
|
|
|
|
|
this.filterData[this.pageType][index].flag = true
|
2023-10-24 16:02:25 +08:00
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.filterData[this.pageType][index].value = []
|
|
|
|
|
|
this.filterData[this.pageType][index].flag = true
|
|
|
|
|
|
}
|
2023-11-10 14:11:46 +08:00
|
|
|
|
},
|
|
|
|
|
|
getFilter (name, topColumn) {
|
|
|
|
|
|
if (topColumn === 'tag') {
|
|
|
|
|
|
const params = {
|
|
|
|
|
|
column: topColumn,
|
|
|
|
|
|
operator: 'has',
|
|
|
|
|
|
value: name
|
|
|
|
|
|
}
|
|
|
|
|
|
this.$refs.search.changeParams([params])
|
|
|
|
|
|
} else {
|
|
|
|
|
|
const params = {
|
|
|
|
|
|
column: topColumn,
|
|
|
|
|
|
operator: '=',
|
|
|
|
|
|
value: name
|
|
|
|
|
|
}
|
|
|
|
|
|
this.$refs.search.changeParams([params])
|
|
|
|
|
|
}
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.emitter.emit('advanced-search')
|
|
|
|
|
|
})
|
2022-02-14 22:22:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2022-02-17 19:28:48 +08:00
|
|
|
|
mounted () {
|
2023-10-24 16:02:25 +08:00
|
|
|
|
let { q } = this.$route.query
|
|
|
|
|
|
|
|
|
|
|
|
// 如果地址栏有listMode,即列表页,并非首页,则开始搜索
|
|
|
|
|
|
if (q) {
|
|
|
|
|
|
// %位置为0是输入中文时能解码,%20,25%分别是空格和%的情况
|
|
|
|
|
|
if (q && (q.indexOf('%') === 0 || q.indexOf('%20') > -1 || q.indexOf('%25') > -1)) {
|
|
|
|
|
|
q = decodeURI(q)
|
|
|
|
|
|
}
|
|
|
|
|
|
// %位置不为0,即内容包含非英文时
|
|
|
|
|
|
const str1 = q.substring(q.indexOf('%'), q.indexOf('%') + 3)
|
2023-12-12 10:06:21 +08:00
|
|
|
|
if (q && q.indexOf('%') > 0 && (str1 === '%20' || str1 === '%25')) {
|
2023-10-24 16:02:25 +08:00
|
|
|
|
q = decodeURI(q)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-12-12 10:06:21 +08:00
|
|
|
|
const parser = new Parser(schemaDetectionSecurity)
|
|
|
|
|
|
q = parser.conversionEnum(q)
|
2023-10-24 16:02:25 +08:00
|
|
|
|
this.queryFilter(q)
|
2023-10-31 14:43:29 +08:00
|
|
|
|
if (this.initFlag) {
|
|
|
|
|
|
this.timer = setTimeout(() => {
|
|
|
|
|
|
this.initFlag = false
|
|
|
|
|
|
}, 1000)
|
|
|
|
|
|
}
|
2023-10-24 16:02:25 +08:00
|
|
|
|
this.queryList(q)
|
2022-04-26 14:00:16 +08:00
|
|
|
|
this.debounceFunc = this.$_.debounce(this.resize, 300)
|
|
|
|
|
|
window.addEventListener('resize', this.debounceFunc)
|
2022-02-17 19:28:48 +08:00
|
|
|
|
},
|
2022-02-14 22:22:31 +08:00
|
|
|
|
watch: {
|
2022-03-03 18:01:26 +08:00
|
|
|
|
eventSeverityData: {
|
|
|
|
|
|
deep: true,
|
|
|
|
|
|
handler (n) {
|
|
|
|
|
|
if (!n || n.length === 0) {
|
|
|
|
|
|
this.timeout = setTimeout(() => {
|
|
|
|
|
|
this.isEventSeverityNoData = true
|
2022-03-04 15:46:30 +08:00
|
|
|
|
// this.$set(this.isEventSeverityNoData ,true)
|
2022-03-03 18:01:26 +08:00
|
|
|
|
this.loading = false
|
|
|
|
|
|
}, 500)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
clearTimeout(this.timeout)
|
2022-03-04 15:46:30 +08:00
|
|
|
|
// this.$set(this.isEventSeverityNoData ,false)
|
2022-03-03 18:01:26 +08:00
|
|
|
|
this.isEventSeverityNoData = false
|
|
|
|
|
|
this.loading = false
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
statisticsSeverityData: {
|
|
|
|
|
|
deep: true,
|
|
|
|
|
|
handler (n) {
|
|
|
|
|
|
if (!n || n.length === 0) {
|
|
|
|
|
|
this.timeout = setTimeout(() => {
|
2022-03-04 15:46:30 +08:00
|
|
|
|
// this.$set(this.isStatisticsSeverityNoData ,true)
|
2022-03-03 18:01:26 +08:00
|
|
|
|
this.isStatisticsSeverityNoData = true
|
|
|
|
|
|
}, 500)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
clearTimeout(this.timeout)
|
2022-03-04 15:46:30 +08:00
|
|
|
|
// this.$set(this.isStatisticsSeverityNoData ,false)
|
2022-03-03 18:01:26 +08:00
|
|
|
|
this.isStatisticsSeverityNoData = false
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
statisticsCategoryData: {
|
|
|
|
|
|
deep: true,
|
|
|
|
|
|
handler (n) {
|
|
|
|
|
|
if (!n || n.length === 0) {
|
|
|
|
|
|
this.timeout = setTimeout(() => {
|
|
|
|
|
|
this.isStatisticsCategoryNoData = true
|
2022-03-04 15:46:30 +08:00
|
|
|
|
// this.$set(this.isStatisticsCategoryNoData ,true)
|
2022-03-03 18:01:26 +08:00
|
|
|
|
}, 500)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
clearTimeout(this.timeout)
|
2022-03-04 15:46:30 +08:00
|
|
|
|
// this.$set(this.isStatisticsCategoryNoData ,false)
|
2022-03-03 18:01:26 +08:00
|
|
|
|
this.isStatisticsCategoryNoData = false
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
statisticsActiveAttackData: {
|
|
|
|
|
|
deep: true,
|
|
|
|
|
|
handler (n) {
|
|
|
|
|
|
if (!n || n.length === 0) {
|
|
|
|
|
|
this.timeout = setTimeout(() => {
|
|
|
|
|
|
this.isStatisticsActiveAttackNoData = true
|
2022-03-04 15:46:30 +08:00
|
|
|
|
// this.$set(this.isStatisticsActiveAttackNoData ,true)
|
2022-03-03 18:01:26 +08:00
|
|
|
|
}, 500)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
clearTimeout(this.timeout)
|
2022-03-04 15:46:30 +08:00
|
|
|
|
// this.$set(this.isStatisticsActiveAttackNoData ,false)
|
2022-03-03 18:01:26 +08:00
|
|
|
|
this.isStatisticsActiveAttackNoData = false
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2022-11-22 10:52:30 +08:00
|
|
|
|
timeFilter () {
|
2022-02-14 22:22:31 +08:00
|
|
|
|
this.search(this.metaList, this.q)
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2022-04-19 18:17:12 +08:00
|
|
|
|
beforeUnmount () {
|
2022-04-26 14:00:16 +08:00
|
|
|
|
window.removeEventListener('resize', this.debounceFunc)
|
2022-04-19 18:17:12 +08:00
|
|
|
|
},
|
2022-02-14 22:22:31 +08:00
|
|
|
|
setup () {
|
2023-10-22 18:29:34 +08:00
|
|
|
|
const store = useStore()
|
2023-11-09 16:17:25 +08:00
|
|
|
|
let { query, path } = useRoute()
|
2023-10-22 18:29:34 +08:00
|
|
|
|
// 获取路由跳转过的历史状态,赋值给当前界面,起到保留状态的作用,如浏览器的回退前进等
|
|
|
|
|
|
const routerObj = store.getters.getRouterHistoryList.find(item => item.t === query.t)
|
|
|
|
|
|
if (routerObj) {
|
|
|
|
|
|
query = routerObj.query
|
|
|
|
|
|
path = routerObj.path
|
2022-02-25 13:33:54 +08:00
|
|
|
|
|
2023-10-22 18:29:34 +08:00
|
|
|
|
// 如果当前界面之前载入过,获取状态后更新地址栏,以便后续的赋值操作
|
|
|
|
|
|
const newUrl = urlParamsHandler(window.location.href, useRoute().query, query)
|
|
|
|
|
|
overwriteUrl(newUrl)
|
|
|
|
|
|
}
|
2023-11-09 16:17:25 +08:00
|
|
|
|
const pageType = path.replace('/detection/', '')
|
2023-10-22 18:29:34 +08:00
|
|
|
|
// 获取url携带的range、startTime、endTime
|
|
|
|
|
|
const rangeParam = query.range
|
|
|
|
|
|
const startTimeParam = query.startTime
|
|
|
|
|
|
const endTimeParam = query.endTime
|
2023-11-13 17:23:32 +08:00
|
|
|
|
// 优先级:url > config.js > 默认值。
|
|
|
|
|
|
const dateRangeValue = rangeParam ? parseInt(rangeParam) : (DEFAULT_TIME_FILTER_RANGE.detection || 60)
|
2023-10-22 18:29:34 +08:00
|
|
|
|
const timeFilter = ref({ dateRangeValue })
|
|
|
|
|
|
if (!startTimeParam || !endTimeParam) {
|
2023-11-13 17:23:32 +08:00
|
|
|
|
const { startTime, endTime } = getNowTime(dateRangeValue)
|
2023-10-22 18:29:34 +08:00
|
|
|
|
timeFilter.value.startTime = getSecond(startTime)
|
|
|
|
|
|
timeFilter.value.endTime = getSecond(endTime)
|
|
|
|
|
|
// 如果没有时间参数,就将参数写入url
|
|
|
|
|
|
const newUrl = urlParamsHandler(window.location.href, useRoute().query, { startTime: timeFilter.value.startTime, endTime: timeFilter.value.endTime, range: dateRangeValue })
|
|
|
|
|
|
overwriteUrl(newUrl)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
timeFilter.value.startTime = parseInt(startTimeParam)
|
|
|
|
|
|
timeFilter.value.endTime = parseInt(endTimeParam)
|
|
|
|
|
|
}
|
2023-10-31 14:43:29 +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
|
|
|
|
|
|
})
|
2022-02-14 22:22:31 +08:00
|
|
|
|
return {
|
2022-02-17 19:28:48 +08:00
|
|
|
|
timeFilter,
|
2023-10-31 14:43:29 +08:00
|
|
|
|
pageType,
|
|
|
|
|
|
pageObj
|
2022-02-14 22:22:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|