|
@@ -1,53 +1,176 @@
|
|
|
<template>
|
|
|
- <ContentWrap>
|
|
|
- <!-- 列表 -->
|
|
|
- <XTable @register="registerTable">
|
|
|
- <!-- 操作:导出 -->
|
|
|
- <template #toolbar_buttons>
|
|
|
- <XButton
|
|
|
- type="warning"
|
|
|
- preIcon="ep:download"
|
|
|
- :title="t('action.export')"
|
|
|
- @click="exportList('登录列表.xls')"
|
|
|
+ <content-wrap>
|
|
|
+ <!-- 搜索工作栏 -->
|
|
|
+ <el-form
|
|
|
+ class="-mb-15px"
|
|
|
+ :model="queryParams"
|
|
|
+ ref="queryFormRef"
|
|
|
+ :inline="true"
|
|
|
+ label-width="68px"
|
|
|
+ >
|
|
|
+ <el-form-item label="用户名称" prop="username">
|
|
|
+ <el-input
|
|
|
+ v-model="queryParams.username"
|
|
|
+ placeholder="请输入用户名称"
|
|
|
+ clearable
|
|
|
+ @keyup.enter="handleQuery"
|
|
|
+ class="!w-240px"
|
|
|
/>
|
|
|
- </template>
|
|
|
- <template #actionbtns_default="{ row }">
|
|
|
- <!-- 操作:详情 -->
|
|
|
- <XTextButton preIcon="ep:view" :title="t('action.detail')" @click="handleDetail(row)" />
|
|
|
- </template>
|
|
|
- </XTable>
|
|
|
- </ContentWrap>
|
|
|
- <!-- 弹窗 -->
|
|
|
- <XModal id="postModel" v-model="dialogVisible" :title="dialogTitle">
|
|
|
- <!-- 表单:详情 -->
|
|
|
- <Descriptions :schema="allSchemas.detailSchema" :data="detailData" />
|
|
|
- <template #footer>
|
|
|
- <!-- 按钮:关闭 -->
|
|
|
- <XButton :title="t('dialog.close')" @click="dialogVisible = false" />
|
|
|
- </template>
|
|
|
- </XModal>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="登录地址" prop="userIp">
|
|
|
+ <el-input
|
|
|
+ v-model="queryParams.userIp"
|
|
|
+ placeholder="请输入登录地址"
|
|
|
+ clearable
|
|
|
+ @keyup.enter="handleQuery"
|
|
|
+ class="!w-240px"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="登录日期" prop="createTime">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="queryParams.createTime"
|
|
|
+ value-format="YYYY-MM-DD HH:mm:ss"
|
|
|
+ type="daterange"
|
|
|
+ start-placeholder="开始日期"
|
|
|
+ end-placeholder="结束日期"
|
|
|
+ :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
|
|
+ class="!w-240px"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
|
|
+ <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
|
|
+ <el-button
|
|
|
+ type="success"
|
|
|
+ plain
|
|
|
+ @click="handleExport"
|
|
|
+ :loading="exportLoading"
|
|
|
+ v-hasPermi="['infra:config:export']"
|
|
|
+ >
|
|
|
+ <Icon icon="ep:download" class="mr-5px" /> 导出
|
|
|
+ </el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </content-wrap>
|
|
|
+
|
|
|
+ <!-- 列表 -->
|
|
|
+ <content-wrap>
|
|
|
+ <el-table class="yudao-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">
|
|
|
+ <dict-tag :type="DICT_TYPE.SYSTEM_LOGIN_TYPE" :value="scope.row.logType" />
|
|
|
+ </template>
|
|
|
+ </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">
|
|
|
+ <dict-tag :type="DICT_TYPE.SYSTEM_LOGIN_RESULT" :value="scope.row.result" />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ label="登录日期"
|
|
|
+ align="center"
|
|
|
+ prop="createTime"
|
|
|
+ width="180"
|
|
|
+ :formatter="dateFormatter"
|
|
|
+ />
|
|
|
+ <el-table-column label="操作" align="center">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-button
|
|
|
+ link
|
|
|
+ type="primary"
|
|
|
+ @click="openModal(scope.row)"
|
|
|
+ v-hasPermi="['infra:config:query']"
|
|
|
+ >
|
|
|
+ 详情
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <!-- 分页 -->
|
|
|
+ <Pagination
|
|
|
+ :total="total"
|
|
|
+ v-model:page="queryParams.pageNo"
|
|
|
+ v-model:limit="queryParams.pageSize"
|
|
|
+ @pagination="getList"
|
|
|
+ />
|
|
|
+ </content-wrap>
|
|
|
+
|
|
|
+ <!-- 表单弹窗:详情 -->
|
|
|
+ <login-log-detail ref="modalRef" />
|
|
|
</template>
|
|
|
-<script setup lang="ts" name="Loginlog">
|
|
|
-// 业务相关的 import
|
|
|
-import { allSchemas } from './loginLog.data'
|
|
|
-import { getLoginLogPageApi, exportLoginLogApi, LoginLogVO } from '@/api/system/loginLog'
|
|
|
-
|
|
|
-const { t } = useI18n() // 国际化
|
|
|
-// 列表相关的变量
|
|
|
-const [registerTable, { exportList }] = useXTable({
|
|
|
- allSchemas: allSchemas,
|
|
|
- getListApi: getLoginLogPageApi,
|
|
|
- exportListApi: exportLoginLogApi
|
|
|
+<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'
|
|
|
+const message = useMessage() // 消息弹窗
|
|
|
+
|
|
|
+const loading = ref(true) // 列表的加载中
|
|
|
+const total = ref(0) // 列表的总页数
|
|
|
+const list = ref([]) // 列表的数据
|
|
|
+const queryParams = reactive({
|
|
|
+ pageNo: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ username: undefined,
|
|
|
+ userIp: undefined,
|
|
|
+ createTime: []
|
|
|
})
|
|
|
+const queryFormRef = ref() // 搜索的表单
|
|
|
+const exportLoading = ref(false) // 导出的加载中
|
|
|
+
|
|
|
+/** 查询参数列表 */
|
|
|
+const getList = async () => {
|
|
|
+ loading.value = true
|
|
|
+ try {
|
|
|
+ const data = await LoginLogApi.getLoginLogPage(queryParams)
|
|
|
+ list.value = data.list
|
|
|
+ total.value = data.total
|
|
|
+ } finally {
|
|
|
+ loading.value = false
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
-// 详情操作
|
|
|
-const detailData = ref() // 详情 Ref
|
|
|
-const dialogVisible = ref(false) // 是否显示弹出层
|
|
|
-const dialogTitle = ref(t('action.detail')) // 弹出层标题
|
|
|
-// 详情
|
|
|
-const handleDetail = async (row: LoginLogVO) => {
|
|
|
- // 设置数据
|
|
|
- detailData.value = row
|
|
|
- dialogVisible.value = true
|
|
|
+/** 搜索按钮操作 */
|
|
|
+const handleQuery = () => {
|
|
|
+ queryParams.pageNo = 1
|
|
|
+ getList()
|
|
|
}
|
|
|
+
|
|
|
+/** 重置按钮操作 */
|
|
|
+const resetQuery = () => {
|
|
|
+ queryFormRef.value.resetFields()
|
|
|
+ handleQuery()
|
|
|
+}
|
|
|
+
|
|
|
+/** 详情操作 */
|
|
|
+const modalRef = ref()
|
|
|
+const openModal = (data: LoginLogApi.LoginLogVO) => {
|
|
|
+ modalRef.value.openModal(data)
|
|
|
+}
|
|
|
+
|
|
|
+/** 导出按钮操作 */
|
|
|
+const handleExport = async () => {
|
|
|
+ try {
|
|
|
+ // 导出的二次确认
|
|
|
+ await message.exportConfirm()
|
|
|
+ // 发起导出
|
|
|
+ exportLoading.value = true
|
|
|
+ const data = await LoginLogApi.exportLoginLog(queryParams)
|
|
|
+ download.excel(data, '登录日志.xls')
|
|
|
+ } catch {
|
|
|
+ } finally {
|
|
|
+ exportLoading.value = false
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+/** 初始化 **/
|
|
|
+onMounted(() => {
|
|
|
+ getList()
|
|
|
+})
|
|
|
</script>
|