add audit file log
This commit is contained in:
@@ -14,3 +14,18 @@ export function remove (data) {
|
|||||||
data,
|
data,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function fileList (params) {
|
||||||
|
return request({
|
||||||
|
url: '/audit_file/list',
|
||||||
|
params,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function fileRemove (data) {
|
||||||
|
return request({
|
||||||
|
url: '/audit_file/delete',
|
||||||
|
method: 'post',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -136,6 +136,12 @@ export const asyncRoutes = [
|
|||||||
meta: { title: 'AuditConnLog', icon: 'Tickets' /*keepAlive: true*/ },
|
meta: { title: 'AuditConnLog', icon: 'Tickets' /*keepAlive: true*/ },
|
||||||
component: () => import('@/views/audit/connList.vue'),
|
component: () => import('@/views/audit/connList.vue'),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/auditFile',
|
||||||
|
name: 'AuditFile',
|
||||||
|
meta: { title: 'AuditFileLog', icon: 'Files' /*keepAlive: true*/ },
|
||||||
|
component: () => import('@/views/audit/fileList.vue'),
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -55,3 +55,15 @@ export function downBlob (blob, filename) {
|
|||||||
document.body.removeChild(a)
|
document.body.removeChild(a)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function sizeFormat (size) {
|
||||||
|
if (size < 1024) {
|
||||||
|
return size + 'B'
|
||||||
|
} else if (size < 1024 * 1024) {
|
||||||
|
return (size / 1024).toFixed(2) + 'KB'
|
||||||
|
} else if (size < 1024 * 1024 * 1024) {
|
||||||
|
return (size / 1024 / 1024).toFixed(2) + 'MB'
|
||||||
|
} else {
|
||||||
|
return (size / 1024 / 1024 / 1024).toFixed(2) + 'GB'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -366,5 +366,38 @@
|
|||||||
},
|
},
|
||||||
"CloseTime": {
|
"CloseTime": {
|
||||||
"One": "Close Time"
|
"One": "Close Time"
|
||||||
|
},
|
||||||
|
"AuditFileLog": {
|
||||||
|
"One": "File Log"
|
||||||
|
},
|
||||||
|
"Common": {
|
||||||
|
"One": "Common"
|
||||||
|
},
|
||||||
|
"File": {
|
||||||
|
"One": "File"
|
||||||
|
},
|
||||||
|
"Num": {
|
||||||
|
"One": "Num"
|
||||||
|
},
|
||||||
|
"Ip": {
|
||||||
|
"One": "Ip"
|
||||||
|
},
|
||||||
|
"FileName": {
|
||||||
|
"One": "File Name"
|
||||||
|
},
|
||||||
|
"FileInfo": {
|
||||||
|
"One": "File Info"
|
||||||
|
},
|
||||||
|
"Path": {
|
||||||
|
"One": "Path"
|
||||||
|
},
|
||||||
|
"IndexNum": {
|
||||||
|
"One": "Index Num"
|
||||||
|
},
|
||||||
|
"ToRemote": {
|
||||||
|
"One": "To Remote"
|
||||||
|
},
|
||||||
|
"ToLocal": {
|
||||||
|
"One": "To Local"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -352,5 +352,38 @@
|
|||||||
},
|
},
|
||||||
"CloseTime": {
|
"CloseTime": {
|
||||||
"One": "关闭时间"
|
"One": "关闭时间"
|
||||||
|
},
|
||||||
|
"AuditFileLog": {
|
||||||
|
"One": "文件日志"
|
||||||
|
},
|
||||||
|
"Common": {
|
||||||
|
"One": "普通"
|
||||||
|
},
|
||||||
|
"File": {
|
||||||
|
"One": "文件"
|
||||||
|
},
|
||||||
|
"Num": {
|
||||||
|
"One": "数量"
|
||||||
|
},
|
||||||
|
"Ip": {
|
||||||
|
"One": "IP"
|
||||||
|
},
|
||||||
|
"FileName": {
|
||||||
|
"One": "文件名"
|
||||||
|
},
|
||||||
|
"FileInfo": {
|
||||||
|
"One": "文件信息"
|
||||||
|
},
|
||||||
|
"Path": {
|
||||||
|
"One": "路径"
|
||||||
|
},
|
||||||
|
"IndexNum": {
|
||||||
|
"One": "序号"
|
||||||
|
},
|
||||||
|
"ToRemote": {
|
||||||
|
"One": "到远程"
|
||||||
|
},
|
||||||
|
"ToLocal": {
|
||||||
|
"One": "到本地"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,16 +14,22 @@
|
|||||||
</el-form>
|
</el-form>
|
||||||
</el-card>
|
</el-card>
|
||||||
<el-card class="list-body" shadow="hover">
|
<el-card class="list-body" shadow="hover">
|
||||||
<!-- <el-tag type="danger" style="margin-bottom: 10px">不建议在此操作地址簿,可能会造成数据不同步</el-tag>-->
|
|
||||||
<el-table :data="listRes.list" v-loading="listRes.loading" border>
|
<el-table :data="listRes.list" v-loading="listRes.loading" border>
|
||||||
<el-table-column prop="id" label="id" align="center" width="100"/>
|
<el-table-column prop="id" label="id" align="center" width="100"/>
|
||||||
<el-table-column :label="T('Peer')" prop="peer_id" align="center" width="120"/>
|
<el-table-column :label="T('Peer')" prop="peer_id" align="center" width="120"/>
|
||||||
<el-table-column :label="T('FromPeer')" prop="from_peer" align="center" width="120"/>
|
<el-table-column :label="T('FromPeer')" prop="from_peer" align="center" width="120"/>
|
||||||
<el-table-column :label="T('FromName')" prop="from_name" align="center" width="120"/>
|
<el-table-column :label="T('FromName')" prop="from_name" align="center" width="120"/>
|
||||||
|
<el-table-column :label="T('Ip')" prop="ip" align="center" width="120"/>
|
||||||
|
<el-table-column pop="type" :label="T('Type')" align="center" width="120">
|
||||||
|
<template #default="{row}">
|
||||||
|
<el-tag v-if="row.type === 1" type="warning">{{ T('File') }}</el-tag>
|
||||||
|
<el-tag v-else>{{ T('Common') }}</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column prop="uuid" label="uuid" align="center" width="120" show-overflow-tooltip/>
|
<el-table-column prop="uuid" label="uuid" align="center" width="120" show-overflow-tooltip/>
|
||||||
<el-table-column prop="created_at" :label="T('CreatedAt')" align="center"/>
|
<el-table-column prop="created_at" :label="T('CreatedAt')" align="center"/>
|
||||||
<el-table-column :label="T('CloseTime')" prop="close_time" align="center"/>
|
<el-table-column :label="T('CloseTime')" prop="close_time" align="center"/>
|
||||||
<el-table-column :label="T('Actions')" align="center" width="400">
|
<el-table-column :label="T('Actions')" align="center" width="150">
|
||||||
<template #default="{row}">
|
<template #default="{row}">
|
||||||
<el-button type="danger" @click="del(row)">{{ T('Delete') }}</el-button>
|
<el-button type="danger" @click="del(row)">{{ T('Delete') }}</el-button>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -0,0 +1,118 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-card class="list-query" shadow="hover">
|
||||||
|
<el-form inline label-width="80px">
|
||||||
|
<el-form-item :label="T('Peer')">
|
||||||
|
<el-input v-model="listQuery.peer_id" clearable></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label="T('FromPeer')">
|
||||||
|
<el-input v-model="listQuery.from_peer" clearable></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" @click="handlerQuery">筛选</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</el-card>
|
||||||
|
<el-card class="list-body" shadow="hover">
|
||||||
|
<el-table :data="listRes.list" v-loading="listRes.loading" border max-height="750">
|
||||||
|
<el-table-column prop="id" label="id" align="center" width="100"/>
|
||||||
|
<el-table-column :label="T('Peer')" prop="peer_id" align="center" width="120"/>
|
||||||
|
<el-table-column :label="T('FromPeer')" prop="from_peer" align="center" width="120"/>
|
||||||
|
<el-table-column :label="T('FromName')" prop="from_name" align="center" width="120"/>
|
||||||
|
<el-table-column :label="T('Ip')" prop="ip" align="center" width="120"/>
|
||||||
|
<el-table-column prop="type" :label="T('Type')" align="center" width="200">
|
||||||
|
<template #default="{row}">
|
||||||
|
<el-tag v-if="row.type === 1" type="warning"> {{T('ToRemote')}}: <el-icon><Right/></el-icon> {{row.peer_id}}</el-tag>
|
||||||
|
<el-tag v-else>{{T('ToLocal')}}: <el-icon><Right/></el-icon> {{row.from_peer}}</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="num" :label="T('Num')" align="center" width="100"/>
|
||||||
|
<el-table-column :label="T('FileInfo')" align="center" width="300">
|
||||||
|
<template #default="{row}">
|
||||||
|
<template v-if="!row.is_file">
|
||||||
|
<el-table size="small" :data="row.info?.files?.filter((v,k) => k<showDirFileNum)" fit>
|
||||||
|
<el-table-column prop="0" :label="T('FileName')" align="center" width="150" show-overflow-tooltip></el-table-column>
|
||||||
|
<el-table-column prop="1" :label="T('Size')" align="center">
|
||||||
|
<template #default="{row:_row}">
|
||||||
|
{{ sizeFormat(_row[1]) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<el-button size="small" v-if="row.info.files.length>showDirFileNum" style="width: 100%;margin-top: 5px" type="primary" @click="showAllFile(row.info.files)">
|
||||||
|
{{ T('More') }}({{ row.info.files.length - showDirFileNum }})
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
<div v-else>
|
||||||
|
{{ sizeFormat(row.info.files[0][1]) }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="path" :label="T('Path')" align="center" width="150" show-overflow-tooltip/>
|
||||||
|
<el-table-column prop="uuid" label="uuid" align="center" width="120" show-overflow-tooltip/>
|
||||||
|
<el-table-column prop="created_at" :label="T('CreatedAt')" align="center" min-width="120"/>
|
||||||
|
<el-table-column :label="T('Actions')" align="center" width="150" fixed="right">
|
||||||
|
<template #default="{row}">
|
||||||
|
<el-button type="danger" @click="del(row)">{{ T('Delete') }}</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-card>
|
||||||
|
<el-card class="list-page" shadow="hover">
|
||||||
|
<el-pagination background
|
||||||
|
layout="prev, pager, next, sizes, jumper"
|
||||||
|
:page-sizes="[10,20,50,100]"
|
||||||
|
v-model:page-size="listQuery.page_size"
|
||||||
|
v-model:current-page="listQuery.page"
|
||||||
|
:total="listRes.total">
|
||||||
|
</el-pagination>
|
||||||
|
</el-card>
|
||||||
|
<el-dialog v-model="allFilesVisible" :title="T('File')">
|
||||||
|
<el-table :data="showFiles" max-height="800px">
|
||||||
|
<el-table-column type="index" :label="T('IndexNum')" width="120" align="center"></el-table-column>
|
||||||
|
<el-table-column prop="0" :label="T('FileName')" align="center"></el-table-column>
|
||||||
|
<el-table-column prop="1" :label="T('Size')" align="center">
|
||||||
|
<template #default="{row:_row}">
|
||||||
|
{{ sizeFormat(_row[1]) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<el-button @click="allFilesVisible=false" style="margin-top: 20px;width: 100%" type="primary">{{ T('Close') }}</el-button>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { onActivated, onMounted, ref, watch } from 'vue'
|
||||||
|
import { useFileRepositories } from '@/views/audit/reponsitories'
|
||||||
|
import { T } from '@/utils/i18n'
|
||||||
|
import { sizeFormat } from '@/utils/file'
|
||||||
|
import { Right } from '@element-plus/icons'
|
||||||
|
|
||||||
|
const showDirFileNum = 3
|
||||||
|
const {
|
||||||
|
listRes,
|
||||||
|
listQuery,
|
||||||
|
getList,
|
||||||
|
handlerQuery,
|
||||||
|
del,
|
||||||
|
} = useFileRepositories()
|
||||||
|
|
||||||
|
onMounted(getList)
|
||||||
|
onActivated(getList)
|
||||||
|
|
||||||
|
watch(() => listQuery.page, getList)
|
||||||
|
|
||||||
|
watch(() => listQuery.page_size, handlerQuery)
|
||||||
|
|
||||||
|
const allFilesVisible = ref(false)
|
||||||
|
const showFiles = ref([])
|
||||||
|
const showAllFile = (files) => {
|
||||||
|
showFiles.value = files
|
||||||
|
allFilesVisible.value = true
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -1,8 +1,10 @@
|
|||||||
import { reactive } from 'vue'
|
import { reactive } from 'vue'
|
||||||
import { list, remove } from '@/api/audit'
|
import { list, remove, fileList, fileRemove } from '@/api/audit'
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
import { formatTime } from '@/utils/time'
|
import { formatTime } from '@/utils/time'
|
||||||
|
import { T } from '@/utils/i18n'
|
||||||
|
|
||||||
export function useRepositories () {
|
export function useRepositories () {
|
||||||
const listRes = reactive({
|
const listRes = reactive({
|
||||||
list: [], total: 0, loading: false,
|
list: [], total: 0, loading: false,
|
||||||
@@ -35,9 +37,9 @@ export function useRepositories () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const del = async (row) => {
|
const del = async (row) => {
|
||||||
const cf = await ElMessageBox.confirm('确定删除么?', {
|
const cf = await ElMessageBox.confirm(T('Confirm?', { param: T('Delete') }), {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: T('Confirm'),
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: T('Cancel'),
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
}).catch(_ => false)
|
}).catch(_ => false)
|
||||||
if (!cf) {
|
if (!cf) {
|
||||||
@@ -46,7 +48,64 @@ export function useRepositories () {
|
|||||||
|
|
||||||
const res = await remove({ id: row.id }).catch(_ => false)
|
const res = await remove({ id: row.id }).catch(_ => false)
|
||||||
if (res) {
|
if (res) {
|
||||||
ElMessage.success('操作成功')
|
ElMessage.success(T('OperationSuccess'))
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
listRes,
|
||||||
|
listQuery,
|
||||||
|
getList,
|
||||||
|
handlerQuery,
|
||||||
|
del,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useFileRepositories () {
|
||||||
|
const listRes = reactive({
|
||||||
|
list: [], total: 0, loading: false,
|
||||||
|
})
|
||||||
|
const listQuery = reactive({
|
||||||
|
page: 1,
|
||||||
|
page_size: 10,
|
||||||
|
peer_id: null,
|
||||||
|
from_peer: null,
|
||||||
|
})
|
||||||
|
|
||||||
|
const getList = async () => {
|
||||||
|
listRes.loading = true
|
||||||
|
const res = await fileList(listQuery).catch(_ => false)
|
||||||
|
listRes.loading = false
|
||||||
|
if (res) {
|
||||||
|
listRes.list = res.data.list.map(item => {
|
||||||
|
item.info = item.info ? JSON.parse(item.info) : '-'
|
||||||
|
return item
|
||||||
|
})
|
||||||
|
listRes.total = res.data.total
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const handlerQuery = () => {
|
||||||
|
if (listQuery.page === 1) {
|
||||||
|
getList()
|
||||||
|
} else {
|
||||||
|
listQuery.page = 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const del = async (row) => {
|
||||||
|
const cf = await ElMessageBox.confirm(T('Confirm?', { param: T('Delete') }), {
|
||||||
|
confirmButtonText: T('Confirm'),
|
||||||
|
cancelButtonText: T('Cancel'),
|
||||||
|
type: 'warning',
|
||||||
|
}).catch(_ => false)
|
||||||
|
if (!cf) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
const res = await fileRemove({ id: row.id }).catch(_ => false)
|
||||||
|
if (res) {
|
||||||
|
ElMessage.success(T('OperationSuccess'))
|
||||||
getList()
|
getList()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { reactive } from 'vue'
|
|||||||
import { list, remove } from '@/api/login_log'
|
import { list, remove } from '@/api/login_log'
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
|
import { T } from '@/utils/i18n'
|
||||||
|
|
||||||
export function useRepositories () {
|
export function useRepositories () {
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
@@ -35,9 +36,9 @@ export function useRepositories () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const del = async (row) => {
|
const del = async (row) => {
|
||||||
const cf = await ElMessageBox.confirm('确定删除么?', {
|
const cf = await ElMessageBox.confirm(T('Confirm?', { param: T('Delete') }), {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: T('Confirm'),
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: T('Cancel'),
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
}).catch(_ => false)
|
}).catch(_ => false)
|
||||||
if (!cf) {
|
if (!cf) {
|
||||||
@@ -46,7 +47,7 @@ export function useRepositories () {
|
|||||||
|
|
||||||
const res = await remove({ id: row.id }).catch(_ => false)
|
const res = await remove({ id: row.id }).catch(_ => false)
|
||||||
if (res) {
|
if (res) {
|
||||||
ElMessage.success('操作成功')
|
ElMessage.success(T('OperationSuccess'))
|
||||||
getList()
|
getList()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user