// import { sceneState, outputSceneState } from '@/utils/dict/warehouse'
// import { useDictLabel } from '@/utils/dict'
const minPackUnitFun = row => {
  return `${row.measurementUnit || ''}${row.unit}/${row.minPackUnit}`
}

const bizSceneFormatter = useDictLabel(sceneState)
const outputSceneStateFormatter = useDictLabel(outputSceneState)
export const tableColumnConfigM = {
  first: [
    { label: '条码号', prop: 'barCode', type: 'barCode' },
    { label: '编码', prop: 'num' },
    { label: '最小单元', prop: '', formatter: minPackUnitFun },
    { label: '生产日期', prop: 'manufactureTime' },
    { label: '过期时间', prop: '' },
    { label: '入库时间', prop: 'createTime' },
    { label: '入库单号', prop: 'bizNum' },
    {
      label: '货位',
      prop: 'bizNum',
      formatter: row =>
        `${row.warehouseName}-${row.areaName}-${row.shelfCode}-${row.cargoSpaceCode}`
    }
  ],
  second: [
    { label: '入库单号', prop: 'bizNum' },
    {
      label: '入库场景',
      prop: 'bizScene',
      formatter: row => bizSceneFormatter(+row.bizScene)
    },
    {
      label: '入库数量',
      prop: 'outInNum',
      formatter: row => row.measurementUnit * row.outInNum
    },
    { label: '计量单位', prop: 'unit' },
    { label: '包装数量', prop: 'outInNum' },
    { label: '最小包装单位', prop: 'minPackUnit' },
    // { label: '最小单元', prop: 'minPackUnit', formatter: minPackUnitFun },
    // { label: '库位', prop: 'cargoSpaceCode' },
    { label: '入库时间', prop: 'verifyTime' }
  ],
  third: [
    { label: '调拔单号', prop: 'dialNumber' },
    {
      label: '调拨数量',
      prop: 'outInNum',
      formatter: row => row.measurementUnit * row.count
    },
    { label: '计量单位', prop: 'unit' },
    { label: '包装数量', prop: 'count' },
    { label: '最小包装单位', prop: 'minPackUnit' },
    // { label: '包装数量', prop: 'measurementUnit' },
    // { label: '最小包装单位', prop: 'minPackUnit' },
    // { label: '最小单元', prop: 'minPackUnit', formatter: minPackUnitFun },
    { label: '调出仓库', prop: 'warehouseName' },
    { label: '调入仓库', prop: 'inWarehouseName' },
    { label: '审核时间', prop: 'auditorTime' }
  ],
  fourth: [
    { label: '出库单号', prop: 'bizNum' },
    {
      label: '出库场景',
      prop: 'bizScene',
      formatter: row => outputSceneStateFormatter(+row.bizScene)
    },
    // {
    //   label: '出库数量',
    //   prop: 'outInNum',
    //   formatter: row => row.measurementUnit * row.outInNum
    // },
    { label: '计量单位', prop: 'unit' },
    { label: '包装数量', prop: 'outInNum' },
    { label: '最小包装单位', prop: 'minPackUnit' },
    // { label: '包装数量', prop: 'measurementUnit' },
    // { label: '最小包装单位', prop: 'minPackUnit' },
    // { label: '最小单元', prop: 'minPackUnit', formatter: minPackUnitFun },
    // {
    //   label: '出库库位',
    //   prop: 'cargoSpaceCode',
    //   formatter: row =>
    //     `${row.warehouseName}-${row.areaName}-${row.shelfCode}-${row.cargoSpaceCode}`
    // },
    { label: '出库时间', prop: 'verifyTime' }
  ],
  fifth: [
    { label: '工单编号', prop: 'workOrderCode' },
    {
      label: '状态',
      prop: 'status',
      class: row => (row.status == 3 ? 'primary-text' : 'danger-text'),
      formatter: row => (row.status == 3 ? '盘盈' : '盘亏')
    },
    {
      label: '损溢数量',
      prop: 'amount',
      formatter: row =>
        row.amount === null
          ? ''
          : row.status == 3
          ? `+${row.amount}`
          : `-${row.amount}`
    },
    { label: '计量单位', prop: 'unit' },
    // { label: '包装数量', prop: '' },
    // { label: '最小包装单位', prop: 'minimumPackUnit' },
    // { label: '最小单元', prop: '', formatter: minPackUnitFun },
    // {
    //   label: '库位',
    //   prop: '',
    //   formatter: row =>
    //     `${row.warehouseName}-${row.areaName}-${row.shelfCode}-${row.cargoSpaceCode}`
    // },
    { label: '审核时间', prop: 'planAuditTime' }
  ]
}
// 物料
export const tableColumnConfig = {
  first: [
    { label: '条码号', prop: 'barCode', type: 'barCode' },
    { label: '桶号', prop: 'num' },
    { label: '最小单元', prop: '', formatter: minPackUnitFun },
    { label: '生产日期', prop: 'manufactureTime' },
    { label: '过期时间', prop: '' },
    { label: '入库时间', prop: 'createTime' },
    { label: '入库单号', prop: 'bizNum' },
    {
      label: '货位',
      prop: 'bizNum',
      formatter: row =>
        `${row.warehouseName}-${row.areaName}-${row.shelfCode}-${row.cargoSpaceCode}`
    }
    // { label: '条码', prop: 'barCode', type: 'barCode' }
  ],
  second: [
    { label: '入库单号', prop: 'bizNum' },
    { label: '入库场景', prop: 'bizScene' },
    {
      label: '入库数量',
      prop: 'outInNum',
      formatter: row => row.measurementUnit * row.outInNum
    },
    { label: '计量单位', prop: 'unit' },
    { label: '包装数量', prop: 'outInNum' },
    { label: '最小包装单位', prop: 'minPackUnit' },
    // { label: '最小单元', prop: 'minPackUnit', formatter: minPackUnitFun },
    // {
    //   label: '库位',
    //   prop: 'cargoSpaceCode',
    //   formatter: row =>
    //     `${row.warehouseName}-${row.areaName}-${row.shelfCode}-${row.cargoSpaceCode}`
    // },
    { label: '入库时间', prop: 'verifyTime' }
  ],
  third: [
    { label: '调拔单号', prop: 'dialNumber' },
    { label: '调拨数量', prop: 'count' },
    {
      label: '调拨数量',
      prop: 'outInNum',
      formatter: row => row.measurementUnit * row.count
    },
    { label: '计量单位', prop: 'unit' },
    { label: '包装数量', prop: 'count' },
    { label: '最小包装单位', prop: 'minPackUnit' },
    // { label: '包装数量', prop: 'measurementUnit' },
    // { label: '最小包装单位', prop: 'minPackUnit' },
    // { label: '最小单元', prop: 'minPackUnit', formatter: minPackUnitFun },
    { label: '调出仓库', prop: 'warehouseName' },
    { label: '调入仓库', prop: 'inWarehouseName' },
    { label: '审核时间', prop: 'auditorTime' }
  ],
  fourth: [
    { label: '出库单号', prop: 'bizNum' },
    {
      label: '出库场景',
      prop: 'bizScene',
      formatter: row => outputSceneStateFormatter(+row.bizScene)
    },
    // {
    //   label: '出库数量',
    //   prop: 'outInNum',
    //   formatter: row => row.measurementUnit * row.outInNum
    // },
    { label: '计量单位', prop: 'unit' },
    { label: '包装数量', prop: 'outInNum' },
    { label: '最小包装单位', prop: 'minPackUnit' },
    // { label: '包装数量', prop: 'measurementUnit' },
    // { label: '最小包装单位', prop: 'minPackUnit' },
    // { label: '最小单元', prop: 'minPackUnit', formatter: minPackUnitFun },
    {
      label: '出库库位',
      prop: 'cargoSpaceCode',
      formatter: row =>
        `${row.warehouseName}-${row.areaName}-${row.shelfCode}-${row.cargoSpaceCode}`
    },
    { label: '出库时间', prop: 'verifyTime' }
  ],
  fifth: [
    { label: '工单编号', prop: 'workOrderCode' },
    {
      label: '状态',
      prop: 'status',
      class: row => (row.status == 3 ? 'primary-text' : 'danger-text'),
      formatter: row => (row.status == 3 ? '盘盈' : '盘亏')
    },
    {
      label: '损溢数量',
      prop: 'amount',
      formatter: row =>
        row.amount === null
          ? ''
          : row.status == 3
          ? `+${row.amount}`
          : `-${row.amount}`
    },
    { label: '计量单位', prop: 'unit' },
    // { label: '包装数量', prop: '' },
    // { label: '最小包装单位', prop: 'minimumPackUnit' },
    // { label: '最小单元', prop: '', formatter: minPackUnitFun },
    // {
    //   label: '库位',
    //   prop: '',
    //   formatter: row =>
    //     `${row.warehouseName}-${row.areaName}-${row.shelfCode}-${row.cargoSpaceCode}`
    // },
    { label: '审核时间', prop: 'planAuditTime' }
  ]
}

// export const

export const titleCof = {
  second: '入库单号',
  third: '调拨单号',
  fourth: '出库单号',
  fifth: '工单编号'
}
