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

import { getStoreOption } from '#/views/system/store/api';
// import dayjs from 'dayjs';

export const formOptions: VbenFormProps = {
  // 默认展开
  collapsed: false,
  schema: [
    {
      component: 'ApiSelect',
      componentProps: {
        placeholder: '请选择',
        // 菜单接口转options格式
        afterFetch: (data: { id: number; name: string }[]) => {
          return data.map((item: any) => ({
            label: item.name,
            value: item.id,
          }));
        },
        api: getStoreOption,
      },
      // defaultValue: 0,
      fieldName: 'store_id',
      label: '诊所',
    },
    {
      component: 'RangePicker',
      componentProps: {
        format: 'YYYY-MM-DD', // 确保格式与你需要的一致
      },
      // defaultValue: [dayjs().startOf('month'), dayjs()],
      fieldName: 'search_time',
      label: '时间范围',
    },
  ],
  // 控制表单是否显示折叠按钮
  showCollapseButton: true,
  submitButtonOptions: {
    content: '查询',
  },
  // 是否在字段值改变时提交表单
  // submitOnChange: true,
  // submitOnChange: true,
  // 按下回车时是否提交表单
  submitOnEnter: true,
};
