let grid = {
  labelCol: { span: 6 },
  wrapperCol: { span: 12 },
  span: 12,
  // 高度
  itemHeight: '50px',
}
export function formItems(self) {
  let _this = self
  return [
    { type: 'input', hidden: true, name: 'checkTaskNo', label: '任务号', ...grid, value: '' },
    { type: 'input', name: 'id', label: 'id', ...grid, value: '', hidden: true },
    { type: 'input', name: 'bizPropertyId', label: 'bizPropertyId', ...grid, value: '', hidden: true },
    { type: 'input', name: 'ownerId', label: 'ownerId', ...grid, value: '', hidden: true },
    { type: 'input', name: 'containerOrderId', label: 'containerOrderId', ...grid, value: '', hidden: true },
    { type: 'input', name: 'outboundId', label: 'outboundId', ...grid, value: '', hidden: true },
    { type: 'input', name: 'planes', label: 'planes', ...grid, value: '', hidden: true },
    {
      type: 'input',
      className: 'input-md',
      size: 'large',
      name: 'stationNo',
      label: '工作站',
      ...grid,
      value: '',
      on: {
        pressEnter() {
          self.checkStation('stationNo')
        },
      },
    },
    {
      type: 'input',
      className: 'input-md',
      size: 'large',
      name: 'pieceBarcode',
      label: '商品条码',
      ...grid,
      value: '',
      on: {
        pressEnter() {
          self.checkStation('goodsBarcode')
        },
      },
    },
    {
      type: 'input',
      className: 'input-md',
      size: 'large',
      name: 'itemName',
      label: '商品名称',
      ...{ labelCol: { span: 3 }, wrapperCol: { span: 18 }, span: 24, itemHeight: '50px' },
      value: '',
    },
    {
      type: 'input',
      className: 'input-md',
      size: 'large',
      name: 'manufacturerId',
      label: '生产厂家',
      ...{ labelCol: { span: 3 }, wrapperCol: { span: 18 }, span: 24, itemHeight: '50px' },
      value: '',
    },
    // { type: 'input', name: 'goodsOwnerName', label: '货主', ...grid, value: '', on: {pressEnter(){self.checkStation('goodsOwnerName')}} },
    {
      type: 'search',
      className: 'input-md',
      size: 'large',
      name: 'cargoOwnerName',
      label: '货主',
      targetValueKey: 'cargoOwnerName',
      destroyOnClose: true,
      targetClick: false,
      ...{ labelCol: { span: 3 }, wrapperCol: { span: 18 }, span: 24, itemHeight: '50px' },
      value: '',
      toolBar: {
        items: [
          {
            type: 'input',
            name: 'cargoOwnerName',
            label: '货主名称',
            span: 8,
            value: '',
          },
          {
            type: 'input',
            name: 'opCode',
            label: '助记码',
            span: 8,
            value: '',
          },
        ],
      },
      tableConfig: {
        rowKey: 'id',
        rowSelectType: 1,
        hasRowSelectCheck: true,
        columns: [
          { dataIndex: 'cargoOwnerName', title: '货位名称', key: 'cargoOwnerName' },
          { dataIndex: 'cargoOwnerId', title: '货位ID', key: 'cargoOwnerId' },
        ],
      },
      remoteUrl: { url: '/kz/check/getGoodsOwners', method: 'post' },
      on: {
        change(event, value, rowData, form) {
          if (!value) {
            form.setFieldsValue({ ownerId: '' })
          } else {
            console.log(rowData, 'rowData')
            form.setFieldsValue({ ownerId: rowData[0].cargoOwnerId })
          }
        },
      },
    },
    { type: 'input', className: 'input-md', size: 'large', name: 'pieceUom', label: '规格', ...grid, value: '' },
    { type: 'input', className: 'input-md', size: 'large', name: 'containerNo', label: '货架编号', ...grid, value: '' },
    {
      type: 'search',
      className: 'input-md',
      size: 'large',
      name: 'manufacturerLotNum',
      label: '批号',
      targetValueKey: 'manufacturerLotNum',
      destroyOnClose: true,
      targetClick: false,
      ...grid,
      value: '',
      toolBar: {
        items: [
          {
            type: 'input',
            name: 'manufacturerLotNum',
            label: '批号',
            span: 8,
            value: '',
          },
          {
            type: 'input',
            name: 'lotId',
            label: '批号ID',
            span: 8,
            value: '',
          },
        ],
      },
      modalOpenChange: (open) => {
        console.log(_this.$refs, 'openopenopenopen')
        let values = _this.$refs.formTarget.form.getFieldsValue()
        console.log(values, 'openopenopenopen')
        if (!values.goodsBarcode || !values.goodsName) {
          // 仓库
          _this.$message.warn('请选择扫描商品条码')
          return false
        }
        if (!values.ownerId) {
          // 仓库
          _this.$message.warn('请选择货主')
          return false
        }

        return true
      },
      tableConfig: {
        rowKey: 'id',
        rowSelectType: 1,
        hasRowSelectCheck: true,
        columns: [
          { dataIndex: 'manufacturerLotNum', title: '批号', key: 'manufacturerLotNum' },
          { dataIndex: 'lotId', title: '批号ID', key: 'goodsOwnerId' },
        ],
        remoteBefore(res, remoteParams) {
          console.log(remoteParams, '66666666')
          let values = _this.$refs.formTarget.form.getFieldsValue()
          console.log(values)
          remoteParams.data.goodsBarcode = values.goodsBarcode
          remoteParams.data.goodsOwnerName = values.goodsOwnerName
          remoteParams.data.ownerId = values.ownerId
          return remoteParams
        },
      },
      value: '',
      remoteUrl: { url: '/kz/check/getLots', method: 'post' },
      on: {
        change(event, value, rowData, form) {
          if (!value) {
            form.setFieldsValue({ bizPropertyId: '' })
          } else {
            console.log(rowData, 'rowData')
            form.setFieldsValue({ bizPropertyId: rowData[0].id })
          }
        },
      },
    },
    {
      type: 'input',
      className: 'input-md',
      size: 'large',
      name: 'palletLocation',
      label: '货位编码',
      ...grid,
      value: '',
    },
    // { type: 'input', className: 'input-md', size: 'large',name: 'goodsStatusDecr', label: '商品状态', ...grid, value: '', },
    {
      type: 'input',
      className: 'input-md',
      size: 'large',
      name: 'itemHealthCategoryName',
      label: '商品大类',
      ...grid,
      value: '',
    },
    {
      type: 'input',
      className: 'input-md',
      size: 'large',
      name: 'firstCount',
      label: '实物数量',
      ...grid,
      value: '',
      size: 'large',
    },
  ]
}
