import type { VbenFormProps } from '#/adapter/form';

import { API_OP_LOG_PLATFORM_OPTIONS } from './platform';

// import dayjs from 'dayjs';

export const formOptions: VbenFormProps = {
  // 默认展开
  collapsed: false,
  schema: [
    {
      component: 'ApiLogUserPicker',
      fieldName: 'user_filter',
      label: '操作用户',
    },
    {
      component: 'VbenInput',
      // defaultValue: [dayjs().startOf('month'), dayjs()],
      fieldName: 'router',
      label: 'api接口',
    },
    {
      component: 'Select',
      componentProps: {
        allowClear: true,
        options: [...API_OP_LOG_PLATFORM_OPTIONS],
        placeholder: '全部',
      },
      fieldName: 'platform_type',
      label: '接口来源',
    },
    {
      component: 'RangePicker',
      componentProps: {
        format: 'YYYY-MM-DD', // 确保格式与你需要的一致
      },
      // defaultValue: [dayjs().startOf('month'), dayjs()],
      fieldName: 'search_time',
      label: '时间范围',
    },
  ],
  // 控制表单是否显示折叠按钮
  showCollapseButton: true,
  submitButtonOptions: {
    content: '查询',
  },
  // 是否在字段值改变时提交表单
  submitOnChange: false,
  // 按下回车时是否提交表单
  submitOnEnter: true,
};
