diff --git a/src/assets/css/components/index.scss b/src/assets/css/components/index.scss index 5101930a..0139fabf 100644 --- a/src/assets/css/components/index.scss +++ b/src/assets/css/components/index.scss @@ -69,4 +69,6 @@ @import 'views/charts2/dnsTrafficLine'; @import 'views/charts2/dnsRecentEvents'; @import 'views/charts2/dnsActiveMaliciousDomain'; +@import 'views/charts2/dnsEventChart'; +@import './views/charts2/dnsEventChartByPie'; //@import '../chart'; diff --git a/src/assets/css/components/views/charts2/dnsEventChart.scss b/src/assets/css/components/views/charts2/dnsEventChart.scss new file mode 100644 index 00000000..7c3987fe --- /dev/null +++ b/src/assets/css/components/views/charts2/dnsEventChart.scss @@ -0,0 +1,19 @@ +.dns-event-chart { + width: 100%; + height: 100%; + border: 1px solid #E2E5EC; + border-radius: 4px; + display: flex; + justify-content: space-between; + + .dns-event-chart-pie { + width: 33%; + height: 100%; + } + + .dns-event-chart-bar { + width: 67%; + height: 100%; + } + +} diff --git a/src/assets/css/components/views/charts2/dnsEventChartByPie.scss b/src/assets/css/components/views/charts2/dnsEventChartByPie.scss new file mode 100644 index 00000000..f0b7f3c5 --- /dev/null +++ b/src/assets/css/components/views/charts2/dnsEventChartByPie.scss @@ -0,0 +1,34 @@ +.dns-event { + position: relative; + width: 100%; + height: 100%; + border: none; + + .dns-event-pie { + width: 100%; + height: 100%; + border-radius: 4px; + display: flex; + border: none; + + .dns-event-pies { + height: 100%; + width: 100%; + display: flex; + align-items: center; + + .chart-drawing { + height: 100%; + width: 50%; + } + + .color-block { + width: 8px; + height: 8px; + margin-right: 8px; + margin-top: 3px; + } + } + } +} + diff --git a/src/mock/dns.js b/src/mock/dns.js index 39407cde..47c4f3e7 100644 --- a/src/mock/dns.js +++ b/src/mock/dns.js @@ -36,4 +36,40 @@ if (openMock) { } } }) + Mock.mock(new RegExp(BASE_CONFIG.baseUrl + 'interface/dnsInsight/eventChart.*'), 'get', function (requestObj) { + const data = [] + for (let i = 0; i < 2; i++) { + data.push({ + type: '', + analysis: { + sum: 0 + }, + values: [] + }) + } + data[0].type = 'performanceEvent' + data[1].type = 'securityEvent' + + let num = 1435781430781 + for (let i = 0; i < 16; i++) { + num += 5 * 60 * 1000 + data[0].values.push([ + num, Math.floor(Math.random() * 50) + 10 + ]) + data[1].values.push([ + num, Math.floor(Math.random() * 10) + 2 + ]) + } + + data[0].analysis.sum = Math.floor(Math.random() * 800) + 160 + data[1].analysis.sum = Math.floor(Math.random() * 160) + 32 + + return { + msg: 'success', + code: 200, + data: { + result: data + } + } + }) } diff --git a/src/utils/api.js b/src/utils/api.js index ee047f04..4111415e 100644 --- a/src/utils/api.js +++ b/src/utils/api.js @@ -204,7 +204,8 @@ export const api = { dnsInsight: { recentEvents: '/interface/dnsInsight/recentEvents', activeMaliciousDomain: '/interface/dnsInsight/activeMaliciousDomain', - totalTrafficAnalysis: '/interface/dns/overview/totalTrafficAnalysis' + totalTrafficAnalysis: '/interface/dns/overview/totalTrafficAnalysis', + eventChart: '/interface/dnsInsight/eventChart' } } diff --git a/src/utils/constants.js b/src/utils/constants.js index 3f946575..b31e3a49 100644 --- a/src/utils/constants.js +++ b/src/utils/constants.js @@ -805,6 +805,8 @@ export const chartColor3 = ['#00A7AB', '#7FA054', '#35ADDA', '#E48F3E', '#9FBC1D export const chartColor4 = ['#E5F6F6', '#F2F6EE', '#EBF7FC', '#FCF4EB', '#9FBC1D', '#F5F1F5'] export const chartColor5 = ['#E26154', '#E7B34E', '#88AF65'] +export const chartColor6 = ['#E99F67', '#D9C74B'] + export const iso36112 = { [storageKey.iso36112Capital]: 'data/countriesWithCapital', [storageKey.iso36112WorldLow]: 'worldChinaLow', diff --git a/src/views/charts2/charts/dnsInsight/DnsActiveMaliciousDomain.vue b/src/views/charts2/charts/dnsInsight/DnsActiveMaliciousDomain.vue index ea784b30..8670f4d3 100644 --- a/src/views/charts2/charts/dnsInsight/DnsActiveMaliciousDomain.vue +++ b/src/views/charts2/charts/dnsInsight/DnsActiveMaliciousDomain.vue @@ -124,10 +124,8 @@ export default { type: this.tableType, severity: this.tableSeverity } - console.log('DnsActiveMaliciousDomain.vue--initData--请求入参', this.timeFilter) get(api.dnsInsight.activeMaliciousDomain, params).then(res => { - console.log('DnsActiveMaliciousDomain.vue--initData--初始化数据', res.data) if (res.code === 200) { const data = res.data.result if (!data || data.length === 0) { diff --git a/src/views/charts2/charts/dnsInsight/DnsEventChartByBar.vue b/src/views/charts2/charts/dnsInsight/DnsEventChartByBar.vue new file mode 100644 index 00000000..fccaee40 --- /dev/null +++ b/src/views/charts2/charts/dnsInsight/DnsEventChartByBar.vue @@ -0,0 +1,99 @@ + + + diff --git a/src/views/charts2/charts/dnsInsight/DnsEventChartByPie.vue b/src/views/charts2/charts/dnsInsight/DnsEventChartByPie.vue new file mode 100644 index 00000000..069476cb --- /dev/null +++ b/src/views/charts2/charts/dnsInsight/DnsEventChartByPie.vue @@ -0,0 +1,151 @@ + + + diff --git a/src/views/charts2/charts/options/echartOption.js b/src/views/charts2/charts/options/echartOption.js index 43f8c20b..b7c2b25a 100644 --- a/src/views/charts2/charts/options/echartOption.js +++ b/src/views/charts2/charts/options/echartOption.js @@ -4,6 +4,7 @@ import { chartColor2, chartColor3, chartColor5, + chartColor6, unitTypes } from '@/utils/constants' import unitConvert from '@/utils/unit-convert' @@ -376,3 +377,68 @@ export const trafficLineChartOption = { } ] } + +export const stackedBarChartOption = { + color: chartColor6, + legend: { + show: false + }, + tooltip: { + trigger: 'axis', + axisPointer: { + barWidth: 26, + type: 'shadow' // 'shadow' as default; can also be 'line' or 'shadow' + } + }, + grid: { + top: '12%', + left: '2%', + right: '2%', + bottom: 24, + containLabel: true + }, + xAxis: { + type: 'time', + boundaryGap: ['1%', '3%'], + splitNumber: 12, + axisLine: { + show: false + }, + axisTick: { + show: false + }, + axisLabel: { + margin: 12, + formatter: function (value) { + const data = new Date(value) + const h = data.getHours() > 9 ? data.getHours() : '0' + data.getHours() + const m = data.getMinutes() > 9 ? data.getMinutes() : '0' + data.getMinutes() + return h + ':' + m + } + } + }, + yAxis: { + type: 'value', + splitLine: { + show: true, + lineStyle: { + color: '#ECECEC' + } + }, + axisLabel: { + margin: 20 + } + }, + series: [ + { + data: [], + stack: 'total', + type: 'bar', + name: '', + emphasis: { + focus: 'series' + }, + barWidth: 26 + } + ] +}