// 主表格
export function tableOne(self) {
  let _this = self
  return {
    rowKey: 'billId',
    rowSelectType: 2,
    tableRemoteUrl: '',
    action: [],
    columns: [
      {
        title: '订单编号',
        hidden: false,
        ellipsis: true,
        dataIndex: 'billCode',
        sorter: (a, b) => a.billCode.localeCompare(b.billCode),
        width: '150px',
      },
      {
        title: '收货单位',
        hidden: false,
        ellipsis: true,
        dataIndex: 'shipperName',
        sorter: (a, b) => a.shipperName.localeCompare(b.shipperName),
      },
      {
        title: '状态',
        hidden: false,
        ellipsis: true,
        dataIndex: 'status',
        sorter: (a, b) => a.status.localeCompare(b.status),
      },
      {
        title: '失败原因',
        hidden: false,
        ellipsis: true,
        dataIndex: 'errorMsg',
        sorter: (a, b) => a.errorMsg.localeCompare(b.errorMsg),
      },
      {
        title: '波次编号',
        hidden: false,
        ellipsis: true,
        dataIndex: 'waveCode',
        sorter: (a, b) => a.waveCode.localeCompare(b.waveCode),
      },
      {
        title: '货主',
        hidden: false,
        ellipsis: true,
        dataIndex: 'consignorName',
        sorter: (a, b) => a.consignorName.localeCompare(b.consignorName),
      },
      // todo:待更新
      {
        title: '挂起类型',
        hidden: false,
        ellipsis: true,
        dataIndex: 'char1',
        sorter: (a, b) => a.char1.localeCompare(b.char1),
      },
      {
        title: '操作',
        key: 'operate',
        align: 'center',
        width: '175px',
        scopedSlots: {customRender: 'action'}
      }
    ]
  }
}

