import { FormConfig } from "/@/components/PageSearch";
import dayjs from "dayjs";

const now = new Date();
const start = dayjs(now).subtract(30, 'days').format("YYYY-MM-DD");
const end = dayjs(now).format('YYYY-MM-DD');

const searchFormConfig: FormConfig = {
  formItems: [
    {
      field: "date",
      type: "date_picker",
      // defaultValue: [start, end],
      trigger: "change",
      otherOptions: {
        type: "daterange",
        startPlaceholder: "下单开始时间",
        endPlaceholder: "下单结束时间",
        valueFormat: "YYYY-MM-DD",
        startProp: "start_date",
        endProp: "end_date"
      }
    },
    {
      field: "commitment_date",
      type: "date_picker",
      trigger: "change",
      otherOptions: {
        type: "daterange",
        startPlaceholder: "要求到货开始时间",
        endPlaceholder: "要求到货结束时间",
        valueFormat: "YYYY-MM-DD",
        startProp: "start_arrive_date",
        endProp: "end_arrive_date"
      }
    },
    {
      field: "depart_id",
      type: "depart-query",
      trigger: "change"
    },
  ]
};

export default searchFormConfig;
