<template>
  <BasicDrawer v-bind="$attrs" @register="registerDrawer" title="上下线记录详情" width="25%">
    <Description :column="3" size="middle" @register="registeDesc" />
  </BasicDrawer>
</template>
<script lang="ts" setup>
  import { formSchema } from './config.data';
  import { BasicDrawer, useDrawerInner } from '/@/components/Drawer';
  import { deviceStateLogDetail } from '/@/api/device/deviceManager';
  import { Description } from '/@/components/Description/index';
  import { useDescription } from '/@/components/Description';

  defineEmits(['success', 'register']);

  const [registeDesc, { setDescProps }] = useDescription({
    schema: formSchema,
    column: 2,
    layout: 'vertical',
  });

  const [registerDrawer, { setDrawerProps }] = useDrawerInner(async (data) => {
    setDrawerProps({ confirmLoading: false });
    const res = await deviceStateLogDetail(data.record.id);
    setDescProps({ data: res });
  });
</script>
