export const setViewGoodsColumns = (self, expData = []) => {
  return [
    { dataIndex: 'id', title: 'ID', hidden: true, type: 'txt', width: 200 },
    { dataIndex: 'itemId', title: '商品Id', hidden: true, type: 'txt', width: 200 },
    {
      dataIndex: 'itemCode', title: '商品编码', type: 'txt',
      sorter: (a, b) => {
        return a.itemCode != b.itemCode
      }
    },
    {
      dataIndex: 'itemName', title: '商品名称', type: 'txt',
      sorter: (a, b) => {
        return a.itemName != b.itemName
      },
    },
    {
      dataIndex: 'itemCategoryName', title: '商品品类', type: 'txt',
      sorter: (a, b) => {
        return ~~a.itemCategory - ~~b.itemCategory
      },
    },
    {
      dataIndex: 'packType',
      title: '包装类型Code',
      type: 'txt',
      hidden: true
    },
    {
      dataIndex: 'packTypeName',
      title: '包装类型',
      type: 'select',
      autoLoad: false,
      on: {
        change(data) {
          const { value, record, label } = data
          record.packType = value
          record.packTypeName = label
        }
      },
      get options() {
        return self.options.PACK_TYPE
      },
      sorter: (a, b) => {
        return ~~a.packType - ~~b.packType
      },
    },

    {
      dataIndex: 'cargoThermosphere',
      title: '货物温层Code',
      type: 'txt',
      hidden: true
    },
    {
      dataIndex: 'cargoThermosphereName',
      title: '货物温层',
      type: 'select',
      autoLoad: false,
      on: {
        change(data) {
          const { value, record, label } = data
          record.cargoThermosphere = value
          record.cargoThermosphereName = label
        }
      },
      get options() {
        return self.options.CARGO_THERMOSPHERE
      },
      sorter: (a, b) => {
        return ~~a.cargoThermosphere - ~~b.cargoThermosphere
      },
    },


    {
      dataIndex: 'planDeliveryPcs',
      title: '计划提货件数',
      precision: 0,
      align: 'center',
      type: 'number',
      on: {
        change: self.handleChange,
      },
      sorter: (a, b) => {
        return ~~a.pcs - ~~b.pcs
      },
    },
    {
      dataIndex: 'planDeliveryWeight',
      title: '计划提货重量',
      type: 'number',
      align: 'center',
      on: {
        change: self.handleChange,
      },
      sorter: (a, b) => {
        return ~~a.weight - ~~b.weight
      },
    },
    {
      dataIndex: 'planDeliveryVolume',
      title: '计划提货体积',
      type: 'number',
      align: 'center',
      on: {
        change: self.handleChange,
      },
      sorter: (a, b) => {
        return ~~a.volume - ~~b.volume
      },
    },
    { dataIndex: 'memo', title: '备注', width: 180, placeholder: '请输入备注' },

    {
      dataIndex: 'temperatureCtlUpperLimit', title: '温控区间（上限）',
      sorter: (a, b) => {
        return ~~a.temperatureCtlUpperLimit - ~~b.temperatureCtlUpperLimit
      },
    },
    {
      dataIndex: 'temperatureCtlLowerLimit', title: '温控区间（下限）',
      sorter: (a, b) => {
        return ~~a.temperatureCtlLowerLimit - ~~b.temperatureCtlLowerLimit
      },
    },

    {
      dataIndex: 'branchName',
      title: '默认存放仓库',
      width: 120,
      type: 'txt',
      sorter: (a, b) => {
        return a.branchName != b.branchName
      },
    },
    {
      dataIndex: 'inventoryPcs',
      title: '库存数量',
      width: 120,
      type: 'number',
      sorter: (a, b) => {
        return ~~a.inventoryPcs - ~~b.inventoryPcs
      },
    },
    {
      dataIndex: 'stagingLocation',
      title: '暂存位',
      type: 'txt',
      width: 120,
    },
    ...expData
  ]
}


export const setGoodsColumns = (self, expData = []) => {



  return [
    { dataIndex: 'id', title: 'ID', hidden: true },
    { dataIndex: 'itemCode', title: '商品编码' },
    { dataIndex: 'itemName', title: '商品名称' },

    { dataIndex: 'itemCategoryName', title: '商品品类' },
    { dataIndex: 'packTypeName', title: '包装类型' },
    { dataIndex: 'cargoThermosphereName', title: '货物温层' },
    {
      dataIndex: 'origPcs',
      title: '原始件数',
      type: 'txt',
      align: 'center',
      width: 120,
      sorter: (a, b) => {
        return ~~a.origPcs - ~~b.origPcs
      },
    },

    {
      title: '计划发货件数',
      dataIndex: 'planDeliveryPcs',
      type: 'txt',
      width: 120,
      align: 'center',
      sorter: (a, b) => {
        return ~~a.planDeliveryPcs - ~~b.planDeliveryPcs
      },
    },
    {
      title: '关闭件数',
      dataIndex: 'closingPcs',
      width: 120,
      align: 'center',
      sorter: (a, b) => {
        return ~~a.closingPcs - ~~b.closingPcs
      },
    },
    {
      title: '剩余件数',
      dataIndex: 'pcs',
      width: 120,
      align: 'center',
      sorter: (a, b) => {
        return ~~a.pcs - ~~b.pcs
      },
    },
    {
      dataIndex: 'weight',
      title: '剩余重量(公斤)',
      align: 'center',
      sorter: (a, b) => {
        return a.weight - b.weight
      },
    },
    {
      dataIndex: 'volume',
      title: '剩余体积(立方)',
      align: 'center',
      sorter: (a, b) => {
        return a.center - b.center
      },
    },
    { dataIndex: 'memo', title: '备注' },
    {
      dataIndex: 'branchName',
      title: '默认存放仓库',
    },
    {
      dataIndex: 'inventoryPcs',
      title: '库存数量',
    },
    {
      dataIndex: 'stagingLocation',
      title: '暂存位',
    },
    ...expData,

  ]

}
