|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const CreateBySelectMats = (props) => { | 
|---|
|  |  |  | const { open, setOpen, data, setData } = props; | 
|---|
|  |  |  | const { open, setOpen, data, setData, queryForm } = props; | 
|---|
|  |  |  | const [page, setPage] = useState({ page: DEFAULT_START_PAGE, pageSize: DEFAULT_PAGE_SIZE }); | 
|---|
|  |  |  | const [rowCount, setRowCount] = useState(0); | 
|---|
|  |  |  | const [isLoading, setIsLoading] = useState(false); | 
|---|
|  |  |  | 
|---|
|  |  |  | return acc; | 
|---|
|  |  |  | }, {}); | 
|---|
|  |  |  | return { | 
|---|
|  |  |  | id: el.id, | 
|---|
|  |  |  | matnrId: el.matnrId, | 
|---|
|  |  |  | maktx: el.maktx, | 
|---|
|  |  |  | matnrCode: el.matnrCode, | 
|---|
|  |  |  | 
|---|
|  |  |  | batch: el.batch, | 
|---|
|  |  |  | spec: el.spec, | 
|---|
|  |  |  | model: el.model, | 
|---|
|  |  |  | fieldsIndex: el.fieldsIndex, | 
|---|
|  |  |  | stockUnit: el.unit || '', | 
|---|
|  |  |  | ...dynamicFields | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const getData = async () => { | 
|---|
|  |  |  | setIsLoading(true) | 
|---|
|  |  |  | const res = await request.post(`/transfer/locs/items`, { | 
|---|
|  |  |  | let params = { | 
|---|
|  |  |  | ...formData, | 
|---|
|  |  |  | orgAreaId: queryForm?.orgAreaId, | 
|---|
|  |  |  | current: page?.page, | 
|---|
|  |  |  | pageSize: page?.pageSize, | 
|---|
|  |  |  | orderBy: "create_time desc" | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | setIsLoading(true) | 
|---|
|  |  |  | const res = await request.post(`/transfer/locs/items`, params); | 
|---|
|  |  |  | if (res?.data?.code === 200) { | 
|---|
|  |  |  | const { data } = res.data; | 
|---|
|  |  |  | setTableData(data?.records); | 
|---|
|  |  |  | setRowCount(data?.total); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | notify(res.data.msg); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | aria-labelledby="form-dialog-title" | 
|---|
|  |  |  | fullWidth | 
|---|
|  |  |  | disableRestoreFocus | 
|---|
|  |  |  | maxWidth="lg" | 
|---|
|  |  |  | maxWidth="xl" | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <DialogTitle id="form-dialog-title" sx={{ | 
|---|
|  |  |  | position: 'sticky', | 
|---|
|  |  |  | 
|---|
|  |  |  | </Grid> | 
|---|
|  |  |  | </Box> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <Box sx={{ mt: 2, height: 400, width: '100%' }}> | 
|---|
|  |  |  | <Box sx={{ mt: 2, height: 600, width: '100%' }}> | 
|---|
|  |  |  | <SelectMatsTableView | 
|---|
|  |  |  | tableData={tableData} | 
|---|
|  |  |  | setTableData={setTableData} | 
|---|
|  |  |  | 
|---|
|  |  |  | const [columns, setColumns] = useState([ | 
|---|
|  |  |  | { field: 'maktx', headerName: translate('table.field.matnr.name'), width: 300 }, | 
|---|
|  |  |  | { field: 'matnrCode', headerName: translate('table.field.matnr.code'), width: 200 }, | 
|---|
|  |  |  | // { field: 'groupId$', headerName: translate('table.field.matnr.groupId'), width: 100 }, | 
|---|
|  |  |  | { field: 'locCode', headerName: translate('table.field.locItem.locCode'), width: 100 }, | 
|---|
|  |  |  | { field: 'spec', headerName: translate('table.field.matnr.spec'), width: 100 }, | 
|---|
|  |  |  | { field: 'batch', headerName: translate('table.field.locItem.batch'), width: 100 }, | 
|---|
|  |  |  | { field: 'model', headerName: translate('table.field.matnr.model'), width: 100 }, | 
|---|
|  |  |  | 
|---|
|  |  |  | { field: 'unit', headerName: translate('table.field.matnr.unit'), width: 100 }, | 
|---|
|  |  |  | { field: 'wareArea', headerName: translate('table.field.locItem.wareArea'), width: 100, sortable: false }, | 
|---|
|  |  |  | ]) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const getData = async () => { | 
|---|
|  |  |  | const res = await request.post(`/matnr/page`, { | 
|---|
|  |  |  | // const res = await request.post(`/transfer/locs/items`, { | 
|---|
|  |  |  | ...formData, | 
|---|
|  |  |  | current: page, | 
|---|
|  |  |  | pageSize: pageSize, | 
|---|
|  |  |  | orderBy: "create_time desc" | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | if (res?.data?.code === 200) { | 
|---|
|  |  |  | const { data } = res.data; | 
|---|
|  |  |  | console.log('====-->'); | 
|---|
|  |  |  | console.log(data); | 
|---|
|  |  |  | setTableData(data?.records); | 
|---|
|  |  |  | setRowCount(data?.total); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | notify(res.data.msg); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const handleSelectionChange = (ids) => { | 
|---|
|  |  |  | setSelectedRows(ids) | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return ( | 
|---|
|  |  |  | <div style={{ height: 400, width: '100%' }}> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <div style={{ height: 590, width: '100%' }}> | 
|---|
|  |  |  | <DataGrid | 
|---|
|  |  |  | rows={tableData} | 
|---|
|  |  |  | rowCount={rowCount} | 
|---|
|  |  |  | columns={columns} | 
|---|
|  |  |  | paginationMode="server" | 
|---|
|  |  |  | paginationModel={page} | 
|---|
|  |  |  | checkboxSelection | 
|---|
|  |  |  | onPaginationModelChange={setPage} | 
|---|
|  |  |  | onRowSelectionModelChange={handleSelectionChange} | 
|---|
|  |  |  | selectionModel={selectedRows} | 
|---|
|  |  |  | disableColumnMenu={true} | 
|---|
|  |  |  | disableColumnSorting | 
|---|
|  |  |  | disableMultipleColumnsSorting | 
|---|
|  |  |  | loading={isLoading} | 
|---|
|  |  |  | slotProps={{ | 
|---|
|  |  |  | loadingOverlay: { | 
|---|