This commit is contained in:
zhangxiaolong
2022-03-22 11:09:13 +08:00
49 changed files with 1699 additions and 634 deletions

View File

@@ -352,9 +352,9 @@ export default {
ChartAlarmInfo,
ChartDomainRecursiveResolve
},
data() {
data () {
return {
tabHandleClickType: '',
tabHandleClickType: ''
}
},
props: {
@@ -374,7 +374,7 @@ export default {
tabHandleClickType: String
},
computed: {
isNoData() {
isNoData () {
return (
!this.loading &&
(_.isEmpty(this.chartData) || this.isError) &&
@@ -389,47 +389,47 @@ export default {
!this.isAlarmInfo
)
},
chartOption() {
chartOption () {
if (this.customChartOption) {
return _.cloneDeep(this.customChartOption)
} else {
return getOption(this.chartInfo.type)
}
},
}
},
methods: {
resize() {
resize () {
this.$refs['chart' + this.chartInfo.id] &&
this.$refs['chart' + this.chartInfo.id].resize()
},
showLoading(show) {
showLoading (show) {
this.$emit('showLoading', show)
},
getAlarmInfo(url, extraParams, isRefresh, timeFilter) {
getAlarmInfo (url, extraParams, isRefresh, timeFilter) {
this.$emit('getChartData', url, extraParams, isRefresh, timeFilter)
},
getChartData(url, extraParams) {
getChartData (url, extraParams) {
this.$emit('getChartData', url, extraParams)
},
initEchartsWithTable() {
initEchartsWithTable () {
this.$refs['chart' + this.chartInfo.id] &&
this.$refs['chart' + this.chartInfo.id].initEchartsWithTable(
`chart${this.chartInfo.id}`,
`chart${this.chartInfo.id}`
)
},
query(params) {
query (params) {
this.$emit('query', params)
},
}
},
watch: {
tabHandleClickType: {
deep: true,
handler(n) {
handler (n) {
this.tabHandleClickType = n
},
}
}
},
setup(props) {
setup (props) {
return {
isEcharts: isEcharts(props.chartInfo.type),
isEchartsLine: isEchartsLine(props.chartInfo.type),
@@ -442,7 +442,7 @@ export default {
isSingleValue: isSingleValue(props.chartInfo.type),
isSingleValueWithEcharts: isSingleValueWithEcharts(props.chartInfo.type),
isSingleValueWithEchartsTemp: isSingleValueWithEchartsTemp(
props.chartInfo.type,
props.chartInfo.type
),
isRelationShip: isRelationShip(props.chartInfo.type),
isTable: isTable(props.chartInfo.type),

View File

@@ -236,7 +236,7 @@ import {
isBasicTable,
isGroup,
isEchartsWithTable,
isAlarmInfo,
isAlarmInfo
} from './charts/tools'
import ChartError from '@/views/charts/ChartError'
import { getNowTime } from '@/utils/date-util'
@@ -246,7 +246,7 @@ import {
chartActiveIpTableOrderOptions,
chartPieTableTopOptions,
eventSeverity,
chartTableColumnMapping,
chartTableColumnMapping
} from '@/utils/constants'
export default {
@@ -255,19 +255,19 @@ export default {
chartInfo: Object,
errorInfo: {
type: String,
default: '',
default: ''
},
isError: {
type: Boolean,
default: false,
default: false
},
table: Object,
orderPieTable: Object,
orderPieTable: Object
},
components: {
ChartError,
ChartError
},
data() {
data () {
return {
chartTableColumnMapping,
dropdownMenuShow: false,
@@ -280,37 +280,37 @@ export default {
tableData: [
{
name: '192.168.20.21',
num: 111,
num: 111
},
{
name: '192.168.20.22',
num: 345,
num: 345
},
{
name: '192.168.20.23',
num: 111,
num: 111
},
{
name: '192.168.20.24',
num: 345,
num: 345
},
{
name: '192.168.20.25',
num: 111,
num: 111
},
{
name: '192.168.20.26',
num: 345,
},
], // table的所有数据
},
num: 345
}
] // table的所有数据
}
}
},
methods: {
refresh() {
refresh () {
this.$emit('refresh')
},
timeRefreshChange() {
timeRefreshChange () {
// 不是自选时间
if (!this.$refs.dateTimeRange.isCustom) {
const value = this.chartTimeFilter.dateRangeValue
@@ -319,26 +319,26 @@ export default {
this.$emit('refresh', this.chartTimeFilter)
}
},
reload(s, e, v) {
reload (s, e, v) {
this.dateTimeRangeChange(s, e, v)
},
groupShow() {
groupShow () {
this.$emit('groupShow', this.chartInfo)
},
dateTimeRangeChange(s, e, v) {
dateTimeRangeChange (s, e, v) {
this.chartTimeFilter = { startTime: s, endTime: e, dateRangeValue: v }
this.$emit('refresh', this.chartTimeFilter)
},
tableLimitChange() {
tableLimitChange () {
this.$emit('tableChange')
},
activeIpTableLimitChange() {
activeIpTableLimitChange () {
this.$emit('tableChange')
},
orderPieTableChange() {
orderPieTableChange () {
this.$emit('orderPieTableChange', this.orderPieTable)
},
tabHandleClick(item) {
tabHandleClick (item) {
this.isFocus = item
if (item === 'All') {
this.isFocusAll = true
@@ -346,24 +346,24 @@ export default {
this.isFocusAll = false
}
this.$emit('tabHandleClick', item)
},
}
},
watch: {
isFocus: {
deep: true,
handler(n) {},
},
handler (n) {}
}
},
computed: {
showRefreshButton() {
showRefreshButton () {
// 自己是group且父元素是block时不显示刷新按钮
// TODO 父元素是block且只有自己一个子元素时不显示刷新按钮
const isGroupAndParentIsBlock =
this.$_.get(this.chartInfo.parent, 'type') === 95 && this.isGroup
return !isGroupAndParentIsBlock
},
}
},
setup(props) {
setup (props) {
const dateRangeValue = 60
const { startTime, endTime } = getNowTime(dateRangeValue)
// entity详情内的chart时间工具不是公共的需要单独定义
@@ -382,8 +382,8 @@ export default {
isActiveIpTable: isActiveIpTable(props.chartInfo.type),
isEchartsWithTable: isEchartsWithTable(props.chartInfo.type),
isGroup: isGroup(props.chartInfo.type),
isAlarmInfo: isAlarmInfo(props.chartInfo.type),
isAlarmInfo: isAlarmInfo(props.chartInfo.type)
}
},
}
}
</script>

View File

@@ -181,10 +181,10 @@ export default {
this.queryTimeRange = { startTime: getSecond(this.chartTimeFilter.startTime), endTime: getSecond(this.chartTimeFilter.endTime) }
}
const chartParams = this.chartInfo.params
if(isAlarmInfo && JSON.stringify(extraParams) === '{}'){
if (isAlarmInfo && JSON.stringify(extraParams) === '{}') {
extraParams = {
pageNo : 1,
pageSize : 9
pageNo: 1,
pageSize: 9
}
}
// 接口查询参数
@@ -426,7 +426,7 @@ export default {
isCryptocurrencyEventList: isCryptocurrencyEventList(props.chartInfo.type),
isAppBasicInfo: isAppBasicInfo(props.chartInfo.type),
isAppRelatedDomain: isAppRelatedDomain(props.chartInfo.type),
isAlarmInfo:isAlarmInfo(props.chartInfo.type)
isAlarmInfo: isAlarmInfo(props.chartInfo.type)
}
}
}

View File

@@ -28,7 +28,7 @@
v-for="(c, i) in table.tableColumns"
show-overflow-tooltip
:key="i"
:label="$t(chartTableOrderOptionsMapping[c])"
:label="c"
:prop="c"
>
<template #default="{ row }">

View File

@@ -119,16 +119,16 @@ export default {
chartInfo: Object,
chartData: [Array, Object],
tabHandleClickType: String,
queryParams: Object,
queryParams: Object
},
data() {
data () {
return {
pageSizeForAlarm: 9,
eventSeverityColor: eventSeverityColor,
pageNo: 1,
alarmInfoCount: {},
fromChartData: '',
isNoData:false
isNoData: false
// result: [
// {
// entityType: 'ip',
@@ -145,52 +145,52 @@ export default {
}
},
computed: {
isNoData() {
isNoData () {
let isNoData = true
if (!this.$_.isEmpty(this.chartData)) {
isNoData = false
}
return isNoData
},
}
},
watch: {
tabHandleClickType: {
deep: true,
handler(n) {
handler (n) {
this.$nextTick(() => {
this.getData(1, n)
})
},
}
},
alarmInfoCount: {
deep: true,
handler(n) {},
handler (n) {}
},
queryParams: {
deep: true,
handler(n) {
handler (n) {
if (n.startTime && n.endTime) {
this.getCount(1)
}
},
},
}
}
},
components: {
ChartTablePagination,
ChartTablePagination
},
methods: {
unitConvert,
getMillisecond,
getCount() {
let countQuery = {
getCount () {
const countQuery = {
startTime: this.queryParams.startTime,
endTime: this.queryParams.endTime,
eventSeverity:
this.tabHandleClickType === 'All' ? '' : this.tabHandleClickType,
this.tabHandleClickType === 'All' ? '' : this.tabHandleClickType
}
this.$nextTick(() => {
get('/interface/dns/alarmInfoCount', {
...countQuery,
...countQuery
}).then((response) => {
if (response.code === 200) {
this.alarmInfoCount = response.data
@@ -198,7 +198,7 @@ export default {
})
})
},
getData(val, n) {
getData (val, n) {
this.pageNo = val
const extraParams = {
pageNo: val,
@@ -208,30 +208,30 @@ export default {
? ''
: n
: this.tabHandleClickType === 'All'
? ''
: this.tabHandleClickType,
? ''
: this.tabHandleClickType
}
const query = {
startTime: this.queryParams.startTime,
endTime: this.queryParams.endTime,
eventSeverity:
this.tabHandleClickType === 'All' ? '' : this.tabHandleClickType,
this.tabHandleClickType === 'All' ? '' : this.tabHandleClickType
}
this.$emit('getAlarmInfo', null, extraParams, false, {
startTime: query.startTime,
endTime: query.endTime,
endTime: query.endTime
})
get('/interface/dns/alarmInfoCount', {
...query,
...query
}).then((response) => {
if (response.code === 200) {
this.alarmInfoCount = response.data
}
})
},
pageJump(val) {
pageJump (val) {
this.getData(val)
},
},
}
}
}
</script>

View File

@@ -4,9 +4,9 @@
<div style="display: flex; justify-content: space-between; width: 100%;">
<el-descriptions :column="1" style="padding: 20px 30px;">
<el-descriptions-item :label="$t('overall.appName') + ':'">{{$_.get(chartData, "name") || '-'}}</el-descriptions-item>
<el-descriptions-item :label="$t('overall.appFullName') + ':'">{{$_.get(chartData, "allName") || '-'}}</el-descriptions-item>
<el-descriptions-item :label="$t('overall.technology') + ':'">{{$_.get(chartData, "tech") || '-'}}</el-descriptions-item>
<el-descriptions-item :label="$t('overall.remark') + ':'">{{$_.get(chartData, "description") || '-'}}</el-descriptions-item>
<el-descriptions-item :label="$t('overall.appFullName') + ':'">{{$_.get(chartData, "appLongname") || '-'}}</el-descriptions-item>
<el-descriptions-item :label="$t('overall.technology') + ':'">{{$_.get(chartData, "appTechnology") || '-'}}</el-descriptions-item>
<el-descriptions-item :label="$t('overall.remark') + ':'">{{$_.get(chartData, "appDescription") || '-'}}</el-descriptions-item>
</el-descriptions>
<div class="cn-chart__body-single">
<div class="cn-chart__body-single-table">

View File

@@ -38,10 +38,10 @@ export default {
this.handleYaxis()
if (this.isEchartsPie) {
if(chartParams.size && chartParams.size === 'small'){
if (chartParams.size && chartParams.size === 'small') {
this.chartOption.series[0] = {
...this.chartOption.series[0],
radius : ['30%', '45%'],
radius: ['30%', '45%'],
label: {
show: false
},
@@ -51,18 +51,18 @@ export default {
}
this.chartOption.legend = {
...this.chartOption.legend,
left :'60%',
itemGap:5,
itemWidth:8,
itemHeight:8,
left: '60%',
itemGap: 5,
itemWidth: 8,
itemHeight: 8,
formatter: function (name) {
return name.length > 9 ? name.substr(0, 9) + '...' : name
//return echarts.format.truncateText(name, 6, '…');
// return echarts.format.truncateText(name, 6, '…');
},
tooltip: {
show: true
},
textStyle: { //图例文字的样式
textStyle: { // 图例文字的样式
color: '#666666',
fontSize: 12,
fontWeight: 400
@@ -72,23 +72,23 @@ export default {
let otherData = []
this.chartData.sort(reverseSortBy('num'))
if(this.chartData.length>5){
if (this.chartData.length > 5) {
chartDataTmp = this.chartData.slice(0, 5)
chartDataTmp.forEach(data=>{
if(data.name===''){
chartDataTmp.forEach(data => {
if (data.name === '') {
data.name = ' '
}
})
let otherSum = 0
otherData = this.chartData.slice(5)
otherData.forEach(data=>{
otherSum = otherSum+data.num
otherData.forEach(data => {
otherSum = otherSum + data.num
})
chartDataTmp.push({'num':otherSum,'name':'other'})
} else if(this.chartData.length<=5){
chartDataTmp.push({ num: otherSum, name: 'other' })
} else if (this.chartData.length <= 5) {
chartDataTmp = this.chartData.slice(0, this.chartData.length)
chartDataTmp.forEach(data=>{
if(data.name===''){
chartDataTmp.forEach(data => {
if (data.name === '') {
data.name = ' '
}
})
@@ -102,7 +102,7 @@ export default {
unitType: chartParams.unitType ? chartParams.unitType : 'number'
}
})
}else {
} else {
this.chartOption.series[0].data = this.chartData.map(d => {
return {
name: lineToSpace(d.name),

View File

@@ -139,30 +139,30 @@ export default {
props: {
chartInfo: Object,
chartData: [Array, Object],
queryParams: Object,
queryParams: Object
},
data() {
data () {
return {
icon: '',
color: '',
type: 0,
chartOption: null,
timer: null,
timer: null
}
},
watch: {
chartInfo: {
deep: true,
immediate: true,
handler(n) {
handler (n) {
this.icon = n.params.icon
this.color = n.params.color
this.type = n.type
},
},
}
}
},
computed: {
handleSingleValue() {
handleSingleValue () {
const value =
this.$_.isEmpty(this.chartData) || this.$_.get(this, 'chartData')
? this.chartData
@@ -185,7 +185,7 @@ export default {
}
return result
},
singleValueClass() {
singleValueClass () {
return function (type) {
let c
switch (type) {
@@ -214,10 +214,10 @@ export default {
}
return c
}
},
}
},
methods: {
chartSingleValueTotal() {
chartSingleValueTotal () {
const chartParams = this.$_.get(this.chartInfo, 'params') || {}
if (this.type === 52) {
const dom = document.getElementById(`chart${this.chartInfo.id}`)
@@ -234,29 +234,29 @@ export default {
data: r.values.map((v) => [
Number(v[0]) * 1000,
Number(v[1]),
chartParams.unitType,
chartParams.unitType
]),
lineStyle: {
color: getChartColor[i],
},
color: getChartColor[i]
}
}
})
myChart.setOption(this.chartOption)
},
}
)
}
},
}
},
mounted() {
mounted () {
this.$nextTick(
() =>
(this.timer = setTimeout(() => {
this.chartSingleValueTotal()
}, 200)),
}, 200))
)
},
deactivated() {
deactivated () {
clearTimeout(this.timer)
},
}
}
</script>

View File

@@ -37,12 +37,12 @@ export default {
}
}
},
watch:{
pageSizeForAlarm:{
deep:true,
watch: {
pageSizeForAlarm: {
deep: true
},
total:{
deep:true,
total: {
deep: true
}
},
methods: {

View File

@@ -35,13 +35,13 @@ export default {
result: {
doh: {
count: 111,
percent: 0.85,
percent: 0.85
},
dot: {
count: 111,
percent: 80.85,
},
},
percent: 80.85
}
}
}
}
}

View File

@@ -85,14 +85,14 @@ export default {
this.myChart2.setOption(this.chartOption)
this.$store.commit('setChartList', this.$_.cloneDeep(this.myChart2))
}
let _this = this
window.addEventListener("resize", function(){
_this.$store.getters.getChartList.forEach(chart =>{
if(chart){
const _this = this
window.addEventListener('resize', function () {
_this.$store.getters.getChartList.forEach(chart => {
if (chart) {
chart.resize()
}
})
});
})
} finally {
setTimeout(() => {
this.$emit('showLoading', false)

View File

@@ -1,11 +1,9 @@
import unitConvert from '@/utils/unit-convert'
import { unitTypes } from '@/utils/constants'
import { unitTypes, chartColor } from '@/utils/constants'
import {
categoryVerticalFormatter,
chartColor,
getCharBartColor,
timeVerticalFormatter,
tooLongFormatter
timeVerticalFormatter
} from '@/views/charts/charts/tools'
export const ipOpenPortBar = {

View File

@@ -223,16 +223,16 @@ export function getLayout (type) {
export function getGroupHeight (arr) {
if (arr.length) {
let minYArr = [...arr]
const minYArr = [...arr]
minYArr.sort((a, b) => {
return a.y - b.y
})
let maxYArr = [...arr]
const maxYArr = [...arr]
maxYArr.sort((a, b) => {
return (b.y + b.h) - (a.y + a.h)
})
return maxYArr[0].y + maxYArr[0].h - minYArr[0].y
/*let lastItem = []
/* let lastItem = []
let maxY = arr[0].y
arr.forEach((children, index) => {
if (maxY === children.y) {
@@ -251,7 +251,7 @@ export function getGroupHeight (arr) {
if (maxY < 0) {
maxY = 0
}
return maxHeight + maxY*/
return maxHeight + maxY */
} else {
return 1
}