Skip to content

Commit 4481964

Browse files
committed
Vue3 重构:REVIEW 登录日志
1 parent 8e032d9 commit 4481964

File tree

4 files changed

+13
-26
lines changed

4 files changed

+13
-26
lines changed

src/api/system/loginLog/index.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,12 @@ export interface LoginLogVO {
1313
createTime: Date
1414
}
1515

16-
export interface LoginLogReqVO extends PageParam {
17-
userIp?: string
18-
username?: string
19-
status?: boolean
20-
createTime?: Date[]
21-
}
22-
2316
// 查询登录日志列表
24-
export const getLoginLogPage = (params: LoginLogReqVO) => {
17+
export const getLoginLogPage = (params: PageParam) => {
2518
return request.get({ url: '/system/login-log/page', params })
2619
}
20+
2721
// 导出登录日志
28-
export const exportLoginLog = (params: LoginLogReqVO) => {
22+
export const exportLoginLog = (params) => {
2923
return request.download({ url: '/system/login-log/export', params })
3024
}

src/styles/index.scss

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,3 @@
2626
border-left-color: var(--el-color-primary);
2727
}
2828
}
29-
30-
// 添加表头样式
31-
.el-table.yudao-table {
32-
--el-table-header-bg-color: #f8f8f9;
33-
--el-table-header-text-color: #606266;
34-
}

src/views/system/loginlog/detail.vue renamed to src/views/system/loginlog/LoginLogDetail.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<Dialog title="详情" v-model="modelVisible" :scroll="true" :max-height="500" width="800">
2+
<Dialog title="详情" v-model="modelVisible" width="800">
33
<el-descriptions border :column="1">
44
<el-descriptions-item label="日志编号" min-width="120">
55
{{ detailData.id }}
@@ -35,7 +35,7 @@ const detailLoading = ref(false) // 表单的加载中
3535
const detailData = ref() // 详情数据
3636
3737
/** 打开弹窗 */
38-
const openModal = async (data: LoginLogApi.LoginLogVO) => {
38+
const open = async (data: LoginLogApi.LoginLogVO) => {
3939
modelVisible.value = true
4040
// 设置数据
4141
detailLoading.value = true
@@ -45,5 +45,5 @@ const openModal = async (data: LoginLogApi.LoginLogVO) => {
4545
detailLoading.value = false
4646
}
4747
}
48-
defineExpose({ openModal }) // 提供 openModal 方法,用于打开弹窗
48+
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
4949
</script>

src/views/system/loginlog/index.vue

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555

5656
<!-- 列表 -->
5757
<content-wrap>
58-
<el-table class="yudao-table" v-loading="loading" :data="list">
58+
<el-table v-loading="loading" :data="list">
5959
<el-table-column label="日志编号" align="center" prop="id" />
6060
<el-table-column label="操作类型" align="center" prop="logType">
6161
<template #default="scope">
@@ -64,7 +64,6 @@
6464
</el-table-column>
6565
<el-table-column label="用户名称" align="center" prop="username" width="180" />
6666
<el-table-column label="登录地址" align="center" prop="userIp" width="180" />
67-
6867
<el-table-column label="浏览器" align="center" prop="userAgent" />
6968
<el-table-column label="登陆结果" align="center" prop="result">
7069
<template #default="scope">
@@ -83,7 +82,7 @@
8382
<el-button
8483
link
8584
type="primary"
86-
@click="openModal(scope.row)"
85+
@click="openDetail(scope.row)"
8786
v-hasPermi="['infra:config:query']"
8887
>
8988
详情
@@ -101,14 +100,14 @@
101100
</content-wrap>
102101

103102
<!-- 表单弹窗:详情 -->
104-
<login-log-detail ref="modalRef" />
103+
<LoginLogDetail ref="detailRef" />
105104
</template>
106105
<script setup lang="ts" name="LoginLog">
107106
import { DICT_TYPE } from '@/utils/dict'
108107
import { dateFormatter } from '@/utils/formatTime'
109108
import download from '@/utils/download'
110109
import * as LoginLogApi from '@/api/system/loginLog'
111-
import LoginLogDetail from './detail.vue'
110+
import LoginLogDetail from './LoginLogDetail.vue'
112111
const message = useMessage() // 消息弹窗
113112
114113
const loading = ref(true) // 列表的加载中
@@ -149,9 +148,9 @@ const resetQuery = () => {
149148
}
150149
151150
/** 详情操作 */
152-
const modalRef = ref()
153-
const openModal = (data: LoginLogApi.LoginLogVO) => {
154-
modalRef.value.openModal(data)
151+
const detailRef = ref()
152+
const openDetail = (data: LoginLogApi.LoginLogVO) => {
153+
detailRef.value.open(data)
155154
}
156155
157156
/** 导出按钮操作 */

0 commit comments

Comments
 (0)