2022-07-29 09:55:58 +08:00
|
|
|
<template>
|
|
|
|
|
<div class="npm-recent">
|
|
|
|
|
<div class="npm-recent-title">{{ $t('network.recentEvents') }}</div>
|
|
|
|
|
<el-table
|
|
|
|
|
:id="`tabTable_${index}`"
|
|
|
|
|
:ref="`dataTable_${index}`"
|
|
|
|
|
:data="tableData"
|
|
|
|
|
class="npm-recent-table"
|
|
|
|
|
height="100%"
|
|
|
|
|
>
|
|
|
|
|
<template v-for="(item, index) in customTableTitles" :key="index">
|
|
|
|
|
<el-table-column class="data-column">
|
|
|
|
|
<template #header>
|
|
|
|
|
<span class="data-column__span">{{$t(item.label)}}</span>
|
|
|
|
|
</template>
|
|
|
|
|
<template #default="scope" :column="item">
|
|
|
|
|
<div class="data-recent-table">
|
2022-08-11 16:45:48 +08:00
|
|
|
<template v-if="item.prop === 'eventSeverity'">
|
|
|
|
|
<span class="data-recent-table-severity" :class="scope.row[item.prop]">{{$t(scope.row[item.prop])}}</span>
|
2022-07-29 09:55:58 +08:00
|
|
|
</template>
|
2022-08-11 16:45:48 +08:00
|
|
|
<template v-else-if="item.prop === 'eventKey'">
|
2022-07-29 09:55:58 +08:00
|
|
|
<span class="data-recent-table-entity">{{$t(scope.row[item.prop])}}</span>
|
|
|
|
|
</template>
|
|
|
|
|
<template v-else-if="item.prop === 'eventType'">
|
|
|
|
|
<span class="data-recent-table-eventType">{{$t(scope.row[item.prop])}}</span>
|
|
|
|
|
</template>
|
|
|
|
|
<span v-else-if="scope.row[item.prop]">{{scope.row[item.prop]}}</span>
|
|
|
|
|
<span v-else>-</span>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2022-08-11 16:45:48 +08:00
|
|
|
import { get } from '@/utils/http'
|
|
|
|
|
import { api } from '@/utils/api'
|
|
|
|
|
import { getSecond } from '@/utils/date-util'
|
|
|
|
|
|
2022-07-29 09:55:58 +08:00
|
|
|
export default {
|
|
|
|
|
name: 'NpmRecentEvents',
|
2022-08-11 16:45:48 +08:00
|
|
|
props: {
|
|
|
|
|
chart: Object,
|
|
|
|
|
timeFilter: Object
|
|
|
|
|
},
|
2022-07-29 09:55:58 +08:00
|
|
|
data () {
|
|
|
|
|
return {
|
2022-08-11 16:45:48 +08:00
|
|
|
tableData: [],
|
2022-07-29 09:55:58 +08:00
|
|
|
customTableTitles: [
|
2022-08-11 16:45:48 +08:00
|
|
|
{ label: 'network.severity', prop: 'eventSeverity' },
|
|
|
|
|
{ label: 'network.entity', prop: 'eventKey' },
|
2022-07-29 09:55:58 +08:00
|
|
|
{ label: 'detections.eventType', prop: 'eventType' }
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
},
|
2022-08-11 16:45:48 +08:00
|
|
|
methods: {
|
|
|
|
|
recentEventsListData () {
|
|
|
|
|
const params = {
|
|
|
|
|
startTime: getSecond(this.timeFilter.startTime),
|
|
|
|
|
endTime: getSecond(this.timeFilter.endTime),
|
|
|
|
|
limit: 1
|
2022-07-29 09:55:58 +08:00
|
|
|
}
|
2022-08-11 16:45:48 +08:00
|
|
|
get(api.npm.events.recentEvents, params).then(res => {
|
|
|
|
|
if (res.code === 200) {
|
|
|
|
|
this.tableData = res.data.result
|
|
|
|
|
}
|
|
|
|
|
})
|
2022-07-29 09:55:58 +08:00
|
|
|
}
|
2022-08-11 16:45:48 +08:00
|
|
|
},
|
|
|
|
|
mounted () {
|
|
|
|
|
this.recentEventsListData()
|
2022-07-29 09:55:58 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|