import { consignorAttr, carrierAttr, driverAttr, carAttr } from '@/blocks/components/searchModalConfig'

const coommon = [
  {
    ...consignorAttr,
    name: 'cargoOwnerName',
    label: '货主',
    type: 'searchModal',
    targetClick: false,

  },
  {
    //承运商
    ...carrierAttr,
    targetValueKey: 'name',
    name: "carrierName",
    type: 'searchModal',
    targetClick: false,
  },
  {
    //司机
    ...driverAttr,
    name: "driverName",
    type: 'searchModal',
    targetClick: false,
  },
  {
    //车辆
    ...carAttr,
    label:'车牌号',
    name: "vehiclePlateNumber",
    type: 'searchModal',
    targetClick: false
  }]
//派车单
export const loadingBill = [
  {
    hidden: true,
    value: '查询',
    type: 'button',
    htmlType: 'submit',
  },
  ...coommon,
  { name: 'loadingBillNo', label: '派车单号', type: 'input' },
  {
    name: 'createStartDate',
    label: '创建开始日期',
    disabledDate(startValue, form) {
      let endValue = form.getFieldValue('createEndDate')
      if (!startValue || !endValue) {
        return false
      }
      return startValue.valueOf() > new Date(endValue).valueOf()
    },
    type: 'date',
    format: 'YYYY-MM-DD',
    placeholder: '年/月/日',

  },
  {
    name: 'createEndDate',
    disabledDate(endValue, form) {
      let startValue = form.getFieldValue('createStartDate')
      if (!startValue || !endValue) {
        return false
      }
      return new Date(startValue).valueOf() > endValue.valueOf()
    },

    label: '创建结束日期',
    type: 'date',
    format: 'YYYY-MM-DD',
    placeholder: '年/月/日',

  },


]

export const setQueryFormItmes = (self, count) => {
  if (count === 3) {
    return loadingBill
  }

  return [
    {
      hidden: true,
      value: '查询',
      type: 'button',
      htmlType: 'submit',
    },
    ...coommon,
    {
      name: 'orderStartDate_orderEndDate',
      label: '下单日期',
      type: 'a-range-picker',
      format: 'YYYY-MM-DD',
      valueFormat: 'YYYY-MM-DD',
      placeholder: ['开始时间', '结束时间']
    },


   {
      name:'shipStartDate_shipEndDate',
      label: '启运日期',
      type: 'a-range-picker',
      format: 'YYYY-MM-DD',
      valueFormat: 'YYYY-MM-DD',
      placeholder: ['开始时间', '结束时间']
    },
    {
      name: 'deliveryStartDate_deliveryEndDate',
      label: '送达日期',
      type: 'a-range-picker',
      format: 'YYYY-MM-DD',
      valueFormat: 'YYYY-MM-DD',
      placeholder: ['开始时间', '结束时间']
    },
    {
      name: 'receiptStartDate_receiptEndDate',
      label: '回单日期',
      type: 'a-range-picker',
      format: 'YYYY-MM-DD',
      valueFormat: 'YYYY-MM-DD',
      placeholder: ['开始时间', '结束时间']
    },
    {
      name: 'originalBackStartDate_originalBackEndDate',
      label: '正本回单日期',
      type: 'a-range-picker',
      format: 'YYYY-MM-DD',
      valueFormat: 'YYYY-MM-DD',
      placeholder: ['开始时间', '结束时间']

    },
    {
      name: 'completeStartDate_completeEndDate',
      label: '完成日期',
      type: 'a-range-picker',
      format: 'YYYY-MM-DD',
      valueFormat: 'YYYY-MM-DD',
      placeholder: ['开始时间', '结束时间']
    },
    { name: 'orderNo', label: '订单号', type: 'input' },
    { name: 'shipbillNo', label: '运单号', type: 'input' },
    {
      name: 'orderBusinessType',
      label: '业务类型',
      type: 'select',
      get options() {
        return self.options.ORDER_BUSINESS_TYPE
      },
    },
    {
      name: 'shipperProvinceCityDistrict',
      label: '始发地',
      type: 'input'
    },
    {
      name: 'consigneeProvinceCityDistrict',
      label: '目的地',
      type: 'input'
    },
    // {
    //   name: 'synchronousStatus',
    //   label: '同步状态',
    //   type: 'select',
    //   get options() {
    //     return self.options.SYNCHRONOUS_STATUS
    //   },
    // },
    // {
    //   name: 'settlementStatus',
    //   label: '核算状态',
    //   type: 'select',
    //   get options() {
    //     return self.options.SETTLEMENT_STATUS
    //   },
    // },
  ]
}


