//PubCarrier物流商选择
function setPubCarrier(obj = {}) {
  let name = '物流商'
  let code = 'carrier'
  let baseObject = { carrierCode: true, label: '选择物流商', remoteData: {}, required: false, ...obj }
  const { carrierCode, label, remoteData, search, ok, change, required } = baseObject

  return [
    {
      type: 'searchModal',
      label,
      targetClick: true,
      required,
      name: code + 'name',
      targetValueKey: code + 'name',
      remoteData,
      remoteUrl: { url: '/api/oms-std-maindata/pubCarrier/queryWindow/v1.0', method: 'post' },
      tableConfig: {
        rowKey: code + 'id',
        columns: [
          {
            hidden: true,
            dataIndex: code + 'id',
            title: code + 'id'
          },
          {
            dataIndex: code + 'code',
            title: name + '编码'
          },
          {
            dataIndex: code + 'name',
            title: name + '名称'
          }
        ]
      },
      toolBar: {
        items: [
          {
            type: 'input',
            name: code + 'code',
            label: name + '编码',
            value: ''
          },
          {
            type: 'input',
            name: code + 'name',
            label: name + '名称',
            value: ''
          }
        ]
      },
      on: {
        change,
        search,
        ok
      }
    },
    { name: code + 'code', required, label: name + '编码', type: 'input', hidden: !carrierCode, disabled: true },
    { name: code + 'id', required, label: name + 'id', type: 'input', hidden: true }
  ]
}
export default setPubCarrier
