mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
feat:对接日志管理
This commit is contained in:
208
src/views/monitor/login-infor/index.vue
Normal file
208
src/views/monitor/login-infor/index.vue
Normal file
@ -0,0 +1,208 @@
|
||||
<script setup lang="tsx">
|
||||
import { NButton } from 'naive-ui';
|
||||
import { fetchBatchDeleteLoginInfor, fetchGetLoginInforList } from '@/service/api/monitor/login-infor';
|
||||
import { $t } from '@/locales';
|
||||
import { useAuth } from '@/hooks/business/auth';
|
||||
import { useAppStore } from '@/store/modules/app';
|
||||
import { useDownload } from '@/hooks/business/download';
|
||||
import { useTable, useTableOperate } from '@/hooks/common/table';
|
||||
import { useDict } from '@/hooks/business/dict';
|
||||
import DictTag from '@/components/custom/dict-tag.vue';
|
||||
import SvgIcon from '@/components/custom/svg-icon.vue';
|
||||
import { getBrowserIcon, getOsIcon } from '@/utils/format';
|
||||
import LoginInforSearch from './modules/login-infor-search.vue';
|
||||
import LoginInforViewDrawer from './modules/login-infor-view-drawer.vue';
|
||||
defineOptions({
|
||||
name: 'LoginInforList'
|
||||
});
|
||||
|
||||
const appStore = useAppStore();
|
||||
const { download } = useDownload();
|
||||
const { hasAuth } = useAuth();
|
||||
|
||||
useDict('sys_common_status');
|
||||
useDict('sys_device_type');
|
||||
|
||||
const {
|
||||
columns,
|
||||
columnChecks,
|
||||
data,
|
||||
getData,
|
||||
getDataByPage,
|
||||
loading,
|
||||
mobilePagination,
|
||||
searchParams,
|
||||
resetSearchParams
|
||||
} = useTable({
|
||||
apiFn: fetchGetLoginInforList,
|
||||
apiParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
// if you want to use the searchParams in Form, you need to define the following properties, and the value is null
|
||||
// the value can not be undefined, otherwise the property in Form will not be reactive
|
||||
userName: null,
|
||||
ipaddr: null,
|
||||
status: null
|
||||
},
|
||||
columns: () => [
|
||||
{
|
||||
type: 'selection',
|
||||
align: 'center',
|
||||
width: 48
|
||||
},
|
||||
{
|
||||
key: 'index',
|
||||
title: $t('common.index'),
|
||||
align: 'center',
|
||||
width: 64
|
||||
},
|
||||
{
|
||||
key: 'userName',
|
||||
title: '用户账号',
|
||||
align: 'center',
|
||||
minWidth: 120
|
||||
},
|
||||
{
|
||||
key: 'deviceType',
|
||||
title: '设备类型',
|
||||
align: 'center',
|
||||
minWidth: 120,
|
||||
render: row => {
|
||||
return <DictTag size="small" value={row.deviceType} dict-code="sys_device_type" />;
|
||||
}
|
||||
},
|
||||
{
|
||||
key: 'ipaddr',
|
||||
title: '登录IP地址',
|
||||
align: 'center',
|
||||
minWidth: 120
|
||||
},
|
||||
{
|
||||
key: 'loginLocation',
|
||||
title: '登录地点',
|
||||
align: 'center',
|
||||
minWidth: 120
|
||||
},
|
||||
{
|
||||
key: 'browser',
|
||||
title: '浏览器类型',
|
||||
align: 'center',
|
||||
minWidth: 120,
|
||||
render: row => {
|
||||
return (
|
||||
<div class="flex items-center gap-2">
|
||||
<SvgIcon icon={getBrowserIcon(row.browser)} />
|
||||
{row.browser}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
},
|
||||
{
|
||||
key: 'os',
|
||||
title: '操作系统',
|
||||
align: 'center',
|
||||
ellipsis: {
|
||||
tooltip: true
|
||||
},
|
||||
minWidth: 120,
|
||||
render: row => {
|
||||
const osName = row.os?.split(' or ')[0] ?? '';
|
||||
return (
|
||||
<div class="flex items-center gap-2">
|
||||
<SvgIcon icon={getOsIcon(osName)} />
|
||||
{osName}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
},
|
||||
{
|
||||
key: 'status',
|
||||
title: '登录状态',
|
||||
align: 'center',
|
||||
minWidth: 120,
|
||||
render: row => {
|
||||
return <DictTag size="small" value={row.status} dict-code="sys_common_status" />;
|
||||
}
|
||||
},
|
||||
{
|
||||
key: 'loginTime',
|
||||
title: '访问时间',
|
||||
align: 'center',
|
||||
ellipsis: {
|
||||
tooltip: true
|
||||
},
|
||||
minWidth: 120
|
||||
},
|
||||
{
|
||||
key: 'operate',
|
||||
title: $t('common.operate'),
|
||||
align: 'center',
|
||||
width: 130,
|
||||
render: row => {
|
||||
const viewBtn = () => {
|
||||
return (
|
||||
<NButton type="primary" ghost size="small" onClick={() => view(row.infoId!)}>
|
||||
详情
|
||||
</NButton>
|
||||
);
|
||||
};
|
||||
return <div class="flex-center gap-8px">{viewBtn()}</div>;
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
const { drawerVisible, editingData, handleEdit, checkedRowKeys, onBatchDeleted } = useTableOperate(data, getData);
|
||||
|
||||
async function handleBatchDelete() {
|
||||
// request
|
||||
const { error } = await fetchBatchDeleteLoginInfor(checkedRowKeys.value);
|
||||
if (error) return;
|
||||
onBatchDeleted();
|
||||
}
|
||||
|
||||
async function view(infoId: CommonType.IdType) {
|
||||
handleEdit('infoId', infoId);
|
||||
}
|
||||
|
||||
async function handleExport() {
|
||||
download('/monitor/logininfor/export', searchParams, `登录日志记录_${new Date().getTime()}.xlsx`);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="min-h-500px flex-col-stretch gap-16px overflow-hidden lt-sm:overflow-auto">
|
||||
<LoginInforSearch v-model:model="searchParams" @reset="resetSearchParams" @search="getDataByPage" />
|
||||
<NCard title="登录日志列表" :bordered="false" size="small" class="sm:flex-1-hidden card-wrapper">
|
||||
<template #header-extra>
|
||||
<TableHeaderOperation
|
||||
v-model:columns="columnChecks"
|
||||
:disabled-delete="checkedRowKeys.length === 0"
|
||||
:loading="loading"
|
||||
:show-add="false"
|
||||
:show-delete="hasAuth('monitor:logininfor:remove')"
|
||||
:show-export="hasAuth('monitor:logininfor:export')"
|
||||
@delete="handleBatchDelete"
|
||||
@export="handleExport"
|
||||
@refresh="getData"
|
||||
/>
|
||||
</template>
|
||||
<NDataTable
|
||||
v-model:checked-row-keys="checkedRowKeys"
|
||||
:columns="columns"
|
||||
:data="data"
|
||||
size="small"
|
||||
:flex-height="!appStore.isMobile"
|
||||
:scroll-x="962"
|
||||
:loading="loading"
|
||||
remote
|
||||
:row-key="row => row.infoId"
|
||||
:pagination="mobilePagination"
|
||||
class="sm:h-full"
|
||||
/>
|
||||
<LoginInforViewDrawer v-model:visible="drawerVisible" :row-data="editingData" />
|
||||
</NCard>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped></style>
|
76
src/views/monitor/login-infor/modules/login-infor-search.vue
Normal file
76
src/views/monitor/login-infor/modules/login-infor-search.vue
Normal file
@ -0,0 +1,76 @@
|
||||
<script setup lang="ts">
|
||||
import { $t } from '@/locales';
|
||||
import { useNaiveForm } from '@/hooks/common/form';
|
||||
import { useDict } from '@/hooks/business/dict';
|
||||
defineOptions({
|
||||
name: 'LoginInforSearch'
|
||||
});
|
||||
|
||||
interface Emits {
|
||||
(e: 'reset'): void;
|
||||
(e: 'search'): void;
|
||||
}
|
||||
|
||||
const emit = defineEmits<Emits>();
|
||||
|
||||
const { formRef, validate, restoreValidation } = useNaiveForm();
|
||||
|
||||
const model = defineModel<Api.Monitor.LoginInforSearchParams>('model', { required: true });
|
||||
|
||||
useDict('sys_common_status');
|
||||
|
||||
async function reset() {
|
||||
await restoreValidation();
|
||||
emit('reset');
|
||||
}
|
||||
|
||||
async function search() {
|
||||
await validate();
|
||||
emit('search');
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<NCard :bordered="false" size="small" class="card-wrapper">
|
||||
<NCollapse>
|
||||
<NCollapseItem :title="$t('common.search')" name="user-search">
|
||||
<NForm ref="formRef" :model="model" label-placement="left" :label-width="80">
|
||||
<NGrid responsive="screen" item-responsive>
|
||||
<NFormItemGi span="24 s:12 m:6" label="IP地址" path="ipaddr" class="pr-24px">
|
||||
<NInput v-model:value="model.ipaddr" placeholder="请输入登录IP地址" />
|
||||
</NFormItemGi>
|
||||
<NFormItemGi span="24 s:12 m:6" label="用户账号" path="userName" class="pr-24px">
|
||||
<NInput v-model:value="model.userName" placeholder="请输入用户账号" />
|
||||
</NFormItemGi>
|
||||
<NFormItemGi span="24 s:12 m:6" label="登录状态" path="status" class="pr-24px">
|
||||
<DictSelect
|
||||
v-model:value="model.status"
|
||||
placeholder="请选择登录状态"
|
||||
dict-code="sys_common_status"
|
||||
clearable
|
||||
/>
|
||||
</NFormItemGi>
|
||||
<NFormItemGi span="24" class="pr-24px">
|
||||
<NSpace class="w-full" justify="end">
|
||||
<NButton @click="reset">
|
||||
<template #icon>
|
||||
<icon-ic-round-refresh class="text-icon" />
|
||||
</template>
|
||||
{{ $t('common.reset') }}
|
||||
</NButton>
|
||||
<NButton type="primary" ghost @click="search">
|
||||
<template #icon>
|
||||
<icon-ic-round-search class="text-icon" />
|
||||
</template>
|
||||
{{ $t('common.search') }}
|
||||
</NButton>
|
||||
</NSpace>
|
||||
</NFormItemGi>
|
||||
</NGrid>
|
||||
</NForm>
|
||||
</NCollapseItem>
|
||||
</NCollapse>
|
||||
</NCard>
|
||||
</template>
|
||||
|
||||
<style scoped></style>
|
@ -0,0 +1,80 @@
|
||||
<script setup lang="ts">
|
||||
import { $t } from '@/locales';
|
||||
import { useDict } from '@/hooks/business/dict';
|
||||
import { getBrowserIcon, getOsIcon } from '@/utils/format';
|
||||
defineOptions({
|
||||
name: 'LoginInforViewDrawer'
|
||||
});
|
||||
|
||||
interface Props {
|
||||
/** the edit row data */
|
||||
rowData: Api.Monitor.LoginInfor | null;
|
||||
}
|
||||
|
||||
const props = defineProps<Props>();
|
||||
|
||||
const visible = defineModel<boolean>('visible', {
|
||||
default: false
|
||||
});
|
||||
|
||||
useDict('sys_device_type');
|
||||
useDict('sys_common_status');
|
||||
|
||||
const title = '登录信息详情';
|
||||
|
||||
function closeDrawer() {
|
||||
visible.value = false;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<NDrawer v-model:show="visible" :title="title" display-directive="show" :width="800" class="max-w-90%">
|
||||
<NDrawerContent :title="title" :native-scrollbar="false" closable>
|
||||
<NDescriptions label-placement="left" :column="1" size="small" bordered>
|
||||
<NDescriptionsItem label="用户账号">
|
||||
{{ props.rowData?.userName }}
|
||||
</NDescriptionsItem>
|
||||
<NDescriptionsItem label="客户端">
|
||||
{{ props.rowData?.clientKey }}
|
||||
</NDescriptionsItem>
|
||||
<NDescriptionsItem label="设备类型">
|
||||
<DictTag size="small" :value="props.rowData?.deviceType" dict-code="sys_device_type" />
|
||||
</NDescriptionsItem>
|
||||
<NDescriptionsItem label="登录IP地址">
|
||||
{{ props.rowData?.ipaddr }}
|
||||
</NDescriptionsItem>
|
||||
<NDescriptionsItem label="登录地点">
|
||||
{{ props.rowData?.loginLocation }}
|
||||
</NDescriptionsItem>
|
||||
<NDescriptionsItem label="浏览器类型">
|
||||
<div class="flex items-center gap-2">
|
||||
<SvgIcon :icon="getBrowserIcon(props.rowData?.browser ?? '')" />
|
||||
{{ props.rowData?.browser }}
|
||||
</div>
|
||||
</NDescriptionsItem>
|
||||
<NDescriptionsItem label="操作系统">
|
||||
<div class="flex items-center gap-2">
|
||||
<SvgIcon :icon="getOsIcon(props.rowData?.os ?? '')" />
|
||||
{{ props.rowData?.os }}
|
||||
</div>
|
||||
</NDescriptionsItem>
|
||||
<NDescriptionsItem label="登录状态">
|
||||
<DictTag size="small" :value="props.rowData?.status" dict-code="sys_common_status" />
|
||||
</NDescriptionsItem>
|
||||
<NDescriptionsItem label="提示消息">
|
||||
{{ props.rowData?.msg }}
|
||||
</NDescriptionsItem>
|
||||
<NDescriptionsItem label="访问时间">
|
||||
{{ props.rowData?.loginTime }}
|
||||
</NDescriptionsItem>
|
||||
</NDescriptions>
|
||||
<template #footer>
|
||||
<NSpace :size="16">
|
||||
<NButton @click="closeDrawer">{{ $t('common.close') }}</NButton>
|
||||
</NSpace>
|
||||
</template>
|
||||
</NDrawerContent>
|
||||
</NDrawer>
|
||||
</template>
|
||||
|
||||
<style scoped></style>
|
208
src/views/monitor/oper-log/index.vue
Normal file
208
src/views/monitor/oper-log/index.vue
Normal file
@ -0,0 +1,208 @@
|
||||
<script setup lang="tsx">
|
||||
import { NButton } from 'naive-ui';
|
||||
import { fetchBatchDeleteOperLog, fetchCleanOperLog, fetchGetOperLogList } from '@/service/api/monitor/oper-log';
|
||||
import { $t } from '@/locales';
|
||||
import { useAuth } from '@/hooks/business/auth';
|
||||
import { useAppStore } from '@/store/modules/app';
|
||||
import { useDownload } from '@/hooks/business/download';
|
||||
import { useTable, useTableOperate } from '@/hooks/common/table';
|
||||
import DictTag from '@/components/custom/dict-tag.vue';
|
||||
import { useDict } from '@/hooks/business/dict';
|
||||
import OperLogViewDrawer from './modules/oper-log-view-drawer.vue';
|
||||
import OperLogSearch from './modules/oper-log-search.vue';
|
||||
defineOptions({
|
||||
name: 'OperLogList'
|
||||
});
|
||||
|
||||
useDict('sys_common_status');
|
||||
useDict('sys_oper_type');
|
||||
|
||||
const appStore = useAppStore();
|
||||
const { download } = useDownload();
|
||||
const { hasAuth } = useAuth();
|
||||
|
||||
const {
|
||||
columns,
|
||||
columnChecks,
|
||||
data,
|
||||
getData,
|
||||
getDataByPage,
|
||||
loading,
|
||||
mobilePagination,
|
||||
searchParams,
|
||||
resetSearchParams
|
||||
} = useTable({
|
||||
apiFn: fetchGetOperLogList,
|
||||
apiParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
// if you want to use the searchParams in Form, you need to define the following properties, and the value is null
|
||||
// the value can not be undefined, otherwise the property in Form will not be reactive
|
||||
title: null,
|
||||
businessType: null,
|
||||
operName: null,
|
||||
operIp: null,
|
||||
status: null,
|
||||
operTime: null
|
||||
},
|
||||
columns: () => [
|
||||
{
|
||||
type: 'selection',
|
||||
align: 'center',
|
||||
width: 48
|
||||
},
|
||||
{
|
||||
key: 'index',
|
||||
title: $t('common.index'),
|
||||
align: 'center',
|
||||
width: 64
|
||||
},
|
||||
{
|
||||
key: 'title',
|
||||
title: '系统模块',
|
||||
align: 'center',
|
||||
minWidth: 120
|
||||
},
|
||||
{
|
||||
key: 'businessType',
|
||||
title: '操作类型',
|
||||
align: 'center',
|
||||
minWidth: 120,
|
||||
render(row) {
|
||||
return <DictTag size="small" value={row.businessType} dictCode="sys_oper_type" />;
|
||||
}
|
||||
},
|
||||
{
|
||||
key: 'operName',
|
||||
title: '操作人员',
|
||||
align: 'center',
|
||||
minWidth: 120
|
||||
},
|
||||
{
|
||||
key: 'operIp',
|
||||
title: '操作IP',
|
||||
align: 'center',
|
||||
minWidth: 120
|
||||
},
|
||||
{
|
||||
key: 'operLocation',
|
||||
title: '操作地点',
|
||||
align: 'center',
|
||||
minWidth: 120
|
||||
},
|
||||
{
|
||||
key: 'status',
|
||||
title: '操作状态',
|
||||
align: 'center',
|
||||
minWidth: 120,
|
||||
render(row) {
|
||||
return <DictTag size="small" value={row.status} dictCode="sys_common_status" />;
|
||||
}
|
||||
},
|
||||
{
|
||||
key: 'operTime',
|
||||
title: '操作时间',
|
||||
align: 'center',
|
||||
minWidth: 120
|
||||
},
|
||||
{
|
||||
key: 'costTime',
|
||||
title: '消耗时间',
|
||||
align: 'center',
|
||||
minWidth: 120,
|
||||
render(row) {
|
||||
return `${row.costTime} ms`;
|
||||
}
|
||||
},
|
||||
{
|
||||
key: 'operate',
|
||||
title: $t('common.operate'),
|
||||
align: 'center',
|
||||
width: 130,
|
||||
render: row => {
|
||||
const viewBtn = () => {
|
||||
return (
|
||||
<NButton type="primary" ghost size="small" onClick={() => view(row.operId!)}>
|
||||
详情
|
||||
</NButton>
|
||||
);
|
||||
};
|
||||
return <div class="flex-center gap-8px">{viewBtn()}</div>;
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
const { drawerVisible, editingData, handleEdit, checkedRowKeys, onBatchDeleted } = useTableOperate(data, getData);
|
||||
|
||||
async function handleBatchDelete() {
|
||||
// request
|
||||
const { error } = await fetchBatchDeleteOperLog(checkedRowKeys.value);
|
||||
if (error) return;
|
||||
onBatchDeleted();
|
||||
}
|
||||
async function view(operId: CommonType.IdType) {
|
||||
handleEdit('operId', operId);
|
||||
}
|
||||
|
||||
async function handleExport() {
|
||||
download('/monitor/operlog/export', searchParams, `操作日志_${new Date().getTime()}.xlsx`);
|
||||
}
|
||||
|
||||
async function handleCleanOperLog() {
|
||||
const { error } = await fetchCleanOperLog();
|
||||
if (error) return;
|
||||
window.$message?.success('清理成功');
|
||||
await getData();
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="min-h-500px flex-col-stretch gap-16px overflow-hidden lt-sm:overflow-auto">
|
||||
<OperLogSearch v-model:model="searchParams" @reset="resetSearchParams" @search="getDataByPage" />
|
||||
<NCard title="操作日志列表" :bordered="false" size="small" class="sm:flex-1-hidden card-wrapper">
|
||||
<template #header-extra>
|
||||
<NSpace>
|
||||
<NPopconfirm v-if="hasAuth('monitor:operlog:remove')" @positive-click="() => handleCleanOperLog()">
|
||||
<template #trigger>
|
||||
<NButton type="warning" ghost size="small">
|
||||
<template #icon>
|
||||
<icon-ic-round-delete class="text-icon" />
|
||||
</template>
|
||||
清空
|
||||
</NButton>
|
||||
</template>
|
||||
确认清空操作日志?
|
||||
</NPopconfirm>
|
||||
<TableHeaderOperation
|
||||
v-model:columns="columnChecks"
|
||||
:disabled-delete="checkedRowKeys.length === 0"
|
||||
:loading="loading"
|
||||
:show-add="false"
|
||||
:show-delete="hasAuth('monitor:operlog:remove')"
|
||||
:show-export="hasAuth('monitor:operlog:export')"
|
||||
@delete="handleBatchDelete"
|
||||
@export="handleExport"
|
||||
@refresh="getData"
|
||||
/>
|
||||
</NSpace>
|
||||
</template>
|
||||
<NDataTable
|
||||
v-model:checked-row-keys="checkedRowKeys"
|
||||
:columns="columns"
|
||||
:data="data"
|
||||
size="small"
|
||||
:flex-height="!appStore.isMobile"
|
||||
:scroll-x="962"
|
||||
:loading="loading"
|
||||
remote
|
||||
:row-key="row => row.operId"
|
||||
:pagination="mobilePagination"
|
||||
class="sm:h-full"
|
||||
/>
|
||||
<OperLogViewDrawer v-model:visible="drawerVisible" :row-data="editingData" />
|
||||
</NCard>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped></style>
|
88
src/views/monitor/oper-log/modules/oper-log-search.vue
Normal file
88
src/views/monitor/oper-log/modules/oper-log-search.vue
Normal file
@ -0,0 +1,88 @@
|
||||
<script setup lang="ts">
|
||||
import { $t } from '@/locales';
|
||||
import { useNaiveForm } from '@/hooks/common/form';
|
||||
import { useDict } from '@/hooks/business/dict';
|
||||
defineOptions({
|
||||
name: 'OperLogSearch'
|
||||
});
|
||||
|
||||
useDict('sys_oper_type');
|
||||
useDict('sys_common_status');
|
||||
|
||||
interface Emits {
|
||||
(e: 'reset'): void;
|
||||
(e: 'search'): void;
|
||||
}
|
||||
|
||||
const emit = defineEmits<Emits>();
|
||||
|
||||
const { formRef, validate, restoreValidation } = useNaiveForm();
|
||||
|
||||
const model = defineModel<Api.Monitor.OperLogSearchParams>('model', { required: true });
|
||||
|
||||
async function reset() {
|
||||
await restoreValidation();
|
||||
emit('reset');
|
||||
}
|
||||
|
||||
async function search() {
|
||||
await validate();
|
||||
emit('search');
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<NCard :bordered="false" size="small" class="card-wrapper">
|
||||
<NCollapse>
|
||||
<NCollapseItem :title="$t('common.search')" name="user-search">
|
||||
<NForm ref="formRef" :model="model" label-placement="left" :label-width="80">
|
||||
<NGrid responsive="screen" item-responsive>
|
||||
<NFormItemGi span="24 s:12 m:6" label="系统模块" path="title" class="pr-24px">
|
||||
<NInput v-model:value="model.title" placeholder="请输入系统模块" />
|
||||
</NFormItemGi>
|
||||
<NFormItemGi span="24 s:12 m:6" label="操作类型" path="businessType" class="pr-24px">
|
||||
<DictSelect
|
||||
v-model:value="model.businessType"
|
||||
placeholder="请选择操作类型"
|
||||
dict-code="sys_oper_type"
|
||||
clearable
|
||||
/>
|
||||
</NFormItemGi>
|
||||
<NFormItemGi span="24 s:12 m:6" label="操作人员" path="operName" class="pr-24px">
|
||||
<NInput v-model:value="model.operName" placeholder="请输入操作人员" />
|
||||
</NFormItemGi>
|
||||
<NFormItemGi span="24 s:12 m:6" label="操作IP" path="operIp" class="pr-24px">
|
||||
<NInput v-model:value="model.operIp" placeholder="请输入操作IP" />
|
||||
</NFormItemGi>
|
||||
<NFormItemGi span="24 s:12 m:6" label="操作状态" path="status" class="pr-24px">
|
||||
<DictSelect
|
||||
v-model:value="model.status"
|
||||
placeholder="请选择操作状态"
|
||||
dict-code="sys_common_status"
|
||||
clearable
|
||||
/>
|
||||
</NFormItemGi>
|
||||
<NFormItemGi span="24" class="pr-24px">
|
||||
<NSpace class="w-full" justify="end">
|
||||
<NButton @click="reset">
|
||||
<template #icon>
|
||||
<icon-ic-round-refresh class="text-icon" />
|
||||
</template>
|
||||
{{ $t('common.reset') }}
|
||||
</NButton>
|
||||
<NButton type="primary" ghost @click="search">
|
||||
<template #icon>
|
||||
<icon-ic-round-search class="text-icon" />
|
||||
</template>
|
||||
{{ $t('common.search') }}
|
||||
</NButton>
|
||||
</NSpace>
|
||||
</NFormItemGi>
|
||||
</NGrid>
|
||||
</NForm>
|
||||
</NCollapseItem>
|
||||
</NCollapse>
|
||||
</NCard>
|
||||
</template>
|
||||
|
||||
<style scoped></style>
|
71
src/views/monitor/oper-log/modules/oper-log-view-drawer.vue
Normal file
71
src/views/monitor/oper-log/modules/oper-log-view-drawer.vue
Normal file
@ -0,0 +1,71 @@
|
||||
<script setup lang="tsx">
|
||||
import { NDescriptions, NDescriptionsItem, NTag } from 'naive-ui';
|
||||
import { $t } from '@/locales';
|
||||
import DictTag from '@/components/custom/dict-tag.vue';
|
||||
import { getRequestMethodTagType } from '@/utils/format';
|
||||
defineOptions({
|
||||
name: 'OperLogViewDrawer'
|
||||
});
|
||||
|
||||
interface Props {
|
||||
/** the edit row data */
|
||||
rowData: Api.Monitor.OperLog | null;
|
||||
}
|
||||
|
||||
const props = defineProps<Props>();
|
||||
const visible = defineModel<boolean>('visible', {
|
||||
default: false
|
||||
});
|
||||
const title = '操作日志详情';
|
||||
|
||||
function closeDrawer() {
|
||||
visible.value = false;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<NDrawer v-model:show="visible" :title="title" display-directive="show" :width="800" class="max-w-90%">
|
||||
<NDrawerContent :title="title" :native-scrollbar="false" closable>
|
||||
<NDescriptions label-class="min-w-100px" :column="1" size="small" bordered label-placement="left">
|
||||
<NDescriptionsItem label="日志编号">{{ props.rowData?.operId }}</NDescriptionsItem>
|
||||
<NDescriptionsItem label="操作状态">
|
||||
<DictTag size="small" :value="props.rowData?.status" dict-code="sys_common_status" />
|
||||
</NDescriptionsItem>
|
||||
<NDescriptionsItem label="系统模块">
|
||||
<NSpace>
|
||||
<NTag size="small" type="primary">{{ props.rowData?.title }}模块</NTag>
|
||||
<DictTag size="small" :value="props.rowData?.businessType" dict-code="sys_oper_type" />
|
||||
</NSpace>
|
||||
</NDescriptionsItem>
|
||||
<NDescriptionsItem label="操作信息">
|
||||
{{ props.rowData?.operName }} | {{ props.rowData?.deptName }} | {{ props.rowData?.operIp }} |
|
||||
{{ props.rowData?.operLocation }}
|
||||
</NDescriptionsItem>
|
||||
<NDescriptionsItem label="请求信息">
|
||||
<NSpace>
|
||||
<NTag size="small" :type="getRequestMethodTagType(props.rowData?.requestMethod ?? '')">
|
||||
{{ `${props.rowData?.requestMethod?.toUpperCase()}请求` }}
|
||||
</NTag>
|
||||
{{ props.rowData?.operUrl }}
|
||||
</NSpace>
|
||||
</NDescriptionsItem>
|
||||
<NDescriptionsItem label="操作时间">{{ props.rowData?.operTime }}</NDescriptionsItem>
|
||||
<NDescriptionsItem label="请求参数">
|
||||
<JsonPreview :data="props.rowData?.operParam" />
|
||||
</NDescriptionsItem>
|
||||
<NDescriptionsItem label="返回参数">
|
||||
<JsonPreview :data="props.rowData?.jsonResult" />
|
||||
</NDescriptionsItem>
|
||||
<NDescriptionsItem label="消耗时间">
|
||||
{{ `${props.rowData?.costTime} ms` }}
|
||||
</NDescriptionsItem>
|
||||
<NDescriptionsItem label="错误消息">{{ props.rowData?.errorMsg }}</NDescriptionsItem>
|
||||
</NDescriptions>
|
||||
<template #footer>
|
||||
<NSpace :size="16">
|
||||
<NButton @click="closeDrawer">{{ $t('common.close') }}</NButton>
|
||||
</NSpace>
|
||||
</template>
|
||||
</NDrawerContent>
|
||||
</NDrawer>
|
||||
</template>
|
@ -1,6 +1,6 @@
|
||||
<script setup lang="tsx">
|
||||
import { NButton, NPopconfirm } from 'naive-ui';
|
||||
import { fetchBatchDeleteConfig, fetchGetConfigList } from '@/service/api/system/config';
|
||||
import { fetchBatchDeleteConfig, fetchGetConfigList, fetchRefreshCache } from '@/service/api/system/config';
|
||||
import { $t } from '@/locales';
|
||||
import { useAuth } from '@/hooks/business/auth';
|
||||
import { useAppStore } from '@/store/modules/app';
|
||||
@ -169,6 +169,13 @@ async function edit(configId: CommonType.IdType) {
|
||||
async function handleExport() {
|
||||
download('/system/config/export', searchParams, `参数配置_${new Date().getTime()}.xlsx`);
|
||||
}
|
||||
|
||||
async function handleRefreshCache() {
|
||||
const { error } = await fetchRefreshCache();
|
||||
if (error) return;
|
||||
window.$message?.success('刷新缓存成功');
|
||||
await getData();
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@ -176,18 +183,23 @@ async function handleExport() {
|
||||
<ConfigSearch v-model:model="searchParams" @reset="resetSearchParams" @search="getDataByPage" />
|
||||
<NCard title="参数配置列表" :bordered="false" size="small" class="sm:flex-1-hidden card-wrapper">
|
||||
<template #header-extra>
|
||||
<TableHeaderOperation
|
||||
v-model:columns="columnChecks"
|
||||
:disabled-delete="checkedRowKeys.length === 0"
|
||||
:loading="loading"
|
||||
:show-add="hasAuth('system:config:add')"
|
||||
:show-delete="hasAuth('system:config:remove')"
|
||||
:show-export="hasAuth('system:config:export')"
|
||||
@add="handleAdd"
|
||||
@delete="handleBatchDelete"
|
||||
@export="handleExport"
|
||||
@refresh="getData"
|
||||
/>
|
||||
<NSpace>
|
||||
<NButton v-if="hasAuth('system:config:remove')" type="warning" ghost size="small" @click="handleRefreshCache">
|
||||
刷新缓存
|
||||
</NButton>
|
||||
<TableHeaderOperation
|
||||
v-model:columns="columnChecks"
|
||||
:disabled-delete="checkedRowKeys.length === 0"
|
||||
:loading="loading"
|
||||
:show-add="hasAuth('system:config:add')"
|
||||
:show-delete="hasAuth('system:config:remove')"
|
||||
:show-export="hasAuth('system:config:export')"
|
||||
@add="handleAdd"
|
||||
@delete="handleBatchDelete"
|
||||
@export="handleExport"
|
||||
@refresh="getData"
|
||||
/>
|
||||
</NSpace>
|
||||
</template>
|
||||
<NDataTable
|
||||
v-model:checked-row-keys="checkedRowKeys"
|
||||
|
@ -2,7 +2,7 @@
|
||||
import { NButton, NPopconfirm } from 'naive-ui';
|
||||
import { ref } from 'vue';
|
||||
import type { TableDataWithIndex } from '@sa/hooks';
|
||||
import { fetchBatchDeleteDictType, fetchGetDictTypeList } from '@/service/api/system/dict';
|
||||
import { fetchBatchDeleteDictType, fetchGetDictTypeList, fetchRefreshCache } from '@/service/api/system/dict';
|
||||
import { $t } from '@/locales';
|
||||
import { useAuth } from '@/hooks/business/auth';
|
||||
import { useAppStore } from '@/store/modules/app';
|
||||
@ -170,6 +170,13 @@ async function edit(dictId: CommonType.IdType) {
|
||||
async function handleExport() {
|
||||
download('/system/dict/type/export', searchParams, `字典类型_${new Date().getTime()}.xlsx`);
|
||||
}
|
||||
|
||||
async function handleRefreshCache() {
|
||||
const { error } = await fetchRefreshCache();
|
||||
if (error) return;
|
||||
window.$message?.success('刷新缓存成功');
|
||||
await getData();
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@ -177,18 +184,23 @@ async function handleExport() {
|
||||
<DictTypeSearch v-model:model="searchParams" @reset="resetSearchParams" @search="getDataByPage" />
|
||||
<NCard title="字典类型列表" :bordered="false" size="small" class="sm:flex-1-hidden card-wrapper">
|
||||
<template #header-extra>
|
||||
<TableHeaderOperation
|
||||
v-model:columns="columnChecks"
|
||||
:disabled-delete="checkedRowKeys.length === 0"
|
||||
:loading="loading"
|
||||
:show-add="hasAuth('system:dict:add')"
|
||||
:show-delete="hasAuth('system:dict:remove')"
|
||||
:show-export="hasAuth('system:dict:export')"
|
||||
@add="handleAdd"
|
||||
@delete="handleBatchDelete"
|
||||
@export="handleExport"
|
||||
@refresh="getData"
|
||||
/>
|
||||
<NSpace>
|
||||
<NButton v-if="hasAuth('system:dict:remove')" type="warning" ghost size="small" @click="handleRefreshCache">
|
||||
刷新缓存
|
||||
</NButton>
|
||||
<TableHeaderOperation
|
||||
v-model:columns="columnChecks"
|
||||
:disabled-delete="checkedRowKeys.length === 0"
|
||||
:loading="loading"
|
||||
:show-add="hasAuth('system:dict:add')"
|
||||
:show-delete="hasAuth('system:dict:remove')"
|
||||
:show-export="hasAuth('system:dict:export')"
|
||||
@add="handleAdd"
|
||||
@delete="handleBatchDelete"
|
||||
@export="handleExport"
|
||||
@refresh="getData"
|
||||
/>
|
||||
</NSpace>
|
||||
</template>
|
||||
<NDataTable
|
||||
v-model:checked-row-keys="checkedRowKeys"
|
||||
|
Reference in New Issue
Block a user