Skip to content

Commit

Permalink
Merge pull request #12 from ins0mn1a93/main
Browse files Browse the repository at this point in the history
修复了前端页面交互问题
  • Loading branch information
ins0mn1a93 authored Dec 11, 2024
2 parents f32569c + baa038a commit cfac8dd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
13 changes: 8 additions & 5 deletions frontend/src/pages/netstat.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<script setup lang="tsx">
import { ElAutoResizer, ElTableV2, ElTooltip } from 'element-plus'
import { netstats } from '../utils'
import { computed } from 'vue'
import { ref,computed } from 'vue'
import dayjs from 'dayjs'
// const netstats = ref([])
const columns = [{
key: 'id',
title: 'ID',
Expand Down Expand Up @@ -43,17 +44,19 @@ const columns = [{
const data = computed(() => netstats.value.map(n => {
return {
...n,
time: dayjs(n.time).format('YYYY-MM-DD HH:mm:ss'),
local: `${n.localIP}:${n.localPort}`,
remote: `${n.remoteIP}:${n.remotePort}`,
time: n.time ? dayjs(n.time).format('YYYY-MM-DD HH:mm:ss') : '未知时间',
local: n.localIP && n.localPort ? `${n.localIP}:${n.localPort}` : '未知地址',
remote: n.remoteIP && n.remotePort ? `${n.remoteIP}:${n.remotePort}` : '未知地址',
location: n.location || '未知位置',
executable: n.executable || '未知程序'
}
}))
</script>

<template>
<ElAutoResizer>
<template #default="{ height, width }">
<ElTableV2 :columns :data :height :width />
<ElTableV2 :columns :data="data || []" :height :width />
</template>
</ElAutoResizer>
</template>
14 changes: 8 additions & 6 deletions frontend/src/pages/threat.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<script setup lang="tsx">
import { ElAutoResizer, ElButton, ElTableV2 } from 'element-plus'
import { credibilityLevel, riskLevel, threats } from '../utils'
import { computed } from 'vue'
import { ref, computed } from 'vue'
import dayjs from 'dayjs'
// const threats = ref([])
const columns = [{
key: 'id',
title: 'ID',
Expand Down Expand Up @@ -45,20 +46,21 @@ const columns = [{
cellRenderer: () => (<ElButton type="danger" size="small">删除</ElButton>)
}]
const data = computed(() => threats.value.map(n => {
return {
const data = computed(() => {
if (!threats.value) return []
return threats.value.map(n => ({
...n,
time: dayjs(n.time).format('YYYY-MM-DD HH:mm:ss'),
risk: `${riskLevel[n.risk]}(${n.risk})`,
credibility: `${credibilityLevel[n.credibility]}(${n.credibility})`,
}
}))
}))
})
</script>

<template>
<ElAutoResizer>
<template #default="{ height, width }">
<ElTableV2 :columns :data :height :width />
<ElTableV2 :columns="columns" :data="data || []" :height="height" :width="width" />
</template>
</ElAutoResizer>
</template>

0 comments on commit cfac8dd

Please sign in to comment.