// 子表格
export const goodsColumnsConfig = [
  {
    dataIndex: 'itemHealthCategory',
    width: '100px',
    title: '商品大类'
  },
  {
    title: '商品编号',
    ellipsis: true,
    dataIndex: 'itemId',
    width: '100px'
  },
  {
    title: '商品编码',
    ellipsis: true,
    dataIndex: 'itemCode',
    width: '100px',
  },
  {
    title: '商品名称',
    ellipsis: true,
    dataIndex: 'itemName',
    width: '200px',
  },
  {
    title: '商品规格',
    ellipsis: true,
    dataIndex: 'itemSpecs',
    width: '100px',
  },
  {
    title: '库存不足数量',
    ellipsis: true,
    dataIndex: 'unStockQty',
    width: '100px',
  },
  {
    title: '数量',
    ellipsis: true,
    dataIndex: 'pieceQty',
    width: '100px',
  },
  {
    title: '零散数',
    ellipsis: true,
    dataIndex: 'oddPieceQty',
    width: '100px',
  },
  {
    dataIndex: 'caseConversionRate',
    width: '100px',
    title: '箱含量'
  },
  {
    dataIndex: 'manufacturerLotNum',
    title: '批号',
    width: '150px',
  },
  {
    dataIndex: 'pdateFrom',
    title: '生产日期',
    width: '150px',
  },
  {
    dataIndex: 'itemHealthListedLicensor',
    width: '150px',
    title: '上市许可持有人'
  },
  {
    title: '生产厂家',
    ellipsis: true,
    dataIndex: 'manufacturer',
    width: '200px'
  },
  {
    dataIndex: 'countryOriginId',
    width: '150px',
    title: '产地'
  },
  {
    dataIndex: 'itemHealthRegisterNbr',
    width: '150px',
    title: '注册证号'
  },
  {
    dataIndex: 'itemHealthIsDouble',
    width: '100px',
    title: '是否双人复核',
    customRender: (text, record) => {
      if (text == '0') return '单人'
      if (text == '1') return '双人'
      return text
    }
  },
  {
    dataIndex: 'itemHealthApprovalNbr',
    width: '100px',
    title: '批准文号'
  },
  {
    dataIndex: 'isCaseOrPiece',
    width: '100px',
    title: '整散标志',
    customRender: (text, record) => {
      if (text == '0') return '整散合一'
      if (text == '1') return '整散分离'
      return text
    }
  },
  {
    dataIndex: 'itemHealthSuperviseflag',
    width: '100px',
    title: '是否监管',
    customRender: (text, record) => {
      if (text == '0') return '否'
      if (text == '1') return '是'
      return text
    }
  },
  {
    dataIndex: 'itemIsValuable',
    width: '100px',
    title: '是否贵重商品',
    customRender: (text, record) => {
      if (text == '0') return '否'
      if (text == '1') return '是'
      return text
    }
  },
  {
    dataIndex: 'itemIsFragile',
    width: '100px',
    title: '是否易碎',
    customRender: (text, record) => {
      if (text == '0') return '否'
      if (text == '1') return '是'
      return text
    }
  },
  {
    dataIndex: 'isBacteria',
    width: '100px',
    title: '是否无菌',
    customRender: (text, record) => {
      if (text == '0') return '否'
      if (text == '1') return '是'
      return text
    }
  },
  {
    dataIndex: 'isDelegate',
    width: '100px',
    title: '是否委托生产',
    customRender: (text, record) => {
      if (text == '0') return '否'
      if (text == '1') return '是'
      return text
    }
  },
  {
    dataIndex: 'isHosted',
    width: '100px',
    title: '商品是否代管',
    customRender: (text, record) => {
      if (text == '0') return '否'
      if (text == '1') return '是'
      return text
    }
  },
  {
    dataIndex: 'itemAssistantCode',
    width: '100px',
    title: '助记码'
  },
  {
    dataIndex: 'cargoOwnerCode',
    width: '100px',
    title: '货主编码'
  },
  {
    dataIndex: 'itemHealthProduceLicense',
    width: '150px',
    title: '生产企业许可证号'
  },
  {
    dataIndex: 'itemHealthRecordNbr',
    width: '100px',
    title: '备案号'
  },
  {
    dataIndex: 'volume',
    width: '100px',
    title: '箱体积'
  },
  {
    dataIndex: 'weight',
    width: '100px',
    title: '箱重量'
  },
  {
    title: '操作',
    key: 'operate',
    align: 'center',
    fixed: 'right',
    width: '175px',
    scopedSlots: {customRender: 'action'}
  }
]
// 红冲表格
export const HCgoodsColumnsConfig = [
  {
    dataIndex: 'redReason',
    width: '100px',
    title: '红冲原因'
  },
  {
    dataIndex: 'qty',
    width: '100px',
    title: '红冲数量',
    type: 'txt',
    customRender: (text, record) => {
      let stockQty = record.stockQty ? record.stockQty : 0
      return (record.pieceQty - stockQty)
    }
  },
  {
    dataIndex: 'itemHealthCategory',
    type: 'txt',
    width: '100px',
    title: '商品大类'
  },
  {
    title: '商品编号',
    hidden: false,
    ellipsis: true,
    dataIndex: 'itemId',
    type: 'txt',
    width: '100px',
  },
  {
    title: '商品编码',
    hidden: false,
    ellipsis: true,
    dataIndex: 'itemCode',
    type: 'txt',
    width: '100px',
  },
  {
    title: '商品名称',
    hidden: false,
    ellipsis: true,
    dataIndex: 'itemName',
    type: 'txt',
    width: '200px',
  },
  {
    title: '商品规格',
    hidden: false,
    ellipsis: true,
    dataIndex: 'itemSpecs',
    type: 'txt',
    width: '100px',
  },
  {
    dataIndex: 'itemHealthListedLicensor',
    type: 'txt',
    width: '150px',
    title: '上市许可持有人'
  },
  {
    title: '生产厂家',
    hidden: false,
    ellipsis: true,
    dataIndex: 'manufacturer',
    type: 'txt',
    width: '200px',
  },
  {
    dataIndex: 'countryOriginId',
    type: 'txt',
    width: '150px',
    title: '产地'
  },
  {
    dataIndex: 'itemHealthRegisterNbr',
    type: 'txt',
    title: '注册证号'
  },
  {
    dataIndex: 'lotNo',
    type: 'txt',
    title: '批号',
  },
  {
    dataIndex: 'pdateFrom',
    type: 'txt',
    title: '生产日期',
    width: '150px',
  },
  {
    title: '数量',
    ellipsis: true,
    dataIndex: 'pieceQty',
    type: 'txt',
    width: '100px',
  },
  {
    title: '零散数',
    ellipsis: true,
    dataIndex: 'oddPieceQty',
    type: 'txt',
    width: '100px',
  },
  {
    dataIndex: 'caseConversionRate',
    type: 'txt',
    width: '100px',
    title: '包装数量'
  },
  {
    dataIndex: 'itemHealthIsDouble',
    type: 'txt',
    width: '100px',
    title: '是否双人复核',
    customRender: (text, record) => {
      if (text == '0') return '单人'
      if (text == '1') return '双人'
      return text
    }
  },
  {
    dataIndex: 'specification',
    type: 'txt',
    width: '100px',
    title: '商品规格'
  },
  {
    dataIndex: 'itemHealthApprovalNbr',
    type: 'txt',
    width: '100px',
    title: '批准文号'
  },
  {
    dataIndex: 'isCaseOrPiece',
    type: 'txt',
    width: '100px',
    title: '整散标志',
    customRender: (text, record) => {
      if (text == '0') return '整散合一'
      if (text == '1') return '整散分离'
      return text
    }
  },
  {
    dataIndex: 'itemHealthSuperviseflag',
    type: 'txt',
    width: '100px',
    title: '是否监管',
    customRender: (text, record) => {
      if (text == '0') return '否'
      if (text == '1') return '是'
      return text
    }
  },
  {
    dataIndex: 'itemIsValuable',
    type: 'txt',
    width: '100px',
    title: '是否贵重商品',
    customRender: (text, record) => {
      if (text == '0') return '否'
      if (text == '1') return '是'
      return text
    }
  },
  {
    dataIndex: 'itemIsFragile',
    type: 'txt',
    width: '100px',
    title: '是否易碎',
    customRender: (text, record) => {
      if (text == '0') return '否'
      if (text == '1') return '是'
      return text
    }
  },
  {
    dataIndex: 'isBacteria',
    type: 'txt',
    width: '100px',
    title: '是否无菌',
    customRender: (text, record) => {
      if (text == '0') return '否'
      if (text == '1') return '是'
      return text
    }
  },
  {
    dataIndex: 'isDelegate',
    type: 'txt',
    width: '100px',
    title: '是否委托生产',
    customRender: (text, record) => {
      if (text == '0') return '否'
      if (text == '1') return '是'
      return text
    }
  },
  {
    dataIndex: 'isHosted',
    type: 'txt',
    width: '100px',
    title: '商品是否代管',
    customRender: (text, record) => {
      if (text == '0') return '否'
      if (text == '1') return '是'
      return text
    }
  },
  {
    dataIndex: 'itemAssistantCode',
    type: 'txt',
    width: '100px',
    title: '助记码'
  },
  {
    dataIndex: 'cargoOwnerCode',
    type: 'txt',
    width: '100px',
    title: '货主编码'
  },
  {
    dataIndex: 'itemHealthProduceLicense',
    type: 'txt',
    width: '150px',
    title: '生产企业许可证号'
  },
  {
    dataIndex: 'itemHealthRecordNbr',
    type: 'txt',
    width: '100px',
    title: '备案号'
  },
  {
    dataIndex: 'volume',
    type: 'txt',
    width: '100px',
    title: '箱体积'
  },
  {
    dataIndex: 'weight',
    type: 'txt',
    width: '100px',
    title: '箱重量'
  }
]
