<script setup lang="ts">
import type { OperationLog } from '#/api/monitor/operlog/model';

import { useVbenModal } from '@vben/common-ui';

import { Description, useDescription } from '#/components/description';

import { descSchema } from './data';

const [BasicModal, modalApi] = useVbenModal({
  onOpenChange: handleOpenChange,
});

const [registerDescription, { setDescProps }] = useDescription({
  column: 1,
  schema: descSchema,
});

function handleOpenChange(open: boolean) {
  if (!open) {
    return null;
  }
  const { record } = modalApi.getData() as { record: OperationLog };
  setDescProps({ data: record }, true);
}
</script>

<template>
  <BasicModal :footer="false" class="w-[800px]" title="查看日志">
    <Description @register="registerDescription" />
  </BasicModal>
</template>
