import {genWarehouseAuthSearchModal} from '@/views/kzyWMS/SearchModal';


const grid = {span: 8, labelCol: {span: 6}}

const items = [
  // 仓库
  ...genWarehouseAuthSearchModal(1, true, false, null,
    function (rowData, form) {
      if (!rowData) {
        form.setFieldsValue({
          warehouseId: '',
          warehouseCode: '',
          warehouseName: ''
        })
      } else {
        form.setFieldsValue({
          warehouseId: rowData[0].warehouseId,
          warehouseCode: rowData[0].warehouseCode,
          warehouseName: rowData[0].warehouseName,
        })
      }
    },
    {span: 8, labelCol: {span: 6}}
  )
]
const columns = [
  {type: "txt", dataIndex: 'cargoOwnerName', title: '货主名称', key: 'cargoOwnerName'},
  {type: "txt", dataIndex: 'itemHealthCategoryName', title: '商品分类名称', key: 'itemHealthCategoryName'},
  {type: "txt", dataIndex: 'itemName', title: '商品名称', key: 'itemName'},
  {type: "txt", dataIndex: 'itemCode', title: '商品编码', key: 'itemCode'},
  {type: "txt", dataIndex: 'itemCategoryCode', title: '商品类别', key: 'itemCategoryCode'},
  {type: "txt", dataIndex: 'avlQuantity', title: '可补数量', key: 'avlQuantity'},
  {type: "txt", dataIndex: 'avlNum', title: '可补件数', key: 'avlNum'},
  {type: "txt", dataIndex: 'totalReplenishQuantity', title: '应补数量', key: 'totalReplenishQuantity'},
  {type: "txt", dataIndex: 'totalReplenishNum', title: '应补件数', key: 'totalReplenishNum'},
  {type: "txt", dataIndex: 'pieceQuantity', title: '实补数量', key: 'pieceQuantity', customRender: (text, rows, index) => rows.caseConversionRate * rows.pieceNum},
  {type: "number", dataIndex: 'pieceNum', title: '实补件数', key: 'pieceNum',},
  {type: "txt", dataIndex: 'caseConversionRate', title: '包装数量', key: 'caseConversionRate'},
  {type: "txt", dataIndex: 'countryOriginId', title: '产地', key: 'countryOriginId'},
  {type: "txt", dataIndex: 'manufacturerId', title: '生产厂家', key: 'manufacturerId'},
  {type: "txt", dataIndex: 'specification', title: '规格说明', key: 'specification'},
  {type: "txt", dataIndex: 'caseUom', title: '包装单位', key: 'caseUom'},
  {type: "txt", dataIndex: 'managementLotNbr', title: '批准文号', key: 'managementLotNbr'},
  {type: "txt", dataIndex: 'stockHigherLimit', title: '库存上限', key: 'stockHigherLimit'},
  {type: "txt", dataIndex: 'stockLowerLimit', title: '库存下限', key: 'stockLowerLimit'},
]

export {items, columns}