|  |  | 
 |  |  |     '& .column-maktx': { | 
 |  |  |         width: 200 | 
 |  |  |     }, | 
 |  |  |     '& .RaBulkActionsToolbar-toolbar': { | 
 |  |  |         display: 'none' | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     mt: '60px' | 
 |  |  |     // '& .RaBulkActionsToolbar-toolbar': { | 
 |  |  |     //     display: 'none' | 
 |  |  |     // } | 
 |  |  |  | 
 |  |  | })); | 
 |  |  |  | 
 |  |  | const OutStockPublic = (props) => { | 
 |  |  |     const { record, open, setOpen } = props; | 
 |  |  |     const { record, open, setOpen, setManualDialog } = props; | 
 |  |  |     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 ComfirmButton = () => { | 
 |  |  |         const { selectedIds, data } = useListContext(); | 
 |  |  |         const handleRowClick = () => { | 
 |  |  |             const ids = data.filter(item => selectedIds.includes(item.id)).map(item => item.id); | 
 |  |  |             setRowSelectedIds(ids); | 
 |  |  |             const mas = data.filter(item => selectedIds.includes(item.id)).map(item => item.matnrCode); | 
 |  |  |             //设置库位信息筛选条件 | 
 |  |  |             setSelectedMatnr(mas); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         return ( | 
 |  |  |             <Button label="toolbar.confirm" size="medium" onClick={handleRowClick} /> | 
 |  |  |         ) | 
 |  |  |     }; | 
 |  |  |  | 
 |  |  |     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(() => { | 
 |  |  |         if (open) { | 
 |  |  |             getWaveRule() | 
 |  |  |         } | 
 |  |  |     }, [open, formData]) | 
 |  |  |         getWaveRule() | 
 |  |  |     }, [open]) | 
 |  |  |  | 
 |  |  |     const getWaveRule = async () => { | 
 |  |  |         if (formData.waveId == null && formData.waveId == undefined) { | 
 |  |  | 
 |  |  |         } | 
 |  |  |         const { data: { code, data, msg } } = await request.post('/outStock/order/getOutTaskItems', { ...formData }); | 
 |  |  |         if (code === 200) { | 
 |  |  |             setRows(data) | 
 |  |  |             // setRows(data) | 
 |  |  |             setFetchRows(data) | 
 |  |  |         } else { | 
 |  |  |             notify(msg); | 
 |  |  |         } | 
 |  |  | 
 |  |  |                                 }} | 
 |  |  |                                 title={"menu.outStockItem"} | 
 |  |  |                                 empty={false} | 
 |  |  |                                 filter={{ asnId: record?.id, deleted: 0 }} | 
 |  |  |                                 filter={{ orderId: record?.id, deleted: 0 }} | 
 |  |  |                                 sort={{ field: "create_time", order: "desc" }} | 
 |  |  |                                 actions={false} | 
 |  |  |                                 pagination={false} | 
 |  |  |                                 perPage={DEFAULT_ITEM_PAGE_SIZE} | 
 |  |  |                             > | 
 |  |  |                                 <LinearProgress | 
 |  |  |                                     sx={{ height: "2px", position: 'absolute', top: 0, left: 0, right: 0, }} | 
 |  |  |                                 /> | 
 |  |  |                                 <StyledDatagrid | 
 |  |  |                                     storeKey={"outStockPublic"} | 
 |  |  |                                     preferenceKey='outStockItem' | 
 |  |  |                                     bulkActionButtons={<></>} | 
 |  |  |                                     rowClick={false} | 
 |  |  |                                     omit={['id', 'splrName', 'qty', 'poCode', 'workQty']} | 
 |  |  |                                     bulkActionButtons={<> | 
 |  |  |                                         <ComfirmButton /> | 
 |  |  |                                     </>} | 
 |  |  |                                     omit={['id', 'splrName', 'qty', 'poCode',]} | 
 |  |  |                                 > | 
 |  |  |                                     <NumberField source="id" /> | 
 |  |  |                                     <TextField source="asnCode" label="table.field.outStockItem.asnCode" /> | 
 |  |  |                                     <TextField source="asnCode" label="table.field.outStockItem.orderCode" /> | 
 |  |  |                                     <TextField source="poCode" label="table.field.outStockItem.poCode" /> | 
 |  |  |                                     <TextField source="matnrCode" label="table.field.outStockItem.matnrCode" /> | 
 |  |  |                                     <TextField source="maktx" label="table.field.outStockItem.maktx" /> | 
 |  |  | 
 |  |  |                         </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} | 
 |  |  | 
 |  |  |             console.log(selectedIds); | 
 |  |  |         } | 
 |  |  |     }, [selectedIds]) | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     const baseColumns = [ | 
 |  |  |         // { field: 'id', headerName: 'ID', width: 40 }, | 
 |  |  | 
 |  |  |  | 
 |  |  |     return ( | 
 |  |  |         <DataGrid | 
 |  |  |             storeKey={"locItemPreview"} | 
 |  |  |             rows={rows} | 
 |  |  |             columns={columns} | 
 |  |  |             slots={{ toolbar: CustomToolBar }} | 
 |  |  | 
 |  |  |         /> | 
 |  |  |     ) | 
 |  |  | } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  | //提交按钮 | 
 |  |  | 
 |  |  |     } | 
 |  |  |     return ( | 
 |  |  |         <ConfirmButton | 
 |  |  |             label="toolbar.confirm" | 
 |  |  |             label="toolbar.allComfirm" | 
 |  |  |             variant="contained" | 
 |  |  |             size="medium" | 
 |  |  |             onConfirm={submit} | 
 |  |  |             startIcon={<ConfirmationNumberOutlinedIcon />} | 
 |  |  |         /> | 
 |  |  |     ) | 
 |  |  | } |