refactor: loginlog
parent
866247959e
commit
4a692ed28c
|
@ -1,8 +1,24 @@
|
||||||
import request from '@/config/axios'
|
import request from '@/config/axios'
|
||||||
import type { ErrorCodeVO } from './types'
|
export interface ErrorCodeVO {
|
||||||
|
id: number
|
||||||
|
type: number
|
||||||
|
applicationName: string
|
||||||
|
code: number
|
||||||
|
message: string
|
||||||
|
memo: string
|
||||||
|
createTime: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ErrorCodePageReqVO extends BasePage {
|
||||||
|
type?: number
|
||||||
|
applicationName?: string
|
||||||
|
code?: number
|
||||||
|
message?: string
|
||||||
|
createTime?: string[]
|
||||||
|
}
|
||||||
|
|
||||||
// 查询错误码列表
|
// 查询错误码列表
|
||||||
export const getErrorCodePageApi = (params) => {
|
export const getErrorCodePageApi = (params: ErrorCodePageReqVO) => {
|
||||||
return request.get({ url: '/system/error-code/page', params })
|
return request.get({ url: '/system/error-code/page', params })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,6 +42,6 @@ export const deleteErrorCodeApi = (id: number) => {
|
||||||
return request.delete({ url: '/system/error-code/delete?id=' + id })
|
return request.delete({ url: '/system/error-code/delete?id=' + id })
|
||||||
}
|
}
|
||||||
// 导出错误码
|
// 导出错误码
|
||||||
export const excelErrorCodeApi = (params) => {
|
export const excelErrorCodeApi = (params: ErrorCodePageReqVO) => {
|
||||||
return request.download({ url: '/system/error-code/export-excel', params })
|
return request.download({ url: '/system/error-code/export-excel', params })
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
export type ErrorCodeVO = {
|
|
||||||
id: number
|
|
||||||
type: number
|
|
||||||
applicationName: string
|
|
||||||
code: number
|
|
||||||
message: string
|
|
||||||
memo: string
|
|
||||||
createTime: string
|
|
||||||
}
|
|
|
@ -12,11 +12,18 @@ export interface LoginLogVO {
|
||||||
createTime: string
|
createTime: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface LoginLogReqVO extends BasePage {
|
||||||
|
userIp?: string
|
||||||
|
username?: string
|
||||||
|
status?: boolean
|
||||||
|
createTime?: string[]
|
||||||
|
}
|
||||||
|
|
||||||
// 查询登录日志列表
|
// 查询登录日志列表
|
||||||
export const getLoginLogPageApi = (params) => {
|
export const getLoginLogPageApi = (params: LoginLogReqVO) => {
|
||||||
return request.get({ url: '/system/login-log/page', params })
|
return request.get({ url: '/system/login-log/page', params })
|
||||||
}
|
}
|
||||||
// 导出登录日志
|
// 导出登录日志
|
||||||
export const exportLoginLogApi = (params) => {
|
export const exportLoginLogApi = (params: LoginLogReqVO) => {
|
||||||
return request.download({ url: '/system/login-log/export', params })
|
return request.download({ url: '/system/login-log/export', params })
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,8 @@ const crudSchemas = reactive<VxeCrudSchema>({
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '错误码错误提示',
|
title: '错误码错误提示',
|
||||||
field: 'message'
|
field: 'message',
|
||||||
|
isSearch: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t('common.createTime'),
|
title: t('common.createTime'),
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
preIcon="ep:view"
|
preIcon="ep:view"
|
||||||
:title="t('action.detail')"
|
:title="t('action.detail')"
|
||||||
v-hasPermi="['system:error-code:update']"
|
v-hasPermi="['system:error-code:update']"
|
||||||
@click="handleDetail(row)"
|
@click="handleDetail(row.id)"
|
||||||
/>
|
/>
|
||||||
<XTextButton
|
<XTextButton
|
||||||
preIcon="ep:delete"
|
preIcon="ep:delete"
|
||||||
|
@ -64,7 +64,6 @@
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, unref } from 'vue'
|
import { ref, unref } from 'vue'
|
||||||
import type { ErrorCodeVO } from '@/api/system/errorCode/types'
|
|
||||||
import { rules, allSchemas } from './errorCode.data'
|
import { rules, allSchemas } from './errorCode.data'
|
||||||
import * as ErrorCodeApi from '@/api/system/errorCode'
|
import * as ErrorCodeApi from '@/api/system/errorCode'
|
||||||
import { useI18n } from '@/hooks/web/useI18n'
|
import { useI18n } from '@/hooks/web/useI18n'
|
||||||
|
@ -83,7 +82,7 @@ const xGrid = ref<VxeGridInstance>() // grid Ref
|
||||||
const formRef = ref<FormExpose>() // 表单 Ref
|
const formRef = ref<FormExpose>() // 表单 Ref
|
||||||
const detailRef = ref() // 详情 Ref
|
const detailRef = ref() // 详情 Ref
|
||||||
|
|
||||||
const { gridOptions } = useVxeGrid<ErrorCodeVO>({
|
const { gridOptions } = useVxeGrid<ErrorCodeApi.ErrorCodeVO>({
|
||||||
allSchemas: allSchemas,
|
allSchemas: allSchemas,
|
||||||
getListApi: ErrorCodeApi.getErrorCodePageApi
|
getListApi: ErrorCodeApi.getErrorCodePageApi
|
||||||
})
|
})
|
||||||
|
@ -101,13 +100,6 @@ const handleCreate = () => {
|
||||||
unref(formRef)?.getElFormRef()?.resetFields()
|
unref(formRef)?.getElFormRef()?.resetFields()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 详情操作
|
|
||||||
const handleDetail = async (row: ErrorCodeVO) => {
|
|
||||||
// 设置数据
|
|
||||||
detailRef.value = row
|
|
||||||
setDialogTile('detail')
|
|
||||||
}
|
|
||||||
|
|
||||||
// 修改操作
|
// 修改操作
|
||||||
const handleUpdate = async (rowId: number) => {
|
const handleUpdate = async (rowId: number) => {
|
||||||
setDialogTile('update')
|
setDialogTile('update')
|
||||||
|
@ -116,6 +108,14 @@ const handleUpdate = async (rowId: number) => {
|
||||||
unref(formRef)?.setValues(res)
|
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) => {
|
const handleDelete = async (rowId: number) => {
|
||||||
message
|
message
|
||||||
|
@ -138,7 +138,7 @@ const submitForm = async () => {
|
||||||
actionLoading.value = true
|
actionLoading.value = true
|
||||||
// 提交请求
|
// 提交请求
|
||||||
try {
|
try {
|
||||||
const data = unref(formRef)?.formModel as ErrorCodeVO
|
const data = unref(formRef)?.formModel as ErrorCodeApi.ErrorCodeVO
|
||||||
if (actionType.value === 'create') {
|
if (actionType.value === 'create') {
|
||||||
await ErrorCodeApi.createErrorCodeApi(data)
|
await ErrorCodeApi.createErrorCodeApi(data)
|
||||||
message.success(t('common.createSuccess'))
|
message.success(t('common.createSuccess'))
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar">
|
<vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar">
|
||||||
<template #toolbar_buttons>
|
<template #toolbar_buttons>
|
||||||
<XButton
|
<XButton
|
||||||
type="primary"
|
type="warning"
|
||||||
preIcon="ep:download"
|
preIcon="ep:download"
|
||||||
:title="t('action.export')"
|
:title="t('action.export')"
|
||||||
@click="handleExport()"
|
@click="handleExport()"
|
||||||
|
|
|
@ -13,8 +13,11 @@ const crudSchemas = reactive<VxeCrudSchema>({
|
||||||
{
|
{
|
||||||
title: '日志类型',
|
title: '日志类型',
|
||||||
field: 'logType',
|
field: 'logType',
|
||||||
dictType: DICT_TYPE.SYSTEM_LOGIN_TYPE,
|
dictType: DICT_TYPE.SYSTEM_LOGIN_TYPE
|
||||||
isSearch: true
|
},
|
||||||
|
{
|
||||||
|
title: '用户类型',
|
||||||
|
field: 'userType'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '用户名称',
|
title: '用户名称',
|
||||||
|
@ -27,20 +30,24 @@ const crudSchemas = reactive<VxeCrudSchema>({
|
||||||
isSearch: true
|
isSearch: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'userAgent',
|
title: '浏览器',
|
||||||
field: 'userAgent'
|
field: 'userAgent'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '登陆结果',
|
title: '登陆结果',
|
||||||
field: 'result',
|
field: 'result',
|
||||||
dictType: DICT_TYPE.SYSTEM_LOGIN_RESULT,
|
dictType: DICT_TYPE.SYSTEM_LOGIN_RESULT
|
||||||
isSearch: true
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t('common.createTime'),
|
title: t('common.createTime'),
|
||||||
field: 'createTime',
|
field: 'createTime',
|
||||||
formatter: 'formatDate',
|
formatter: 'formatDate',
|
||||||
isForm: false
|
isForm: false,
|
||||||
|
search: {
|
||||||
|
itemRender: {
|
||||||
|
name: 'XDataTimePicker'
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
@click="handleCreate()"
|
@click="handleCreate()"
|
||||||
/>
|
/>
|
||||||
<XButton
|
<XButton
|
||||||
type="primary"
|
type="warning"
|
||||||
preIcon="ep:download"
|
preIcon="ep:download"
|
||||||
:title="t('action.export')"
|
:title="t('action.export')"
|
||||||
v-hasPermi="['system:post:export']"
|
v-hasPermi="['system:post:export']"
|
||||||
|
|
Loading…
Reference in New Issue