优化登录日志、操作日志

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

View File

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

View File

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

View File

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

View File

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