//客户选择
/**customer客户选择弹出查询配置 */
function setCustomer(obj = {}) {
  let vName = '客户'
  let code = 'customer'
  let baseObject = { customercode: false, label: '客户选择', remoteData: {}, required: false, ...obj }
  const { name, targetValueKey, customercode, label, remoteData, search, ok, change, required } = baseObject
  return [
    {
      type: 'searchModal',
      label,
      targetClick: true,
      required,
      name: name || code + 'name',
      targetValueKey: code + 'name',
      remoteData,
      remoteUrl: { url: '/api/oms-std-maindata/pubCustomer/pubCustomerPopupQuery/v1.0', method: 'post' },
      tableConfig: {
        rowKey: code + 'id',
        columns: [
          {
            hidden: true,
            dataIndex: 'id',
            title: 'id'
          },
          {
            dataIndex: code + 'code',
            title: vName + '编码'
          },
          {
            dataIndex: code + 'name',
            title: vName + '名称'
          }
        ]
      },
      toolBar: {
        items: [
          {
            type: 'input',
            name: code + 'code',
            label: vName + '编码',
            value: ''
          },
          {
            type: 'input',
            name: code + 'name',
            label: vName + '名称',
            value: ''
          }
        ]
      },
      on: {
        change,
        search,
        ok
      }
    },
    { name: code + 'code', required, label: vName + '编码', type: 'input', hidden: !customercode, disabled: true },
    { name: code + 'id', required, label: vName + 'ID', type: 'input', hidden: true }
  ]
}
export default setCustomer
