| | |
| | | import { DICT_TYPE } from '@vben/constants'; |
| | | |
| | | import { MdItemSelect } from '#/views/mes/md/item/components'; |
| | | import { MdVendorSelect } from '#/views/mes/md/vendor/components'; |
| | | |
| | | import { |
| | | WmWarehouseAreaSelect, |
| | |
| | | newFrozen: boolean, |
| | | row: MesWmMaterialStockApi.MaterialStock, |
| | | ) => Promise<boolean | undefined>, |
| | | onMove?: (row: MesWmMaterialStockApi.MaterialStock) => void, |
| | | ): VxeTableGridOptions<MesWmMaterialStockApi.MaterialStock>['columns'] { |
| | | const { hasAccessByCodes } = useAccess(); |
| | | return [ |
| | |
| | | field: 'quantity', |
| | | title: '在库数量', |
| | | width: 100, |
| | | }, |
| | | { |
| | | field: 'frozenQuantity', |
| | | title: '冻结数量', |
| | | width: 100, |
| | | formatter: ({ cellValue }: { cellValue: number }) => |
| | | (cellValue || 0).toFixed(2), |
| | | }, |
| | | { |
| | | field: 'reservedQuantity', |
| | | title: '占用量', |
| | | width: 100, |
| | | formatter: ({ cellValue }: { cellValue: number }) => |
| | | (cellValue || 0).toFixed(2), |
| | | }, |
| | | { |
| | | field: 'inTransitQuantity', |
| | | title: '在途量', |
| | | width: 100, |
| | | formatter: ({ cellValue }: { cellValue: number }) => |
| | | (cellValue || 0).toFixed(2), |
| | | }, |
| | | { |
| | | field: 'availableQuantity', |
| | | title: '可用量', |
| | | width: 100, |
| | | cellRender: { |
| | | name: 'CellText', |
| | | props: { |
| | | class: ({ row }: { row: MesWmMaterialStockApi.MaterialStock }) => |
| | | (row.availableQuantity || 0) < 0 ? 'text-red-500 font-bold' : '', |
| | | formatter: ({ row }: { row: MesWmMaterialStockApi.MaterialStock }) => |
| | | ((row.availableQuantity || 0) as number).toFixed(2), |
| | | }, |
| | | }, |
| | | }, |
| | | { |
| | | field: 'unitMeasureName', |
| | |
| | | }, |
| | | }, |
| | | }, |
| | | ...(onMove |
| | | ? [ |
| | | { |
| | | title: '操作', |
| | | width: 80, |
| | | fixed: 'right' as const, |
| | | slots: { default: 'actions' } as const, |
| | | }, |
| | | ] |
| | | : []), |
| | | ]; |
| | | } |
| | | |
| | |
| | | export function useSelectGridFormSchema(): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'itemId', |
| | | fieldName: 'itemName', |
| | | label: '物料', |
| | | component: markRaw(MdItemSelect), |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请选择物料', |
| | | allowClear: true, |
| | | placeholder: '请输入物料名称', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'vendorId', |
| | | fieldName: 'vendorName', |
| | | label: '供应商', |
| | | component: markRaw(MdVendorSelect), |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请选择供应商', |
| | | allowClear: true, |
| | | placeholder: '请输入供应商名称', |
| | | }, |
| | | }, |
| | | { |
| | |
| | | width: 100, |
| | | }, |
| | | { |
| | | field: 'frozenQuantity', |
| | | title: '冻结数量', |
| | | width: 100, |
| | | formatter: ({ cellValue }: { cellValue: number }) => |
| | | (cellValue || 0).toFixed(2), |
| | | }, |
| | | { |
| | | field: 'reservedQuantity', |
| | | title: '占用量', |
| | | width: 100, |
| | | formatter: ({ cellValue }: { cellValue: number }) => |
| | | (cellValue || 0).toFixed(2), |
| | | }, |
| | | { |
| | | field: 'inTransitQuantity', |
| | | title: '在途量', |
| | | width: 100, |
| | | formatter: ({ cellValue }: { cellValue: number }) => |
| | | (cellValue || 0).toFixed(2), |
| | | }, |
| | | { |
| | | field: 'availableQuantity', |
| | | title: '可用量', |
| | | width: 100, |
| | | cellRender: { |
| | | name: 'CellText', |
| | | props: { |
| | | class: ({ row }: { row: MesWmMaterialStockApi.MaterialStock }) => |
| | | (row.availableQuantity || 0) < 0 ? 'text-red-500 font-bold' : '', |
| | | formatter: ({ row }: { row: MesWmMaterialStockApi.MaterialStock }) => |
| | | ((row.availableQuantity || 0) as number).toFixed(2), |
| | | }, |
| | | }, |
| | | }, |
| | | { |
| | | field: 'receiptTime', |
| | | title: '入库日期', |
| | | width: 180, |