Commit 4a692ed28caf46b7b4ca9444342d97ccfb47167f
1 parent
86624795
refactor: loginlog
Showing
8 changed files
with
56 additions
and
34 deletions
yudao-ui-admin-vue3/src/api/system/errorCode/index.ts
| 1 | import request from '@/config/axios' | 1 | import request from '@/config/axios' |
| 2 | -import type { ErrorCodeVO } from './types' | 2 | +export interface ErrorCodeVO { |
| 3 | + id: number | ||
| 4 | + type: number | ||
| 5 | + applicationName: string | ||
| 6 | + code: number | ||
| 7 | + message: string | ||
| 8 | + memo: string | ||
| 9 | + createTime: string | ||
| 10 | +} | ||
| 11 | + | ||
| 12 | +export interface ErrorCodePageReqVO extends BasePage { | ||
| 13 | + type?: number | ||
| 14 | + applicationName?: string | ||
| 15 | + code?: number | ||
| 16 | + message?: string | ||
| 17 | + createTime?: string[] | ||
| 18 | +} | ||
| 3 | 19 | ||
| 4 | // 查询错误码列表 | 20 | // 查询错误码列表 |
| 5 | -export const getErrorCodePageApi = (params) => { | 21 | +export const getErrorCodePageApi = (params: ErrorCodePageReqVO) => { |
| 6 | return request.get({ url: '/system/error-code/page', params }) | 22 | return request.get({ url: '/system/error-code/page', params }) |
| 7 | } | 23 | } |
| 8 | 24 | ||
| @@ -26,6 +42,6 @@ export const deleteErrorCodeApi = (id: number) => { | @@ -26,6 +42,6 @@ export const deleteErrorCodeApi = (id: number) => { | ||
| 26 | return request.delete({ url: '/system/error-code/delete?id=' + id }) | 42 | return request.delete({ url: '/system/error-code/delete?id=' + id }) |
| 27 | } | 43 | } |
| 28 | // 导出错误码 | 44 | // 导出错误码 |
| 29 | -export const excelErrorCodeApi = (params) => { | 45 | +export const excelErrorCodeApi = (params: ErrorCodePageReqVO) => { |
| 30 | return request.download({ url: '/system/error-code/export-excel', params }) | 46 | return request.download({ url: '/system/error-code/export-excel', params }) |
| 31 | } | 47 | } |
yudao-ui-admin-vue3/src/api/system/errorCode/types.ts deleted
yudao-ui-admin-vue3/src/api/system/loginLog/index.ts
| @@ -12,11 +12,18 @@ export interface LoginLogVO { | @@ -12,11 +12,18 @@ export interface LoginLogVO { | ||
| 12 | createTime: string | 12 | createTime: string |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | +export interface LoginLogReqVO extends BasePage { | ||
| 16 | + userIp?: string | ||
| 17 | + username?: string | ||
| 18 | + status?: boolean | ||
| 19 | + createTime?: string[] | ||
| 20 | +} | ||
| 21 | + | ||
| 15 | // 查询登录日志列表 | 22 | // 查询登录日志列表 |
| 16 | -export const getLoginLogPageApi = (params) => { | 23 | +export const getLoginLogPageApi = (params: LoginLogReqVO) => { |
| 17 | return request.get({ url: '/system/login-log/page', params }) | 24 | return request.get({ url: '/system/login-log/page', params }) |
| 18 | } | 25 | } |
| 19 | // 导出登录日志 | 26 | // 导出登录日志 |
| 20 | -export const exportLoginLogApi = (params) => { | 27 | +export const exportLoginLogApi = (params: LoginLogReqVO) => { |
| 21 | return request.download({ url: '/system/login-log/export', params }) | 28 | return request.download({ url: '/system/login-log/export', params }) |
| 22 | } | 29 | } |
yudao-ui-admin-vue3/src/views/system/errorCode/errorCode.data.ts
| @@ -34,7 +34,8 @@ const crudSchemas = reactive<VxeCrudSchema>({ | @@ -34,7 +34,8 @@ const crudSchemas = reactive<VxeCrudSchema>({ | ||
| 34 | }, | 34 | }, |
| 35 | { | 35 | { |
| 36 | title: '错误码错误提示', | 36 | title: '错误码错误提示', |
| 37 | - field: 'message' | 37 | + field: 'message', |
| 38 | + isSearch: true | ||
| 38 | }, | 39 | }, |
| 39 | { | 40 | { |
| 40 | title: t('common.createTime'), | 41 | title: t('common.createTime'), |
yudao-ui-admin-vue3/src/views/system/errorCode/index.vue
| @@ -21,7 +21,7 @@ | @@ -21,7 +21,7 @@ | ||
| 21 | preIcon="ep:view" | 21 | preIcon="ep:view" |
| 22 | :title="t('action.detail')" | 22 | :title="t('action.detail')" |
| 23 | v-hasPermi="['system:error-code:update']" | 23 | v-hasPermi="['system:error-code:update']" |
| 24 | - @click="handleDetail(row)" | 24 | + @click="handleDetail(row.id)" |
| 25 | /> | 25 | /> |
| 26 | <XTextButton | 26 | <XTextButton |
| 27 | preIcon="ep:delete" | 27 | preIcon="ep:delete" |
| @@ -64,7 +64,6 @@ | @@ -64,7 +64,6 @@ | ||
| 64 | 64 | ||
| 65 | <script setup lang="ts"> | 65 | <script setup lang="ts"> |
| 66 | import { ref, unref } from 'vue' | 66 | import { ref, unref } from 'vue' |
| 67 | -import type { ErrorCodeVO } from '@/api/system/errorCode/types' | ||
| 68 | import { rules, allSchemas } from './errorCode.data' | 67 | import { rules, allSchemas } from './errorCode.data' |
| 69 | import * as ErrorCodeApi from '@/api/system/errorCode' | 68 | import * as ErrorCodeApi from '@/api/system/errorCode' |
| 70 | import { useI18n } from '@/hooks/web/useI18n' | 69 | import { useI18n } from '@/hooks/web/useI18n' |
| @@ -83,7 +82,7 @@ const xGrid = ref<VxeGridInstance>() // grid Ref | @@ -83,7 +82,7 @@ const xGrid = ref<VxeGridInstance>() // grid Ref | ||
| 83 | const formRef = ref<FormExpose>() // 表单 Ref | 82 | const formRef = ref<FormExpose>() // 表单 Ref |
| 84 | const detailRef = ref() // 详情 Ref | 83 | const detailRef = ref() // 详情 Ref |
| 85 | 84 | ||
| 86 | -const { gridOptions } = useVxeGrid<ErrorCodeVO>({ | 85 | +const { gridOptions } = useVxeGrid<ErrorCodeApi.ErrorCodeVO>({ |
| 87 | allSchemas: allSchemas, | 86 | allSchemas: allSchemas, |
| 88 | getListApi: ErrorCodeApi.getErrorCodePageApi | 87 | getListApi: ErrorCodeApi.getErrorCodePageApi |
| 89 | }) | 88 | }) |
| @@ -101,13 +100,6 @@ const handleCreate = () => { | @@ -101,13 +100,6 @@ const handleCreate = () => { | ||
| 101 | unref(formRef)?.getElFormRef()?.resetFields() | 100 | unref(formRef)?.getElFormRef()?.resetFields() |
| 102 | } | 101 | } |
| 103 | 102 | ||
| 104 | -// 详情操作 | ||
| 105 | -const handleDetail = async (row: ErrorCodeVO) => { | ||
| 106 | - // 设置数据 | ||
| 107 | - detailRef.value = row | ||
| 108 | - setDialogTile('detail') | ||
| 109 | -} | ||
| 110 | - | ||
| 111 | // 修改操作 | 103 | // 修改操作 |
| 112 | const handleUpdate = async (rowId: number) => { | 104 | const handleUpdate = async (rowId: number) => { |
| 113 | setDialogTile('update') | 105 | setDialogTile('update') |
| @@ -116,6 +108,14 @@ const handleUpdate = async (rowId: number) => { | @@ -116,6 +108,14 @@ const handleUpdate = async (rowId: number) => { | ||
| 116 | unref(formRef)?.setValues(res) | 108 | unref(formRef)?.setValues(res) |
| 117 | } | 109 | } |
| 118 | 110 | ||
| 111 | +// 详情操作 | ||
| 112 | +const handleDetail = async (rowId: number) => { | ||
| 113 | + setDialogTile('detail') | ||
| 114 | + // 设置数据 | ||
| 115 | + const res = await ErrorCodeApi.getErrorCodeApi(rowId) | ||
| 116 | + detailRef.value = res | ||
| 117 | +} | ||
| 118 | + | ||
| 119 | // 删除操作 | 119 | // 删除操作 |
| 120 | const handleDelete = async (rowId: number) => { | 120 | const handleDelete = async (rowId: number) => { |
| 121 | message | 121 | message |
| @@ -138,7 +138,7 @@ const submitForm = async () => { | @@ -138,7 +138,7 @@ const submitForm = async () => { | ||
| 138 | actionLoading.value = true | 138 | actionLoading.value = true |
| 139 | // 提交请求 | 139 | // 提交请求 |
| 140 | try { | 140 | try { |
| 141 | - const data = unref(formRef)?.formModel as ErrorCodeVO | 141 | + const data = unref(formRef)?.formModel as ErrorCodeApi.ErrorCodeVO |
| 142 | if (actionType.value === 'create') { | 142 | if (actionType.value === 'create') { |
| 143 | await ErrorCodeApi.createErrorCodeApi(data) | 143 | await ErrorCodeApi.createErrorCodeApi(data) |
| 144 | message.success(t('common.createSuccess')) | 144 | message.success(t('common.createSuccess')) |
yudao-ui-admin-vue3/src/views/system/loginlog/index.vue
| @@ -4,7 +4,7 @@ | @@ -4,7 +4,7 @@ | ||
| 4 | <vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar"> | 4 | <vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar"> |
| 5 | <template #toolbar_buttons> | 5 | <template #toolbar_buttons> |
| 6 | <XButton | 6 | <XButton |
| 7 | - type="primary" | 7 | + type="warning" |
| 8 | preIcon="ep:download" | 8 | preIcon="ep:download" |
| 9 | :title="t('action.export')" | 9 | :title="t('action.export')" |
| 10 | @click="handleExport()" | 10 | @click="handleExport()" |
yudao-ui-admin-vue3/src/views/system/loginlog/loginLog.data.ts
| @@ -13,8 +13,11 @@ const crudSchemas = reactive<VxeCrudSchema>({ | @@ -13,8 +13,11 @@ const crudSchemas = reactive<VxeCrudSchema>({ | ||
| 13 | { | 13 | { |
| 14 | title: '日志类型', | 14 | title: '日志类型', |
| 15 | field: 'logType', | 15 | field: 'logType', |
| 16 | - dictType: DICT_TYPE.SYSTEM_LOGIN_TYPE, | ||
| 17 | - isSearch: true | 16 | + dictType: DICT_TYPE.SYSTEM_LOGIN_TYPE |
| 17 | + }, | ||
| 18 | + { | ||
| 19 | + title: '用户类型', | ||
| 20 | + field: 'userType' | ||
| 18 | }, | 21 | }, |
| 19 | { | 22 | { |
| 20 | title: '用户名称', | 23 | title: '用户名称', |
| @@ -27,20 +30,24 @@ const crudSchemas = reactive<VxeCrudSchema>({ | @@ -27,20 +30,24 @@ const crudSchemas = reactive<VxeCrudSchema>({ | ||
| 27 | isSearch: true | 30 | isSearch: true |
| 28 | }, | 31 | }, |
| 29 | { | 32 | { |
| 30 | - title: 'userAgent', | 33 | + title: '浏览器', |
| 31 | field: 'userAgent' | 34 | field: 'userAgent' |
| 32 | }, | 35 | }, |
| 33 | { | 36 | { |
| 34 | title: '登陆结果', | 37 | title: '登陆结果', |
| 35 | field: 'result', | 38 | field: 'result', |
| 36 | - dictType: DICT_TYPE.SYSTEM_LOGIN_RESULT, | ||
| 37 | - isSearch: true | 39 | + dictType: DICT_TYPE.SYSTEM_LOGIN_RESULT |
| 38 | }, | 40 | }, |
| 39 | { | 41 | { |
| 40 | title: t('common.createTime'), | 42 | title: t('common.createTime'), |
| 41 | field: 'createTime', | 43 | field: 'createTime', |
| 42 | formatter: 'formatDate', | 44 | formatter: 'formatDate', |
| 43 | - isForm: false | 45 | + isForm: false, |
| 46 | + search: { | ||
| 47 | + itemRender: { | ||
| 48 | + name: 'XDataTimePicker' | ||
| 49 | + } | ||
| 50 | + } | ||
| 44 | } | 51 | } |
| 45 | ] | 52 | ] |
| 46 | }) | 53 | }) |
yudao-ui-admin-vue3/src/views/system/post/index.vue
| @@ -12,7 +12,7 @@ | @@ -12,7 +12,7 @@ | ||
| 12 | @click="handleCreate()" | 12 | @click="handleCreate()" |
| 13 | /> | 13 | /> |
| 14 | <XButton | 14 | <XButton |
| 15 | - type="primary" | 15 | + type="warning" |
| 16 | preIcon="ep:download" | 16 | preIcon="ep:download" |
| 17 | :title="t('action.export')" | 17 | :title="t('action.export')" |
| 18 | v-hasPermi="['system:post:export']" | 18 | v-hasPermi="['system:post:export']" |