refactor: loginlog

This commit is contained in:
xingyu4j
2022-11-13 15:13:38 +08:00
parent 866247959e
commit 4a692ed28c
8 changed files with 56 additions and 34 deletions

View File

@ -34,7 +34,8 @@ const crudSchemas = reactive<VxeCrudSchema>({
},
{
title: '错误码错误提示',
field: 'message'
field: 'message',
isSearch: true
},
{
title: t('common.createTime'),

View File

@ -21,7 +21,7 @@
preIcon="ep:view"
:title="t('action.detail')"
v-hasPermi="['system:error-code:update']"
@click="handleDetail(row)"
@click="handleDetail(row.id)"
/>
<XTextButton
preIcon="ep:delete"
@ -64,7 +64,6 @@
<script setup lang="ts">
import { ref, unref } from 'vue'
import type { ErrorCodeVO } from '@/api/system/errorCode/types'
import { rules, allSchemas } from './errorCode.data'
import * as ErrorCodeApi from '@/api/system/errorCode'
import { useI18n } from '@/hooks/web/useI18n'
@ -83,7 +82,7 @@ const xGrid = ref<VxeGridInstance>() // grid Ref
const formRef = ref<FormExpose>() // 表单 Ref
const detailRef = ref() // 详情 Ref
const { gridOptions } = useVxeGrid<ErrorCodeVO>({
const { gridOptions } = useVxeGrid<ErrorCodeApi.ErrorCodeVO>({
allSchemas: allSchemas,
getListApi: ErrorCodeApi.getErrorCodePageApi
})
@ -101,13 +100,6 @@ const handleCreate = () => {
unref(formRef)?.getElFormRef()?.resetFields()
}
// 详情操作
const handleDetail = async (row: ErrorCodeVO) => {
// 设置数据
detailRef.value = row
setDialogTile('detail')
}
// 修改操作
const handleUpdate = async (rowId: number) => {
setDialogTile('update')
@ -116,6 +108,14 @@ const handleUpdate = async (rowId: number) => {
unref(formRef)?.setValues(res)
}
// 详情操作
const handleDetail = async (rowId: number) => {
setDialogTile('detail')
// 设置数据
const res = await ErrorCodeApi.getErrorCodeApi(rowId)
detailRef.value = res
}
// 删除操作
const handleDelete = async (rowId: number) => {
message
@ -138,7 +138,7 @@ const submitForm = async () => {
actionLoading.value = true
// 提交请求
try {
const data = unref(formRef)?.formModel as ErrorCodeVO
const data = unref(formRef)?.formModel as ErrorCodeApi.ErrorCodeVO
if (actionType.value === 'create') {
await ErrorCodeApi.createErrorCodeApi(data)
message.success(t('common.createSuccess'))

View File

@ -4,7 +4,7 @@
<vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar">
<template #toolbar_buttons>
<XButton
type="primary"
type="warning"
preIcon="ep:download"
:title="t('action.export')"
@click="handleExport()"

View File

@ -13,8 +13,11 @@ const crudSchemas = reactive<VxeCrudSchema>({
{
title: '日志类型',
field: 'logType',
dictType: DICT_TYPE.SYSTEM_LOGIN_TYPE,
isSearch: true
dictType: DICT_TYPE.SYSTEM_LOGIN_TYPE
},
{
title: '用户类型',
field: 'userType'
},
{
title: '用户名称',
@ -27,20 +30,24 @@ const crudSchemas = reactive<VxeCrudSchema>({
isSearch: true
},
{
title: 'userAgent',
title: '浏览器',
field: 'userAgent'
},
{
title: '登陆结果',
field: 'result',
dictType: DICT_TYPE.SYSTEM_LOGIN_RESULT,
isSearch: true
dictType: DICT_TYPE.SYSTEM_LOGIN_RESULT
},
{
title: t('common.createTime'),
field: 'createTime',
formatter: 'formatDate',
isForm: false
isForm: false,
search: {
itemRender: {
name: 'XDataTimePicker'
}
}
}
]
})

View File

@ -12,7 +12,7 @@
@click="handleCreate()"
/>
<XButton
type="primary"
type="warning"
preIcon="ep:download"
:title="t('action.export')"
v-hasPermi="['system:post:export']"