//setPubTransline线路选择
function setPubTransline(obj = {}) {
  let name = '线路'
  let code = 'line'
  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/pubTransline/popupTransline/v1.0', method: 'post' },
      remoteData: { lineCode: '', lineName: '', ...remoteData },
      tableConfig: {
        rowKey: code + 'Id',
        columns: [
          {
            hidden: true,
            dataIndex: 'id',
            title: '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 setPubTransline
