| | |
| | | const notify = useNotify(); |
| | | const gridRef = useGridApiRef(); |
| | | const [rows, setRows] = useState([]); |
| | | const [fetchRows, setFetchRows] = useState([]); |
| | | const translate = useTranslate(); |
| | | const [rowSelectedIds, setRowSelectedIds] = useState([]); |
| | | const [selectedMatnr, setSelectedMatnr] = useState([]); |
| | | const [selectedIds, setSelectedIds] = useState([]); |
| | | const [formData, setFormData] = useState({ |
| | | orderId: record?.id, |
| | | waveId: DEFAULT_TYPE |
| | | }); |
| | | const [formData, setFormData] = useState({ orderId: record?.id, waveId: DEFAULT_TYPE }); |
| | | const [dialog, setDialog] = useState(false); |
| | | const [selectedValue, setSelectedValue] = useState({}); |
| | | |
| | | useEffect(() => { |
| | | if (selectedMatnr.length < 1) { |
| | | setRows(fetchRows) |
| | | } else { |
| | | const mas = fetchRows.filter(item => selectedMatnr.includes(item.matnrCode)); |
| | | setRows(mas) |
| | | } |
| | | }, [selectedMatnr]) |
| | | |
| | | |
| | | const handleRowClick = (id, resource, record) => { |
| | | setRowSelectedIds(prev => |
| | | prev.includes(id) |
| | | ? prev.filter(item => item !== id) // 取消选择 |
| | | : [...prev, id] // 添加选择 |
| | | ); |
| | | |
| | | //设置库位信息筛选条件 |
| | | setSelectedMatnr(prev => |
| | | prev.includes(record?.matnrCode) |
| | | ? prev.filter(item => item !== record?.matnrCode) // 取消选择 |
| | | : [...prev, record?.matnrCode] // 添加选择 |
| | | ); |
| | | }; |
| | | |
| | | const handleClickOpen = () => { |
| | | setDialog(true); |
| | |
| | | const handleClose = (value) => { |
| | | setDialog(false); |
| | | setSelectedValue(value); |
| | | const newRows = rows.map(item => { |
| | | return selectedIds.includes(item?.id) ? { |
| | | ...item, |
| | | siteNo: value?.site |
| | | } : item |
| | | }) |
| | | setRows(newRows); |
| | | if (selectedIds.length == 0) { |
| | | const newRows = rows.map(item => { |
| | | return { |
| | | ...item, |
| | | siteNo: value?.site |
| | | } |
| | | }) |
| | | setRows(newRows); |
| | | } else { |
| | | const newRows = rows.map(item => { |
| | | return selectedIds.includes(item?.id) ? { |
| | | ...item, |
| | | siteNo: value?.site |
| | | } : item |
| | | }) |
| | | setRows(newRows); |
| | | } |
| | | }; |
| | | |
| | | useEffect(() => { |
| | |
| | | const { data: { code, data, msg } } = await request.post('/outStock/order/getOutTaskItems', { ...formData }); |
| | | if (code === 200) { |
| | | setRows(data) |
| | | setFetchRows(data) |
| | | } else { |
| | | notify(msg); |
| | | } |
| | |
| | | sx={{ height: "2px", position: 'absolute', top: 0, left: 0, right: 0, }} |
| | | /> |
| | | <StyledDatagrid |
| | | storeKey={"outStockPublic"} |
| | | preferenceKey='outStockItem' |
| | | bulkActionButtons={<></>} |
| | | rowClick={false} |
| | | rowClick={handleRowClick} |
| | | selectedIds={rowSelectedIds} |
| | | omit={['id', 'splrName', 'qty', 'poCode', 'workQty']} |
| | | > |
| | | <NumberField source="id" /> |
| | |
| | | </Card> |
| | | </Grid> |
| | | <Grid item xl={6.3} gap={2}> |
| | | <Card> |
| | | <Box sx={{ height: 500, width: '100%' }}> |
| | | <Card sx={{ minHeight: 1050, height: 'calc(100% - 10px)', width: '100%' }}> |
| | | <Box> |
| | | <PreviewTable |
| | | rows={rows} |
| | | gridRef={gridRef} |
| | |
| | | } |
| | | }, [selectedIds]) |
| | | |
| | | |
| | | const baseColumns = [ |
| | | // { field: 'id', headerName: 'ID', width: 40 }, |
| | | { field: 'locCode', headerName: '库位', width: 110 }, |
| | |
| | | { field: 'batch', headerName: '批次', width: 90 }, |
| | | { field: 'unit', headerName: '单位', width: 60 }, |
| | | { field: 'outQty', headerName: '出库数量', width: 110, }, |
| | | { |
| | | field: 'anfme', headerName: '库存数量', width: 110, |
| | | { field: 'anfme', headerName: '库存数量', width: 110, |
| | | renderCell: (params) => ( |
| | | <OutStockAnfme value={params.value} /> |
| | | ) |
| | |
| | | |
| | | return ( |
| | | <DataGrid |
| | | storeKey={"locItemPreview"} |
| | | rows={rows} |
| | | columns={columns} |
| | | slots={{ toolbar: CustomToolBar }} |
| | |
| | | /> |
| | | ) |
| | | } |
| | | |
| | | |
| | | |
| | | //提交按钮 |