2024-08-07 08:57:56 +08:00
|
|
|
<script setup lang="ts">
|
2024-09-26 08:40:16 +08:00
|
|
|
import type { Recordable } from '@vben/types';
|
2024-09-24 11:23:02 +08:00
|
|
|
|
2024-09-26 08:40:16 +08:00
|
|
|
import type { OperationLog } from '#/api/monitor/operlog/model';
|
|
|
|
|
|
|
|
import { onMounted, ref } from 'vue';
|
|
|
|
|
|
|
|
import { Page, useVbenDrawer } from '@vben/common-ui';
|
|
|
|
import { $t } from '@vben/locales';
|
|
|
|
|
|
|
|
import { Card, Table } from 'ant-design-vue';
|
2024-09-24 11:23:02 +08:00
|
|
|
|
|
|
|
import { useVbenForm } from '#/adapter';
|
2024-09-26 08:40:16 +08:00
|
|
|
import { operLogList } from '#/api/monitor/operlog';
|
2024-09-24 11:23:02 +08:00
|
|
|
|
2024-09-26 08:40:16 +08:00
|
|
|
import { columns, querySchema } from './data';
|
|
|
|
import operationPreviewDrawer from './OperationPreviewDrawer.vue';
|
2024-09-24 11:23:02 +08:00
|
|
|
|
|
|
|
const [QueryForm] = useVbenForm({
|
|
|
|
// 默认展开
|
|
|
|
collapsed: false,
|
|
|
|
// 所有表单项共用,可单独在表单内覆盖
|
|
|
|
commonConfig: {
|
|
|
|
// 所有表单项
|
|
|
|
componentProps: {
|
|
|
|
class: 'w-full',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
schema: querySchema(),
|
|
|
|
// 是否可展开
|
|
|
|
showCollapseButton: true,
|
|
|
|
submitButtonOptions: {
|
|
|
|
text: '查询',
|
|
|
|
},
|
|
|
|
wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4',
|
|
|
|
});
|
2024-09-26 08:40:16 +08:00
|
|
|
|
|
|
|
const dataSource = ref<OperationLog[]>([]);
|
|
|
|
|
|
|
|
onMounted(async () => {
|
|
|
|
const resp = await operLogList({ pageNum: 1, pageSize: 30 });
|
|
|
|
dataSource.value = resp.rows;
|
|
|
|
});
|
|
|
|
|
|
|
|
const [OperationPreviewDrawer, drawerApi] = useVbenDrawer({
|
|
|
|
connectedComponent: operationPreviewDrawer,
|
|
|
|
});
|
|
|
|
|
|
|
|
function handlePreview(record: Recordable<any>) {
|
|
|
|
drawerApi.setData({ record });
|
|
|
|
drawerApi.open();
|
|
|
|
}
|
2024-08-07 08:57:56 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2024-09-24 11:23:02 +08:00
|
|
|
<Page>
|
|
|
|
<Card>
|
|
|
|
<QueryForm />
|
|
|
|
</Card>
|
2024-09-26 08:40:16 +08:00
|
|
|
<div class="bg-background"></div>
|
|
|
|
<Table :columns="columns" :data-source="dataSource">
|
|
|
|
<template #bodyCell="{ record, column }">
|
|
|
|
<template v-if="column.dataIndex === 'action'">
|
|
|
|
<a-button size="small" type="link" @click="handlePreview(record)">
|
|
|
|
{{ $t('pages.common.preview') }}
|
|
|
|
</a-button>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
</Table>
|
|
|
|
<OperationPreviewDrawer />
|
2024-09-24 11:23:02 +08:00
|
|
|
</Page>
|
2024-08-07 08:57:56 +08:00
|
|
|
</template>
|