From c73bfe563e19aee0fcf2465a0982bb307cc4c249 Mon Sep 17 00:00:00 2001 From: skyouc Date: 星期五, 11 七月 2025 17:09:44 +0800 Subject: [PATCH] no message --- rsf-admin/src/page/warehouseAreas/WarehouseAreasList.jsx | 127 +++++++++++++++++++++++++++++++++--------- 1 files changed, 99 insertions(+), 28 deletions(-) diff --git a/rsf-admin/src/page/warehouseAreas/WarehouseAreasList.jsx b/rsf-admin/src/page/warehouseAreas/WarehouseAreasList.jsx index cf5d60c..9a4d3bd 100644 --- a/rsf-admin/src/page/warehouseAreas/WarehouseAreasList.jsx +++ b/rsf-admin/src/page/warehouseAreas/WarehouseAreasList.jsx @@ -31,6 +31,7 @@ ReferenceArrayInput, AutocompleteInput, DeleteButton, + Datagrid, useRefresh, Button } from 'react-admin'; @@ -44,21 +45,84 @@ import PageDrawer from "../components/PageDrawer"; import BatchModal from "./BatchModal"; import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting'; -import * as Common from '@/utils/common'; import EditIcon from '@mui/icons-material/Edit'; +import { minWidth } from "@mui/system"; + + +const ScrollableDatagrid = styled(Datagrid)(({ theme }) => ({ + '& .MuiTable-root': { + minWidth: '100%', // 纭繚琛ㄦ牸瀹藉害瓒冲 + tableLayout: 'fixed', // 鍥哄畾琛ㄦ牸甯冨眬 + }, + '& .RaDatagrid-rowCell': { + textAlign: 'center', + whiteSpace: 'nowrap', + textOverflow: 'ellipsis', + }, + + '& .RaDatagrid-headerCell': { + whiteSpace: 'nowrap', + overflowX: 'auto', + }, + + '& .opt': { + width: 200, + position: 'sticky', + zIndex: 3, + right: 0, + + }, +})); + const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ - '& .css-1vooibu-MuiSvgIcon-root': { - height: '.9em' - }, - '& .RaDatagrid-row': { - cursor: 'auto' - }, - '& .column-name': { - }, + // height: '.9em' + // }, + // '& .RaDatagrid-row': { + // cursor: 'auto' + // }, '& .opt': { - width: 200 + width: 200, + position: 'sticky', + right: 0, }, + + '& .MuiTableContainer-root': { + overflowX: 'auto', + '&::-webkit-scrollbar': { + height: '8px', + }, + '&::-webkit-scrollbar-thumb': { + backgroundColor: theme.palette.action.hover, + borderRadius: '4px', + }, + }, + // '& .MuiTable-root': { + // minWidth: '100%', // 纭繚琛ㄦ牸瀹藉害瓒冲 + // tableLayout: 'fixed', // 鍥哄畾琛ㄦ牸甯冨眬 + // }, + // '& .MuiTableCell-root': { + // whiteSpace: 'nowrap', + // overflow: 'hidden', + // textOverflow: 'ellipsis', + // position: 'relative', // 涓哄浐瀹氬垪鎻愪緵瀹氫綅涓婁笅鏂� + // }, + // '& .MuiTableCell-actions': { + // position: 'sticky', + // right: 0, + // background: theme.palette.background.paper, + // zIndex: 2, + // width: '150px', + // minWidth: '150px', + // boxShadow: '-2px 0 4px rgba(0,0,0,0.1)', + // '& button': { + // marginLeft: theme.spacing(1), + // } + // }, + // '& .MuiTableHead-root .MuiTableCell-actions': { + // zIndex: 3, // 琛ㄥご姣斿唴瀹归珮涓�灞� + // } + })); const filters = [ @@ -127,6 +191,13 @@ duration: theme.transitions.duration.enteringScreen, }), marginRight: drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, + '& .RaList-content': { + position: 'sticky', + overflow: 'auto', + width: 'auto', + righ: '0px', + minWidth: '100%' + } }} title={"menu.warehouseAreas"} empty={<EmptyData onClick={() => { setCreateDialog(true) }} />} @@ -142,7 +213,7 @@ )} perPage={DEFAULT_PAGE_SIZE} > - <StyledDatagrid + <ScrollableDatagrid preferenceKey='warehouseAreas' bulkActionButtons={ <> @@ -157,33 +228,33 @@ > <NumberField source="id" /> {/* <TextField source="uuid" label="table.field.warehouseAreas.uuid" /> */} - <TextField source="name" label="table.field.warehouseAreas.name" /> - <TextField source="code" label="table.field.warehouseAreas.code" /> - <TextField source="type$" label="table.field.warehouseAreas.type"/> + <TextField source="name" label="table.field.warehouseAreas.name" width="10%" /> + <TextField source="code" label="table.field.warehouseAreas.code" width="10%" /> + <TextField source="type$" label="table.field.warehouseAreas.type" width="10%" /> {/* <ReferenceField source="shipperId" label="table.field.warehouseAreas.shipperId" reference="shipper" link={false} sortable={false}> <TextField source="name" /> </ReferenceField> */} - <TextField source="warehouseId$" label="table.field.warehouseAreas.wareId" /> - <TextField source="shipperId$" label="table.field.warehouseAreas.shipperId" /> - <NumberField source="supplierId" label="table.field.warehouseAreas.supplierId" /> - <TextField source="flagMinus$" label="table.field.warehouseAreas.flagMinus" sortable={false} /> - <TextField source="flagLabelMange$" label="table.field.warehouseAreas.flagLabelMange" sortable={false} /> - <TextField source="flagMix$" label="table.field.warehouseAreas.flagMix" sortable={false} /> - <ReferenceField source="updateBy" label="common.field.updateBy" reference="user" link={false} sortable={false}> + <TextField source="warehouseId$" label="table.field.warehouseAreas.wareId" width="10%" /> + <TextField source="shipperId$" label="table.field.warehouseAreas.shipperId" width="10%" /> + <NumberField source="supplierId" label="table.field.warehouseAreas.supplierId" width="10%" /> + <TextField source="flagMinus$" label="table.field.warehouseAreas.flagMinus" sortable={false} width="10%" /> + <TextField source="flagLabelMange$" label="table.field.warehouseAreas.flagLabelMange" sortable={false} width="10%" /> + <TextField source="flagMix$" label="table.field.warehouseAreas.flagMix" sortable={false} width="10%" /> + <ReferenceField source="updateBy" label="common.field.updateBy" reference="user" link={false} sortable={false} width="10%"> <TextField source="nickname" /> </ReferenceField> - <DateField source="updateTime" label="common.field.updateTime" showTime /> - <ReferenceField source="createBy" label="common.field.createBy" reference="user" link={false} sortable={false}> + <DateField source="updateTime" label="common.field.updateTime" showTime width="10%" /> + <ReferenceField source="createBy" label="common.field.createBy" reference="user" link={false} sortable={false} width="10%"> <TextField source="nickname" /> </ReferenceField> - <DateField source="createTime" label="common.field.createTime" showTime /> - <BooleanField source="statusBool" label="common.field.status" sortable={false} /> - <TextField source="memo" label="common.field.memo" sortable={false} /> - <WrapperField cellClassName="opt" label="common.field.opt"> + <DateField source="createTime" label="common.field.createTime" showTime width="10%" /> + <BooleanField source="statusBool" label="common.field.status" sortable={false} width="10%" /> + <TextField source="memo" label="common.field.memo" sortable={false} width="10%" /> + <WrapperField source="opt" cellClassName="opt" label="common.field.opt"> <EditButton sx={{ padding: '1px', fontSize: '.75rem' }} /> <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} /> </WrapperField> - </StyledDatagrid> + </ScrollableDatagrid> </List> <WarehouseAreasCreate open={createDialog} -- Gitblit v1.9.1