2021-06-20 13:31:55 +08:00
|
|
|
|
<template>
|
2021-07-01 21:39:10 +08:00
|
|
|
|
<!-- 标题 -->
|
2021-06-25 19:11:00 +08:00
|
|
|
|
<div
|
2021-08-26 17:14:51 +08:00
|
|
|
|
v-if="isTitle"
|
|
|
|
|
|
class="cn-chart cn-chart__title"
|
|
|
|
|
|
:style="computePosition">{{chartInfo.i18n ? $t(chartInfo.i18n) : chartInfo.name}}</div>
|
2021-07-01 21:39:10 +08:00
|
|
|
|
<!-- Tabs -->
|
2021-07-05 17:40:43 +08:00
|
|
|
|
<el-tabs
|
2021-07-01 21:39:10 +08:00
|
|
|
|
class="cn-chart cn-chart__tabs"
|
2021-07-21 22:46:08 +08:00
|
|
|
|
v-else-if="isTabs"
|
2021-07-05 17:40:43 +08:00
|
|
|
|
v-model="activeTab"
|
|
|
|
|
|
@tab-click="changeTab"
|
|
|
|
|
|
:style="computePosition"
|
2021-07-22 18:30:45 +08:00
|
|
|
|
:ref="`chart-${chart.id}`"
|
2021-07-05 17:40:43 +08:00
|
|
|
|
>
|
|
|
|
|
|
<el-tab-pane
|
2021-08-26 17:14:51 +08:00
|
|
|
|
v-for="tab in chartInfo.children"
|
|
|
|
|
|
:label="tab.i18n ? $t(tab.i18n) : tab.name" :name="`${tab.id}`"
|
|
|
|
|
|
:key="tab.id"
|
|
|
|
|
|
:ref="`chart-${chart.id}`"
|
2021-07-05 17:40:43 +08:00
|
|
|
|
>
|
2021-07-21 22:46:08 +08:00
|
|
|
|
<template v-for="chart in tab.children">
|
2021-10-13 20:01:29 +08:00
|
|
|
|
<chart
|
|
|
|
|
|
v-if="activeTab == tab.id"
|
|
|
|
|
|
:key="chart.id"
|
|
|
|
|
|
:chart="chart"
|
|
|
|
|
|
:time-filter="timeFilter"
|
|
|
|
|
|
:ref="`chart-${chart.id}`"
|
|
|
|
|
|
:entity="entity"
|
|
|
|
|
|
@getCurrentTimeRange="getCurrentTimeRange"
|
|
|
|
|
|
></chart>
|
2021-07-05 22:58:12 +08:00
|
|
|
|
</template>
|
2021-07-05 17:40:43 +08:00
|
|
|
|
</el-tab-pane>
|
|
|
|
|
|
</el-tabs>
|
2021-06-24 17:59:51 +08:00
|
|
|
|
<!-- 地图 -->
|
|
|
|
|
|
<chart-map
|
2021-06-25 19:11:00 +08:00
|
|
|
|
v-else-if="isMap"
|
2021-06-24 17:59:51 +08:00
|
|
|
|
:style="computePosition"
|
2021-08-11 22:14:23 +08:00
|
|
|
|
:loading="loading"
|
2021-06-24 17:59:51 +08:00
|
|
|
|
>
|
2021-08-20 15:43:48 +08:00
|
|
|
|
<template #chartErrorInfo>
|
2021-08-26 17:14:51 +08:00
|
|
|
|
<chart-error
|
|
|
|
|
|
:isError="isError"
|
|
|
|
|
|
:errorInfo="errorInfo"
|
|
|
|
|
|
>
|
|
|
|
|
|
</chart-error>
|
2021-08-20 15:43:48 +08:00
|
|
|
|
</template>
|
2021-06-24 17:59:51 +08:00
|
|
|
|
<template #title>{{chartInfo.i18n ? $t(chartInfo.i18n) : chartInfo.name}}</template>
|
|
|
|
|
|
<template #operations>
|
2021-10-16 15:50:12 +08:00
|
|
|
|
<span class="header__operation-btn" v-show="showMapBackButton" @click="mapBack"><i class="cn-icon el-icon-back"></i></span>
|
2021-09-15 12:19:13 +08:00
|
|
|
|
<el-popover trigger="hover" placement="top" :content="chartInfo.remark" v-if="chartInfo.remark">
|
|
|
|
|
|
<template #reference>
|
|
|
|
|
|
<span class="header__operation-btn"><i class="cn-icon el-icon-info"></i></span>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-popover>
|
|
|
|
|
|
<span class="header__operation-btn" @click="refresh"><i class="cn-icon cn-icon-refresh"></i></span>
|
2021-06-24 17:59:51 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
<template #default>
|
2021-09-18 17:48:52 +08:00
|
|
|
|
<template v-if="isIpBasicInfo">
|
|
|
|
|
|
<el-descriptions :column="1">
|
2021-09-22 09:08:21 +08:00
|
|
|
|
<el-descriptions-item label="ASN:">{{detailData ? detailData.asn : '-'}}</el-descriptions-item>
|
2021-09-28 17:36:46 +08:00
|
|
|
|
<el-descriptions-item label="AS Org:">{{detailData ? detailData.asnOrg : '-'}}</el-descriptions-item>
|
|
|
|
|
|
<el-descriptions-item :label="$t('entities.asSubnet') + ':'">{{detailData.asnSubnet || '-'}}</el-descriptions-item>
|
2021-09-22 09:08:21 +08:00
|
|
|
|
<el-descriptions-item label="ISP:">{{detailData.isp || '-'}}</el-descriptions-item>
|
|
|
|
|
|
<el-descriptions-item label="DNS PTR:">{{detailData.dnsPTR || '-'}}</el-descriptions-item>
|
2021-09-18 17:48:52 +08:00
|
|
|
|
</el-descriptions>
|
|
|
|
|
|
<div class="chart-location">
|
|
|
|
|
|
<el-descriptions :column="1">
|
|
|
|
|
|
<el-descriptions-item :label="$t('overall.location') + ':'">{{location}}</el-descriptions-item>
|
|
|
|
|
|
</el-descriptions>
|
2021-09-22 09:08:21 +08:00
|
|
|
|
<div class="chart-drawing" style="padding: 0 36px 30px 0;" :id="`chart${chartInfo.id}`"></div>
|
2021-09-18 17:48:52 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
2021-10-16 15:50:12 +08:00
|
|
|
|
<template v-else>
|
|
|
|
|
|
<div class="chart-drawing" :id="`chart${chartInfo.id}`"></div>
|
|
|
|
|
|
</template>
|
2021-06-24 17:59:51 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
</chart-map>
|
|
|
|
|
|
<!-- echarts类的图,如饼图、柱状图、折线图等 -->
|
2021-06-20 13:31:55 +08:00
|
|
|
|
<echarts-frame
|
2021-08-26 17:14:51 +08:00
|
|
|
|
v-else-if="isEcharts"
|
|
|
|
|
|
:layout="layout"
|
|
|
|
|
|
:style="computePosition"
|
|
|
|
|
|
:chartInfo="chartInfo"
|
|
|
|
|
|
:loading="loading"
|
|
|
|
|
|
:no-data="noData"
|
2021-06-20 13:31:55 +08:00
|
|
|
|
>
|
2021-08-26 17:14:51 +08:00
|
|
|
|
<template #chartErrorInfo>
|
|
|
|
|
|
<chart-error
|
|
|
|
|
|
:isError="isError"
|
|
|
|
|
|
:errorInfo="errorInfo"
|
|
|
|
|
|
>
|
|
|
|
|
|
</chart-error>
|
|
|
|
|
|
</template>
|
2021-12-14 07:38:09 +08:00
|
|
|
|
<template #title v-if="layout.indexOf(layoutConstant.HEADER) > -1" >
|
2021-12-14 17:21:37 +08:00
|
|
|
|
{{chartInfo.i18n ? $t(chartInfo.i18n) : chartInfo.name}}
|
2021-07-07 15:51:52 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
<template #operations v-if="layout.indexOf(layoutConstant.HEADER) > -1">
|
2021-07-14 15:40:05 +08:00
|
|
|
|
<div class="header__operation header__operation--echarts" v-if="chart.type === 31">
|
2021-07-06 15:58:24 +08:00
|
|
|
|
<el-select
|
2021-08-11 22:14:23 +08:00
|
|
|
|
size="mini"
|
|
|
|
|
|
v-model="orderPieTable"
|
|
|
|
|
|
class="option__select select-column"
|
|
|
|
|
|
placeholder=""
|
2022-01-03 22:46:22 +08:00
|
|
|
|
popper-class="option-popper is-light"
|
2021-08-11 22:14:23 +08:00
|
|
|
|
@change="orderPieTableChange"
|
2021-07-06 15:58:24 +08:00
|
|
|
|
>
|
2021-07-07 15:51:52 +08:00
|
|
|
|
<el-option v-for="item in chartPieTableTopOptions" :key="item.value" :value="item.value"> {{item.name}}</el-option>
|
2021-07-06 15:58:24 +08:00
|
|
|
|
</el-select>
|
2021-07-07 15:51:52 +08:00
|
|
|
|
</div>
|
2021-09-15 12:19:13 +08:00
|
|
|
|
<el-popover trigger="hover" placement="top" :content="chartInfo.remark" v-if="chartInfo.remark">
|
|
|
|
|
|
<template #reference>
|
|
|
|
|
|
<span class="header__operation-btn"><i class="cn-icon el-icon-info"></i></span>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-popover>
|
2021-12-13 10:16:41 +08:00
|
|
|
|
<span class="header__operation-btn" @click="refresh" ><i class="cn-icon cn-icon-refresh"></i></span>
|
2021-06-20 13:31:55 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
<template #default>
|
2021-09-22 09:08:21 +08:00
|
|
|
|
<!-- IP详情 开放端口 -->
|
|
|
|
|
|
<template v-if="isIpOpenPort">
|
|
|
|
|
|
<div class="ip-detail__open-port">
|
|
|
|
|
|
<div class="open-port__table">
|
|
|
|
|
|
<div style="height: 100%; overflow: hidden auto;">
|
|
|
|
|
|
<div class="open-port__table-row open-port__table-row--header">
|
|
|
|
|
|
<div class="open-port__table-cell" style="min-width: 100px;">Port</div>
|
|
|
|
|
|
<div class="open-port__table-cell" style="min-width: 130px;">{{$t('overall.protocol')}}</div>
|
|
|
|
|
|
<div class="open-port__table-cell">Banner</div>
|
|
|
|
|
|
<div class="open-port__table-cell" style="min-width: 200px;">Update at</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="open-port__table-row" v-for="(data, index) in detailData" :key="index">
|
|
|
|
|
|
<div class="open-port__table-cell">{{data.port || '-'}}</div>
|
|
|
|
|
|
<div class="open-port__table-cell">{{data.protocol || '-'}}</div>
|
|
|
|
|
|
<div class="open-port__table-cell">{{data.banner || '-'}}</div>
|
|
|
|
|
|
<div class="open-port__table-cell">{{data.utime || '-'}}</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="open-port__chart">
|
|
|
|
|
|
<div class="open-port__chart-title">{{$t('overall.protocolsStatistics')}}</div>
|
|
|
|
|
|
<div class="open-port__chart-body chart-drawing" :id="`chart${chartInfo.id}`"></div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
2021-09-24 19:24:25 +08:00
|
|
|
|
<!-- IP详情 托管域名 -->
|
2021-09-22 09:08:21 +08:00
|
|
|
|
<template v-else-if="isIpHostedDomain">
|
|
|
|
|
|
<div class="ip-detail__hosted-domain">
|
|
|
|
|
|
<div class="hosted-domain__list">
|
|
|
|
|
|
<div class="hosted-domain__list-title">{{$t('overall.domain')}}</div>
|
|
|
|
|
|
<div class="hosted-domain__list-body">
|
|
|
|
|
|
<div class="hosted-domain__list-row" v-for="(data, i) in detailData" :key="i">{{data}}</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="hosted-domain__chart">
|
|
|
|
|
|
<div>
|
2021-09-22 23:05:18 +08:00
|
|
|
|
<div class="hosted-domain__chart-title">{{$t('entities.byCategory')}}</div>
|
2021-09-22 09:08:21 +08:00
|
|
|
|
<div class="chart-drawing" :id="`chart${chartInfo.id}-0`"></div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<div class="hosted-domain__chart-title">{{$t('entities.byCredit')}}</div>
|
|
|
|
|
|
<div class="chart-drawing" :id="`chart${chartInfo.id}-1`"></div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
2021-09-24 19:24:25 +08:00
|
|
|
|
<!-- APP详情 关联域名 -->
|
|
|
|
|
|
<template v-else-if="isAppRelatedDomain">
|
|
|
|
|
|
<div class="app-detail__related-domain">
|
|
|
|
|
|
<div class="related-domain__list">
|
|
|
|
|
|
<div class="related-domain__list-title">{{$t('overall.domain')}}</div>
|
|
|
|
|
|
<div class="related-domain__list-body">
|
|
|
|
|
|
<div class="related-domain__list-row" v-for="(data, i) in detailData" :key="i"><i class="cn-icon cn-icon-domain"></i> {{data}}</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="related-domain__chart">
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<div class="related-domain__chart-title">{{$t('entities.byCategory')}}</div>
|
|
|
|
|
|
<div class="chart-drawing" :id="`chart${chartInfo.id}-0`"></div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<div class="related-domain__chart-title">{{$t('entities.byCredit')}}</div>
|
|
|
|
|
|
<div class="chart-drawing" :id="`chart${chartInfo.id}-1`"></div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
2021-10-08 21:09:51 +08:00
|
|
|
|
<template v-else-if="isSankey">
|
|
|
|
|
|
<div class="sankey-box">
|
|
|
|
|
|
<div class="chart-drawing" :id="`chart${chartInfo.id}`"></div>
|
|
|
|
|
|
<div class="sankey__label" style="left: 5%;">{{$t('entities.inboundLinkId')}}</div>
|
|
|
|
|
|
<div class="sankey__label" style="left: 50%;">{{entity.ip || entity.domain || entity.app}}</div>
|
|
|
|
|
|
<div class="sankey__label" style="right: 5%; transform: translateX(50%)">{{$t('entities.outboundLinkId')}}</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
2021-09-22 09:08:21 +08:00
|
|
|
|
<div v-else class="chart-drawing" :id="`chart${chartInfo.id}`"></div>
|
2021-06-20 13:31:55 +08:00
|
|
|
|
</template>
|
2021-07-21 22:46:08 +08:00
|
|
|
|
<template #footer v-if="layout.indexOf(layoutConstant.FOOTER) > -1">
|
2021-06-22 21:19:04 +08:00
|
|
|
|
<!-- 带Table的饼图,展示Table -->
|
|
|
|
|
|
<template v-if="isEchartsWithTable">
|
2021-07-21 22:46:08 +08:00
|
|
|
|
<pie-table :tableData="pieTableData" ref="pieTable" :chartInfo="chartInfo" :time-filter="timeFilter" :order="orderPieTable"/>
|
2021-07-05 22:58:12 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
<template v-else-if="isEchartsWithStatistics">
|
2021-07-22 21:35:06 +08:00
|
|
|
|
<statistics-legend :data="statisticsData" :chart-info="chartInfo" @toggleLegend="toggleStatisticsLegend"></statistics-legend>
|
2021-06-22 21:19:04 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
</template>
|
2021-06-20 13:31:55 +08:00
|
|
|
|
</echarts-frame>
|
2021-06-22 21:19:04 +08:00
|
|
|
|
<!-- 单值图 -->
|
2021-06-20 13:31:55 +08:00
|
|
|
|
<single-value
|
2021-08-26 17:14:51 +08:00
|
|
|
|
v-else-if="isSingleValue"
|
|
|
|
|
|
:type="chartInfo.type"
|
|
|
|
|
|
:style="computePosition"
|
|
|
|
|
|
:icon="singleValue.icon"
|
2021-12-29 14:58:58 +08:00
|
|
|
|
:color="singleValue.color"
|
2021-09-07 11:38:06 +08:00
|
|
|
|
:loading="loading"
|
2021-06-20 13:31:55 +08:00
|
|
|
|
>
|
2021-08-26 17:14:51 +08:00
|
|
|
|
<template #chartErrorInfo>
|
|
|
|
|
|
<chart-error
|
|
|
|
|
|
:isError="isError"
|
|
|
|
|
|
:errorInfo="errorInfo"
|
|
|
|
|
|
>
|
|
|
|
|
|
</chart-error>
|
|
|
|
|
|
</template>
|
2021-09-18 17:48:52 +08:00
|
|
|
|
<template #title>
|
|
|
|
|
|
<span :title="chartInfo.i18n ? $t(chartInfo.i18n) : chartInfo.name">{{chartInfo.i18n ? $t(chartInfo.i18n) : chartInfo.name}}</span>
|
|
|
|
|
|
<span
|
|
|
|
|
|
v-if="chartInfo.params && chartInfo.params.as"
|
|
|
|
|
|
class="ip-detail-as"
|
|
|
|
|
|
>
|
|
|
|
|
|
as <span style="text-transform: capitalize">{{chartInfo.params.as}}</span>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</template>
|
2021-07-13 18:38:32 +08:00
|
|
|
|
<template #data>
|
2021-08-26 19:56:04 +08:00
|
|
|
|
<span>{{handleSingleValue[0] || handleSingleValue[0] === 0 ? handleSingleValue[0] : '-'}}</span>
|
2021-07-21 22:46:08 +08:00
|
|
|
|
<span class="single-value__unit">{{handleSingleValue[1]}}</span>
|
2021-07-13 18:38:32 +08:00
|
|
|
|
</template>
|
2021-08-10 15:16:56 +08:00
|
|
|
|
<template #chart>
|
2021-08-13 09:39:02 +08:00
|
|
|
|
<div class="chart-drawing" :id="`chart${chartInfo.id}`"></div>
|
2021-08-10 15:16:56 +08:00
|
|
|
|
</template>
|
2021-06-20 13:31:55 +08:00
|
|
|
|
</single-value>
|
2021-12-06 21:12:04 +08:00
|
|
|
|
<!-- 表格:Cryptocurrency活跃IP -->
|
|
|
|
|
|
<chart-table-active-ip
|
|
|
|
|
|
v-else-if="isActiveIpTable"
|
|
|
|
|
|
:table-data="activeIpTable.tableData"
|
|
|
|
|
|
:style="computePosition"
|
|
|
|
|
|
:loading="loading"
|
2021-12-29 14:58:58 +08:00
|
|
|
|
:no-data="noData"
|
2021-12-06 21:12:04 +08:00
|
|
|
|
>
|
|
|
|
|
|
<template #chartErrorInfo>
|
|
|
|
|
|
<chart-error
|
|
|
|
|
|
:isError="isError"
|
|
|
|
|
|
:errorInfo="errorInfo"
|
|
|
|
|
|
>
|
|
|
|
|
|
</chart-error>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template #title>{{chartInfo.i18n ? $t(chartInfo.i18n) : chartInfo.name}}</template>
|
|
|
|
|
|
<template #operations>
|
|
|
|
|
|
<el-popover trigger="hover" placement="top" :content="chartInfo.remark" v-if="chartInfo.remark">
|
|
|
|
|
|
<template #reference>
|
|
|
|
|
|
<span class="header__operation-btn"><i class="cn-icon el-icon-info"></i></span>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-popover>
|
|
|
|
|
|
<div class="header__operation header__operation--table">
|
|
|
|
|
|
<el-select
|
|
|
|
|
|
size="mini"
|
|
|
|
|
|
v-model="activeIpTable.orderBy"
|
|
|
|
|
|
class="option__select select-column"
|
|
|
|
|
|
:placeholder="$t('overall.field')"
|
|
|
|
|
|
popper-class="option-popper"
|
|
|
|
|
|
@change="activeIpTableLimitChange"
|
|
|
|
|
|
>
|
|
|
|
|
|
<template v-for="item in chartActiveIpTableOrderOptions" :key="item">
|
|
|
|
|
|
<el-option :value="item">{{item}}</el-option>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-select>
|
|
|
|
|
|
</div>
|
2021-12-13 10:16:41 +08:00
|
|
|
|
<span class="header__operation-btn" @click="refresh"><i class="cn-icon cn-icon-refresh"></i></span>
|
2021-12-06 21:12:04 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
</chart-table-active-ip>
|
2021-06-22 21:19:04 +08:00
|
|
|
|
<!-- 表格 -->
|
2021-06-20 13:31:55 +08:00
|
|
|
|
<chart-table
|
2021-08-26 17:14:51 +08:00
|
|
|
|
v-else-if="isTable"
|
|
|
|
|
|
:table-columns="table.tableColumns"
|
|
|
|
|
|
:table-data="table.currentPageData"
|
|
|
|
|
|
:style="computePosition"
|
|
|
|
|
|
:loading="loading"
|
|
|
|
|
|
:no-data="noData"
|
2021-06-20 13:31:55 +08:00
|
|
|
|
>
|
2021-08-26 17:14:51 +08:00
|
|
|
|
<template #chartErrorInfo>
|
|
|
|
|
|
<chart-error
|
|
|
|
|
|
:isError="isError"
|
|
|
|
|
|
:errorInfo="errorInfo"
|
|
|
|
|
|
>
|
|
|
|
|
|
</chart-error>
|
|
|
|
|
|
</template>
|
2021-06-20 13:31:55 +08:00
|
|
|
|
<template #title>{{chartInfo.i18n ? $t(chartInfo.i18n) : chartInfo.name}}</template>
|
|
|
|
|
|
<template #operations>
|
2021-09-15 12:19:13 +08:00
|
|
|
|
<el-popover trigger="hover" placement="top" :content="chartInfo.remark" v-if="chartInfo.remark">
|
|
|
|
|
|
<template #reference>
|
|
|
|
|
|
<span class="header__operation-btn"><i class="cn-icon el-icon-info"></i></span>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-popover>
|
2021-06-21 20:33:39 +08:00
|
|
|
|
<div class="header__operation header__operation--table">
|
|
|
|
|
|
<el-select
|
|
|
|
|
|
size="mini"
|
|
|
|
|
|
v-model="table.limit"
|
2021-06-22 21:19:04 +08:00
|
|
|
|
class="option__select select-topn"
|
2021-06-21 20:33:39 +08:00
|
|
|
|
placeholder=""
|
2021-06-22 21:19:04 +08:00
|
|
|
|
popper-class="option-popper"
|
2021-07-09 21:58:49 +08:00
|
|
|
|
@change="tableLimitChange"
|
2021-06-21 20:33:39 +08:00
|
|
|
|
>
|
|
|
|
|
|
<el-option v-for="item in chartTableTopOptions" :key="item" :value="item">TOP {{item}}</el-option>
|
|
|
|
|
|
<template #prefix>TOP </template>
|
|
|
|
|
|
</el-select>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="header__operation header__operation--table">
|
|
|
|
|
|
<el-select
|
|
|
|
|
|
size="mini"
|
|
|
|
|
|
v-model="table.orderBy"
|
2021-06-22 21:19:04 +08:00
|
|
|
|
class="option__select select-column"
|
2021-07-22 21:35:06 +08:00
|
|
|
|
:placeholder="$t('overall.field')"
|
2021-06-22 21:19:04 +08:00
|
|
|
|
popper-class="option-popper"
|
2021-07-09 21:58:49 +08:00
|
|
|
|
@change="tableLimitChange"
|
2021-06-21 20:33:39 +08:00
|
|
|
|
>
|
2021-07-13 18:49:41 +08:00
|
|
|
|
<template v-for="(item, index) in table.tableColumns" :key="item.prop">
|
|
|
|
|
|
<el-option v-if="index > 0" :value="item.prop">{{item.prop}}</el-option>
|
|
|
|
|
|
</template>
|
2021-06-21 20:33:39 +08:00
|
|
|
|
</el-select>
|
|
|
|
|
|
</div>
|
2021-10-11 19:12:52 +08:00
|
|
|
|
<span class="header__operation-btn" @click="refresh"><i class="cn-icon cn-icon-refresh"></i></span>
|
2021-06-22 21:19:04 +08:00
|
|
|
|
<!-- <div class="header__operation header__operation--table">
|
2021-06-20 13:31:55 +08:00
|
|
|
|
<span class="option__button"><i class="cn-icon cn-icon-style"></i></span>
|
|
|
|
|
|
<div class="icon-group-divide"></div>
|
|
|
|
|
|
<span class="option__button"><i class="cn-icon cn-icon-dropdown"></i></span>
|
2021-07-14 15:40:05 +08:00
|
|
|
|
</div>
|
2021-06-20 13:31:55 +08:00
|
|
|
|
<div class="header__operation header__operation--table">
|
|
|
|
|
|
<span class="option__button"><i class="cn-icon cn-icon-full-screen"></i></span>
|
2021-07-14 15:40:05 +08:00
|
|
|
|
</div>-->
|
2021-06-20 13:31:55 +08:00
|
|
|
|
</template>
|
2021-06-21 20:33:39 +08:00
|
|
|
|
<template #footer>
|
|
|
|
|
|
<chart-table-pagination
|
2021-08-27 15:08:37 +08:00
|
|
|
|
ref="tablePagination"
|
2021-06-21 20:33:39 +08:00
|
|
|
|
:total="table.tableData.length"
|
|
|
|
|
|
@pageJump="pageJump"
|
|
|
|
|
|
></chart-table-pagination>
|
|
|
|
|
|
</template>
|
2021-06-20 13:31:55 +08:00
|
|
|
|
</chart-table>
|
2021-09-16 21:19:48 +08:00
|
|
|
|
<!-- group -->
|
|
|
|
|
|
<div
|
|
|
|
|
|
v-else-if="isGroup"
|
|
|
|
|
|
class="cn-chart cn-chart__group"
|
|
|
|
|
|
:style="computePosition"
|
|
|
|
|
|
>
|
|
|
|
|
|
<div class="cn-chart__header">
|
2021-09-18 17:48:52 +08:00
|
|
|
|
<chart-error
|
|
|
|
|
|
:isError="isError"
|
|
|
|
|
|
:errorInfo="errorInfo"
|
|
|
|
|
|
>
|
|
|
|
|
|
</chart-error>
|
|
|
|
|
|
<div class="header__title">
|
|
|
|
|
|
<span :title="chartInfo.i18n ? $t(chartInfo.i18n) : chartInfo.name">{{chartInfo.i18n ? $t(chartInfo.i18n) : chartInfo.name}}</span>
|
|
|
|
|
|
<span
|
|
|
|
|
|
v-if="chartInfo.params && chartInfo.params.as"
|
|
|
|
|
|
class="ip-detail-as"
|
|
|
|
|
|
>
|
|
|
|
|
|
as <span style="text-transform: capitalize">{{chartInfo.params.as}}</span>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</div>
|
2021-09-16 21:19:48 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="cn-chart__body">
|
|
|
|
|
|
<template v-for="chart in chartInfo.children" :key="chart.id">
|
2022-01-03 22:46:22 +08:00
|
|
|
|
<chart
|
|
|
|
|
|
:chart="chart"
|
|
|
|
|
|
:time-filter="timeFilter"
|
|
|
|
|
|
:ref="`chart-${chart.id}`"
|
|
|
|
|
|
:entity="entity"
|
|
|
|
|
|
:parent-data="groupData"
|
|
|
|
|
|
:from-block="fromBlock"
|
|
|
|
|
|
@getChartCurrentTimeRange="getChartCurrentTimeRange"
|
|
|
|
|
|
></chart>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<!-- block -->
|
|
|
|
|
|
<div
|
|
|
|
|
|
v-else-if="isBlock"
|
|
|
|
|
|
class="cn-chart cn-chart__block"
|
|
|
|
|
|
:style="computePosition"
|
|
|
|
|
|
:id="chartInfo.params && chartInfo.params.anchorPoint"
|
|
|
|
|
|
>
|
|
|
|
|
|
<div class="cn-chart__header">
|
|
|
|
|
|
<chart-error
|
|
|
|
|
|
:isError="isError"
|
|
|
|
|
|
:errorInfo="errorInfo"
|
|
|
|
|
|
>
|
|
|
|
|
|
</chart-error>
|
|
|
|
|
|
<div class="header__title">
|
|
|
|
|
|
<span :title="chartInfo.i18n ? $t(chartInfo.i18n) : chartInfo.name">{{chartInfo.i18n ? $t(chartInfo.i18n) : chartInfo.name}}</span>
|
|
|
|
|
|
<div style="top: 18px;" class="panel__time" v-if="chartInfo.params && chartInfo.params.showTimeTool">
|
|
|
|
|
|
<DateTimeRange class="date-time-range" :start-time="chartTimeFilter.startTime" :end-time="chartTimeFilter.endTime" ref="dateTimeRange" @change="reload"/>
|
|
|
|
|
|
<TimeRefresh class="date-time-range" @change="timeRefreshChange" :end-time="chartTimeFilter.endTime"/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="cn-chart__body">
|
|
|
|
|
|
<template v-for="chart in chartInfo.children" :key="chart.id">
|
|
|
|
|
|
<chart
|
|
|
|
|
|
:chart="chart"
|
|
|
|
|
|
:time-filter="chartTimeFilter"
|
|
|
|
|
|
:ref="`chart-${chart.id}`"
|
|
|
|
|
|
:entity="entity"
|
|
|
|
|
|
:parent-data="groupData"
|
|
|
|
|
|
:from-block="true"
|
|
|
|
|
|
@getChartCurrentTimeRange="getChartCurrentTimeRange"
|
|
|
|
|
|
></chart>
|
2021-09-16 21:19:48 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2021-09-22 23:05:18 +08:00
|
|
|
|
<!-- Domain详情-whois -->
|
|
|
|
|
|
<div
|
|
|
|
|
|
v-else-if="isDomainWhois"
|
|
|
|
|
|
class="cn-chart cn-chart__whois"
|
|
|
|
|
|
:style="computePosition"
|
|
|
|
|
|
>
|
|
|
|
|
|
<div class="cn-chart__header">
|
|
|
|
|
|
<chart-error
|
|
|
|
|
|
:isError="isError"
|
|
|
|
|
|
:errorInfo="errorInfo"
|
|
|
|
|
|
>
|
|
|
|
|
|
</chart-error>
|
|
|
|
|
|
<div class="header__title">
|
|
|
|
|
|
<span :title="chartInfo.i18n ? $t(chartInfo.i18n) : chartInfo.name">{{chartInfo.i18n ? $t(chartInfo.i18n) : chartInfo.name}}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="cn-chart__body">
|
|
|
|
|
|
<div class="domain-detail-list">
|
|
|
|
|
|
<div class="domain-detail-list__row">
|
|
|
|
|
|
<div class="domain-detail-list__label">{{$t('entities.sponsor')}}</div>
|
|
|
|
|
|
<div class="domain-detail-list__content">{{detailData.sponsor || '-'}}</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="domain-detail-list__row">
|
|
|
|
|
|
<div class="domain-detail-list__label">{{$t('entities.org')}}</div>
|
|
|
|
|
|
<div class="domain-detail-list__content">{{detailData.org || '-'}}</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="domain-detail-list__row">
|
|
|
|
|
|
<div class="domain-detail-list__label">Email</div>
|
|
|
|
|
|
<div class="domain-detail-list__content">{{detailData.email || '-'}}</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="domain-detail-list__row">
|
|
|
|
|
|
<div class="domain-detail-list__label">{{$t('overall.country')}}</div>
|
|
|
|
|
|
<div class="domain-detail-list__content">{{detailData.orgCountry || '-'}}</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="domain-detail-list__row">
|
|
|
|
|
|
<div class="domain-detail-list__label">{{$t('entities.creationDate')}}</div>
|
|
|
|
|
|
<div class="domain-detail-list__content">{{detailData.creationDate || '-'}}</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="domain-detail-list__row">
|
|
|
|
|
|
<div class="domain-detail-list__label">{{$t('entities.expirationDate')}}</div>
|
|
|
|
|
|
<div class="domain-detail-list__content">{{detailData.expirationDate || '-'}}</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<!-- Domain详情-DNS记录 -->
|
|
|
|
|
|
<div
|
|
|
|
|
|
v-else-if="isDomainDnsRecord"
|
|
|
|
|
|
class="cn-chart cn-chart__dns-record"
|
|
|
|
|
|
:style="computePosition"
|
|
|
|
|
|
>
|
|
|
|
|
|
<div class="cn-chart__header">
|
|
|
|
|
|
<chart-error
|
|
|
|
|
|
:isError="isError"
|
|
|
|
|
|
:errorInfo="errorInfo"
|
|
|
|
|
|
>
|
|
|
|
|
|
</chart-error>
|
|
|
|
|
|
<div class="header__title">
|
|
|
|
|
|
<span :title="chartInfo.i18n ? $t(chartInfo.i18n) : chartInfo.name">{{chartInfo.i18n ? $t(chartInfo.i18n) : chartInfo.name}}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="cn-chart__body">
|
|
|
|
|
|
<div class="entity-detail__dns-record">
|
|
|
|
|
|
<div class="dns-record__table">
|
|
|
|
|
|
<div style="height: 100%; overflow: hidden auto;">
|
|
|
|
|
|
<div class="dns-record__table-row dns-record__table-row--header">
|
|
|
|
|
|
<div class="dns-record__table-cell" style="min-width: 200px;">Type</div>
|
|
|
|
|
|
<div class="dns-record__table-cell" style="width: 100%;">Value</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="dns-record__table-row" v-for="(data, index) in detailData" :key="index">
|
|
|
|
|
|
<div class="dns-record__table-cell">{{data.type || '-'}}</div>
|
|
|
|
|
|
<div class="dns-record__table-cell">{{data.value || '-'}}</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2021-12-14 07:38:09 +08:00
|
|
|
|
<!-- Cryptocurrency EventList :近期挖矿事件-->
|
|
|
|
|
|
<div v-else-if="isCryptocurrencyEventList"
|
|
|
|
|
|
class="cn-chart cn-chart__table"
|
|
|
|
|
|
:style="computePosition"
|
|
|
|
|
|
>
|
2021-12-16 10:36:00 +08:00
|
|
|
|
<div class="cn-chart__header" >
|
2021-12-14 07:38:09 +08:00
|
|
|
|
<chart-error
|
|
|
|
|
|
:isError="isError"
|
|
|
|
|
|
:errorInfo="errorInfo"
|
|
|
|
|
|
>
|
|
|
|
|
|
</chart-error>
|
2021-12-14 17:21:37 +08:00
|
|
|
|
<div class="header__title" >
|
2021-12-14 07:38:09 +08:00
|
|
|
|
<span :title="chartInfo.i18n ? $t(chartInfo.i18n) : chartInfo.name">{{chartInfo.i18n ? $t(chartInfo.i18n) : chartInfo.name}}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<span class="header__operations header__operation-btn" @click="refresh"><i class="cn-icon cn-icon-refresh"></i></span>
|
|
|
|
|
|
</div>
|
2021-12-29 14:58:58 +08:00
|
|
|
|
<div class="chart__loading" v-show="loading">
|
|
|
|
|
|
<i class="el-icon-loading"></i>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="cn-chart__body" v-no-data="noData">
|
2021-12-14 07:38:09 +08:00
|
|
|
|
<div class="crypto-eventList__record">
|
|
|
|
|
|
<div class="record__table">
|
|
|
|
|
|
<div style="height: 100%; overflow: hidden auto;">
|
|
|
|
|
|
<div class="record__table-row" v-for="(data, index) in croptyEventList" :key="index">
|
|
|
|
|
|
<div class="record__table-cell">
|
|
|
|
|
|
<div class="circle1" style=""></div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="record__table-cell">
|
|
|
|
|
|
{{data.message || '-'}}:{{data.serverIP || '-'}}<br/>
|
|
|
|
|
|
<span class="record_second" > {{data.time || '-'}} {{data.clientIP || '-'}} </span>
|
|
|
|
|
|
<div class="record_second arrow arrow-hor right"> </div>
|
|
|
|
|
|
<span class="record_second"> {{data.serverIP || '-'}}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2021-09-22 23:05:18 +08:00
|
|
|
|
<!-- APP详情-基本信息 -->
|
|
|
|
|
|
<div
|
|
|
|
|
|
v-else-if="isAppBasicInfo"
|
|
|
|
|
|
class="cn-chart cn-chart__app-basic"
|
|
|
|
|
|
:style="computePosition"
|
|
|
|
|
|
>
|
|
|
|
|
|
<div class="cn-chart__header">
|
|
|
|
|
|
<chart-error
|
|
|
|
|
|
:isError="isError"
|
|
|
|
|
|
:errorInfo="errorInfo"
|
|
|
|
|
|
>
|
|
|
|
|
|
</chart-error>
|
|
|
|
|
|
<div class="header__title">
|
|
|
|
|
|
<span :title="chartInfo.i18n ? $t(chartInfo.i18n) : chartInfo.name">{{chartInfo.i18n ? $t(chartInfo.i18n) : chartInfo.name}}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="cn-chart__body">
|
|
|
|
|
|
<div style="display: flex; justify-content: space-between; width: 100%;">
|
|
|
|
|
|
<el-descriptions :column="1" style="padding: 20px 30px;">
|
2021-09-30 00:50:11 +08:00
|
|
|
|
<el-descriptions-item :label="$t('overall.appName') + ':'">{{detailData.name || '-'}}</el-descriptions-item>
|
|
|
|
|
|
<el-descriptions-item :label="$t('overall.appFullName') + ':'">{{detailData.allName || '-'}}</el-descriptions-item>
|
|
|
|
|
|
<el-descriptions-item :label="$t('overall.technology') + ':'">{{detailData.tech || '-'}}</el-descriptions-item>
|
|
|
|
|
|
<el-descriptions-item :label="$t('overall.remark') + ':'">{{detailData.description || '-'}}</el-descriptions-item>
|
2021-09-22 23:05:18 +08:00
|
|
|
|
</el-descriptions>
|
|
|
|
|
|
<div style="display: flex;">
|
|
|
|
|
|
<single-value
|
|
|
|
|
|
:type="51"
|
|
|
|
|
|
icon="cn-icon cn-icon-category"
|
|
|
|
|
|
:loading="false"
|
|
|
|
|
|
style="width: 250px;"
|
|
|
|
|
|
>
|
|
|
|
|
|
<template #title>
|
|
|
|
|
|
<span>{{$t('entities.category')}}</span>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template #data>
|
2021-09-30 00:50:11 +08:00
|
|
|
|
<span>{{detailData.category ? detailData.category : '-'}}</span>
|
2021-09-22 23:05:18 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
</single-value>
|
|
|
|
|
|
<single-value
|
|
|
|
|
|
:type="51"
|
|
|
|
|
|
icon="cn-icon cn-icon-sub-category"
|
|
|
|
|
|
:loading="false"
|
|
|
|
|
|
style="width: 250px;"
|
|
|
|
|
|
>
|
|
|
|
|
|
<template #title>
|
|
|
|
|
|
<span>{{$t('entities.subcategory')}}</span>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template #data>
|
2021-09-30 00:50:11 +08:00
|
|
|
|
<span>{{detailData.subcategory ? detailData.subcategory : '-'}}</span>
|
2021-09-22 23:05:18 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
</single-value>
|
|
|
|
|
|
<single-value
|
|
|
|
|
|
:type="51"
|
|
|
|
|
|
icon="cn-icon cn-icon-credit"
|
|
|
|
|
|
:loading="false"
|
|
|
|
|
|
style="width: 250px;"
|
|
|
|
|
|
>
|
|
|
|
|
|
<template #title>
|
|
|
|
|
|
<span>{{$t('entities.reputationLevel')}}</span>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template #data>
|
2021-09-30 00:50:11 +08:00
|
|
|
|
<span>{{detailData.risk ? detailData.risk : '-'}}</span>
|
2021-09-22 23:05:18 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
</single-value>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2021-06-20 13:31:55 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
import * as echarts from 'echarts'
|
2021-06-24 17:59:51 +08:00
|
|
|
|
import * as am4Core from '@amcharts/amcharts4/core'
|
|
|
|
|
|
import * as am4Maps from '@amcharts/amcharts4/maps'
|
2022-01-03 22:46:22 +08:00
|
|
|
|
import { ref, shallowRef } from 'vue'
|
2021-08-09 13:38:32 +08:00
|
|
|
|
import { tableTitleMapping, legendMapping } from '@/components/charts/chart-table-title'
|
2021-06-24 17:59:51 +08:00
|
|
|
|
import {
|
|
|
|
|
|
isEcharts,
|
|
|
|
|
|
isSingleValue,
|
|
|
|
|
|
isTable,
|
2021-12-06 21:12:04 +08:00
|
|
|
|
isActiveIpTable,
|
2021-06-25 19:11:00 +08:00
|
|
|
|
isTitle,
|
2021-06-24 17:59:51 +08:00
|
|
|
|
isMap,
|
|
|
|
|
|
getOption,
|
|
|
|
|
|
getTypeCategory,
|
|
|
|
|
|
getLayout,
|
|
|
|
|
|
layoutConstant,
|
|
|
|
|
|
isEchartsWithTable,
|
2021-07-05 22:58:12 +08:00
|
|
|
|
isEchartsWithStatistics,
|
2021-12-13 10:16:41 +08:00
|
|
|
|
isEchartsTimeBar,
|
|
|
|
|
|
isEchartsCategoryBar,
|
2021-07-01 21:39:10 +08:00
|
|
|
|
isMapLine,
|
2021-07-10 12:11:59 +08:00
|
|
|
|
isMapBlock,
|
2021-08-06 15:03:30 +08:00
|
|
|
|
isSingleValueWithEcharts,
|
2021-08-17 17:56:09 +08:00
|
|
|
|
isRelationShip,
|
2021-07-06 10:55:09 +08:00
|
|
|
|
isTabs,
|
2021-09-16 21:19:48 +08:00
|
|
|
|
isGroup,
|
2021-09-18 17:48:52 +08:00
|
|
|
|
isSankey,
|
|
|
|
|
|
isIpBasicInfo,
|
|
|
|
|
|
isIpOpenPort,
|
|
|
|
|
|
isIpHostedDomain,
|
2021-09-22 23:05:18 +08:00
|
|
|
|
isDomainWhois,
|
|
|
|
|
|
isDomainDnsRecord,
|
2021-12-14 07:38:09 +08:00
|
|
|
|
isCryptocurrencyEventList,
|
2021-09-22 23:05:18 +08:00
|
|
|
|
isAppBasicInfo,
|
|
|
|
|
|
isAppRelatedDomain,
|
2021-12-13 10:18:27 +08:00
|
|
|
|
getChartColor, chartBarColor, timeVerticalFormatter, timeHorizontalFormatter,
|
2022-01-03 22:46:22 +08:00
|
|
|
|
categoryHorizontalFormatter, categoryVerticalFormatter, getCharBartColor, isBlock
|
2021-06-24 17:59:51 +08:00
|
|
|
|
} from '@/components/charts/chart-options'
|
2021-08-20 15:43:48 +08:00
|
|
|
|
import ChartError from '@/components/charts/ChartError'
|
2021-06-20 13:31:55 +08:00
|
|
|
|
import EchartsFrame from '@/components/charts/EchartsFrame'
|
|
|
|
|
|
import SingleValue from '@/components/charts/ChartSingleValue'
|
2021-06-24 17:59:51 +08:00
|
|
|
|
import ChartTable from '@/components/charts/ChartTable'
|
2021-12-06 21:12:04 +08:00
|
|
|
|
import ChartTableActiveIp from '@/components/charts/ChartTableActiveIp'
|
2021-06-24 17:59:51 +08:00
|
|
|
|
import ChartMap from '@/components/charts/ChartMap'
|
2021-06-23 15:57:34 +08:00
|
|
|
|
import PieTable from '@/components/charts/PieTable'
|
2021-07-05 22:58:12 +08:00
|
|
|
|
import StatisticsLegend from '@/components/charts/StatisticsLegend'
|
2021-06-21 20:33:39 +08:00
|
|
|
|
import ChartTablePagination from '@/components/charts/ChartTablePagination'
|
2021-10-11 19:12:52 +08:00
|
|
|
|
import unitConvert, { getUnitType, valueToRangeValue } from '@/utils/unit-convert'
|
2021-12-06 21:12:04 +08:00
|
|
|
|
import { chartTableDefaultPageSize, chartTableTopOptions, chartActiveIpTableOrderOptions, storageKey, chartPieTableTopOptions, unitTypes } from '@/utils/constants'
|
2021-08-17 17:56:09 +08:00
|
|
|
|
import { get, post } from '@/utils/http'
|
2021-07-14 15:40:05 +08:00
|
|
|
|
import { replaceUrlPlaceholder, getCapitalGeo, getGeoData, lineToSpace } from '@/utils/tools'
|
2021-08-15 17:01:46 +08:00
|
|
|
|
import { HeatLegend } from '@/components/amcharts/heatLegend'
|
2022-01-03 22:46:22 +08:00
|
|
|
|
import DateTimeRange from '@/components/common/TimeRange/DateTimeRange'
|
|
|
|
|
|
import TimeRefresh from '@/components/common/TimeRange/TimeRefresh'
|
2021-06-20 13:31:55 +08:00
|
|
|
|
|
2021-10-19 19:06:16 +08:00
|
|
|
|
import * as L from 'leaflet'
|
|
|
|
|
|
import 'leaflet/dist/leaflet.css'
|
|
|
|
|
|
import icon from 'leaflet/dist/images/marker-icon.png'
|
|
|
|
|
|
import iconShadow from 'leaflet/dist/images/marker-shadow.png'
|
2022-01-03 22:46:22 +08:00
|
|
|
|
import { getNowTime } from '@/utils/date-util'
|
2021-10-19 19:06:16 +08:00
|
|
|
|
|
2021-06-20 13:31:55 +08:00
|
|
|
|
export default {
|
|
|
|
|
|
name: 'Chart',
|
|
|
|
|
|
props: {
|
2021-06-23 15:57:34 +08:00
|
|
|
|
chart: Object, // 图表对象,包括id、name、type等数据
|
2021-08-06 15:03:30 +08:00
|
|
|
|
timeFilter: Object,
|
2021-09-18 17:48:52 +08:00
|
|
|
|
parentData: Object,
|
2022-01-03 22:46:22 +08:00
|
|
|
|
fromBlock: Boolean,
|
2021-08-09 13:38:32 +08:00
|
|
|
|
entity: {
|
|
|
|
|
|
type: Object,
|
|
|
|
|
|
default: () => {}
|
|
|
|
|
|
}
|
2021-06-20 13:31:55 +08:00
|
|
|
|
},
|
|
|
|
|
|
components: {
|
|
|
|
|
|
EchartsFrame,
|
|
|
|
|
|
SingleValue,
|
2021-06-21 20:33:39 +08:00
|
|
|
|
ChartTablePagination,
|
2021-06-24 17:59:51 +08:00
|
|
|
|
ChartTable,
|
2021-12-06 21:12:04 +08:00
|
|
|
|
ChartTableActiveIp,
|
2021-06-24 17:59:51 +08:00
|
|
|
|
PieTable,
|
2021-07-05 22:58:12 +08:00
|
|
|
|
StatisticsLegend,
|
2021-08-20 15:43:48 +08:00
|
|
|
|
ChartMap,
|
2022-01-03 22:46:22 +08:00
|
|
|
|
ChartError,
|
|
|
|
|
|
DateTimeRange,
|
|
|
|
|
|
TimeRefresh
|
2021-06-20 13:31:55 +08:00
|
|
|
|
},
|
|
|
|
|
|
data () {
|
|
|
|
|
|
return {
|
2021-06-21 20:33:39 +08:00
|
|
|
|
table: {
|
|
|
|
|
|
pageSize: chartTableDefaultPageSize,
|
|
|
|
|
|
limit: chartTableTopOptions[0], // top-n
|
2021-07-07 18:47:52 +08:00
|
|
|
|
orderBy: 'sessions',
|
2021-06-21 20:33:39 +08:00
|
|
|
|
tableColumns: [], // table字段
|
|
|
|
|
|
tableData: [], // table的所有数据
|
|
|
|
|
|
currentPageData: [] // table当前页的数据
|
2021-06-23 15:57:34 +08:00
|
|
|
|
},
|
2022-01-03 22:46:22 +08:00
|
|
|
|
|
2021-12-06 21:12:04 +08:00
|
|
|
|
activeIpTable: {
|
|
|
|
|
|
orderBy: 'machine',
|
|
|
|
|
|
tableData: [
|
|
|
|
|
|
{
|
|
|
|
|
|
name: '192.168.20.21',
|
|
|
|
|
|
num: 111
|
|
|
|
|
|
|
|
|
|
|
|
}, {
|
|
|
|
|
|
name: '192.168.20.22',
|
|
|
|
|
|
num: 345
|
|
|
|
|
|
}, {
|
|
|
|
|
|
name: '192.168.20.23',
|
|
|
|
|
|
num: 111
|
|
|
|
|
|
|
|
|
|
|
|
}, {
|
|
|
|
|
|
name: '192.168.20.24',
|
|
|
|
|
|
num: 345
|
|
|
|
|
|
}, {
|
|
|
|
|
|
name: '192.168.20.25',
|
|
|
|
|
|
num: 111
|
|
|
|
|
|
|
|
|
|
|
|
}, {
|
|
|
|
|
|
name: '192.168.20.26',
|
|
|
|
|
|
num: 345
|
|
|
|
|
|
}
|
2021-12-13 10:18:27 +08:00
|
|
|
|
] // table的所有数据
|
2021-12-06 21:12:04 +08:00
|
|
|
|
},
|
2021-06-25 19:11:00 +08:00
|
|
|
|
pieTableData: [],
|
2021-07-06 17:51:17 +08:00
|
|
|
|
singleValue: {
|
|
|
|
|
|
value: '-',
|
2021-12-29 14:58:58 +08:00
|
|
|
|
icon: '',
|
|
|
|
|
|
color: ''
|
2021-07-06 17:51:17 +08:00
|
|
|
|
},
|
2021-10-16 15:50:12 +08:00
|
|
|
|
showMapBackButton: false, // 下钻之后控制是否显示返回上一层按钮
|
2021-10-13 20:01:29 +08:00
|
|
|
|
standaloneTimeRange: { // 单个图表刷新时,重新获取时间范围,且不影响到其他图
|
|
|
|
|
|
use: false,
|
|
|
|
|
|
startTime: '',
|
|
|
|
|
|
endTime: ''
|
|
|
|
|
|
},
|
|
|
|
|
|
queryTimeRange: { // 实际查询接口时使用的时间
|
|
|
|
|
|
startTime: '',
|
|
|
|
|
|
endTime: ''
|
|
|
|
|
|
},
|
2021-07-05 17:40:43 +08:00
|
|
|
|
activeTab: '',
|
2021-09-18 17:48:52 +08:00
|
|
|
|
groupData: '', // group类型的查询数据,用于传递给子chart,子chart通过params.dataKey取值
|
2021-09-22 09:08:21 +08:00
|
|
|
|
detailData: '', // 详情类型图表的数据
|
2021-12-14 07:38:09 +08:00
|
|
|
|
croptyEventList: [],
|
2021-07-07 15:51:52 +08:00
|
|
|
|
statisticsData: [],
|
|
|
|
|
|
orderPieTable: chartPieTableTopOptions[0].value,
|
2021-07-22 18:30:45 +08:00
|
|
|
|
selectPieChartName: '',
|
2021-07-23 11:39:10 +08:00
|
|
|
|
allSelectPieChartName: [],
|
2021-08-11 22:14:23 +08:00
|
|
|
|
chartOption: null,
|
2021-08-13 09:39:02 +08:00
|
|
|
|
loading: true,
|
2021-08-15 15:49:29 +08:00
|
|
|
|
noData: false, // 查询结果为空
|
2021-10-13 19:06:24 +08:00
|
|
|
|
noData0: false, // 单chart内含多图表时使用
|
|
|
|
|
|
noData1: false,
|
2021-08-20 15:43:48 +08:00
|
|
|
|
throttle: null, // 节流器
|
2021-08-26 17:14:51 +08:00
|
|
|
|
isError: false, // 接口响应是否报错
|
2021-08-26 18:58:01 +08:00
|
|
|
|
errorInfo: '', // 接口具体错误信息
|
2021-10-16 15:50:12 +08:00
|
|
|
|
polygonSeries: null, // 世界地图series
|
|
|
|
|
|
countrySeries: null, // 下钻国家series
|
2021-10-19 19:06:16 +08:00
|
|
|
|
baseMapSeriesName: ['Container', 'MapChart'],
|
|
|
|
|
|
mapPictureUrl: '/Tiles/{z}/{x}/{y}.png'
|
2021-06-20 13:31:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
initChart () {
|
2021-08-11 22:14:23 +08:00
|
|
|
|
this.loading = true
|
2022-01-03 22:46:22 +08:00
|
|
|
|
if (this.standaloneTimeRange.use) {
|
|
|
|
|
|
this.queryTimeRange = { startTime: parseInt(this.standaloneTimeRange.startTime / 1000), endTime: parseInt(this.standaloneTimeRange.endTime / 1000) }
|
|
|
|
|
|
} else if (this.timeFilter) {
|
|
|
|
|
|
this.queryTimeRange = { startTime: parseInt(this.timeFilter.startTime / 1000), endTime: parseInt(this.timeFilter.endTime / 1000) }
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.queryTimeRange = { startTime: parseInt(this.chartTimeFilter.startTime / 1000), endTime: parseInt(this.chartTimeFilter.endTime / 1000) }
|
|
|
|
|
|
}
|
2021-08-06 15:03:30 +08:00
|
|
|
|
try {
|
|
|
|
|
|
const chartParams = this.chartInfo.params
|
|
|
|
|
|
if (this.isMap) {
|
2021-10-16 15:50:12 +08:00
|
|
|
|
this.initMap(`chart${this.chartInfo.id}`)
|
2021-08-06 15:03:30 +08:00
|
|
|
|
if (chartParams) {
|
2021-10-19 19:06:16 +08:00
|
|
|
|
this.isIpBasicInfo ? this.loadLeafletMap() : this.loadAm4ChartMap(this.polygonSeries)
|
2021-06-23 15:57:34 +08:00
|
|
|
|
}
|
2021-09-08 21:29:12 +08:00
|
|
|
|
// TODO 优化:缓存地图,重新查询时只更改数据,不再次初始化
|
2021-08-06 15:03:30 +08:00
|
|
|
|
} else if (this.isEcharts) {
|
2021-09-24 19:24:25 +08:00
|
|
|
|
if (this.isIpHostedDomain || this.isAppRelatedDomain) {
|
|
|
|
|
|
const dom = document.getElementById(`chart${this.chartInfo.id}-0`)
|
|
|
|
|
|
const dom2 = document.getElementById(`chart${this.chartInfo.id}-1`)
|
|
|
|
|
|
!this.myChart && (this.myChart = echarts.init(dom))
|
|
|
|
|
|
!this.myChart2 && (this.myChart2 = echarts.init(dom2))
|
2021-09-22 09:08:21 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
const dom = document.getElementById(`chart${this.chartInfo.id}`)
|
|
|
|
|
|
!this.myChart && (this.myChart = echarts.init(dom))
|
|
|
|
|
|
}
|
2021-08-06 15:03:30 +08:00
|
|
|
|
this.chartOption = this.$_.cloneDeep(getOption(this.chart.type))
|
|
|
|
|
|
if (chartParams) {
|
|
|
|
|
|
if (this.isEchartsWithTable) {
|
|
|
|
|
|
this.initEchartsWithPieTable(chartParams)
|
|
|
|
|
|
} else if (this.isEchartsWithStatistics) {
|
|
|
|
|
|
this.initEchartsWithStatistics(chartParams)
|
2021-08-17 17:56:09 +08:00
|
|
|
|
} else if (this.isRelationShip) {
|
|
|
|
|
|
this.initRelationShip(chartParams)
|
2021-09-18 17:48:52 +08:00
|
|
|
|
} else if (this.isSankey) {
|
|
|
|
|
|
this.initSankey(chartParams)
|
2021-09-22 09:08:21 +08:00
|
|
|
|
} else if (this.isIpOpenPort) {
|
|
|
|
|
|
this.initIpOpenPort(chartParams)
|
|
|
|
|
|
} else if (this.isIpHostedDomain) {
|
|
|
|
|
|
this.initIpHostedDomain(chartParams)
|
2021-09-24 19:24:25 +08:00
|
|
|
|
} else if (this.isAppRelatedDomain) {
|
|
|
|
|
|
this.initAppRelatedDomain(chartParams)
|
2021-12-13 10:16:41 +08:00
|
|
|
|
} else if (this.isEchartsTimeBar) {
|
|
|
|
|
|
this.initEchartsTimeBar(chartParams)
|
2021-12-13 10:18:27 +08:00
|
|
|
|
} else if (this.isEchartsCategoryBar) {
|
2021-12-13 10:16:41 +08:00
|
|
|
|
this.initEchartsCategoryBar(chartParams)
|
2021-12-13 10:18:27 +08:00
|
|
|
|
} else {
|
2021-08-06 15:03:30 +08:00
|
|
|
|
this.initECharts(chartParams)
|
2021-07-01 21:39:10 +08:00
|
|
|
|
}
|
2021-08-06 15:03:30 +08:00
|
|
|
|
}
|
2021-12-06 21:12:04 +08:00
|
|
|
|
} else if (this.isActiveIpTable) {
|
|
|
|
|
|
this.initChartActiveIpTable(chartParams)
|
2021-08-06 15:03:30 +08:00
|
|
|
|
} else if (this.isTable) {
|
|
|
|
|
|
if (chartParams) {
|
|
|
|
|
|
this.initChartTable(chartParams)
|
|
|
|
|
|
}
|
|
|
|
|
|
} else if (this.isSingleValue) {
|
|
|
|
|
|
if (chartParams) {
|
|
|
|
|
|
this.singleValue.icon = chartParams.icon
|
2021-12-29 14:58:58 +08:00
|
|
|
|
if (chartParams.color) {
|
|
|
|
|
|
this.singleValue.color = chartParams.color
|
|
|
|
|
|
}
|
2021-09-18 17:48:52 +08:00
|
|
|
|
const gotData = new Promise(resolve => {
|
2021-09-28 17:36:46 +08:00
|
|
|
|
let result = ''
|
2021-09-18 17:48:52 +08:00
|
|
|
|
if (chartParams.dataKey) {
|
2021-09-28 19:02:29 +08:00
|
|
|
|
if (this.parentData && (this.parentData[chartParams.dataKey] || this.parentData[chartParams.dataKey] === 0)) {
|
2021-09-28 17:36:46 +08:00
|
|
|
|
result = this.parentData[chartParams.dataKey]
|
2021-09-18 17:48:52 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
this.noData = true
|
|
|
|
|
|
}
|
2021-09-28 17:36:46 +08:00
|
|
|
|
resolve(result)
|
2021-08-26 17:14:51 +08:00
|
|
|
|
} else {
|
2021-10-13 20:01:29 +08:00
|
|
|
|
const queryParams = { ...this.queryTimeRange, ...this.entity }
|
2021-09-18 17:48:52 +08:00
|
|
|
|
get(replaceUrlPlaceholder(chartParams.url, queryParams)).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
2021-09-28 17:36:46 +08:00
|
|
|
|
result = response.data.result
|
2021-09-18 17:48:52 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
this.isError = true
|
|
|
|
|
|
this.noData = true
|
|
|
|
|
|
this.errorInfo = response.msg || response.message || 'Unknown'
|
|
|
|
|
|
}
|
2021-09-28 17:36:46 +08:00
|
|
|
|
resolve(result)
|
2021-09-18 17:48:52 +08:00
|
|
|
|
})
|
2021-08-06 15:03:30 +08:00
|
|
|
|
}
|
2021-09-18 17:48:52 +08:00
|
|
|
|
})
|
2021-09-28 17:36:46 +08:00
|
|
|
|
gotData.then(result => {
|
2021-08-11 22:14:23 +08:00
|
|
|
|
if (this.isSingleValueWithEcharts) { // 带曲线的单值图
|
2021-09-28 17:36:46 +08:00
|
|
|
|
const dom = document.getElementById(`chart${this.chartInfo.id}`)
|
|
|
|
|
|
!this.myChart && (this.myChart = echarts.init(dom))
|
|
|
|
|
|
this.chartOption = this.$_.cloneDeep(getOption(this.chart.type))
|
|
|
|
|
|
const seriesTemplate = this.chartOption.series[0]
|
|
|
|
|
|
this.chartOption.series = result.map((r, i) => {
|
|
|
|
|
|
return {
|
|
|
|
|
|
...seriesTemplate,
|
|
|
|
|
|
name: r.legend,
|
|
|
|
|
|
data: r.values.map(v => [Number(v[0]) * 1000, Number(v[1]), chartParams.unitType]),
|
|
|
|
|
|
lineStyle: {
|
|
|
|
|
|
color: getChartColor[i]
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
this.myChart.setOption(this.chartOption)
|
|
|
|
|
|
this.singleValue.value = result[0].values[result[0].values.length - 1][1]
|
|
|
|
|
|
/* const queryParams = { startTime: parseInt(this.timeFilter.startTime / 1000), endTime: parseInt(this.timeFilter.endTime / 1000), ...this.entity }
|
2021-08-11 22:14:23 +08:00
|
|
|
|
const dom = document.getElementById(`chart${this.chartInfo.id}`)
|
|
|
|
|
|
!this.myChart && (this.myChart = echarts.init(dom))
|
|
|
|
|
|
this.chartOption = this.$_.cloneDeep(getOption(this.chart.type))
|
|
|
|
|
|
const seriesTemplate = this.chartOption.series[0]
|
2021-08-10 15:16:56 +08:00
|
|
|
|
|
2021-08-11 22:14:23 +08:00
|
|
|
|
get(replaceUrlPlaceholder(chartParams.urlLine, queryParams)).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
this.chartOption.series = response.data.result.map((r, i) => {
|
|
|
|
|
|
return {
|
|
|
|
|
|
...seriesTemplate,
|
|
|
|
|
|
name: r.legend,
|
|
|
|
|
|
data: r.values.map(v => [Number(v[0]) * 1000, Number(v[1]), chartParams.unitType]),
|
|
|
|
|
|
lineStyle: {
|
|
|
|
|
|
color: getChartColor[i]
|
|
|
|
|
|
}
|
2021-08-10 15:16:56 +08:00
|
|
|
|
}
|
2021-08-11 22:14:23 +08:00
|
|
|
|
})
|
2021-08-26 17:14:51 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
this.isError = true
|
|
|
|
|
|
this.noData = true
|
|
|
|
|
|
this.errorInfo = response.msg || response.message || 'Unknown'
|
2021-08-11 22:14:23 +08:00
|
|
|
|
}
|
|
|
|
|
|
this.myChart.setOption(this.chartOption)
|
2021-09-28 17:36:46 +08:00
|
|
|
|
}) */
|
2021-08-11 22:14:23 +08:00
|
|
|
|
} else {
|
2021-09-28 17:36:46 +08:00
|
|
|
|
this.singleValue.value = result
|
2021-08-11 22:14:23 +08:00
|
|
|
|
this.loading = false
|
|
|
|
|
|
}
|
2021-08-13 18:57:49 +08:00
|
|
|
|
}).catch(() => {
|
|
|
|
|
|
this.singleValue.value = ''
|
|
|
|
|
|
}).finally(() => {
|
2021-09-08 21:29:12 +08:00
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
this.loading = false
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.echartsResize()
|
|
|
|
|
|
})
|
|
|
|
|
|
}, 250)
|
2021-08-11 22:14:23 +08:00
|
|
|
|
})
|
2021-08-06 15:03:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
} else if (this.isTabs) {
|
|
|
|
|
|
if (!this.$_.isEmpty(this.chartInfo.children)) {
|
|
|
|
|
|
this.activeTab = `${this.chartInfo.children[0].id}`
|
|
|
|
|
|
}
|
2021-09-18 17:48:52 +08:00
|
|
|
|
} else if (this.isGroup) {
|
2021-09-28 19:02:29 +08:00
|
|
|
|
if (chartParams && chartParams.url) {
|
2021-10-13 20:01:29 +08:00
|
|
|
|
const queryParams = { ...this.queryTimeRange, ...this.entity }
|
2021-09-28 19:02:29 +08:00
|
|
|
|
get(replaceUrlPlaceholder(chartParams.url, queryParams)).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
this.groupData = response.data.result
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.isError = true
|
|
|
|
|
|
this.noData = true
|
|
|
|
|
|
this.errorInfo = response.msg || response.message || 'Unknown'
|
|
|
|
|
|
}
|
|
|
|
|
|
}).catch(e => {
|
2021-09-18 17:48:52 +08:00
|
|
|
|
this.isError = true
|
2021-09-28 19:02:29 +08:00
|
|
|
|
this.errorInfo = e
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2021-09-22 23:05:18 +08:00
|
|
|
|
} else if (this.isDomainWhois || this.isDomainDnsRecord) {
|
|
|
|
|
|
const queryParams = { domain: this.entity.domain }
|
|
|
|
|
|
get(replaceUrlPlaceholder(chartParams.url, queryParams)).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
this.detailData = response.data.result
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.isError = true
|
|
|
|
|
|
this.noData = true
|
|
|
|
|
|
this.errorInfo = response.msg || response.message || 'Unknown'
|
|
|
|
|
|
}
|
|
|
|
|
|
}).catch(e => {
|
|
|
|
|
|
this.isError = true
|
|
|
|
|
|
this.errorInfo = e
|
|
|
|
|
|
})
|
2021-12-14 07:38:09 +08:00
|
|
|
|
} else if (this.isCryptocurrencyEventList) {
|
|
|
|
|
|
const queryParams = { ...this.queryTimeRange, ...this.entity }
|
|
|
|
|
|
get(replaceUrlPlaceholder(chartParams.url, queryParams)).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
2021-12-29 14:58:58 +08:00
|
|
|
|
if (response.data.result.length > 0) {
|
|
|
|
|
|
this.croptyEventList = response.data.result
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.noData = true
|
|
|
|
|
|
}
|
2021-12-14 07:38:09 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
this.isError = true
|
|
|
|
|
|
this.noData = true
|
|
|
|
|
|
this.errorInfo = response.msg || response.message || 'Unknown'
|
|
|
|
|
|
|
|
|
|
|
|
// 测试数据
|
|
|
|
|
|
this.initTestEventListData()
|
|
|
|
|
|
}
|
|
|
|
|
|
}).catch(e => {
|
|
|
|
|
|
this.isError = true
|
|
|
|
|
|
this.errorInfo = e
|
2021-12-29 14:58:58 +08:00
|
|
|
|
}).finally(() => {
|
|
|
|
|
|
setTimeout(() => { this.loading = false }, 250)
|
2021-12-14 07:38:09 +08:00
|
|
|
|
})
|
2021-09-30 00:50:11 +08:00
|
|
|
|
} else if (this.isAppBasicInfo) {
|
|
|
|
|
|
const queryParams = { app: this.entity.app }
|
|
|
|
|
|
get(replaceUrlPlaceholder(chartParams.url, queryParams)).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
this.detailData = response.data.result
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.isError = true
|
|
|
|
|
|
this.noData = true
|
|
|
|
|
|
this.errorInfo = response.msg || response.message || 'Unknown'
|
|
|
|
|
|
}
|
|
|
|
|
|
}).catch(e => {
|
|
|
|
|
|
this.isError = true
|
|
|
|
|
|
this.errorInfo = e
|
|
|
|
|
|
})
|
2021-07-05 17:40:43 +08:00
|
|
|
|
}
|
2021-08-06 15:03:30 +08:00
|
|
|
|
} catch (e) {
|
|
|
|
|
|
console.error(e)
|
2021-06-20 13:31:55 +08:00
|
|
|
|
}
|
2021-06-21 20:33:39 +08:00
|
|
|
|
},
|
2021-12-14 07:38:09 +08:00
|
|
|
|
|
|
|
|
|
|
initTestEventListData () {
|
|
|
|
|
|
this.noData = false
|
|
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < this.croptyEventList.length; i++) {
|
|
|
|
|
|
this.croptyEventList.splice(i, 1)
|
|
|
|
|
|
}
|
|
|
|
|
|
this.croptyEventList = [{
|
|
|
|
|
|
time: '2021-11-23 12:00:00',
|
|
|
|
|
|
serverIP: '192.168.1.1',
|
|
|
|
|
|
clientIP: '101.1.1.1',
|
|
|
|
|
|
message: '检测到连接挖矿木马远控地址',
|
|
|
|
|
|
level: 1
|
|
|
|
|
|
}, {
|
|
|
|
|
|
time: '2021-11-23 12:10:00',
|
|
|
|
|
|
serverIP: '192.168.1.1',
|
|
|
|
|
|
clientIP: '101.1.1.1',
|
|
|
|
|
|
message: '检测到连接挖矿木马远控地址',
|
|
|
|
|
|
level: 1
|
|
|
|
|
|
}, {
|
|
|
|
|
|
time: '2021-11-23 12:10:00',
|
|
|
|
|
|
serverIP: '192.168.1.1',
|
|
|
|
|
|
clientIP: '101.1.1.1',
|
|
|
|
|
|
message: '检测到连接挖矿木马远控地址',
|
|
|
|
|
|
level: 1
|
|
|
|
|
|
}
|
|
|
|
|
|
]
|
|
|
|
|
|
},
|
|
|
|
|
|
|
2021-07-21 22:46:08 +08:00
|
|
|
|
reloadChart () {
|
|
|
|
|
|
this.initChart()
|
|
|
|
|
|
this.$nextTick(() => {
|
2021-07-22 18:30:45 +08:00
|
|
|
|
if (!this.$_.isEmpty(this.chart.children)) {
|
|
|
|
|
|
this.chart.children.forEach(chart => {
|
|
|
|
|
|
this.$refs[`chart-${chart.id}`].reloadChart()
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2021-07-21 22:46:08 +08:00
|
|
|
|
})
|
|
|
|
|
|
},
|
2022-01-03 22:46:22 +08:00
|
|
|
|
timeRefreshChange () {
|
|
|
|
|
|
if (!this.$refs.dateTimeRange.isCustom) {
|
|
|
|
|
|
const value = this.chartTimeFilter.dateRangeValue
|
|
|
|
|
|
this.$refs.dateTimeRange.quickChange(value)
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
reload (s, e, v) {
|
|
|
|
|
|
this.dateTimeRangeChange(s, e, v)
|
|
|
|
|
|
},
|
|
|
|
|
|
dateTimeRangeChange (s, e, v) {
|
|
|
|
|
|
this.chartTimeFilter = { startTime: s, endTime: e, dateRangeValue: v }
|
|
|
|
|
|
},
|
2021-10-11 19:12:52 +08:00
|
|
|
|
generateTooltipHTML () {
|
|
|
|
|
|
return `
|
2021-10-13 19:06:24 +08:00
|
|
|
|
<div class="map-tooltip" style="padding-bottom: 10px;">
|
|
|
|
|
|
<div class="map-tooltip__title">{name}</div>
|
|
|
|
|
|
<div class="map-tooltip__content">
|
|
|
|
|
|
<span>{labelText}</span>
|
|
|
|
|
|
<span>{showValue}</span>
|
|
|
|
|
|
</div>
|
2021-10-11 19:12:52 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
`
|
2021-08-26 17:14:51 +08:00
|
|
|
|
},
|
2021-07-05 17:40:43 +08:00
|
|
|
|
changeTab (tab) {
|
|
|
|
|
|
this.activeTab = tab.paneName
|
|
|
|
|
|
},
|
2021-06-24 17:59:51 +08:00
|
|
|
|
initMap (id) {
|
2021-10-19 19:06:16 +08:00
|
|
|
|
if (this.isIpBasicInfo) {
|
|
|
|
|
|
L.Marker.prototype.options.icon = L.icon({
|
|
|
|
|
|
iconUrl: icon,
|
|
|
|
|
|
shadowUrl: iconShadow
|
|
|
|
|
|
})
|
|
|
|
|
|
const map = L.map(`chart${this.chartInfo.id}`, {
|
|
|
|
|
|
minZoom: 3,
|
|
|
|
|
|
maxZoom: 7,
|
|
|
|
|
|
zoom: 5,
|
|
|
|
|
|
attributionControl: false,
|
|
|
|
|
|
zoomControl: false,
|
|
|
|
|
|
maxBounds: L.latLngBounds(L.latLng(-90, -180), L.latLng(90, 180))
|
|
|
|
|
|
})
|
|
|
|
|
|
L.tileLayer(
|
|
|
|
|
|
this.mapPictureUrl,
|
|
|
|
|
|
{ noWrap: true }
|
|
|
|
|
|
).addTo(map)
|
|
|
|
|
|
|
|
|
|
|
|
const attribution = L.control.attribution({ position: 'bottomright', prefix: '' })
|
|
|
|
|
|
attribution.addAttribution(' © OpenStreetMap contributors')
|
|
|
|
|
|
attribution.addTo(map)
|
|
|
|
|
|
|
|
|
|
|
|
/* L.control.zoom({
|
|
|
|
|
|
position: 'bottomright',
|
|
|
|
|
|
zoomInText: '<i class="nz-icon nz-icon-enlarge"></i>',
|
|
|
|
|
|
zoomOutText: '<i class="nz-icon nz-icon-narrow"></i>',
|
|
|
|
|
|
zoomInTitle: '',
|
|
|
|
|
|
zoomOutTitle: ''
|
|
|
|
|
|
}).addTo(map) */
|
|
|
|
|
|
|
|
|
|
|
|
this.myChart = map
|
|
|
|
|
|
} else {
|
|
|
|
|
|
const chart = am4Core.create(id, am4Maps.MapChart)
|
|
|
|
|
|
chart.geodata = getGeoData(storageKey.iso36112WorldLow)
|
|
|
|
|
|
chart.projection = new am4Maps.projections.Miller()
|
|
|
|
|
|
this.myChart = chart
|
|
|
|
|
|
const polygonSeries = chart.series.push(new am4Maps.MapPolygonSeries())
|
|
|
|
|
|
polygonSeries.useGeodata = true
|
|
|
|
|
|
polygonSeries.exclude = ['AQ'] // 排除南极洲
|
|
|
|
|
|
polygonSeries.tooltip.getFillFromObject = false
|
|
|
|
|
|
polygonSeries.tooltip.background.fill = am4Core.color('#FFFFFF')
|
|
|
|
|
|
this.polygonSeries = polygonSeries
|
|
|
|
|
|
const polygonTemplate = polygonSeries.mapPolygons.template
|
|
|
|
|
|
polygonTemplate.tooltipHTML = this.generateTooltipHTML()
|
|
|
|
|
|
polygonTemplate.nonScalingStroke = true
|
|
|
|
|
|
polygonTemplate.strokeWidth = 0.5
|
|
|
|
|
|
polygonTemplate.fill = am4Core.color('rgba(176,196,222,.5)')
|
|
|
|
|
|
polygonTemplate.events.on('hit', ev => {
|
2021-11-18 09:09:09 +08:00
|
|
|
|
let countryId = ev.target.dataItem.dataContext.id
|
|
|
|
|
|
countryId = countryId === 'Private IP' ? 'China' : countryId
|
2021-10-19 19:06:16 +08:00
|
|
|
|
if (countryId) {
|
|
|
|
|
|
ev.target.series.chart.zoomToMapObject(ev.target)
|
|
|
|
|
|
ev.target.isHover = false
|
|
|
|
|
|
this.countrySeries = chart.series.push(new am4Maps.MapPolygonSeries())
|
|
|
|
|
|
this.countrySeries.tooltip.getFillFromObject = false
|
|
|
|
|
|
this.countrySeries.tooltip.background.fill = am4Core.color('#FFFFFF')
|
|
|
|
|
|
const countryTemplate = this.countrySeries.mapPolygons.template
|
|
|
|
|
|
countryTemplate.tooltipHTML = this.generateTooltipHTML()
|
|
|
|
|
|
countryTemplate.nonScalingStroke = true
|
|
|
|
|
|
countryTemplate.strokeWidth = 0.5
|
|
|
|
|
|
countryTemplate.fill = am4Core.color('rgba(176,196,222,.5)')
|
|
|
|
|
|
const geoData = getGeoData(countryId)
|
|
|
|
|
|
if (geoData) {
|
|
|
|
|
|
this.countrySeries.geodata = geoData
|
|
|
|
|
|
this.polygonSeries.hide()
|
|
|
|
|
|
this.loadAm4ChartMap(this.countrySeries, ev.target.dataItem.dataContext.serverCountry)
|
|
|
|
|
|
}
|
2021-10-16 15:50:12 +08:00
|
|
|
|
}
|
2021-10-19 19:06:16 +08:00
|
|
|
|
})
|
2021-07-10 12:11:59 +08:00
|
|
|
|
}
|
2021-06-24 17:59:51 +08:00
|
|
|
|
},
|
2021-10-19 19:06:16 +08:00
|
|
|
|
loadAm4ChartMap (polygonSeries, country) {
|
2021-10-16 15:50:12 +08:00
|
|
|
|
this.loading = true
|
|
|
|
|
|
// 清除数据
|
|
|
|
|
|
polygonSeries.data.splice(0)
|
|
|
|
|
|
// 清除legend
|
|
|
|
|
|
this.myChart.children.each((s, i) => {
|
|
|
|
|
|
if (s.className !== 'Container') {
|
|
|
|
|
|
this.myChart.children.removeIndex(i)
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
this.showMapBackButton = !!country
|
2021-07-13 18:38:32 +08:00
|
|
|
|
const chartParams = this.chartInfo.params
|
2021-10-16 15:50:12 +08:00
|
|
|
|
const queryParams = { ...this.queryTimeRange, country: country || '', region: '', ...this.entity } // 统计数据的查询参数
|
2021-07-08 18:02:57 +08:00
|
|
|
|
get(replaceUrlPlaceholder(chartParams.url, queryParams)).then(response => {
|
2021-08-09 13:38:32 +08:00
|
|
|
|
if (response.code === 200 && !this.$_.isEmpty(response.data.result)) {
|
2021-07-08 18:02:57 +08:00
|
|
|
|
const data = response.data.result
|
2021-10-19 19:06:16 +08:00
|
|
|
|
data.forEach(r => {
|
|
|
|
|
|
const serverCountryCapital = r.serverId && getCapitalGeo(r.serverId)
|
|
|
|
|
|
const clientCountryCapital = r.clientId && getCapitalGeo(r.clientId)
|
|
|
|
|
|
serverCountryCapital && (r.serverLongitude = serverCountryCapital.capitalLongitude)
|
|
|
|
|
|
serverCountryCapital && (r.serverLatitude = serverCountryCapital.capitalLatitude)
|
|
|
|
|
|
clientCountryCapital && (r.clientLongitude = clientCountryCapital.capitalLongitude)
|
|
|
|
|
|
clientCountryCapital && (r.clientLatitude = clientCountryCapital.capitalLatitude)
|
|
|
|
|
|
})
|
|
|
|
|
|
/* if (this.isMapLine) {
|
|
|
|
|
|
const lineSeries = this.myChart.series.push(new am4Maps.MapLineSeries())
|
|
|
|
|
|
const lineTemplate = lineSeries.mapLines.template
|
|
|
|
|
|
lineTemplate.stroke = am4Core.color('#A258EC')
|
|
|
|
|
|
lineTemplate.line.nonScalingStroke = true
|
|
|
|
|
|
lineTemplate.line.strokeDasharray = '4 3'
|
|
|
|
|
|
lineTemplate.nonScalingStroke = true
|
|
|
|
|
|
lineTemplate.arrow.nonScaling = true
|
|
|
|
|
|
lineTemplate.arrow.width = 4
|
|
|
|
|
|
lineTemplate.arrow.height = 6
|
|
|
|
|
|
lineSeries.data = [
|
|
|
|
|
|
{
|
|
|
|
|
|
multiGeoLine: data.map(d => {
|
|
|
|
|
|
return [
|
|
|
|
|
|
{
|
|
|
|
|
|
latitude: parseFloat(d.serverLatitude),
|
|
|
|
|
|
longitude: parseFloat(d.serverLongitude)
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
latitude: parseFloat(d.clientLatitude),
|
|
|
|
|
|
longitude: parseFloat(d.clientLongitude)
|
|
|
|
|
|
}
|
|
|
|
|
|
]
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
]
|
|
|
|
|
|
const imageSeries = this.myChart.series.push(new am4Maps.MapImageSeries())
|
|
|
|
|
|
imageSeries.dataFields.value = 'sessions'
|
|
|
|
|
|
const imageSeriesTemplate = imageSeries.mapImages.template
|
|
|
|
|
|
const circle = imageSeriesTemplate.createChild(am4Core.Circle)
|
|
|
|
|
|
|
|
|
|
|
|
circle.fillOpacity = 0.7
|
|
|
|
|
|
circle.nonScaling = true
|
|
|
|
|
|
const radiusHeat = imageSeries.heatRules.push({
|
|
|
|
|
|
target: circle,
|
|
|
|
|
|
property: 'radius',
|
|
|
|
|
|
min: 8,
|
|
|
|
|
|
max: 30
|
2021-07-08 18:02:57 +08:00
|
|
|
|
})
|
2021-10-19 19:06:16 +08:00
|
|
|
|
const colorHeat = imageSeries.heatRules.push({
|
|
|
|
|
|
target: circle,
|
|
|
|
|
|
property: 'fill',
|
|
|
|
|
|
min: am4Core.color('#D2A8FF'),
|
|
|
|
|
|
max: am4Core.color('#A258EC')
|
|
|
|
|
|
})
|
|
|
|
|
|
imageSeriesTemplate.propertyFields.latitude = 'latitude'
|
|
|
|
|
|
imageSeriesTemplate.propertyFields.longitude = 'longitude'
|
2021-07-08 18:02:57 +08:00
|
|
|
|
|
2021-10-19 19:06:16 +08:00
|
|
|
|
const pointData = []
|
|
|
|
|
|
data.forEach(d => {
|
|
|
|
|
|
pointData.push({
|
|
|
|
|
|
...d,
|
|
|
|
|
|
latitude: parseFloat(d.serverLatitude),
|
|
|
|
|
|
longitude: parseFloat(d.serverLongitude)
|
2021-07-08 18:02:57 +08:00
|
|
|
|
})
|
2021-10-19 19:06:16 +08:00
|
|
|
|
pointData.push({
|
|
|
|
|
|
...d,
|
|
|
|
|
|
latitude: parseFloat(d.clientLatitude),
|
|
|
|
|
|
longitude: parseFloat(d.clientLongitude)
|
2021-07-08 18:02:57 +08:00
|
|
|
|
})
|
2021-10-19 19:06:16 +08:00
|
|
|
|
})
|
|
|
|
|
|
imageSeries.data = pointData
|
|
|
|
|
|
} */
|
|
|
|
|
|
if (this.isMapBlock) {
|
|
|
|
|
|
const sumData = []
|
|
|
|
|
|
data.forEach(r => {
|
|
|
|
|
|
const hit = sumData.find(s => s.id === r.serverId)
|
|
|
|
|
|
const { key, labelText } = this.getDataKey(r)
|
|
|
|
|
|
const value = Number(r[key]) || 0
|
|
|
|
|
|
if (hit) {
|
|
|
|
|
|
hit.value += value
|
|
|
|
|
|
} else {
|
|
|
|
|
|
sumData.push({
|
|
|
|
|
|
id: r.serverId,
|
|
|
|
|
|
serverCountry: r.serverCountry,
|
|
|
|
|
|
key,
|
|
|
|
|
|
labelText,
|
|
|
|
|
|
value
|
2021-09-22 09:08:21 +08:00
|
|
|
|
})
|
2021-10-19 19:06:16 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
const seriesData = sumData.map(r => ({
|
|
|
|
|
|
...r,
|
|
|
|
|
|
showValue: (r.value || r.value === 0) ? valueToRangeValue(r.value, chartParams.unitType).join(' ') : ''
|
|
|
|
|
|
}))
|
|
|
|
|
|
polygonSeries.data = [...seriesData]
|
|
|
|
|
|
const sorted = seriesData.sort((a, b) => b.value - a.value)
|
|
|
|
|
|
const allZero = this.$_.isEmpty(sorted) || Number(sorted[0].value) === 0 // 数据全为0的情况,legend只显示1个颜色
|
2021-08-13 18:57:49 +08:00
|
|
|
|
|
2021-10-19 19:06:16 +08:00
|
|
|
|
polygonSeries.heatRules.push({
|
|
|
|
|
|
property: 'fill',
|
|
|
|
|
|
target: polygonSeries.mapPolygons.template,
|
|
|
|
|
|
min: this.myChart.colors.getIndex(1).brighten(1),
|
|
|
|
|
|
max: allZero ? this.myChart.colors.getIndex(1).brighten(1) : this.myChart.colors.getIndex(1).brighten(-0.3)
|
|
|
|
|
|
})
|
|
|
|
|
|
const heatLegend = this.myChart.createChild(HeatLegend)
|
|
|
|
|
|
heatLegend.markerContainer.height = 6
|
|
|
|
|
|
heatLegend.series = polygonSeries
|
|
|
|
|
|
heatLegend.align = 'left'
|
|
|
|
|
|
heatLegend.markerCount = allZero ? 1 : 3
|
|
|
|
|
|
heatLegend.minValue = 0
|
|
|
|
|
|
heatLegend.fontSize = 12
|
|
|
|
|
|
heatLegend.maxValue = allZero ? 1 : Number(sorted[0].value)
|
|
|
|
|
|
heatLegend.width = allZero ? am4Core.percent(10) : am4Core.percent(25)
|
|
|
|
|
|
heatLegend.marginLeft = 15
|
|
|
|
|
|
heatLegend.valign = 'bottom'
|
2021-08-13 18:57:49 +08:00
|
|
|
|
|
2021-10-19 19:06:16 +08:00
|
|
|
|
const minRange = heatLegend.valueAxis.axisRanges.create()
|
|
|
|
|
|
minRange.value = heatLegend.minValue
|
|
|
|
|
|
minRange.label.text = minRange.value === 0 ? 0 : unitConvert(heatLegend.minValue, chartParams.unitType).join(' ')
|
|
|
|
|
|
const maxRange = heatLegend.valueAxis.axisRanges.create()
|
|
|
|
|
|
maxRange.value = heatLegend.maxValue
|
|
|
|
|
|
maxRange.label.text = maxRange.value === 0 ? 0 : unitConvert(heatLegend.maxValue, chartParams.unitType).join(' ')
|
2021-08-26 17:14:51 +08:00
|
|
|
|
|
2021-10-19 19:06:16 +08:00
|
|
|
|
heatLegend.valueAxis.renderer.labels.template.adapter.add('text', function (labelText) {
|
|
|
|
|
|
return ''
|
|
|
|
|
|
})
|
2021-07-08 18:02:57 +08:00
|
|
|
|
}
|
2021-09-15 12:19:13 +08:00
|
|
|
|
} else if (response.code !== 200) {
|
2021-08-26 17:14:51 +08:00
|
|
|
|
this.isError = true
|
|
|
|
|
|
this.noData = true
|
|
|
|
|
|
this.errorInfo = response.msg || response.message || 'Unknown'
|
2021-07-08 18:02:57 +08:00
|
|
|
|
}
|
2021-08-13 18:57:49 +08:00
|
|
|
|
}).finally(() => {
|
2021-08-11 22:14:23 +08:00
|
|
|
|
setTimeout(() => { this.loading = false }, 250)
|
2021-07-08 18:02:57 +08:00
|
|
|
|
})
|
|
|
|
|
|
},
|
2021-10-19 19:06:16 +08:00
|
|
|
|
loadLeafletMap () {
|
|
|
|
|
|
this.loading = true
|
|
|
|
|
|
const chartParams = this.chartInfo.params
|
|
|
|
|
|
get(replaceUrlPlaceholder(chartParams.url, this.entity)).then(response => {
|
|
|
|
|
|
if (response.code === 200 && !this.$_.isEmpty(response.data.result)) {
|
|
|
|
|
|
this.detailData = response.data.result
|
|
|
|
|
|
this.myChart.setView([this.detailData.latitude, this.detailData.longitude], 5)
|
|
|
|
|
|
const myIcon = L.divIcon({
|
|
|
|
|
|
className: 'cn-icon cn-icon-position2 position-icon'
|
|
|
|
|
|
})
|
|
|
|
|
|
L.marker([this.detailData.latitude, this.detailData.longitude], { icon: myIcon }).addTo(this.myChart)
|
|
|
|
|
|
}
|
|
|
|
|
|
}).finally(() => {
|
|
|
|
|
|
setTimeout(() => { this.loading = false }, 250)
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
2021-06-21 20:33:39 +08:00
|
|
|
|
pageJump (val) {
|
|
|
|
|
|
this.table.currentPageData = this.getTargetPageData(val, this.table.pageSize, this.table.tableData)
|
|
|
|
|
|
},
|
|
|
|
|
|
getTargetPageData (pageNum, pageSize, tableData) {
|
|
|
|
|
|
return this.$_.slice(tableData, (pageNum - 1) * pageSize, pageNum * pageSize)
|
2021-07-07 15:51:52 +08:00
|
|
|
|
},
|
2021-09-15 12:19:13 +08:00
|
|
|
|
refresh () {
|
2022-01-03 22:46:22 +08:00
|
|
|
|
const eventName = this.fromBlock ? 'getChartCurrentTimeRange' : 'getCurrentTimeRange'
|
|
|
|
|
|
this.$emit(eventName, ({ startTime, endTime }) => {
|
2021-10-13 20:01:29 +08:00
|
|
|
|
this.standaloneTimeRange.use = true
|
|
|
|
|
|
this.standaloneTimeRange.startTime = startTime
|
|
|
|
|
|
this.standaloneTimeRange.endTime = endTime
|
|
|
|
|
|
this.initChart()
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
2021-10-16 15:50:12 +08:00
|
|
|
|
mapBack () {
|
|
|
|
|
|
this.countrySeries.hide()
|
2021-10-19 19:06:16 +08:00
|
|
|
|
this.loadAm4ChartMap(this.polygonSeries)
|
2021-10-16 15:50:12 +08:00
|
|
|
|
this.polygonSeries.show()
|
|
|
|
|
|
this.myChart.goHome()
|
|
|
|
|
|
},
|
|
|
|
|
|
// 获取最新时间
|
2021-10-13 20:01:29 +08:00
|
|
|
|
getCurrentTimeRange (callback) {
|
|
|
|
|
|
this.$emit('getCurrentTimeRange', ({ startTime, endTime }) => {
|
|
|
|
|
|
callback({ startTime, endTime })
|
|
|
|
|
|
})
|
2021-09-15 12:19:13 +08:00
|
|
|
|
},
|
2022-01-03 22:46:22 +08:00
|
|
|
|
// 获取最新时间
|
|
|
|
|
|
getChartCurrentTimeRange (callback) {
|
|
|
|
|
|
console.info(this.isGroup)
|
|
|
|
|
|
if (this.isGroup) {
|
|
|
|
|
|
this.$emit('getChartCurrentTimeRange', ({ startTime, endTime }) => {
|
|
|
|
|
|
console.info(startTime, endTime)
|
|
|
|
|
|
callback({ startTime, endTime })
|
|
|
|
|
|
})
|
|
|
|
|
|
} else {
|
|
|
|
|
|
const myEndTime = window.$dayJs.tz().valueOf()
|
|
|
|
|
|
const myStartTime = myEndTime - this.chartTimeFilter.dateRangeValue * 60 * 1000
|
|
|
|
|
|
console.info(myStartTime, myEndTime)
|
|
|
|
|
|
callback({ startTime: myStartTime, endTime: myEndTime })
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2021-10-11 19:12:52 +08:00
|
|
|
|
getDataKey (r) {
|
|
|
|
|
|
let key = ''
|
|
|
|
|
|
let labelText = ''
|
|
|
|
|
|
if (r.establishLatency || r.establishLatency === 0) {
|
|
|
|
|
|
key = 'establishLatency'
|
|
|
|
|
|
labelText = this.$t('networkAppPerformance.tripTime')
|
|
|
|
|
|
} else if (r.httpResponseLatency || r.httpResponseLatency === 0) {
|
|
|
|
|
|
key = 'httpResponseLatency'
|
|
|
|
|
|
labelText = this.$t('networkAppPerformance.httpResponse')
|
|
|
|
|
|
} else if (r.sslConLatency || r.sslConLatency === 0) {
|
|
|
|
|
|
key = 'sslConLatency'
|
|
|
|
|
|
labelText = this.$t('networkAppPerformance.sslResponse')
|
|
|
|
|
|
} else if (r.sequenceGapLossPercent || r.sequenceGapLossPercent === 0) {
|
|
|
|
|
|
key = 'sequenceGapLossPercent'
|
2021-10-12 18:17:53 +08:00
|
|
|
|
labelText = this.$t('networkAppPerformance.packetLossRate')
|
2021-10-11 19:12:52 +08:00
|
|
|
|
} else if (r.pktRetransPercent || r.pktRetransPercent === 0) {
|
|
|
|
|
|
key = 'pktRetransPercent'
|
|
|
|
|
|
labelText = this.$t('networkAppPerformance.retransmissionRate')
|
|
|
|
|
|
} else if (r.sessions || r.sessions === 0) {
|
|
|
|
|
|
key = 'sessions'
|
|
|
|
|
|
labelText = this.$t('overall.sessions')
|
|
|
|
|
|
}
|
|
|
|
|
|
return { key, labelText }
|
|
|
|
|
|
},
|
2021-08-09 13:38:32 +08:00
|
|
|
|
getTableTitle (data) {
|
|
|
|
|
|
if (data.length > 0) {
|
2021-08-16 17:21:46 +08:00
|
|
|
|
const dataColumns = Object.keys(data[0]) // 返回数据的字段
|
|
|
|
|
|
const columns = dataColumns.map(c => tableTitleMapping[c]) // 展示字段
|
2022-01-04 17:04:05 +08:00
|
|
|
|
const keys = ['clientIp', 'serverIp', 'ip', 'appId', 'app', 'appName', 'domain']
|
2021-08-16 17:21:46 +08:00
|
|
|
|
return columns.sort((a, b) => {
|
|
|
|
|
|
if (keys.indexOf(a.prop) > -1) {
|
|
|
|
|
|
return -1
|
|
|
|
|
|
} else if (keys.indexOf(b.prop) > -1) {
|
|
|
|
|
|
return 1
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return 0
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2021-08-09 13:38:32 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
return []
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2021-07-22 21:35:06 +08:00
|
|
|
|
toggleStatisticsLegend (index) {
|
|
|
|
|
|
this.statisticsData[index].active = !this.statisticsData[index].active
|
|
|
|
|
|
this.statisticsData.forEach((d, i) => {
|
|
|
|
|
|
if (d.active) {
|
|
|
|
|
|
this.myChart.dispatchAction({
|
|
|
|
|
|
type: 'legendSelect',
|
|
|
|
|
|
name: d.legend
|
|
|
|
|
|
})
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.myChart.dispatchAction({
|
|
|
|
|
|
type: 'legendUnSelect',
|
|
|
|
|
|
name: d.legend
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
2021-07-07 15:51:52 +08:00
|
|
|
|
orderPieTableChange () {
|
2021-07-08 11:08:40 +08:00
|
|
|
|
if (this.chart.type === 31) {
|
2021-07-14 15:40:05 +08:00
|
|
|
|
const chartParams = this.chartInfo.params || null // 图表参数
|
2021-07-10 11:18:40 +08:00
|
|
|
|
this.initEchartsWithPieTable(chartParams)
|
2021-07-08 11:08:40 +08:00
|
|
|
|
}
|
2021-07-07 15:51:52 +08:00
|
|
|
|
},
|
2021-08-15 15:49:29 +08:00
|
|
|
|
timeLineIsAllZero (data) {
|
2021-08-15 18:53:27 +08:00
|
|
|
|
if (data.resultType === 'matrix') {
|
|
|
|
|
|
let allZero = true
|
|
|
|
|
|
try {
|
2021-08-16 11:34:37 +08:00
|
|
|
|
data.result.forEach(d => {
|
2021-08-15 18:53:27 +08:00
|
|
|
|
d.values.forEach(r => {
|
2021-08-16 11:34:37 +08:00
|
|
|
|
if (r[1] && r[1] !== '0') {
|
2021-08-15 18:53:27 +08:00
|
|
|
|
allZero = false
|
|
|
|
|
|
throw new Error('break')
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2021-08-15 15:49:29 +08:00
|
|
|
|
})
|
2021-08-15 18:53:27 +08:00
|
|
|
|
} catch (e) {}
|
|
|
|
|
|
return allZero
|
|
|
|
|
|
}
|
2021-08-15 15:49:29 +08:00
|
|
|
|
},
|
2021-07-10 11:18:40 +08:00
|
|
|
|
initECharts (chartParams) {
|
2021-08-19 18:50:50 +08:00
|
|
|
|
if (chartParams.showLegend === false) {
|
2021-08-17 16:37:02 +08:00
|
|
|
|
this.chartOption.legend.show = false
|
|
|
|
|
|
}
|
2021-10-13 20:01:29 +08:00
|
|
|
|
const queryParams = { ...this.queryTimeRange, ...this.entity }
|
2021-07-10 11:18:40 +08:00
|
|
|
|
get(replaceUrlPlaceholder(chartParams.url, queryParams)).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
2021-08-15 15:49:29 +08:00
|
|
|
|
if (this.$_.isEmpty(response.data.result)) {
|
|
|
|
|
|
this.noData = true
|
|
|
|
|
|
return
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.noData = false
|
|
|
|
|
|
}
|
2021-07-10 11:18:40 +08:00
|
|
|
|
const seriesTemplate = this.chartOption.series[0]
|
2021-08-15 18:53:27 +08:00
|
|
|
|
const allZero = this.timeLineIsAllZero(response.data)
|
2021-08-15 15:49:29 +08:00
|
|
|
|
if (allZero) {
|
|
|
|
|
|
this.chartOption.yAxis = {
|
|
|
|
|
|
...this.chartOption.yAxis,
|
|
|
|
|
|
min: 0,
|
|
|
|
|
|
max: 5,
|
|
|
|
|
|
interval: 1
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-07-10 11:18:40 +08:00
|
|
|
|
this.chartOption.series = response.data.result.map(r => {
|
|
|
|
|
|
return {
|
|
|
|
|
|
...seriesTemplate,
|
2021-09-30 15:30:38 +08:00
|
|
|
|
name: legendMapping[`${this.entity && this.entity.ip ? 'ip_' : ''}${r.legend}`] ? legendMapping[`${this.entity && this.entity.ip ? 'ip_' : ''}${r.legend}`] : lineToSpace(r.legend),
|
2021-07-21 22:46:08 +08:00
|
|
|
|
data: r.values.map(v => [Number(v[0]) * 1000, Number(v[1]), chartParams.unitType])
|
2021-07-10 11:18:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
2021-08-16 18:36:13 +08:00
|
|
|
|
const rows = (response.data.result.length - 1) / 4 + 1 // 根据legend个数动态预留legend空间
|
|
|
|
|
|
const gridTop = 10 + 27 * rows
|
|
|
|
|
|
this.chartOption.grid.top = gridTop
|
2021-07-21 22:46:08 +08:00
|
|
|
|
if (chartParams.unitType === unitTypes.byte) {
|
|
|
|
|
|
this.chartOption.yAxis.axisLabel.formatter = function (value, index, a, b) {
|
|
|
|
|
|
return unitConvert(value, unitTypes.byte).join(' ')
|
|
|
|
|
|
}
|
|
|
|
|
|
this.chartOption.grid.left = 75
|
|
|
|
|
|
}
|
2021-08-26 17:14:51 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
this.isError = true
|
|
|
|
|
|
this.noData = true
|
|
|
|
|
|
this.errorInfo = response.msg || response.message || 'Unknown'
|
2021-07-10 11:18:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
this.myChart.setOption(this.chartOption)
|
2021-08-13 18:57:49 +08:00
|
|
|
|
}).finally(() => {
|
2021-09-08 21:29:12 +08:00
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
this.loading = false
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.echartsResize()
|
|
|
|
|
|
})
|
|
|
|
|
|
}, 250)
|
2021-07-10 11:18:40 +08:00
|
|
|
|
})
|
|
|
|
|
|
},
|
2021-08-17 17:56:09 +08:00
|
|
|
|
initRelationShip (chartParams) {
|
2021-10-13 19:06:24 +08:00
|
|
|
|
this.isError = false
|
|
|
|
|
|
this.errorInfo = '0'
|
2021-08-19 18:50:50 +08:00
|
|
|
|
const queryParams = { ...this.entity, limit: 5 }
|
2021-08-17 17:56:09 +08:00
|
|
|
|
post(replaceUrlPlaceholder(chartParams.url, queryParams)).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
2021-08-19 18:50:50 +08:00
|
|
|
|
if (!response.data.result) {
|
|
|
|
|
|
this.noData = true
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
const data = []
|
|
|
|
|
|
const links = []
|
|
|
|
|
|
handleData(data, links, response.data.result)
|
|
|
|
|
|
this.chartOption.series[0].data = data
|
|
|
|
|
|
this.chartOption.series[0].links = links
|
2021-10-13 19:06:24 +08:00
|
|
|
|
this.myChart.setOption(this.chartOption)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.isError = true
|
|
|
|
|
|
this.errorInfo = response
|
|
|
|
|
|
this.noData = true
|
2021-08-17 17:56:09 +08:00
|
|
|
|
}
|
|
|
|
|
|
}).finally(() => {
|
2021-09-08 21:29:12 +08:00
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
this.loading = false
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
this.myChart.resize()
|
|
|
|
|
|
})
|
|
|
|
|
|
}, 250)
|
2021-08-17 17:56:09 +08:00
|
|
|
|
})
|
2021-08-19 18:50:50 +08:00
|
|
|
|
|
|
|
|
|
|
const vm = this
|
|
|
|
|
|
function handleData (data, links, item) {
|
|
|
|
|
|
if (!data.some(d => d.name === item.name)) {
|
|
|
|
|
|
data.push({ name: item.name, ...handleStyle(item) })
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!vm.$_.isEmpty(item.from) && !vm.$_.isEmpty(item.to)) {
|
|
|
|
|
|
links.push({ target: item.to, source: item.from })
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!vm.$_.isEmpty(item.leaf)) {
|
|
|
|
|
|
item.leaf.forEach(i => {
|
|
|
|
|
|
handleData(data, links, i)
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function handleStyle (item) {
|
|
|
|
|
|
const style = {}
|
|
|
|
|
|
switch (item.type) {
|
|
|
|
|
|
case 'app_id': {
|
|
|
|
|
|
style.itemStyle = { color: '#73DEB3' }
|
|
|
|
|
|
style.symbol = 'circle'
|
|
|
|
|
|
break
|
|
|
|
|
|
}
|
|
|
|
|
|
case 'domain': {
|
|
|
|
|
|
style.itemStyle = { color: '#73A0FA' }
|
|
|
|
|
|
style.symbol = 'circle'
|
|
|
|
|
|
break
|
|
|
|
|
|
}
|
|
|
|
|
|
case 'client_ip': {
|
|
|
|
|
|
style.itemStyle = { color: '#E8F6FF', borderColor: '#C9C9C9' }
|
|
|
|
|
|
style.symbol = 'roundRect'
|
|
|
|
|
|
style.symbolSize = [80, 25]
|
|
|
|
|
|
break
|
|
|
|
|
|
}
|
|
|
|
|
|
case 'server_ip': {
|
|
|
|
|
|
style.itemStyle = { color: '#E2FCEF', borderColor: '#C9C9C9' }
|
|
|
|
|
|
style.symbol = 'roundRect'
|
|
|
|
|
|
style.symbolSize = [80, 25]
|
|
|
|
|
|
break
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return style
|
|
|
|
|
|
}
|
2021-09-18 17:48:52 +08:00
|
|
|
|
},
|
|
|
|
|
|
initSankey (chartParams) {
|
2021-10-08 21:09:51 +08:00
|
|
|
|
const vm = this
|
|
|
|
|
|
const entityName = this.entity.ip || this.entity.domain || this.entity.app
|
2021-11-10 21:08:15 +08:00
|
|
|
|
const queryParams = { ...this.queryTimeRange, ...this.entity }
|
2021-10-08 21:09:51 +08:00
|
|
|
|
this.chartOption.series[0].tooltip = {
|
2021-11-10 21:08:15 +08:00
|
|
|
|
formatter: function (param) {
|
2021-10-08 21:09:51 +08:00
|
|
|
|
return `
|
|
|
|
|
|
<div class="sankey__tooltip">
|
|
|
|
|
|
<div class="sankey__tooltip-row">
|
|
|
|
|
|
<div class="sankey__row-label">Via:</div>
|
2021-11-10 21:08:15 +08:00
|
|
|
|
<div class="sankey__row-value">${param.data.name}</div>
|
2021-10-08 21:09:51 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="sankey__tooltip-row">
|
|
|
|
|
|
<div style="margin: 6px 0; height: 1px; width: 100%; background-color: #E7EAED;"></div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="sankey__tooltip-row">
|
|
|
|
|
|
<div class="sankey__row-label">Traffic:</div>
|
2021-11-10 21:08:15 +08:00
|
|
|
|
<div class="sankey__row-value">${param.data.convert[0]}${param.data.convert[1]} (${param.data.percent[0]}%)</div>
|
2021-10-08 21:09:51 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="sankey__tooltip-row">
|
|
|
|
|
|
<div class="sankey__row-label">Performance:</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="sankey__tooltip-table">
|
|
|
|
|
|
<div class="sankey__table-row">
|
|
|
|
|
|
<div class="sankey__table-cell">${vm.$t('networkAppPerformance.tripTime')}:</div>
|
2021-11-10 21:08:15 +08:00
|
|
|
|
<div class="sankey__table-cell">${param.data.latency[0]} ${param.data.latency[1]}</div>
|
2021-10-08 21:09:51 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="sankey__table-row">
|
|
|
|
|
|
<div class="sankey__table-cell">${vm.$t('overall.packetLoss')}:</div>
|
2021-11-10 21:08:15 +08:00
|
|
|
|
<div class="sankey__table-cell">${param.data.lossPercent[0]} %</div>
|
2021-10-08 21:09:51 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="sankey__table-row">
|
|
|
|
|
|
<div class="sankey__table-cell">${vm.$t('overall.packetRetrans')}:</div>
|
2021-11-10 21:08:15 +08:00
|
|
|
|
<div class="sankey__table-cell">${param.data.retransPercent[0]} %</div>
|
2021-10-08 21:09:51 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
`
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-11-10 21:08:15 +08:00
|
|
|
|
get(replaceUrlPlaceholder(chartParams.url, queryParams)).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
if (this.$_.isEmpty(response.data.result)) {
|
|
|
|
|
|
this.noData = true
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.noData = false
|
|
|
|
|
|
let inTotalValue = 0
|
|
|
|
|
|
let outTotalValue = 0
|
|
|
|
|
|
|
|
|
|
|
|
/* 测试代码
|
|
|
|
|
|
const t = []
|
|
|
|
|
|
for (const k in response.data.result) {
|
|
|
|
|
|
t.push(response.data.result[k])
|
|
|
|
|
|
}
|
|
|
|
|
|
response.data.result = t */
|
|
|
|
|
|
|
|
|
|
|
|
response.data.result.forEach(item => {
|
|
|
|
|
|
if (item.direction === 'in') {
|
|
|
|
|
|
inTotalValue += parseInt(item.bytes)
|
|
|
|
|
|
} else if (item.direction === 'out') {
|
|
|
|
|
|
outTotalValue += parseInt(item.bytes)
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
const data = response.data.result.map(item => {
|
|
|
|
|
|
return {
|
|
|
|
|
|
...item,
|
|
|
|
|
|
name: item.linkID,
|
|
|
|
|
|
percent: valueToRangeValue(parseInt(item.bytes) / (item.direction === 'in' ? inTotalValue : outTotalValue) * 100, unitTypes.percent),
|
|
|
|
|
|
convert: unitConvert(item.bytes, unitTypes.byte),
|
|
|
|
|
|
latency: valueToRangeValue(item.latency, unitTypes.time),
|
|
|
|
|
|
lossPercent: valueToRangeValue(item.lossPercent, unitTypes.percent),
|
|
|
|
|
|
retransPercent: valueToRangeValue(item.retransPercent, unitTypes.percent),
|
|
|
|
|
|
bytes: parseFloat(item.bytes)
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
data.push({ name: entityName })
|
|
|
|
|
|
|
|
|
|
|
|
const link = data.map(item => {
|
|
|
|
|
|
const source = item.direction === 'in' ? item.linkID : entityName
|
|
|
|
|
|
const target = item.direction === 'in' ? entityName : item.linkID
|
|
|
|
|
|
return {
|
|
|
|
|
|
...item,
|
|
|
|
|
|
source,
|
|
|
|
|
|
target,
|
|
|
|
|
|
value: item.bytes
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
this.chartOption.series[0].data = data
|
|
|
|
|
|
this.chartOption.series[0].links = link
|
|
|
|
|
|
this.myChart.setOption(this.chartOption)
|
2021-10-08 21:09:51 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-11-10 21:08:15 +08:00
|
|
|
|
}).finally(() => {
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
this.loading = false
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.echartsResize()
|
|
|
|
|
|
})
|
|
|
|
|
|
}, 250)
|
|
|
|
|
|
})
|
|
|
|
|
|
/* const inDirection = new Promise(resolve =>
|
|
|
|
|
|
get(replaceUrlPlaceholder(chartParams.url, { ...queryParams, direction: 'ingress' })).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
if (this.$_.isEmpty(response.data.result)) {
|
|
|
|
|
|
this.noData = true
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.noData = false
|
|
|
|
|
|
resolve(handleData(response.data.result, 'in'))
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
resolve()
|
|
|
|
|
|
})
|
|
|
|
|
|
)
|
|
|
|
|
|
const outDirection = new Promise(resolve =>
|
|
|
|
|
|
get(replaceUrlPlaceholder(chartParams.url, { ...queryParams, direction: 'egress' })).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
if (this.$_.isEmpty(response.data.result)) {
|
|
|
|
|
|
this.noData = true
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.noData = false
|
|
|
|
|
|
resolve(handleData(response.data.result, 'out'))
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
resolve()
|
2021-10-08 21:09:51 +08:00
|
|
|
|
})
|
2021-11-10 21:08:15 +08:00
|
|
|
|
)
|
|
|
|
|
|
Promise.all([inDirection, outDirection]).then(responses => {
|
|
|
|
|
|
const inData = responses[0]
|
|
|
|
|
|
const outData = responses[1]
|
|
|
|
|
|
this.chartOption.series[0].data = inData.data.concat(outData.data)
|
|
|
|
|
|
this.chartOption.series[0].links = inData.link.concat(outData.link)
|
|
|
|
|
|
this.myChart.setOption(this.chartOption)
|
|
|
|
|
|
}).finally(() => {
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
this.loading = false
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.echartsResize()
|
|
|
|
|
|
})
|
|
|
|
|
|
}, 250)
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
function handleData (originalData, direction) {
|
|
|
|
|
|
let totalValue = 0
|
|
|
|
|
|
originalData.forEach(item => {
|
|
|
|
|
|
totalValue += parseInt(item.bytes)
|
|
|
|
|
|
})
|
|
|
|
|
|
const data = originalData.map(item => {
|
|
|
|
|
|
return {
|
|
|
|
|
|
...item,
|
|
|
|
|
|
name: item.linkID,
|
|
|
|
|
|
percent: unitConvert(parseInt(item.bytes) / totalValue, unitTypes.byte),
|
|
|
|
|
|
bytes: unitConvert(item.bytes, unitTypes.byte)
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
const link = data.map(item => {
|
|
|
|
|
|
const source = direction === 'in' ? item.linkID : entityName
|
|
|
|
|
|
const target = direction === 'in' ? entityName : item.linkID
|
|
|
|
|
|
return {
|
|
|
|
|
|
...item,
|
|
|
|
|
|
source,
|
|
|
|
|
|
target,
|
|
|
|
|
|
value: item.bytes
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
return {
|
|
|
|
|
|
data,
|
|
|
|
|
|
link
|
|
|
|
|
|
}
|
|
|
|
|
|
} */
|
2021-09-22 09:08:21 +08:00
|
|
|
|
},
|
|
|
|
|
|
initIpOpenPort (chartParams) {
|
|
|
|
|
|
get(replaceUrlPlaceholder(chartParams.url, { ip: this.entity.ip })).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
if (this.$_.isEmpty(response.data.result)) {
|
|
|
|
|
|
this.noData = true
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.noData = false
|
2021-09-28 17:36:46 +08:00
|
|
|
|
this.detailData = response.data.result
|
2021-09-22 09:08:21 +08:00
|
|
|
|
const protocols = []
|
|
|
|
|
|
this.detailData.forEach((d, i) => {
|
|
|
|
|
|
const index = protocols.findIndex(p => p.name === d.protocol.toUpperCase())
|
|
|
|
|
|
if (index === -1) {
|
|
|
|
|
|
protocols.push({ name: d.protocol.toUpperCase(), value: 1, itemStyle: { color: getChartColor(i) } })
|
|
|
|
|
|
} else {
|
|
|
|
|
|
protocols[index].value++
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
this.chartOption.series[0].data = protocols
|
|
|
|
|
|
this.chartOption.xAxis.data = protocols.map(p => p.name)
|
|
|
|
|
|
this.myChart.setOption(this.chartOption)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}).finally(() => {
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
this.loading = false
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.echartsResize()
|
|
|
|
|
|
})
|
|
|
|
|
|
}, 250)
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
initIpHostedDomain (chartParams) {
|
2021-10-13 19:06:24 +08:00
|
|
|
|
const list = new Promise(resolve => {
|
|
|
|
|
|
get(replaceUrlPlaceholder(chartParams.url, { ip: this.entity.ip })).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
if (this.$_.isEmpty(response.data.result)) {
|
|
|
|
|
|
this.noData = true
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.noData = false
|
|
|
|
|
|
this.detailData = response.data.result
|
|
|
|
|
|
}
|
2021-09-22 09:08:21 +08:00
|
|
|
|
}
|
2021-10-13 19:06:24 +08:00
|
|
|
|
resolve()
|
|
|
|
|
|
})
|
|
|
|
|
|
})
|
|
|
|
|
|
const byType = new Promise(resolve => {
|
|
|
|
|
|
get(replaceUrlPlaceholder(chartParams.byTypeUrl, { ip: this.entity.ip })).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
if (this.$_.isEmpty(response.data.result)) {
|
|
|
|
|
|
this.noData0 = true
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.noData0 = false
|
|
|
|
|
|
const chartOption = this.$_.cloneDeep(this.chartOption)
|
|
|
|
|
|
chartOption.series[0].data = response.data.result.map(r => ({ ...r, unitType: chartParams.unitType }))
|
|
|
|
|
|
this.myChart.setOption(chartOption)
|
|
|
|
|
|
}
|
2021-09-24 19:24:25 +08:00
|
|
|
|
}
|
2021-10-13 19:06:24 +08:00
|
|
|
|
resolve()
|
|
|
|
|
|
})
|
|
|
|
|
|
})
|
|
|
|
|
|
const byCredit = new Promise(resolve => {
|
|
|
|
|
|
get(replaceUrlPlaceholder(chartParams.byCreditUrl, { ip: this.entity.ip })).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
if (this.$_.isEmpty(response.data.result)) {
|
|
|
|
|
|
this.noData1 = true
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.noData1 = false
|
|
|
|
|
|
const chartOption = this.$_.cloneDeep(this.chartOption)
|
|
|
|
|
|
chartOption.series[0].data = response.data.result.map(r => ({ ...r, unitType: chartParams.unitType }))
|
|
|
|
|
|
this.myChart2.setOption(chartOption)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
resolve()
|
|
|
|
|
|
})
|
|
|
|
|
|
})
|
|
|
|
|
|
Promise.all([list, byType, byCredit]).finally(response => {
|
2021-09-22 09:08:21 +08:00
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
this.loading = false
|
2021-10-13 19:06:24 +08:00
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.echartsResize()
|
|
|
|
|
|
})
|
2021-09-22 09:08:21 +08:00
|
|
|
|
}, 250)
|
|
|
|
|
|
})
|
2021-08-17 17:56:09 +08:00
|
|
|
|
},
|
2021-09-24 19:24:25 +08:00
|
|
|
|
initAppRelatedDomain (chartParams) {
|
|
|
|
|
|
this.noData = false
|
|
|
|
|
|
this.loading = false
|
|
|
|
|
|
this.chartOption.series[0].data = [
|
|
|
|
|
|
{
|
|
|
|
|
|
name: 'test1',
|
|
|
|
|
|
value: 32
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
name: 'test2',
|
|
|
|
|
|
value: 21
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
name: 'test3',
|
|
|
|
|
|
value: 20
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
name: 'test4',
|
|
|
|
|
|
value: 7
|
|
|
|
|
|
}
|
|
|
|
|
|
]
|
|
|
|
|
|
this.myChart.setOption(this.chartOption)
|
|
|
|
|
|
this.myChart2.setOption(this.chartOption)
|
2021-09-30 00:50:11 +08:00
|
|
|
|
get(replaceUrlPlaceholder(chartParams.url, { app: this.entity.app })).then(response => {
|
2021-09-24 19:24:25 +08:00
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
if (this.$_.isEmpty(response.data.result)) {
|
|
|
|
|
|
this.noData = true
|
|
|
|
|
|
} else {
|
2021-09-30 00:50:11 +08:00
|
|
|
|
this.detailData = response.data.result
|
2021-09-24 19:24:25 +08:00
|
|
|
|
this.noData = false
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}).finally(() => {
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
this.loading = false
|
|
|
|
|
|
}, 250)
|
2021-09-30 00:50:11 +08:00
|
|
|
|
})
|
2021-09-24 19:24:25 +08:00
|
|
|
|
},
|
2021-12-13 10:16:41 +08:00
|
|
|
|
|
2021-12-13 10:18:27 +08:00
|
|
|
|
handleTimeChartOption (chartParams, dataArray) {
|
2021-12-13 10:16:41 +08:00
|
|
|
|
let direction = 'vertical'
|
2021-12-13 10:18:27 +08:00
|
|
|
|
if (chartParams.direction) {
|
2021-12-13 10:16:41 +08:00
|
|
|
|
direction = chartParams.direction
|
2021-12-13 10:18:27 +08:00
|
|
|
|
if (direction == 'horizontal') { // 柱状图水平方向
|
2021-12-13 10:16:41 +08:00
|
|
|
|
this.chartOption.xAxis = {
|
|
|
|
|
|
axisTick: { show: false },
|
|
|
|
|
|
axisLine: { show: false },
|
|
|
|
|
|
type: 'value',
|
|
|
|
|
|
axisLabel: {
|
|
|
|
|
|
formatter: function (value, index, a, b) {
|
|
|
|
|
|
return unitConvert(value, unitTypes.number).join(' ')
|
|
|
|
|
|
}
|
2021-12-13 10:18:27 +08:00
|
|
|
|
}
|
2021-12-13 10:16:41 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.chartOption.yAxis = {
|
|
|
|
|
|
type: 'category',
|
|
|
|
|
|
axisTick: { show: false },
|
|
|
|
|
|
axisLine: { show: false },
|
|
|
|
|
|
axisLabel: {
|
|
|
|
|
|
interval: 0,
|
2021-12-13 10:18:27 +08:00
|
|
|
|
// rotate: -40, //设置日期显示样式(倾斜度)
|
|
|
|
|
|
formatter: function (value) { // 在这里写你需要的时间格式
|
2021-12-13 10:16:41 +08:00
|
|
|
|
return window.$dayJs.tz(Number(value)).format('M/D H:m')
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2021-12-13 10:18:27 +08:00
|
|
|
|
axisPointer: { // y轴上显示指针对应的值
|
|
|
|
|
|
show: true
|
|
|
|
|
|
}
|
2021-12-13 10:16:41 +08:00
|
|
|
|
}
|
2021-12-13 10:18:27 +08:00
|
|
|
|
} else if (direction == 'vertical') { // 柱状图竖直方向
|
2021-12-13 10:16:41 +08:00
|
|
|
|
this.chartOption.yAxis = {
|
|
|
|
|
|
axisTick: { show: false },
|
|
|
|
|
|
axisLine: { show: false },
|
|
|
|
|
|
type: 'value',
|
|
|
|
|
|
axisLabel: {
|
|
|
|
|
|
formatter: function (value, index, a, b) {
|
|
|
|
|
|
return unitConvert(value, unitTypes.number).join(' ')
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
minInterval: 1
|
|
|
|
|
|
}
|
|
|
|
|
|
this.chartOption.xAxis = {
|
|
|
|
|
|
type: 'category',
|
|
|
|
|
|
axisTick: { show: false },
|
|
|
|
|
|
axisLine: { show: false },
|
|
|
|
|
|
axisLabel: {
|
|
|
|
|
|
interval: 0,
|
2021-12-13 10:18:27 +08:00
|
|
|
|
// rotate: -40, //设置日期显示样式(倾斜度)
|
|
|
|
|
|
formatter: function (value) { // 在这里写你需要的时间格式
|
2021-12-13 10:16:41 +08:00
|
|
|
|
return window.$dayJs.tz(Number(value)).format('M/D H:m')
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2021-12-13 10:18:27 +08:00
|
|
|
|
axisPointer: { // y轴上显示指针对应的值
|
|
|
|
|
|
show: true
|
|
|
|
|
|
}
|
2021-12-13 10:16:41 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-12-13 10:18:27 +08:00
|
|
|
|
let itemColorAlternately = false// true|false 柱体色是否轮替
|
|
|
|
|
|
if (chartParams.itemColorAlternately) {
|
2021-12-13 10:16:41 +08:00
|
|
|
|
itemColorAlternately = chartParams.itemColorAlternately
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.chartOption.tooltip = {
|
|
|
|
|
|
...this.chartOption.tooltip,
|
2021-12-13 10:18:27 +08:00
|
|
|
|
formatter: (direction == 'horizontal') ? timeHorizontalFormatter : timeVerticalFormatter
|
2021-12-13 10:16:41 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2021-12-13 10:18:27 +08:00
|
|
|
|
this.chartOption.series = {
|
2021-12-13 10:16:41 +08:00
|
|
|
|
...this.chartOption.series[0],
|
|
|
|
|
|
name: this.chartInfo.name,
|
|
|
|
|
|
data: dataArray,
|
|
|
|
|
|
itemStyle: {
|
2021-12-13 10:18:27 +08:00
|
|
|
|
color: function (params) {
|
|
|
|
|
|
if (itemColorAlternately) {
|
2021-12-13 10:16:41 +08:00
|
|
|
|
return getCharBartColor([params.dataIndex])
|
2021-12-13 10:18:27 +08:00
|
|
|
|
} else {
|
2021-12-13 10:16:41 +08:00
|
|
|
|
return getCharBartColor(0)
|
|
|
|
|
|
}
|
2021-12-13 10:18:27 +08:00
|
|
|
|
}
|
2021-12-13 10:16:41 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
initEchartsTimeBar (chartParams) {
|
|
|
|
|
|
const queryParams = { ...this.queryTimeRange, ...this.entity }
|
|
|
|
|
|
get(replaceUrlPlaceholder(chartParams.url, queryParams)).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
if (this.$_.isEmpty(response.data.result)) {
|
|
|
|
|
|
this.noData = true
|
|
|
|
|
|
return
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.noData = false
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
let dataArray = []
|
2021-12-13 10:18:27 +08:00
|
|
|
|
if (chartParams.direction == 'vertical') { // 柱状图竖直方向
|
2021-12-13 10:16:41 +08:00
|
|
|
|
dataArray = response.data.result[0].values.map((r, i) => {
|
2021-12-13 10:18:27 +08:00
|
|
|
|
return [Number(r[0]), Number(r[1]), chartParams.unitType]
|
2021-12-13 10:16:41 +08:00
|
|
|
|
})
|
2021-12-13 10:18:27 +08:00
|
|
|
|
} else if (chartParams.direction == 'horizontal') { // 柱状图水平方向
|
2021-12-13 10:16:41 +08:00
|
|
|
|
dataArray = response.data.result[0].values.map((r, i) => {
|
2021-12-13 10:18:27 +08:00
|
|
|
|
return [Number(r[1]), Number(r[0]), chartParams.unitType]
|
2021-12-13 10:16:41 +08:00
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-12-13 10:18:27 +08:00
|
|
|
|
this.handleTimeChartOption(chartParams, dataArray)
|
2021-12-13 10:16:41 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
this.isError = true
|
|
|
|
|
|
this.noData = true
|
|
|
|
|
|
this.errorInfo = response.msg || response.message || 'Unknown'
|
|
|
|
|
|
|
2021-12-13 10:18:27 +08:00
|
|
|
|
// 产生测试数据
|
2021-12-13 10:16:41 +08:00
|
|
|
|
this.initTestTimeBarData(chartParams)
|
|
|
|
|
|
}
|
|
|
|
|
|
this.myChart.setOption(this.chartOption)
|
|
|
|
|
|
}).finally(() => {
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
this.loading = false
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.echartsResize()
|
|
|
|
|
|
})
|
|
|
|
|
|
}, 250)
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
|
2021-12-13 10:18:27 +08:00
|
|
|
|
initTestTimeBarData (chartParams) {
|
2021-12-13 10:16:41 +08:00
|
|
|
|
this.noData = false
|
2021-12-13 10:18:27 +08:00
|
|
|
|
const data = [[1612113120000, '9'], [1612113220000, '2'], [1612113320000, '3'], [1612113420000, '4'], [1612113520000, '1'], [1612113620000, '5'], [1612113720000, '7'], [1612113820000, '9']]
|
2021-12-13 10:16:41 +08:00
|
|
|
|
let dataArray = []
|
2021-12-13 10:18:27 +08:00
|
|
|
|
if (chartParams.direction == 'vertical') { // 柱状图竖直方向
|
2021-12-13 10:16:41 +08:00
|
|
|
|
dataArray = data.map((r, i) => {
|
2021-12-13 10:18:27 +08:00
|
|
|
|
return [r[0], Number(r[1]), chartParams.unitType]
|
2021-12-13 10:16:41 +08:00
|
|
|
|
})
|
2021-12-13 10:18:27 +08:00
|
|
|
|
} else if (chartParams.direction == 'horizontal') { // 柱状图水平方向
|
2021-12-13 10:16:41 +08:00
|
|
|
|
dataArray = data.map((r, i) => {
|
2021-12-13 10:18:27 +08:00
|
|
|
|
return [Number(r[1]), r[0], chartParams.unitType]
|
2021-12-13 10:16:41 +08:00
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-12-13 10:18:27 +08:00
|
|
|
|
this.handleTimeChartOption(chartParams, dataArray)
|
2021-12-13 10:16:41 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
initEchartsCategoryBar (chartParams) {
|
|
|
|
|
|
const queryParams = { ...this.queryTimeRange, ...this.entity }
|
|
|
|
|
|
get(replaceUrlPlaceholder(chartParams.url, queryParams)).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
if (this.$_.isEmpty(response.data.result)) {
|
|
|
|
|
|
this.noData = true
|
|
|
|
|
|
return
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.noData = false
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
let dataArray = []
|
2021-12-13 10:18:27 +08:00
|
|
|
|
if (chartParams.direction == 'horizontal') { // 柱状图水平方向
|
|
|
|
|
|
dataArray = response.data.result.map((r, i) => { return [r.num, r.name] })
|
|
|
|
|
|
} else if (chartParams.direction == 'vertical') { // 柱状图竖直方向
|
|
|
|
|
|
dataArray = response.data.result.map((r, i) => { return [r.name, r.num] })
|
2021-12-13 10:16:41 +08:00
|
|
|
|
}
|
2021-12-13 10:18:27 +08:00
|
|
|
|
this.handleCategoryChartOption(chartParams, dataArray)
|
2021-12-13 10:16:41 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
this.isError = true
|
|
|
|
|
|
this.noData = true
|
|
|
|
|
|
this.errorInfo = response.msg || response.message || 'Unknown'
|
|
|
|
|
|
|
2021-12-13 10:18:27 +08:00
|
|
|
|
// 产生测试数据
|
2021-12-13 10:16:41 +08:00
|
|
|
|
this.initTestCategoryBarData(chartParams)
|
|
|
|
|
|
}
|
|
|
|
|
|
this.myChart.setOption(this.chartOption)
|
|
|
|
|
|
}).finally(() => {
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
this.loading = false
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.echartsResize()
|
|
|
|
|
|
})
|
|
|
|
|
|
}, 250)
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
|
2021-12-13 10:18:27 +08:00
|
|
|
|
handleCategoryChartOption (chartParams, dataArray) {
|
2021-12-13 10:16:41 +08:00
|
|
|
|
let xType = 'category'
|
|
|
|
|
|
let yType = 'value'
|
|
|
|
|
|
let direction = 'vertical'
|
2021-12-13 10:18:27 +08:00
|
|
|
|
if (chartParams.direction) {
|
|
|
|
|
|
direction = chartParams.direction
|
|
|
|
|
|
if (direction == 'horizontal') { // 柱状图水平方向
|
|
|
|
|
|
xType = 'value'
|
|
|
|
|
|
yType = 'category'
|
|
|
|
|
|
} else if (direction == 'vertical') { // 柱状图竖直方向
|
|
|
|
|
|
xType = 'category'
|
|
|
|
|
|
yType = 'value'
|
|
|
|
|
|
}
|
2021-12-13 10:16:41 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2021-12-13 10:18:27 +08:00
|
|
|
|
let itemColorAlternately = false// true|false 柱体色是否轮替
|
|
|
|
|
|
if (chartParams.itemColorAlternately) {
|
2021-12-13 10:16:41 +08:00
|
|
|
|
itemColorAlternately = chartParams.itemColorAlternately
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.chartOption.tooltip = {
|
|
|
|
|
|
...this.chartOption.tooltip,
|
2021-12-13 10:18:27 +08:00
|
|
|
|
formatter: (direction == 'horizontal') ? categoryHorizontalFormatter : categoryVerticalFormatter
|
2021-12-13 10:16:41 +08:00
|
|
|
|
}
|
|
|
|
|
|
this.chartOption.xAxis = {
|
|
|
|
|
|
...this.chartOption.xAxis,
|
|
|
|
|
|
type: xType
|
|
|
|
|
|
}
|
|
|
|
|
|
this.chartOption.yAxis = {
|
|
|
|
|
|
...this.chartOption.yAxis,
|
|
|
|
|
|
type: yType
|
|
|
|
|
|
}
|
2021-12-13 10:18:27 +08:00
|
|
|
|
this.chartOption.series = {
|
2021-12-13 10:16:41 +08:00
|
|
|
|
...this.chartOption.series[0],
|
|
|
|
|
|
data: dataArray,
|
|
|
|
|
|
itemStyle: {
|
2021-12-13 10:18:27 +08:00
|
|
|
|
color: function (params) {
|
|
|
|
|
|
if (itemColorAlternately) {
|
2021-12-13 10:16:41 +08:00
|
|
|
|
return getCharBartColor([params.dataIndex])
|
2021-12-13 10:18:27 +08:00
|
|
|
|
} else {
|
2021-12-13 10:16:41 +08:00
|
|
|
|
return getCharBartColor(0)
|
|
|
|
|
|
}
|
2021-12-13 10:18:27 +08:00
|
|
|
|
}
|
2021-12-13 10:16:41 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
|
2021-12-13 10:18:27 +08:00
|
|
|
|
initTestCategoryBarData (chartParams) {
|
2021-12-13 10:16:41 +08:00
|
|
|
|
this.noData = false
|
|
|
|
|
|
|
|
|
|
|
|
let xType = 'category'
|
|
|
|
|
|
let yType = 'value'
|
|
|
|
|
|
let direction = 'vertical'
|
2021-12-13 10:18:27 +08:00
|
|
|
|
if (chartParams.direction) {
|
2021-12-13 10:16:41 +08:00
|
|
|
|
direction = chartParams.direction
|
2021-12-13 10:18:27 +08:00
|
|
|
|
if (direction == 'horizontal') { // 柱状图水平方向
|
2021-12-13 10:16:41 +08:00
|
|
|
|
xType = 'value'
|
|
|
|
|
|
yType = 'category'
|
2021-12-13 10:18:27 +08:00
|
|
|
|
} else if (direction == 'vertical') { // 柱状图竖直方向
|
2021-12-13 10:16:41 +08:00
|
|
|
|
xType = 'category'
|
|
|
|
|
|
yType = 'value'
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-12-13 10:18:27 +08:00
|
|
|
|
let itemColorAlternately = false// true|false 柱体色是否轮替
|
|
|
|
|
|
if (chartParams.itemColorAlternately) {
|
2021-12-13 10:16:41 +08:00
|
|
|
|
itemColorAlternately = chartParams.itemColorAlternately
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
let dataArray = []
|
2021-12-13 10:18:27 +08:00
|
|
|
|
if (direction == 'horizontal') { // 柱状图水平方向
|
|
|
|
|
|
dataArray = [
|
|
|
|
|
|
[240, '中国出版集团公司'],
|
|
|
|
|
|
[200, '中国铁路总公司'],
|
|
|
|
|
|
[175, '中国烟草总公司'],
|
|
|
|
|
|
[140, '中国邮政集团公司'],
|
|
|
|
|
|
[99, '中国石油天然气集团公司']
|
2021-12-13 10:16:41 +08:00
|
|
|
|
]
|
2021-12-13 10:18:27 +08:00
|
|
|
|
} else if (direction == 'vertical') { // 柱状图竖直方向
|
|
|
|
|
|
dataArray = [
|
|
|
|
|
|
['中国出版集团公司', 240],
|
|
|
|
|
|
['中国铁路总公司', 200],
|
|
|
|
|
|
['中国烟草总公司', 175],
|
|
|
|
|
|
['中国邮政集团公司', 140],
|
|
|
|
|
|
['中国石油天然气集团公司', 99]
|
2021-12-13 10:16:41 +08:00
|
|
|
|
]
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.chartOption = {
|
|
|
|
|
|
tooltip: {
|
|
|
|
|
|
appendToBody: true,
|
|
|
|
|
|
trigger: 'axis',
|
|
|
|
|
|
textStyle: {
|
|
|
|
|
|
width: '20px',
|
|
|
|
|
|
overflow: 'truncate'
|
|
|
|
|
|
},
|
2021-12-13 10:18:27 +08:00
|
|
|
|
formatter: (direction == 'horizontal') ? categoryHorizontalFormatter : categoryVerticalFormatter,
|
2021-12-13 10:16:41 +08:00
|
|
|
|
show: true,
|
|
|
|
|
|
className: 'nz-chart-tooltip',
|
|
|
|
|
|
extraCssText: 'box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);max-width: 300px !important'
|
|
|
|
|
|
},
|
2021-12-13 10:18:27 +08:00
|
|
|
|
xAxis: {
|
2021-12-13 10:16:41 +08:00
|
|
|
|
type: xType,
|
|
|
|
|
|
axisTick: { show: false },
|
|
|
|
|
|
axisLine: { show: false }
|
|
|
|
|
|
},
|
2021-12-13 10:18:27 +08:00
|
|
|
|
yAxis: {
|
2021-12-13 10:16:41 +08:00
|
|
|
|
type: yType,
|
|
|
|
|
|
axisTick: { show: false },
|
|
|
|
|
|
axisLine: { show: false }
|
|
|
|
|
|
},
|
|
|
|
|
|
grid: {
|
|
|
|
|
|
top: 20,
|
|
|
|
|
|
left: 10,
|
|
|
|
|
|
right: 25,
|
|
|
|
|
|
bottom: 20,
|
2021-12-13 10:18:27 +08:00
|
|
|
|
containLabel: true
|
2021-12-13 10:16:41 +08:00
|
|
|
|
},
|
2021-12-13 10:18:27 +08:00
|
|
|
|
color: chartBarColor,
|
2021-12-13 10:16:41 +08:00
|
|
|
|
series: [{
|
|
|
|
|
|
barWidth: 15,
|
|
|
|
|
|
data: dataArray,
|
|
|
|
|
|
type: 'bar',
|
2021-12-13 10:18:27 +08:00
|
|
|
|
label: { show: false },
|
2021-12-13 10:16:41 +08:00
|
|
|
|
barCategoryGap: '10%',
|
|
|
|
|
|
itemStyle: {
|
2021-12-13 10:18:27 +08:00
|
|
|
|
color: function (params) {
|
|
|
|
|
|
if (itemColorAlternately) {
|
2021-12-13 10:16:41 +08:00
|
|
|
|
return getCharBartColor([params.dataIndex])
|
2021-12-13 10:18:27 +08:00
|
|
|
|
} else {
|
2021-12-13 10:16:41 +08:00
|
|
|
|
return getCharBartColor(0)
|
|
|
|
|
|
}
|
2021-12-13 10:18:27 +08:00
|
|
|
|
}
|
2021-12-13 10:16:41 +08:00
|
|
|
|
}
|
|
|
|
|
|
}]
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
|
2021-07-10 11:18:40 +08:00
|
|
|
|
initEchartsWithStatistics (chartParams) {
|
2021-10-13 20:01:29 +08:00
|
|
|
|
const queryParams = { ...this.queryTimeRange, ...this.entity }
|
2021-07-10 11:18:40 +08:00
|
|
|
|
get(replaceUrlPlaceholder(chartParams.url, queryParams)).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
2021-08-15 15:49:29 +08:00
|
|
|
|
if (this.$_.isEmpty(response.data.result)) {
|
|
|
|
|
|
this.noData = true
|
|
|
|
|
|
return
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.noData = false
|
|
|
|
|
|
}
|
2021-08-15 18:53:27 +08:00
|
|
|
|
const allZero = this.timeLineIsAllZero(response.data)
|
2021-08-15 15:49:29 +08:00
|
|
|
|
if (allZero) {
|
|
|
|
|
|
this.chartOption.yAxis = {
|
|
|
|
|
|
...this.chartOption.yAxis,
|
|
|
|
|
|
min: 0,
|
|
|
|
|
|
max: 5,
|
|
|
|
|
|
interval: 1
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-07-22 21:35:06 +08:00
|
|
|
|
this.statisticsData = response.data.result.map(d => {
|
|
|
|
|
|
return {
|
|
|
|
|
|
...d,
|
|
|
|
|
|
active: true
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2021-07-10 11:18:40 +08:00
|
|
|
|
const seriesTemplate = this.chartOption.series[0]
|
|
|
|
|
|
this.chartOption.series = response.data.result.map((r, i) => {
|
|
|
|
|
|
return {
|
|
|
|
|
|
...seriesTemplate,
|
|
|
|
|
|
name: r.legend,
|
2021-07-21 22:46:08 +08:00
|
|
|
|
data: r.values.map(v => [Number(v[0]) * 1000, Number(v[1]), chartParams.unitType]),
|
2021-07-10 11:18:40 +08:00
|
|
|
|
lineStyle: {
|
|
|
|
|
|
color: getChartColor[i]
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2021-08-26 17:14:51 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
this.isError = true
|
|
|
|
|
|
this.noData = true
|
|
|
|
|
|
this.errorInfo = response.msg || response.message || 'Unknown'
|
2021-07-10 11:18:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
this.myChart.setOption(this.chartOption)
|
2021-08-13 18:57:49 +08:00
|
|
|
|
}).finally(() => {
|
2021-09-08 21:29:12 +08:00
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
this.loading = false
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.echartsResize()
|
|
|
|
|
|
})
|
|
|
|
|
|
}, 250)
|
2021-07-10 11:18:40 +08:00
|
|
|
|
})
|
|
|
|
|
|
},
|
2021-12-21 10:52:30 +08:00
|
|
|
|
|
|
|
|
|
|
initTestDataForApp (chartParams) {
|
|
|
|
|
|
let rlt = ''
|
|
|
|
|
|
if (chartParams.url.indexOf('App') > -1) {
|
|
|
|
|
|
rlt = {
|
|
|
|
|
|
code: 200,
|
|
|
|
|
|
msg: '',
|
|
|
|
|
|
data: {
|
|
|
|
|
|
resultType: 'table',
|
|
|
|
|
|
result: [{
|
|
|
|
|
|
appCategory: 'aaa',
|
|
|
|
|
|
uniqApps: 'bbb',
|
|
|
|
|
|
bytes: '1337678073',
|
|
|
|
|
|
packets: '1687757',
|
|
|
|
|
|
sessions: '28307',
|
|
|
|
|
|
appRisk: 'low'
|
|
|
|
|
|
}, {
|
|
|
|
|
|
appCategory: 'www',
|
|
|
|
|
|
uniqApps: 'uuu',
|
|
|
|
|
|
bytes: '1337678073',
|
|
|
|
|
|
packets: '1687757',
|
|
|
|
|
|
sessions: '28307',
|
|
|
|
|
|
appRisk: 'middle'
|
|
|
|
|
|
}, {
|
|
|
|
|
|
appCategory: 'xxx',
|
|
|
|
|
|
uniqApps: 'zzz',
|
|
|
|
|
|
bytes: '1337678073',
|
|
|
|
|
|
packets: '1687757',
|
|
|
|
|
|
sessions: '28307',
|
|
|
|
|
|
appRisk: 'high'
|
|
|
|
|
|
}
|
|
|
|
|
|
]
|
|
|
|
|
|
},
|
|
|
|
|
|
success: true
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return rlt
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
initTestDataForAppTable (chartParams) {
|
|
|
|
|
|
let rlt = ''
|
|
|
|
|
|
if (chartParams.urlTable.indexOf('app') > -1) {
|
|
|
|
|
|
rlt = {
|
|
|
|
|
|
code: 200,
|
|
|
|
|
|
msg: '',
|
|
|
|
|
|
data: {
|
|
|
|
|
|
resultType: 'table',
|
|
|
|
|
|
result: [{
|
|
|
|
|
|
sessions: '0',
|
|
|
|
|
|
packets: '134',
|
|
|
|
|
|
bytes: '33202',
|
|
|
|
|
|
appName: 'aacccc',
|
|
|
|
|
|
appCategory: 'aaa',
|
|
|
|
|
|
appRisk: 'low'
|
|
|
|
|
|
}, {
|
|
|
|
|
|
sessions: '0',
|
|
|
|
|
|
packets: '134',
|
|
|
|
|
|
bytes: '33202',
|
|
|
|
|
|
appName: 'wwcccc',
|
|
|
|
|
|
appCategory: 'www',
|
|
|
|
|
|
appRisk: 'middle'
|
|
|
|
|
|
}, {
|
|
|
|
|
|
sessions: '0',
|
|
|
|
|
|
packets: '134',
|
|
|
|
|
|
bytes: '33202',
|
|
|
|
|
|
appName: 'xxcccc',
|
|
|
|
|
|
appCategory: 'xxx',
|
|
|
|
|
|
appRisk: 'high'
|
|
|
|
|
|
}
|
|
|
|
|
|
]
|
|
|
|
|
|
},
|
|
|
|
|
|
success: true
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return rlt
|
|
|
|
|
|
},
|
|
|
|
|
|
|
2021-07-10 11:18:40 +08:00
|
|
|
|
initEchartsWithPieTable (chartParams) {
|
2021-07-07 18:33:05 +08:00
|
|
|
|
const self = this
|
2021-07-07 15:51:52 +08:00
|
|
|
|
chartParams.valueColumn = this.orderPieTable
|
2021-07-21 22:46:08 +08:00
|
|
|
|
const unitType = getUnitType(chartParams.valueColumn)
|
2021-10-13 20:01:29 +08:00
|
|
|
|
const queryParams = { ...this.queryTimeRange, limit: 10, order: this.orderPieTable, ...this.entity } // 统计数据的查询参数
|
|
|
|
|
|
const tableQueryParams = { ...this.queryTimeRange, limit: 10, order: this.orderPieTable, ...this.entity } // 统计数据的查询参数
|
2021-12-21 10:52:30 +08:00
|
|
|
|
tableQueryParams[chartParams.nameColumn] = [] // 处理两个图表不一样的地方)
|
2021-07-07 15:51:52 +08:00
|
|
|
|
get(replaceUrlPlaceholder(chartParams.url, queryParams)).then(response => {
|
2021-12-21 10:52:30 +08:00
|
|
|
|
// app:测试数据生成,如接口可正常返回数据后,删除即可
|
|
|
|
|
|
response = this.initTestDataForApp(chartParams)
|
|
|
|
|
|
|
2021-07-07 15:51:52 +08:00
|
|
|
|
if (response.code === 200) {
|
2021-08-15 15:49:29 +08:00
|
|
|
|
if (this.$_.isEmpty(response.data.result)) {
|
|
|
|
|
|
this.noData = true
|
|
|
|
|
|
return
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.noData = false
|
|
|
|
|
|
}
|
2021-08-15 18:53:27 +08:00
|
|
|
|
const allZero = this.timeLineIsAllZero(response.data)
|
2021-08-15 15:49:29 +08:00
|
|
|
|
if (allZero) {
|
|
|
|
|
|
this.chartOption.yAxis = {
|
|
|
|
|
|
...this.chartOption.yAxis,
|
|
|
|
|
|
min: 0,
|
|
|
|
|
|
max: 5,
|
|
|
|
|
|
interval: 1
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-07-14 22:06:56 +08:00
|
|
|
|
const data = response.data.result.map(d => {
|
2021-07-08 10:18:16 +08:00
|
|
|
|
tableQueryParams[chartParams.nameColumn].push(d[chartParams.nameColumn])
|
2021-07-07 15:51:52 +08:00
|
|
|
|
return {
|
|
|
|
|
|
data: d,
|
|
|
|
|
|
name: d[chartParams.nameColumn],
|
2021-07-21 22:46:08 +08:00
|
|
|
|
value: parseInt(d[chartParams.valueColumn]),
|
|
|
|
|
|
unitType: unitType
|
2021-07-07 15:51:52 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
2021-07-23 11:39:10 +08:00
|
|
|
|
this.allSelectPieChartName = tableQueryParams[chartParams.nameColumn]
|
2021-07-14 22:06:56 +08:00
|
|
|
|
this.chartOption.series[0].data = data
|
2021-07-07 15:51:52 +08:00
|
|
|
|
if (this.chartOption.series[0].data && this.chartOption.series[0].data.length > 10) { // pieWithTable 图例超过10个改为滚动显示
|
|
|
|
|
|
this.chartOption.legend.type = 'scroll'
|
|
|
|
|
|
}
|
|
|
|
|
|
this.myChart.setOption(this.chartOption)
|
2021-08-09 13:38:32 +08:00
|
|
|
|
if (!this.$_.isEmpty(data)) {
|
|
|
|
|
|
get(replaceUrlPlaceholder(chartParams.urlTable, tableQueryParams)).then(response2 => {
|
2021-12-21 10:52:30 +08:00
|
|
|
|
// app:测试数据生成,如接口可正常返回数据后,删除即可
|
|
|
|
|
|
response2 = this.initTestDataForAppTable(chartParams)
|
|
|
|
|
|
|
2021-08-09 13:38:32 +08:00
|
|
|
|
if (response2.code === 200) {
|
|
|
|
|
|
this.pieTableData = response2.data.result
|
2021-08-26 17:14:51 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
this.isError = true
|
|
|
|
|
|
this.noData = true
|
|
|
|
|
|
this.errorInfo = response.msg || response.message || 'Unknown'
|
|
|
|
|
|
}
|
2021-08-09 13:38:32 +08:00
|
|
|
|
})
|
|
|
|
|
|
}
|
2021-08-26 17:14:51 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
this.isError = true
|
|
|
|
|
|
this.noData = true
|
|
|
|
|
|
this.errorInfo = response.msg || response.message || 'Unknown'
|
2021-07-07 15:51:52 +08:00
|
|
|
|
}
|
2021-08-13 18:57:49 +08:00
|
|
|
|
}).finally(() => {
|
2021-09-08 21:29:12 +08:00
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
this.loading = false
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.echartsResize()
|
|
|
|
|
|
})
|
|
|
|
|
|
}, 250)
|
2021-07-07 15:51:52 +08:00
|
|
|
|
})
|
2021-07-14 22:06:56 +08:00
|
|
|
|
// legend点击事件
|
2021-07-23 10:22:47 +08:00
|
|
|
|
this.myChart.off('legendselectchanged')
|
2021-07-10 12:30:06 +08:00
|
|
|
|
this.myChart.on('legendselectchanged', function (params) {
|
|
|
|
|
|
self.myChart.setOption({
|
|
|
|
|
|
legend: { selected: { [params.name]: true } }
|
|
|
|
|
|
})
|
2021-07-23 10:11:09 +08:00
|
|
|
|
const index = self.chartOption.series[0].data.findIndex(d => d.name === params.name)
|
|
|
|
|
|
if (self.selectPieChartName !== params.name) {
|
|
|
|
|
|
self.myChart.dispatchAction({
|
|
|
|
|
|
type: 'select',
|
|
|
|
|
|
seriesIndex: 0,
|
|
|
|
|
|
dataIndex: index
|
|
|
|
|
|
})
|
|
|
|
|
|
self.selectPieChartName = params.name
|
|
|
|
|
|
self.loadPieTableData(params.name)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
self.myChart.dispatchAction({
|
|
|
|
|
|
type: 'unselect',
|
|
|
|
|
|
seriesIndex: 0,
|
|
|
|
|
|
dataIndex: index
|
|
|
|
|
|
})
|
|
|
|
|
|
self.selectPieChartName = ''
|
|
|
|
|
|
self.loadPieTableData(this.allSelectPieChartName)
|
|
|
|
|
|
}
|
2021-07-10 12:30:06 +08:00
|
|
|
|
})
|
2021-07-14 22:06:56 +08:00
|
|
|
|
// 饼图色块点击事件
|
2021-07-23 10:22:47 +08:00
|
|
|
|
this.myChart.off('click')
|
2021-07-07 15:51:52 +08:00
|
|
|
|
this.myChart.on('click', function (echartParams) {
|
2021-07-21 22:46:08 +08:00
|
|
|
|
// 若是已选,则点击后取消选择,并查询全部数据
|
|
|
|
|
|
if (echartParams.name === self.selectPieChartName) {
|
|
|
|
|
|
self.selectPieChartName = ''
|
2021-07-23 10:11:09 +08:00
|
|
|
|
self.loadPieTableData(this.allSelectPieChartName)
|
2021-07-21 22:46:08 +08:00
|
|
|
|
} else { // 否则查询当前name数据
|
|
|
|
|
|
self.selectPieChartName = echartParams.name
|
|
|
|
|
|
self.loadPieTableData(echartParams.name)
|
|
|
|
|
|
}
|
2021-07-14 22:06:56 +08:00
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
loadPieTableData (name = '') {
|
2021-10-13 20:01:29 +08:00
|
|
|
|
const childrenParams = { ...this.queryTimeRange, limit: 10, order: this.orderPieTable, ...this.entity }
|
2021-07-14 22:06:56 +08:00
|
|
|
|
childrenParams[this.chartInfo.params.nameColumn] = name
|
|
|
|
|
|
get(replaceUrlPlaceholder(this.chartInfo.params.urlTable, childrenParams)).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
this.pieTableData = response.data.result
|
2021-07-07 15:51:52 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
2021-07-09 21:58:49 +08:00
|
|
|
|
tableLimitChange () {
|
2021-07-14 15:40:05 +08:00
|
|
|
|
const chartParams = this.chartInfo.params || null // 图表参数
|
2021-07-07 18:47:52 +08:00
|
|
|
|
this.initChartTable(chartParams)
|
|
|
|
|
|
},
|
|
|
|
|
|
initChartTable (chartParams) {
|
2021-10-13 20:01:29 +08:00
|
|
|
|
const queryParams = { ...this.queryTimeRange, limit: this.table.limit, order: this.table.orderBy, ...this.entity }
|
2021-07-07 18:47:52 +08:00
|
|
|
|
get(replaceUrlPlaceholder(chartParams.url, queryParams)).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
2021-08-15 15:49:29 +08:00
|
|
|
|
if (this.$_.isEmpty(response.data.result)) {
|
|
|
|
|
|
this.noData = true
|
|
|
|
|
|
return
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.noData = false
|
|
|
|
|
|
}
|
2021-07-07 18:47:52 +08:00
|
|
|
|
this.table.tableData = response.data.result
|
2021-08-09 13:38:32 +08:00
|
|
|
|
this.table.tableColumns = this.getTableTitle(response.data.result)
|
2021-07-07 18:47:52 +08:00
|
|
|
|
this.table.currentPageData = this.getTargetPageData(1, this.table.pageSize, this.table.tableData)
|
2021-08-26 17:14:51 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
this.isError = true
|
|
|
|
|
|
this.noData = true
|
2021-08-27 17:11:58 +08:00
|
|
|
|
this.errorInfo = response.msg || response.message || this.$t('tip.unknownError')
|
2021-07-07 18:47:52 +08:00
|
|
|
|
}
|
2021-08-13 18:57:49 +08:00
|
|
|
|
}).finally(() => {
|
2021-08-27 15:08:37 +08:00
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.$refs.tablePagination.resetPageNo()
|
|
|
|
|
|
})
|
2021-08-13 18:57:49 +08:00
|
|
|
|
setTimeout(() => { this.loading = false }, 250)
|
2021-07-07 18:47:52 +08:00
|
|
|
|
})
|
2021-08-13 09:39:02 +08:00
|
|
|
|
},
|
2021-12-06 21:12:04 +08:00
|
|
|
|
|
|
|
|
|
|
activeIpTableLimitChange () {
|
|
|
|
|
|
const chartParams = this.chartInfo.params || null // 图表参数
|
|
|
|
|
|
this.initChartActiveIpTable(chartParams)
|
|
|
|
|
|
},
|
|
|
|
|
|
initChartActiveIpTable (chartParams) {
|
|
|
|
|
|
const queryParams = { ...this.queryTimeRange, order: this.activeIpTable.orderBy, ...this.entity }
|
|
|
|
|
|
get(replaceUrlPlaceholder(chartParams.url, queryParams)).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
if (this.$_.isEmpty(response.data.result)) {
|
|
|
|
|
|
this.noData = true
|
|
|
|
|
|
return
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.noData = false
|
|
|
|
|
|
}
|
|
|
|
|
|
this.activeIpTable.tableData = response.data.result
|
|
|
|
|
|
this.activeIpTable.tableColumns = this.getTableTitle(response.data.result)
|
|
|
|
|
|
this.activeIpTable.currentPageData = this.getTargetPageData(1, this.activeIpTable.pageSize, this.activeIpTable.tableData)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.isError = true
|
|
|
|
|
|
this.noData = true
|
|
|
|
|
|
this.errorInfo = response.msg || response.message || this.$t('tip.unknownError')
|
|
|
|
|
|
}
|
|
|
|
|
|
}).finally(() => {
|
|
|
|
|
|
setTimeout(() => { this.loading = false }, 250)
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
2021-08-13 09:39:02 +08:00
|
|
|
|
echartsResize () {
|
2021-09-03 14:30:35 +08:00
|
|
|
|
this.myChart && this.myChart.resize()
|
2021-10-13 19:06:24 +08:00
|
|
|
|
this.myChart2 && this.myChart2.resize()
|
2021-07-07 18:47:52 +08:00
|
|
|
|
}
|
2021-06-20 13:31:55 +08:00
|
|
|
|
},
|
|
|
|
|
|
computed: {
|
|
|
|
|
|
computePosition () {
|
|
|
|
|
|
const gridColumn = `${this.chartInfo.x} / ${this.chartInfo.x + this.chartInfo.w}`
|
|
|
|
|
|
const gridRow = `${this.chartInfo.y} / ${this.chartInfo.y + this.chartInfo.h}`
|
|
|
|
|
|
return {
|
|
|
|
|
|
gridColumn,
|
|
|
|
|
|
gridRow
|
|
|
|
|
|
}
|
2021-07-13 18:38:32 +08:00
|
|
|
|
},
|
2021-09-18 17:48:52 +08:00
|
|
|
|
location () {
|
|
|
|
|
|
let location = ''
|
2021-09-22 09:08:21 +08:00
|
|
|
|
if (this.detailData) {
|
|
|
|
|
|
if (this.detailData.country) {
|
|
|
|
|
|
location = this.detailData.country
|
|
|
|
|
|
if (this.detailData.region) {
|
|
|
|
|
|
location += ', '
|
|
|
|
|
|
location += this.detailData.region
|
|
|
|
|
|
}
|
|
|
|
|
|
} else if (this.detailData.region) {
|
|
|
|
|
|
location = this.detailData.region
|
2021-09-18 17:48:52 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return location
|
|
|
|
|
|
},
|
2021-07-13 18:38:32 +08:00
|
|
|
|
handleSingleValue () {
|
2021-07-20 18:58:55 +08:00
|
|
|
|
const value = this.singleValue.value
|
2021-07-21 22:46:08 +08:00
|
|
|
|
const unitType = this.chartInfo.params.unitType
|
|
|
|
|
|
const result = unitConvert(value, unitType)
|
|
|
|
|
|
switch (unitType) {
|
2021-08-26 19:56:04 +08:00
|
|
|
|
case unitTypes.percent: {
|
2021-07-21 22:46:08 +08:00
|
|
|
|
result[0] = result[0] < 0.01 ? '< 0.01' : result[0]
|
|
|
|
|
|
break
|
|
|
|
|
|
}
|
|
|
|
|
|
case unitTypes.time: {
|
|
|
|
|
|
result[0] = result[0] < 1 ? '< 1' : result[0]
|
|
|
|
|
|
break
|
2021-07-14 15:40:05 +08:00
|
|
|
|
}
|
2021-07-21 22:46:08 +08:00
|
|
|
|
default: break
|
2021-07-13 18:38:32 +08:00
|
|
|
|
}
|
2021-07-21 22:46:08 +08:00
|
|
|
|
return result
|
2021-06-20 13:31:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
mounted () {
|
|
|
|
|
|
this.initChart()
|
2021-08-13 09:39:02 +08:00
|
|
|
|
this.throttle = this.$_.throttle(this.echartsResize, 500)
|
|
|
|
|
|
window.addEventListener('resize', this.throttle)
|
2021-06-20 13:31:55 +08:00
|
|
|
|
},
|
2021-07-09 21:58:49 +08:00
|
|
|
|
watch: {
|
|
|
|
|
|
chart: {
|
|
|
|
|
|
immediate: true,
|
|
|
|
|
|
deep: true,
|
|
|
|
|
|
handler (n, o) {
|
|
|
|
|
|
if (o) {
|
|
|
|
|
|
this.initChart()
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-07-22 18:30:45 +08:00
|
|
|
|
},
|
|
|
|
|
|
timeFilter: {
|
|
|
|
|
|
immediate: true,
|
|
|
|
|
|
deep: true,
|
|
|
|
|
|
handler (n, o) {
|
2021-08-02 13:22:15 +08:00
|
|
|
|
if (n && o) {
|
2021-10-13 20:01:29 +08:00
|
|
|
|
this.standaloneTimeRange.use = false
|
2021-07-22 18:30:45 +08:00
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.initChart()
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-09-24 19:24:25 +08:00
|
|
|
|
},
|
|
|
|
|
|
parentData: {
|
|
|
|
|
|
immediate: true,
|
|
|
|
|
|
deep: true,
|
|
|
|
|
|
handler (n, o) {
|
|
|
|
|
|
if (n) {
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.initChart()
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-07-09 21:58:49 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2021-06-20 13:31:55 +08:00
|
|
|
|
setup (props) {
|
|
|
|
|
|
const chartInfo = JSON.parse(JSON.stringify(props.chart))
|
|
|
|
|
|
chartInfo.category = getTypeCategory(props.chart.type)
|
2022-01-03 22:46:22 +08:00
|
|
|
|
|
|
|
|
|
|
const dateRangeValue = 60
|
|
|
|
|
|
const { startTime, endTime } = getNowTime(dateRangeValue)
|
|
|
|
|
|
// entity详情内的chart时间工具不是公共的,需要单独定义
|
|
|
|
|
|
const chartTimeFilter = ref({ startTime, endTime, dateRangeValue })
|
2021-06-20 13:31:55 +08:00
|
|
|
|
return {
|
|
|
|
|
|
chartInfo,
|
2022-01-03 22:46:22 +08:00
|
|
|
|
chartTimeFilter,
|
2021-06-20 13:31:55 +08:00
|
|
|
|
layoutConstant,
|
2021-06-21 20:33:39 +08:00
|
|
|
|
chartTableTopOptions,
|
2021-12-06 21:12:04 +08:00
|
|
|
|
chartActiveIpTableOrderOptions,
|
2021-07-07 15:51:52 +08:00
|
|
|
|
chartPieTableTopOptions,
|
2021-06-20 13:31:55 +08:00
|
|
|
|
isEcharts: isEcharts(props.chart.type),
|
2021-12-13 10:18:27 +08:00
|
|
|
|
isEchartsTimeBar: isEchartsTimeBar(props.chart.type),
|
|
|
|
|
|
isEchartsCategoryBar: isEchartsCategoryBar(props.chart.type),
|
2021-06-22 21:19:04 +08:00
|
|
|
|
isEchartsWithTable: isEchartsWithTable(props.chart.type),
|
2021-07-05 22:58:12 +08:00
|
|
|
|
isEchartsWithStatistics: isEchartsWithStatistics(props.chart.type),
|
2021-06-20 13:31:55 +08:00
|
|
|
|
isSingleValue: isSingleValue(props.chart.type),
|
2021-08-06 15:03:30 +08:00
|
|
|
|
isSingleValueWithEcharts: isSingleValueWithEcharts(props.chart.type),
|
2021-08-17 17:56:09 +08:00
|
|
|
|
isRelationShip: isRelationShip(props.chart.type),
|
2021-06-20 13:31:55 +08:00
|
|
|
|
isTable: isTable(props.chart.type),
|
2021-12-06 21:12:04 +08:00
|
|
|
|
isActiveIpTable: isActiveIpTable(props.chart.type),
|
2021-06-24 17:59:51 +08:00
|
|
|
|
isMap: isMap(props.chart.type),
|
2021-06-25 19:11:00 +08:00
|
|
|
|
isTitle: isTitle(props.chart.type),
|
2021-06-24 17:59:51 +08:00
|
|
|
|
isMapLine: isMapLine(props.chart.type),
|
2021-07-10 12:11:59 +08:00
|
|
|
|
isMapBlock: isMapBlock(props.chart.type),
|
2021-07-01 21:39:10 +08:00
|
|
|
|
isTabs: isTabs(props.chart.type),
|
2021-09-16 21:19:48 +08:00
|
|
|
|
isGroup: isGroup(props.chart.type),
|
2022-01-03 22:46:22 +08:00
|
|
|
|
isBlock: isBlock(props.chart.type),
|
2021-09-18 17:48:52 +08:00
|
|
|
|
isSankey: isSankey(props.chart.type),
|
|
|
|
|
|
isIpBasicInfo: isIpBasicInfo(props.chart.type),
|
|
|
|
|
|
isIpHostedDomain: isIpHostedDomain(props.chart.type),
|
|
|
|
|
|
isIpOpenPort: isIpOpenPort(props.chart.type),
|
2021-09-22 23:05:18 +08:00
|
|
|
|
isDomainWhois: isDomainWhois(props.chart.type),
|
|
|
|
|
|
isDomainDnsRecord: isDomainDnsRecord(props.chart.type),
|
2021-12-14 07:38:09 +08:00
|
|
|
|
isCryptocurrencyEventList: isCryptocurrencyEventList(props.chart.type),
|
2021-09-22 23:05:18 +08:00
|
|
|
|
isAppBasicInfo: isAppBasicInfo(props.chart.type),
|
|
|
|
|
|
isAppRelatedDomain: isAppRelatedDomain(props.chart.type),
|
2021-07-05 22:58:12 +08:00
|
|
|
|
layout: getLayout(props.chart.type),
|
2021-09-24 19:24:25 +08:00
|
|
|
|
myChart: shallowRef(null),
|
|
|
|
|
|
myChart2: shallowRef(null) // 个别有两个图表的chart
|
2021-06-20 13:31:55 +08:00
|
|
|
|
}
|
2021-08-13 09:39:02 +08:00
|
|
|
|
},
|
|
|
|
|
|
unmounted () {
|
|
|
|
|
|
window.removeEventListener('resize', this.throttle)
|
2021-06-20 13:31:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|