2025-03-07 08:18:45 +08:00
|
|
|
<script lang="ts" setup>
|
|
|
|
|
import { ref } from 'vue';
|
|
|
|
|
|
|
|
|
|
import { Page, useVbenModal } from '@vben/common-ui';
|
|
|
|
|
|
|
|
|
|
import { Button, Tag } from 'ant-design-vue';
|
|
|
|
|
|
|
|
|
|
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
|
|
|
|
import { TableAction } from '#/components/table-action';
|
|
|
|
|
|
|
|
|
|
import FormModalDemo from './components/modal.vue';
|
|
|
|
|
import { formOptions } from './config/search';
|
|
|
|
|
import { gridOptions } from './config/table';
|
2026-05-27 09:34:08 +08:00
|
|
|
import {
|
|
|
|
|
getApiOpLogOperatorLabel,
|
|
|
|
|
getApiOpLogPlatformLabel,
|
|
|
|
|
} from './config/platform';
|
2025-03-07 08:18:45 +08:00
|
|
|
import { getIcon } from '#/util/tool';
|
|
|
|
|
import {Icon} from "#/components/icon";
|
|
|
|
|
|
|
|
|
|
ref(false);
|
2026-06-18 13:24:58 +08:00
|
|
|
|
|
|
|
|
let gridApiRef: ReturnType<typeof useVbenVxeGrid>[1];
|
|
|
|
|
|
|
|
|
|
function syncPlatformType(platformType: 0 | 1 | 2) {
|
|
|
|
|
gridApiRef?.formApi?.setFieldValue('platform_type', platformType);
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-07 08:18:45 +08:00
|
|
|
const [Grid, gridApi] = useVbenVxeGrid({
|
2026-06-18 13:24:58 +08:00
|
|
|
formOptions: {
|
|
|
|
|
...formOptions,
|
|
|
|
|
schema: formOptions.schema?.map((item) =>
|
|
|
|
|
item.fieldName === 'user_filter'
|
|
|
|
|
? {
|
|
|
|
|
...item,
|
|
|
|
|
componentProps: {
|
|
|
|
|
onPlatformTypeChange: syncPlatformType,
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
: item,
|
|
|
|
|
),
|
|
|
|
|
},
|
2025-03-07 08:18:45 +08:00
|
|
|
gridOptions,
|
|
|
|
|
});
|
2026-06-18 13:24:58 +08:00
|
|
|
gridApiRef = gridApi;
|
2025-03-07 08:18:45 +08:00
|
|
|
|
|
|
|
|
const [FormModal, formModalApi] = useVbenModal({
|
|
|
|
|
connectedComponent: FormModalDemo,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const showModal = (data = {}, isUpdate = false) => {
|
|
|
|
|
formModalApi.setData({
|
|
|
|
|
// 表单值
|
|
|
|
|
values: data,
|
|
|
|
|
update: isUpdate,
|
|
|
|
|
gridApi,
|
|
|
|
|
});
|
|
|
|
|
formModalApi.open();
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<Page auto-content-height title="Api访问日志管理">
|
|
|
|
|
<FormModal />
|
|
|
|
|
<Grid>
|
|
|
|
|
<template #toolbar-buttons>
|
|
|
|
|
</template>
|
|
|
|
|
<template #type="{ row }">
|
|
|
|
|
<Tag v-if="row.type === 0" color="green"> 访问成功 </Tag>
|
|
|
|
|
<Tag v-else color="red"> 访问失败 </Tag>
|
|
|
|
|
</template>
|
|
|
|
|
<template #admin="{ row }">
|
2026-05-27 09:34:08 +08:00
|
|
|
<span>{{ getApiOpLogOperatorLabel(row) }}</span>
|
|
|
|
|
</template>
|
|
|
|
|
<template #platform_type="{ row }">
|
|
|
|
|
<span>{{ getApiOpLogPlatformLabel(row.platform_type) }}</span>
|
2025-03-07 08:18:45 +08:00
|
|
|
</template>
|
2026-07-23 09:24:06 +08:00
|
|
|
<template #method="{ row }">
|
|
|
|
|
<Tag v-if="row.method === 1" color="blue">GET</Tag>
|
|
|
|
|
<Tag v-else-if="row.method === 2" color="green">POST</Tag>
|
|
|
|
|
<Tag v-else color="default">未知</Tag>
|
|
|
|
|
</template>
|
2025-03-07 08:18:45 +08:00
|
|
|
<template #toolbar-tools></template>
|
|
|
|
|
<template #equipment="{ row }">
|
|
|
|
|
<Icon :icon="getIcon(row.equipment)" :size="20" />
|
|
|
|
|
</template>
|
|
|
|
|
<template #browser="{ row }">
|
|
|
|
|
<Icon :icon="getIcon(row.browser)" :size="20" />
|
|
|
|
|
</template>
|
|
|
|
|
<template #action="{ row }">
|
|
|
|
|
<TableAction
|
|
|
|
|
:actions="[
|
|
|
|
|
{
|
|
|
|
|
label: '查看',
|
|
|
|
|
type: 'link',
|
|
|
|
|
icon: 'uil:edit',
|
|
|
|
|
size: 'small',
|
|
|
|
|
// auth: ['op-log', 'sys:role:detail'],
|
|
|
|
|
onClick: showModal.bind(null, row, true),
|
|
|
|
|
},
|
|
|
|
|
]"
|
|
|
|
|
:drop-down-actions="[]"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
</Grid>
|
|
|
|
|
</Page>
|
|
|
|
|
</template>
|