Vue3 重构:REVIEW 登录日志
This commit is contained in:
parent
8e032d988b
commit
4481964182
@ -13,18 +13,12 @@ export interface LoginLogVO {
|
||||
createTime: Date
|
||||
}
|
||||
|
||||
export interface LoginLogReqVO extends PageParam {
|
||||
userIp?: string
|
||||
username?: string
|
||||
status?: boolean
|
||||
createTime?: Date[]
|
||||
}
|
||||
|
||||
// 查询登录日志列表
|
||||
export const getLoginLogPage = (params: LoginLogReqVO) => {
|
||||
export const getLoginLogPage = (params: PageParam) => {
|
||||
return request.get({ url: '/system/login-log/page', params })
|
||||
}
|
||||
|
||||
// 导出登录日志
|
||||
export const exportLoginLog = (params: LoginLogReqVO) => {
|
||||
export const exportLoginLog = (params) => {
|
||||
return request.download({ url: '/system/login-log/export', params })
|
||||
}
|
||||
|
@ -26,9 +26,3 @@
|
||||
border-left-color: var(--el-color-primary);
|
||||
}
|
||||
}
|
||||
|
||||
// 添加表头样式
|
||||
.el-table.yudao-table {
|
||||
--el-table-header-bg-color: #f8f8f9;
|
||||
--el-table-header-text-color: #606266;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<Dialog title="详情" v-model="modelVisible" :scroll="true" :max-height="500" width="800">
|
||||
<Dialog title="详情" v-model="modelVisible" width="800">
|
||||
<el-descriptions border :column="1">
|
||||
<el-descriptions-item label="日志编号" min-width="120">
|
||||
{{ detailData.id }}
|
||||
@ -35,7 +35,7 @@ const detailLoading = ref(false) // 表单的加载中
|
||||
const detailData = ref() // 详情数据
|
||||
|
||||
/** 打开弹窗 */
|
||||
const openModal = async (data: LoginLogApi.LoginLogVO) => {
|
||||
const open = async (data: LoginLogApi.LoginLogVO) => {
|
||||
modelVisible.value = true
|
||||
// 设置数据
|
||||
detailLoading.value = true
|
||||
@ -45,5 +45,5 @@ const openModal = async (data: LoginLogApi.LoginLogVO) => {
|
||||
detailLoading.value = false
|
||||
}
|
||||
}
|
||||
defineExpose({ openModal }) // 提供 openModal 方法,用于打开弹窗
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
</script>
|
@ -55,7 +55,7 @@
|
||||
|
||||
<!-- 列表 -->
|
||||
<content-wrap>
|
||||
<el-table class="yudao-table" v-loading="loading" :data="list">
|
||||
<el-table v-loading="loading" :data="list">
|
||||
<el-table-column label="日志编号" align="center" prop="id" />
|
||||
<el-table-column label="操作类型" align="center" prop="logType">
|
||||
<template #default="scope">
|
||||
@ -64,7 +64,6 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="用户名称" align="center" prop="username" width="180" />
|
||||
<el-table-column label="登录地址" align="center" prop="userIp" width="180" />
|
||||
|
||||
<el-table-column label="浏览器" align="center" prop="userAgent" />
|
||||
<el-table-column label="登陆结果" align="center" prop="result">
|
||||
<template #default="scope">
|
||||
@ -83,7 +82,7 @@
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
@click="openModal(scope.row)"
|
||||
@click="openDetail(scope.row)"
|
||||
v-hasPermi="['infra:config:query']"
|
||||
>
|
||||
详情
|
||||
@ -101,14 +100,14 @@
|
||||
</content-wrap>
|
||||
|
||||
<!-- 表单弹窗:详情 -->
|
||||
<login-log-detail ref="modalRef" />
|
||||
<LoginLogDetail ref="detailRef" />
|
||||
</template>
|
||||
<script setup lang="ts" name="LoginLog">
|
||||
import { DICT_TYPE } from '@/utils/dict'
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import download from '@/utils/download'
|
||||
import * as LoginLogApi from '@/api/system/loginLog'
|
||||
import LoginLogDetail from './detail.vue'
|
||||
import LoginLogDetail from './LoginLogDetail.vue'
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
const loading = ref(true) // 列表的加载中
|
||||
@ -149,9 +148,9 @@ const resetQuery = () => {
|
||||
}
|
||||
|
||||
/** 详情操作 */
|
||||
const modalRef = ref()
|
||||
const openModal = (data: LoginLogApi.LoginLogVO) => {
|
||||
modalRef.value.openModal(data)
|
||||
const detailRef = ref()
|
||||
const openDetail = (data: LoginLogApi.LoginLogVO) => {
|
||||
detailRef.value.open(data)
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
|
Loading…
Reference in New Issue
Block a user