|  |  |  | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const handleSubmit = () => { | 
|---|
|  |  |  | setOpen(false); | 
|---|
|  |  |  | refresh(); | 
|---|
|  |  |  | const selectedData = selectedRows.map(id => tableData.find(row => row.id === id)); | 
|---|
|  |  |  | setData(selectedData); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const value = selectedData.map((el => { | 
|---|
|  |  |  | return { | 
|---|
|  |  |  | matnrId: el.id, | 
|---|
|  |  |  | maktx: el.name, | 
|---|
|  |  |  | stockUnit: el.stockUnit || '', | 
|---|
|  |  |  | purUnit: el.purchaseUnit || '', | 
|---|
|  |  |  | } | 
|---|
|  |  |  | })) | 
|---|
|  |  |  | setData(value); | 
|---|
|  |  |  | setOpen(false); | 
|---|
|  |  |  | // refresh(); | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const getData = async () => { | 
|---|
|  |  |  | const res = await request.post(`/matnr/page`, { | 
|---|
|  |  |  | pageSize: 99 | 
|---|
|  |  |  | ...formData, | 
|---|
|  |  |  | pageSize: 199 | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | if (res?.data?.code === 200) { | 
|---|
|  |  |  | setTableData(res.data.data.records); | 
|---|
|  |  |  | 
|---|
|  |  |  | }, []); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const handleSearch = () => { | 
|---|
|  |  |  | // 这里可以添加搜索逻辑 | 
|---|
|  |  |  | getData() | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return ( | 
|---|
|  |  |  | 
|---|
|  |  |  | size="small" | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | </Grid> | 
|---|
|  |  |  | <Grid item xs={4}> | 
|---|
|  |  |  | <TextField | 
|---|
|  |  |  | label={translate('table.field.matnr.groupId')} | 
|---|
|  |  |  | name="groupId" | 
|---|
|  |  |  | value={formData.groupId} | 
|---|
|  |  |  | onChange={handleChange} | 
|---|
|  |  |  | variant="outlined" | 
|---|
|  |  |  | size="small" | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | </Grid> | 
|---|
|  |  |  | </Grid> | 
|---|
|  |  |  | </Box> | 
|---|
|  |  |  | <Box sx={{ mt: 2 }}> | 
|---|
|  |  |  | 
|---|
|  |  |  | <DialogActions sx={{ position: 'sticky', bottom: 0, backgroundColor: 'background.paper', zIndex: 1000 }}> | 
|---|
|  |  |  | <Box sx={{ width: '100%', display: 'flex', justifyContent: 'space-between' }}> | 
|---|
|  |  |  | <Button onClick={handleSubmit} variant="contained" startIcon={<SaveIcon />}> | 
|---|
|  |  |  | 确认 | 
|---|
|  |  |  | {translate('toolbar.confirm')} | 
|---|
|  |  |  | </Button> | 
|---|
|  |  |  | </Box> | 
|---|
|  |  |  | </DialogActions> | 
|---|
|  |  |  | 
|---|
|  |  |  | ]; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const handleSelectionChange = (ids) => { | 
|---|
|  |  |  | const selectedData = ids.map((id) => tableData.find((row) => row.id === id)); | 
|---|
|  |  |  | // setSelectedRows(selectedData); | 
|---|
|  |  |  | // setSelectedRows(ids); | 
|---|
|  |  |  | console.log(selectedData) | 
|---|
|  |  |  | setSelectedRows(ids) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return ( | 
|---|
|  |  |  | 
|---|
|  |  |  | disableColumnMenu={true} | 
|---|
|  |  |  | disableColumnSorting | 
|---|
|  |  |  | disableMultipleColumnsSorting | 
|---|
|  |  |  | autoPageSize | 
|---|
|  |  |  | columnBufferPx={100} | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | ); | 
|---|