

import { carrierAttr, consigneeAttr, branchAttr, supplierNoConsignorAttr } from '@/blocks/components/searchModalConfig'



export default (self) => {

  let remoteUrl=undefined;
  return [
    {
      hidden: true,
      value: '查询',
      type: 'button',
      htmlType: 'submit',
    },
    { name: 'orderNo', label: '订单号', type: 'input' },
    { name: 'shipbillNo', label: '运单号', type: 'input' },
    {
      name: 'orderBusinessType',
      label: '业务类型',
      type: 'select',
      get options() {
        return self.options.ORDER_BUSINESS_TYPE
      },
    },
    {
      name: 'createStartTime_createEndTime',
      label: '制单日期',
      type: 'a-range-picker',
      format: 'YYYY-MM-DD',
      valueFormat: 'YYYY-MM-DD',
      placeholder: ['开始时间', '结束时间'],

    },
    // {
    //   name: 'consigneeType', label: '收货方类型', type: 'select',
    //   get options() {
    //     return self.options.CONSIGNEE_TYPE
    //   },
    // },
    {
      ...carrierAttr,
      targetClick:false,
      targetValueKey:'name',
      name: 'carrierName',
      label: '承运商',
      type: 'searchModal'
    },

    {
      name: 'planDeliveryStartDate_planDeliveryEndDate',
      type: 'a-range-picker',
      format: 'YYYY-MM-DD',
      valueFormat: 'YYYY-MM-DD',
      placeholder: ['开始时间', '结束时间'],
      label: '计划发运日期',
    },
    { name: 'loadingLocation', label: '装货地点', type: 'input' },
    {

      name: 'productName',
      label: '产品名称',
      type: 'input',

    },
    {
      name: 'consigneeType', label: '收货方类型', type: 'select',
      get options() {
        return self.options.CONSIGNEE_TYPE
      },
    },
    {
      ...consigneeAttr,
      targetClick: false,
      remoteBefore(node, res, form) {
        let consigneeType = form.getFieldValue('consigneeType');
        let obj = { 1: consigneeAttr.remoteUrl, 2: branchAttr.remoteUrl, 3: supplierNoConsignorAttr.remoteUrl }
        if (obj[consigneeType]) {
          res.url=obj[consigneeType].url
        } else {
          res.url = null
          self.$message.warning('请选择收货方类型');

        }
      },
      name: 'consigneeName',
      label: '收货方',
      type: 'searchModal'
    },

  ]
}

