let grid = {
  span: 6,
  labelCol: {
    span: 8
  }
}

const remoteUrl ={
  url:  '/api/eis-xty-master-wz/api/v1/inbound/task/page',
  headers: {
    'Content-Type': 'application/JSON',
  },
  method: 'post',
};

const items = function (self) {
  return [
    {
      type: 'input',
      name: 'wmsTaskId',
      label: 'WMS任务号',
      ...grid
    },
    {
      type: 'select',
      name: 'wmsPush',
      label: '是否为WMS下发',
      options: [
        { value: 0, label: 'eis内部创建' },
        { value: 1, label: 'wms下发' }
      ],
      ...grid
    },
    {
      type: 'select',
      name: 'taskType',
      label: '任务类型',
      ...grid,
      options: [
        { value: 1, label: '原材料吨包入库' },
        { value: 2, label: '成品人工入库' },
        { value: 3, label: '移库入库' },
        { value: 4, label: '机械手码垛入库' },
        { value: 5, label: '余料回库' },
        { value: 6, label: '耗材补给入库' },
        { value: 9, label: '空托入库' }
      ],
    },
    {
      type: 'input',
      name: 'containerNo',
      label: '容器号',
      ...grid
    },
    {
      type: 'select',
      name: 'containerType',
      label: '容器类型',
      ...grid,
      options: [
        { value: 1, label: '有物料的托盘' },
        { value: -1, label: '塑料空托盘' },
        { value: -2, label: '木空托盘' }
      ]
    },
    {
      type: 'select',
      name: 'status',
      label: '任务状态',
      ...grid,
      options: [
        { value: 0, label: 'wms下发' },
        { value: 10, label: '开始入库' },
        { value: 90, label: '执行完成' },
        { value: 92, label: '取消或关闭' },
        { value: 100, label: '上报wms完成' }
      ]
    },
    {
      type: 'input',
      name: 'ownerId',
      label: '业主',
      ...grid
    },
    {
      type: 'input',
      name: 'goodsCode',
      label: '商品编码',
      ...grid
    },
    {
      type: 'input',
      name: 'lotId',
      label: '批次',
      ...grid
    },
    {
      type: 'input',
      name: 'itemName',
      label: '商品名称',
      ...grid
    },
    {
      type: 'input',
      name: 'char',
      label: '入库数量',
      ...grid
    },
    {
      type: 'input',
      name: 'boxCount',
      label: '箱数',
      ...grid
    },
    {
      type: 'date',
      name: 'startTime',
      label: '开始日期',
      placeholder: '请输入开始日期',
      value: '',
      format: 'YYYY-MM-DD HH:mm:ss',
      style: 'padding-right:5px;',
      ...grid
    },
    {
      type: 'date',
      name: 'endTime',
      label: '结束日期',
      placeholder: '请输入结束日期',
      format: 'YYYY-MM-DD HH:mm:ss',
      value: '',
      ...grid
    },
    {
      ...grid,
      type: 'buttonGroup',
      style: {
        textAlign: 'right'
      },
      options: [
        {
          value: '查询',
          icon: 'search',
          btnType: 'primary',
          style: 'margin-left:50px;margin-right:10px;',
          htmlType: 'submit'
        },
        {
          value: '重置',
          name: 'ccz',
          icon: 'redo',
          on: {
            click(event, form) {
              form.resetFields()
            }
          }
        }
      ]
    }
  ]
}
const columns = [
  {
    dataIndex: 'wmsTaskId',
    title: 'WMS任务号',
    align: 'center',
    width: 150,
    ellipsis: true
  },
  {
    dataIndex: 'wmsPush',
    title: '是否为WMS下发',
    align: 'center',
    width: 150,
    customRender: text => {
      var a = ''
      if (text == 0) {
        a = 'eis内部创建'
      }
      if (text == 1) {
        a = 'wms下发'
      }
      return a
    }
  },
  {
    dataIndex: 'taskType',
    title: '任务类型',
    align: 'center',
    width: 150,
    customRender: text => {
      var a = ''
      if (text == 1) {
        a = '原材料吨包入库'
      }
      if (text == 2) {
        a = '成品人工入库'
      }
      if (text == 3) {
        a = '移库入库'
      }
      if (text == 4) {
        a = '机械手码垛入库'
      }
      if (text == 5) {
        a = '余料回库'
      }
      if (text == 6) {
        a = '耗材补给入库'
      }
      if (text == 9) {
        a = '空托入库'
      }
      return a
    }
  },
  {
    dataIndex: 'containerNo',
    title: '容器号',
    align: 'center',
    width: 150,
    ellipsis: true
  },
  {
    dataIndex: 'containerType',
    title: '容器类型',
    align: 'center',
    width: 150,
    customRender: text => {
      var a = ''
      if (text == 1) {
        a = '有物料的托盘'
      }
      if (text == -1) {
        a = '塑料空托盘'
      }
      if (text == -2) {
        a = '木空托盘'
      }
      return a
    }
  },
  {
    dataIndex: 'status',
    title: '任务状态',
    align: 'center',
    width: 150,
    customRender: text => {
      var a = ''
      if (text == 0) {
        a = 'wms下发'
      }
      if (text == 10) {
        a = '开始入库'
      }
      if (text == 90) {
        a = '执行完成'
      }
      if (text == 92) {
        a = '取消或关闭'
      }
      if (text == 100) {
        a = '上报wms完成'
      }
      return a
    }
  },
  {
    dataIndex: 'createTime',
    title: '创建时间',
    align: 'center',
    width: 150,
    ellipsis: true
  },
  {
    dataIndex: 'updateTime',
    title: '最后一次修改时间',
    align: 'center',
    width: 150,
    ellipsis: true
  },
  {
    dataIndex: 'wmsTaskDetailId',
    title: 'WMS任务明细号',
    align: 'center',
    width: 200,
    ellipsis: true
  },
  {
    dataIndex: 'ownerId',
    title: '业主',
    align: 'center',
    width: 150,
    ellipsis: true
  },
  {
    dataIndex: 'goodsCode',
    title: '商品编码',
    align: 'center',
    width: 150,
    ellipsis: true
  },
  {
    dataIndex: 'lotId',
    title: '批次',
    align: 'center',
    width: 150
  },
  {
    dataIndex: 'itemName',
    title: '商品名称',
    align: 'center',
    width: 150
  },
  {
    dataIndex: 'qty',
    title: '入库数量',
    align: 'center',
    width: 150
  },
  {
    dataIndex: 'boxCount',
    title: '箱数',
    align: 'center',
    width: 150
  },
  {
    dataIndex: 'action',
    title: '操作',
    scopedSlots: { customRender: 'action' },
    fixed: 'right',
    align: 'center',
    width: 150
  }

]

export {
  items,
  columns,
  remoteUrl
}