let grid = {
  labelCol: { span: 6 },
  span: 6,
}
let grid1 = {
  labelCol: { span: 6 },
  span: 24,
}
export function formItems(self) {
  let _this = self
  return [
    { type: 'input', name: 'cargoOwnerId1', label: '备注', ...grid, value: '' },
    { type: 'input', name: 'autoBillNum2', label: 'WMS盘点单号', ...grid, value: '' },
    {
      type: 'buttonGroup',
      style: { textAlign: 'left' },
      ...grid,
      // span: 24,
      options: [
        {
          value: '查询',
          icon: 'search',
          btnType: 'primary',
          style: 'margin-right:10px',
          htmlType: 'submit',
        },
        {
          value: '重置',
          icon: 'redo',
          style: 'margin-left:10px',
          on: {
            click: () => {
              self.$refs.formTarget.form.resetFields()
            },
          },
        },
      ],
    },
  ]
}

export const tableColumns = [
  { hidden: true, title: 'id', dataIndex: 'id' },
  { title: '计划编号', dataIndex: 'checkTaskNo' },
  { title: '备注', dataIndex: 'remark' },
  { title: 'WMS盘点单号', dataIndex: 'wmsCheckNo' },
  {
    title: '盘点类型',
    dataIndex: 'checkType',
    customRender: (text, record) => {
      if (text == 1) {
        return 'eis内部盘点'
      } else if (text == 2) {
        return 'wms盘点'
      }
    },
    className: 'v_top',
  },
  {
    title: '盘点状态',
    dataIndex: 'checkState',
    customRender: (text, record) => {
      if (text == 10) {
        return '已创建'
      } else if (text == 20) {
        return '已下发'
      } else if (text == 30) {
        return '盘点中'
      } else if (text == 40) {
        return '已完成'
      } else if (text == 50) {
        return '上传完成'
      } else if (text == 60) {
        return '取消'
      }
    },
    className: 'v_top',
  },
  { title: '操作', dataIndex: 'action', scopedSlots: { customRender: 'action' } },
]

export const detailColumns = [
  { hidden: true, title: 'id', dataIndex: 'id' },
  { title: '商品条码', dataIndex: 'goodsBarcode' },
  { title: '商品名称', dataIndex: 'goodsName' },
  { title: '货主', dataIndex: 'goodsOwnerName', className: 'v_top' },
  { title: '批号', dataIndex: 'lotNo', className: 'v_top' },

  { title: '原数量', dataIndex: 'planCount', className: 'v_top' },
  { title: '初盘数量', dataIndex: 'firstCount', className: 'v_top' },
  { title: '复盘数量', dataIndex: 'secondCount' },
  //-1 报损 1报溢
  {
    title: '差异类型',
    dataIndex: 'diffType',
    customRender: (text, record) => {
      if (text == -1) {
        return '报损'
      } else if (text == 1) {
        return '报溢'
      }
    },
  },
  { title: '差异数量', dataIndex: 'differ' },
  //90 未处理 91 处理完成
  {
    title: '处理状态',
    dataIndex: 'state',
    customRender: (text, record) => {
      if (text == 90) {
        return '未处理'
      } else if (text == 91) {
        return '处理完成'
      }
    },
  },
]

export function item(self) {
  let _this = self
  return [
    { type: 'input', name: 'checkTaskNo', label: '计划编号', ...grid, value: '' },
    { type: 'input', name: 'checkState', label: '状态', ...grid, value: '' },
    { type: 'input', name: 'remark', label: '备注', ...grid, value: '' },
    { type: 'input', name: 'wmsCheckNo', label: 'WMS盘点单号', ...grid, value: '' },
  ]
}

export function addformItems(self) {
  let _this = self
  return [{ type: 'input', name: 'wmsCheckNo', required: true, label: 'WMS盘点单号', ...grid1, value: '' }]
}
export function spillColumns(self) {
  let billNo =
    self.titleName == '报损' ? { title: '分配单号', dataIndex: 'billNo' } : { title: '上架单号', dataIndex: 'billNo' }
  return [{ hidden: true, title: 'id1', dataIndex: 'id1' }, billNo, { title: '生成时间', dataIndex: 'createTime' }]
}
export function columns(self) {
  let realyQty =
    self.titleName == '报损'
      ? { title: '下架数量', dataIndex: 'realyQty' }
      : { title: '上架数量', dataIndex: 'realyQty' }
  return [
    { hidden: true, title: 'goodsId', dataIndex: 'goodsId' },
    { hidden: true, title: '计划编号', dataIndex: 'checkTaskNo' },
    { title: '商品条码', dataIndex: 'goodsBarcode' },
    { title: '商品名称', dataIndex: 'goodsName' },
    { title: '货主', dataIndex: 'goodsOwnerName' },
    { title: '批号', dataIndex: 'lotNo' },
    realyQty,
  ]
}
