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 | 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 | 22 | return request.get({ url: '/system/error-code/page', params }) |
| 7 | 23 | } |
| 8 | 24 | |
| ... | ... | @@ -26,6 +42,6 @@ export const deleteErrorCodeApi = (id: number) => { |
| 26 | 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 | 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 | 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 | 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 | 28 | return request.download({ url: '/system/login-log/export', params }) |
| 22 | 29 | } | ... | ... |
yudao-ui-admin-vue3/src/views/system/errorCode/errorCode.data.ts
yudao-ui-admin-vue3/src/views/system/errorCode/index.vue
| ... | ... | @@ -21,7 +21,7 @@ |
| 21 | 21 | preIcon="ep:view" |
| 22 | 22 | :title="t('action.detail')" |
| 23 | 23 | v-hasPermi="['system:error-code:update']" |
| 24 | - @click="handleDetail(row)" | |
| 24 | + @click="handleDetail(row.id)" | |
| 25 | 25 | /> |
| 26 | 26 | <XTextButton |
| 27 | 27 | preIcon="ep:delete" |
| ... | ... | @@ -64,7 +64,6 @@ |
| 64 | 64 | |
| 65 | 65 | <script setup lang="ts"> |
| 66 | 66 | import { ref, unref } from 'vue' |
| 67 | -import type { ErrorCodeVO } from '@/api/system/errorCode/types' | |
| 68 | 67 | import { rules, allSchemas } from './errorCode.data' |
| 69 | 68 | import * as ErrorCodeApi from '@/api/system/errorCode' |
| 70 | 69 | import { useI18n } from '@/hooks/web/useI18n' |
| ... | ... | @@ -83,7 +82,7 @@ const xGrid = ref<VxeGridInstance>() // grid Ref |
| 83 | 82 | const formRef = ref<FormExpose>() // 表单 Ref |
| 84 | 83 | const detailRef = ref() // 详情 Ref |
| 85 | 84 | |
| 86 | -const { gridOptions } = useVxeGrid<ErrorCodeVO>({ | |
| 85 | +const { gridOptions } = useVxeGrid<ErrorCodeApi.ErrorCodeVO>({ | |
| 87 | 86 | allSchemas: allSchemas, |
| 88 | 87 | getListApi: ErrorCodeApi.getErrorCodePageApi |
| 89 | 88 | }) |
| ... | ... | @@ -101,13 +100,6 @@ const handleCreate = () => { |
| 101 | 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 | 104 | const handleUpdate = async (rowId: number) => { |
| 113 | 105 | setDialogTile('update') |
| ... | ... | @@ -116,6 +108,14 @@ const handleUpdate = async (rowId: number) => { |
| 116 | 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 | 120 | const handleDelete = async (rowId: number) => { |
| 121 | 121 | message |
| ... | ... | @@ -138,7 +138,7 @@ const submitForm = async () => { |
| 138 | 138 | actionLoading.value = true |
| 139 | 139 | // 提交请求 |
| 140 | 140 | try { |
| 141 | - const data = unref(formRef)?.formModel as ErrorCodeVO | |
| 141 | + const data = unref(formRef)?.formModel as ErrorCodeApi.ErrorCodeVO | |
| 142 | 142 | if (actionType.value === 'create') { |
| 143 | 143 | await ErrorCodeApi.createErrorCodeApi(data) |
| 144 | 144 | message.success(t('common.createSuccess')) | ... | ... |
yudao-ui-admin-vue3/src/views/system/loginlog/index.vue
yudao-ui-admin-vue3/src/views/system/loginlog/loginLog.data.ts
| ... | ... | @@ -13,8 +13,11 @@ const crudSchemas = reactive<VxeCrudSchema>({ |
| 13 | 13 | { |
| 14 | 14 | title: '日志类型', |
| 15 | 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 | 23 | title: '用户名称', |
| ... | ... | @@ -27,20 +30,24 @@ const crudSchemas = reactive<VxeCrudSchema>({ |
| 27 | 30 | isSearch: true |
| 28 | 31 | }, |
| 29 | 32 | { |
| 30 | - title: 'userAgent', | |
| 33 | + title: '浏览器', | |
| 31 | 34 | field: 'userAgent' |
| 32 | 35 | }, |
| 33 | 36 | { |
| 34 | 37 | title: '登陆结果', |
| 35 | 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 | 42 | title: t('common.createTime'), |
| 41 | 43 | field: 'createTime', |
| 42 | 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