提交 dc4635f7 作者: 郁骅焌

操作日志

上级 14310e6f
...@@ -149,6 +149,7 @@ declare module 'vue' { ...@@ -149,6 +149,7 @@ declare module 'vue' {
MenuManagementEdit2: typeof import('./../../../src/views/system/menuManagement/vabAutoComponents/MenuManagementEdit2.vue')['default'] MenuManagementEdit2: typeof import('./../../../src/views/system/menuManagement/vabAutoComponents/MenuManagementEdit2.vue')['default']
NodePanel: typeof import('./../../../src/views/other/workflow/vabAutoComponents/lFComponents/NodePanel.vue')['default'] NodePanel: typeof import('./../../../src/views/other/workflow/vabAutoComponents/lFComponents/NodePanel.vue')['default']
NoticeManagementEdit: typeof import('./../../../src/views/system/noticeManagement/vabAutoComponents/NoticeManagementEdit.vue')['default'] NoticeManagementEdit: typeof import('./../../../src/views/system/noticeManagement/vabAutoComponents/NoticeManagementEdit.vue')['default']
OperatorDetail: typeof import('./../../../src/views/system/logManagement/vabAutoComponents/OperatorDetail.vue')['default']
PageHeader: typeof import('./../../../src/views/index/vabAutoComponents/PageHeader.vue')['default'] PageHeader: typeof import('./../../../src/views/index/vabAutoComponents/PageHeader.vue')['default']
Pending: typeof import('./../../../src/views/index/vabAutoComponents/Pending.vue')['default'] Pending: typeof import('./../../../src/views/index/vabAutoComponents/Pending.vue')['default']
PortalDivider: typeof import('./../../../src/views/portal/vabAutoComponents/PortalDivider.vue')['default'] PortalDivider: typeof import('./../../../src/views/portal/vabAutoComponents/PortalDivider.vue')['default']
......
import request from '/@/utils/request'
/** 查询操作日志列表 */
export function getList(params?: any) {
return request({
url: '/monitor/operlog/list',
method: 'get',
params,
})
}
// 删除操作日志
export const doDelete = (operId: any) => {
return request({
url: `/monitor/operlog/${operId}`,
method: 'delete',
})
}
// 清空操作日志
export function cleanOperlog() {
return request({
url: '/monitor/operlog/clean',
method: 'delete',
})
}
...@@ -7,7 +7,7 @@ import { setupStore } from '/@/store' ...@@ -7,7 +7,7 @@ import { setupStore } from '/@/store'
// 全局方法 // 全局方法
import { useDict } from './utils/dict' import { useDict } from './utils/dict'
import { download } from '/@/utils/download' import { download } from '/@/utils/download'
import { addDateRange, handleTree, resetForm } from '/@/utils/index' import { addDateRange, handleTree, resetForm, selectDictLabel, selectDictLabels } from '/@/utils/index'
// svg图标 // svg图标
import elementIcons from '/@/icon/elementIcon' import elementIcons from '/@/icon/elementIcon'
...@@ -19,6 +19,8 @@ app.config.globalProperties.useDict = useDict ...@@ -19,6 +19,8 @@ app.config.globalProperties.useDict = useDict
app.config.globalProperties.resetForm = resetForm app.config.globalProperties.resetForm = resetForm
app.config.globalProperties.addDateRange = addDateRange app.config.globalProperties.addDateRange = addDateRange
app.config.globalProperties.handleTree = handleTree app.config.globalProperties.handleTree = handleTree
app.config.globalProperties.selectDictLabel = selectDictLabel
app.config.globalProperties.selectDictLabels = selectDictLabels
setupVab(app) setupVab(app)
setupI18n(app) setupI18n(app)
......
...@@ -326,3 +326,47 @@ export function handleTree(data: any, id: any, parentId: any, children: any) { ...@@ -326,3 +326,47 @@ export function handleTree(data: any, id: any, parentId: any, children: any) {
} }
return tree return tree
} }
// 回显数据字典
export function selectDictLabel(datas: any, value: any) {
if (value === undefined) {
return ''
}
const actions = []
Object.keys(datas).some((key) => {
if (datas[key].value == `${value}`) {
actions.push(datas[key].label)
return true
}
})
if (actions.length === 0) {
actions.push(value)
}
return actions.join('')
}
// 回显数据字典(字符串数组)
export function selectDictLabels(datas: any, value: any, separator: any) {
if (value === undefined || value.length === 0) {
return ''
}
if (Array.isArray(value)) {
value = value.join(',')
}
const actions: any = []
const currentSeparator = undefined === separator ? ',' : separator
const temp = value.split(currentSeparator)
Object.keys(value.split(currentSeparator)).some((val) => {
let match = false
Object.keys(datas).some((key) => {
if (datas[key].value == `${temp[val]}`) {
actions.push(datas[key].label + currentSeparator)
match = true
}
})
if (!match) {
actions.push(temp[val] + currentSeparator)
}
})
return actions.join('').substring(0, actions.join('').length - 1)
}
<template>
<vab-dialog v-model="dialogFormVisible" append-to-body :title="title" width="800px" @close="close">
<el-form ref="formRef" label-width="100px" :model="form">
<el-row>
<el-col :span="12">
<el-form-item label="操作模块:">{{ form.title }} / {{ typeFormat(form) }}</el-form-item>
<el-form-item label="登录信息:">{{ form.operName }} / {{ form.operIp }} / {{ form.operLocation }}</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="请求地址:">{{ form.operUrl }}</el-form-item>
<el-form-item label="请求方式:">{{ form.requestMethod }}</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="操作方法:">{{ form.method }}</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="请求参数:">{{ form.operParam }}</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="返回参数:">{{ form.jsonResult }}</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="操作状态:">
<div v-if="form.status === 0">正常</div>
<div v-else-if="form.status === 1">失败</div>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="消耗时间:">{{ form.costTime }}毫秒</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="操作时间:">{{ parseTime(form.operTime) }}</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item v-if="form.status === 1" label="异常信息:">{{ form.errorMsg }}</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<el-button @click="close">关 闭</el-button>
</template>
</vab-dialog>
</template>
<script lang="ts" setup>
import type { FormInstance } from 'element-plus'
defineOptions({
name: 'OperatorDetail',
})
const { proxy } = getCurrentInstance() as any
const { sys_oper_type } = proxy.useDict('sys_oper_type')
const formRef = ref<FormInstance>()
const form = ref<any>({})
const title = ref<string>('操作日志详细')
const dialogFormVisible = ref<boolean>(false)
/** 操作日志类型字典翻译 */
function typeFormat(row: any) {
return proxy.selectDictLabel(sys_oper_type.value, row.businessType)
}
const show = (row?: any) => {
form.value = Object.assign({}, row)
dialogFormVisible.value = true
}
const close = () => {
dialogFormVisible.value = false
}
defineExpose({
show,
})
</script>
<style lang="scss" scoped>
:deep() {
.el-select {
width: 100%;
}
.el-form-item__content {
word-break: break-all;
}
}
</style>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论