优化登录日志、操作日志

This commit is contained in:
zjl 2024-12-11 16:07:55 +08:00
parent 62bcc3c098
commit a5b1a54113
5 changed files with 75 additions and 14 deletions

View File

@ -65,14 +65,20 @@
const editVisible = ref(false);
const loginlogId = ref(0);
const rowKeys = ref([]);
const showModal = ref(false);
/**
* 定义查询参数
*/
const formParams = reactive({
username: '',
type: '',
status: '',
});
/**
* 定义操作栏
*/
const actionColumn = reactive({
width: 200,
title: '操作',
@ -102,24 +108,36 @@
},
});
function addTable() {
showModal.value = true;
}
/**
* 加载数据列表
* @param res 参数
*/
const loadDataTable = async (res) => {
rowKeys.value = [];
const result = await getLoginLogList({ ...formParams, ...res });
return result;
};
/**
* 数据行选中事件
* @param keys 参数
*/
function onCheckedRow(keys) {
rowKeys.value = keys;
}
/**
* 刷新数据列表
* @param noRefresh 参数
*/
function reloadTable(noRefresh = '') {
basicTableRef.value.reload(noRefresh ? {} : { pageNo: 1 });
}
/**
* 执行提交表单
* @param values 参数
*/
function handleSubmit(values: Recordable) {
for (const key in formParams) {
formParams[key] = '';
@ -130,6 +148,10 @@
reloadTable();
}
/**
* 执行重置
* @param values 参数
*/
function handleReset(values: Recordable) {
for (const key in formParams) {
formParams[key] = '';
@ -140,6 +162,9 @@
reloadTable();
}
/**
* 执行注册
*/
const [register, {}] = useForm({
gridProps: { cols: '1 s:1 m:2 l:3 xl:4 2xl:4' },
labelWidth: 80,
@ -155,6 +180,7 @@
await nextTick();
createModalRef.value.openModal();
}
/**
* 执行删除
* @param id 参数

View File

@ -16,6 +16,7 @@ export const columns = [
{
title: '访客',
align: 'left',
width: 200,
render(record) {
return h('div', [
h(
@ -47,6 +48,7 @@ export const columns = [
{
title: '请求接口',
align: 'left',
width: 200,
render(record) {
return h('div', [
h(
@ -72,6 +74,7 @@ export const columns = [
{
title: '接口响应',
align: 'left',
width: 250,
render(record) {
return h('div', [
h('span', '状态:'),
@ -99,6 +102,7 @@ export const columns = [
{
title: '操作来源',
align: 'left',
width: 200,
render(record) {
return h('div', [
h('div', '系统:' + record.os),

View File

@ -54,7 +54,6 @@
import { columns } from './operLog/columns';
import { DeleteOutlined, EyeOutlined } from '@vicons/antd';
import editDialog from './operLog/edit.vue';
import { basicModal, useModal } from '@/components/Modal';
import { schemas } from './operLog/querySchemas';
import { renderIcon } from '@/utils';
@ -65,14 +64,19 @@
const editVisible = ref(false);
const operlogId = ref(0);
const rowKeys = ref([]);
const showModal = ref(false);
/**
* 定义查询参数
*/
const formParams = reactive({
username: '',
type: '',
title: '',
status: '',
});
/**
* 定义操作栏
*/
const actionColumn = reactive({
width: 200,
title: '操作',
@ -102,24 +106,36 @@
},
});
function addTable() {
showModal.value = true;
}
/**
* 加载数据列表
* @param res 参数
*/
const loadDataTable = async (res) => {
rowKeys.value = [];
const result = await getOperLogList({ ...formParams, ...res });
return result;
};
/**
* 数据行选中事件
* @param keys 参数
*/
function onCheckedRow(keys) {
rowKeys.value = keys;
}
/**
* 刷新数据列表
* @param noRefresh 参数
*/
function reloadTable(noRefresh = '') {
basicTableRef.value.reload(noRefresh ? {} : { pageNo: 1 });
}
/**
* 执行提交表单
* @param values 参数
*/
function handleSubmit(values: Recordable) {
for (const key in formParams) {
formParams[key] = '';
@ -130,6 +146,10 @@
reloadTable();
}
/**
* 执行重置
* @param values 参数
*/
function handleReset(values: Recordable) {
for (const key in formParams) {
formParams[key] = '';
@ -140,6 +160,9 @@
reloadTable();
}
/**
* 执行注册
*/
const [register, {}] = useForm({
gridProps: { cols: '1 s:1 m:2 l:3 xl:4 2xl:4' },
labelWidth: 80,
@ -155,6 +178,7 @@
await nextTick();
createModalRef.value.openModal();
}
/**
* 执行删除
* @param id 参数

View File

@ -16,6 +16,7 @@ export const columns = [
{
title: '访客',
align: 'left',
width: 200,
render(record) {
return h('div', [
h(
@ -47,6 +48,7 @@ export const columns = [
{
title: '请求接口',
align: 'left',
width: 200,
render(record) {
return h('div', [
h(
@ -72,6 +74,7 @@ export const columns = [
{
title: '接口响应',
align: 'left',
width: 250,
render(record) {
return h('div', [
h('span', '状态:'),
@ -99,6 +102,7 @@ export const columns = [
{
title: '操作来源',
align: 'left',
width: 200,
render(record) {
return h('div', [
h('div', '系统:' + record.os),

View File

@ -103,7 +103,10 @@
setFormData();
}
});
//
/**
* 定义函数
*/
defineExpose({
openModal,
});