完善日志管理
This commit is contained in:
1
src/typings/components.d.ts
vendored
1
src/typings/components.d.ts
vendored
@@ -45,6 +45,7 @@ declare module 'vue' {
|
|||||||
ASelectOption: typeof import('ant-design-vue/es')['SelectOption']
|
ASelectOption: typeof import('ant-design-vue/es')['SelectOption']
|
||||||
ASpace: typeof import('ant-design-vue/es')['Space']
|
ASpace: typeof import('ant-design-vue/es')['Space']
|
||||||
ASpin: typeof import('ant-design-vue/es')['Spin']
|
ASpin: typeof import('ant-design-vue/es')['Spin']
|
||||||
|
AStatistic: typeof import('ant-design-vue/es')['Statistic']
|
||||||
AStep: typeof import('ant-design-vue/es')['Step']
|
AStep: typeof import('ant-design-vue/es')['Step']
|
||||||
ASteps: typeof import('ant-design-vue/es')['Steps']
|
ASteps: typeof import('ant-design-vue/es')['Steps']
|
||||||
ASwitch: typeof import('ant-design-vue/es')['Switch']
|
ASwitch: typeof import('ant-design-vue/es')['Switch']
|
||||||
|
|||||||
@@ -7,11 +7,22 @@ import logSearch from './modules/log-search.vue';
|
|||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
import { saveAs } from 'file-saver';
|
import { saveAs } from 'file-saver';
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
import useDictStore from '@/store/modules/dict';
|
||||||
|
|
||||||
|
|
||||||
const wrapperEl = shallowRef<HTMLElement | null>(null);
|
const wrapperEl = shallowRef<HTMLElement | null>(null);
|
||||||
const { height: wrapperElHeight } = useElementSize(wrapperEl);
|
const { height: wrapperElHeight } = useElementSize(wrapperEl);
|
||||||
|
|
||||||
|
|
||||||
|
const { parseDataDict, getDict } = useDictStore();
|
||||||
|
/**字典数据 */
|
||||||
|
let dict: {
|
||||||
|
/**数据状态 */
|
||||||
|
sysBusinessType: any[];
|
||||||
|
} = reactive({
|
||||||
|
sysBusinessType: [],
|
||||||
|
});
|
||||||
|
|
||||||
const scrollConfig = computed(() => {
|
const scrollConfig = computed(() => {
|
||||||
return {
|
return {
|
||||||
y: wrapperElHeight.value - 72,
|
y: wrapperElHeight.value - 72,
|
||||||
@@ -41,26 +52,10 @@ const { columns, columnChecks, data, loading, getData, mobilePagination, searchP
|
|||||||
align: 'center'
|
align: 'center'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'operatorType',
|
key: 'businessType',
|
||||||
dataIndex: 'operatorType',
|
dataIndex: 'businessType',
|
||||||
title: t('page.manage.log.operType'),
|
title: t('page.manage.log.operType'),
|
||||||
align: 'center',
|
align: 'center',
|
||||||
customRender: ({ record }: any) => {
|
|
||||||
if (record.operatorType === null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
const tagMap: any = {
|
|
||||||
0: t('page.manage.log.other'),
|
|
||||||
1: t('page.manage.log.backUser'),
|
|
||||||
2: t('page.manage.log.phoneUser'),
|
|
||||||
};
|
|
||||||
const tagColor: any = {
|
|
||||||
'0': 'pink',
|
|
||||||
'1': 'warning',
|
|
||||||
'2': 'blue',
|
|
||||||
};
|
|
||||||
return <Tag color={tagColor[record.operatorType]}> {tagMap[record.operatorType]} </Tag>;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'operName',
|
key: 'operName',
|
||||||
@@ -68,12 +63,33 @@ const { columns, columnChecks, data, loading, getData, mobilePagination, searchP
|
|||||||
title: t('page.manage.log.operName'),
|
title: t('page.manage.log.operName'),
|
||||||
align: 'center'
|
align: 'center'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
key: 'operUrl',
|
||||||
|
dataIndex: 'operUrl',
|
||||||
|
title: t('page.manage.log.operUrl'),
|
||||||
|
align: 'center',
|
||||||
|
ellipsis: true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
key: 'operIp',
|
key: 'operIp',
|
||||||
dataIndex: 'operIp',
|
dataIndex: 'operIp',
|
||||||
title: t('page.manage.log.operIp'),
|
title: t('page.manage.log.operIp'),
|
||||||
align: 'center',
|
align: 'center',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
key: 'operParam',
|
||||||
|
dataIndex: 'operParam',
|
||||||
|
title: t('page.manage.log.operParam'),
|
||||||
|
align: 'center',
|
||||||
|
ellipsis: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'jsonResult',
|
||||||
|
dataIndex: 'jsonResult',
|
||||||
|
title: t('page.manage.log.jsonResult'),
|
||||||
|
align: 'center',
|
||||||
|
ellipsis: true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
key: 'status',
|
key: 'status',
|
||||||
dataIndex: 'status',
|
dataIndex: 'status',
|
||||||
@@ -126,7 +142,15 @@ const {
|
|||||||
const deptTreeData = ref<Api.Common.CommonTree>([]);
|
const deptTreeData = ref<Api.Common.CommonTree>([]);
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getUserDeptTree();
|
// 初始字典数据
|
||||||
|
Promise.allSettled([
|
||||||
|
getDict('sys_oper_type'),
|
||||||
|
]).then((resArr: any) => {
|
||||||
|
if (resArr[0].status === 'fulfilled') {
|
||||||
|
dict.sysBusinessType = resArr[0].value;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
async function handleBatchDelete() {
|
async function handleBatchDelete() {
|
||||||
@@ -147,12 +171,7 @@ function handleUserSelectChange(selectedRowKeys: Key[], selectedRows: any[]) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
async function getUserDeptTree() {
|
|
||||||
const { error, data: tree } = await doGetUserDeptTree();
|
|
||||||
if (!error) {
|
|
||||||
deptTreeData.value = tree;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleExport() {
|
function handleExport() {
|
||||||
Modal.confirm({
|
Modal.confirm({
|
||||||
@@ -182,7 +201,7 @@ function handleExport() {
|
|||||||
<div class="min-h-500px flex-col-stretch gap-16px overflow-hidden lt-sm:overflow-auto">
|
<div class="min-h-500px flex-col-stretch gap-16px overflow-hidden lt-sm:overflow-auto">
|
||||||
<logSearch v-model:model="searchParams" :dept-tree-data="deptTreeData" @reset="resetSearchParams"
|
<logSearch v-model:model="searchParams" :dept-tree-data="deptTreeData" @reset="resetSearchParams"
|
||||||
@search="getData" />
|
@search="getData" />
|
||||||
<ACard :title="t('page.manage.user.title')" :bordered="false" :body-style="{ flex: 1, overflow: 'hidden' }"
|
<ACard :title="t('page.manage.log.title')" :bordered="false" :body-style="{ flex: 1, overflow: 'hidden' }"
|
||||||
class="flex-col-stretch sm:flex-1-hidden card-wrapper">
|
class="flex-col-stretch sm:flex-1-hidden card-wrapper">
|
||||||
<template #extra>
|
<template #extra>
|
||||||
<TableHeaderOperation v-model:columns="columnChecks" :disabled-delete="checkedRowKeys.length === 0"
|
<TableHeaderOperation v-model:columns="columnChecks" :disabled-delete="checkedRowKeys.length === 0"
|
||||||
@@ -193,7 +212,14 @@ function handleExport() {
|
|||||||
:row-selection="{
|
:row-selection="{
|
||||||
selectedRowKeys: checkedRowKeys,
|
selectedRowKeys: checkedRowKeys,
|
||||||
onChange: handleUserSelectChange,
|
onChange: handleUserSelectChange,
|
||||||
}" size="small" :pagination="mobilePagination" :scroll="scrollConfig" class="h-full" />
|
}" size="small" :pagination="mobilePagination" :scroll="scrollConfig" class="h-full">
|
||||||
|
<template #bodyCell="{ column, record }">
|
||||||
|
<template v-if="column.key === 'businessType'">
|
||||||
|
<DictTag :options="dict.sysBusinessType" :value="record.businessType" />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
</ATable>
|
||||||
|
|
||||||
</ACard>
|
</ACard>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -47,8 +47,8 @@ function search() {
|
|||||||
if (!queryRangePicker.value) {
|
if (!queryRangePicker.value) {
|
||||||
queryRangePicker.value = ['', ''];
|
queryRangePicker.value = ['', ''];
|
||||||
}
|
}
|
||||||
model.value.beginTime = queryRangePicker.value[0];
|
model.value['params[beginTime]'] = queryRangePicker.value[0];
|
||||||
model.value.endTime = queryRangePicker.value[1];
|
model.value['params[endTime]'] = queryRangePicker.value[1];
|
||||||
emit('search');
|
emit('search');
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@@ -90,7 +90,7 @@ function search() {
|
|||||||
|
|
||||||
|
|
||||||
<a-col :lg="8" :md="12" :xs="24">
|
<a-col :lg="8" :md="12" :xs="24">
|
||||||
<a-form-item :label="$t('page.manage.log.useTime')" name="queryRangePicker">
|
<a-form-item :label="$t('page.manage.log.operTime')" name="queryRangePicker">
|
||||||
<a-range-picker v-model:value="queryRangePicker" allow-clear bordered show-time
|
<a-range-picker v-model:value="queryRangePicker" allow-clear bordered show-time
|
||||||
value-format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD HH:mm:ss" style="width: 100%"></a-range-picker>
|
value-format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD HH:mm:ss" style="width: 100%"></a-range-picker>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
|||||||
Reference in New Issue
Block a user