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 | 199 +++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 165 insertions(+), 34 deletions(-)
diff --git a/rsf-admin/src/page/warehouseAreas/WarehouseAreasList.jsx b/rsf-admin/src/page/warehouseAreas/WarehouseAreasList.jsx
index a44e1fb..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,26 +45,99 @@
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 = [
<SearchInput source="condition" alwaysOn />,
- <TextField source="warehouseId" label="table.field.warehouseAreas.wareId" alwaysOn />,
+ <ReferenceInput
+ source="warehouseId"
+ label="table.field.loc.warehouseId"
+ reference="warehouse"
+ >
+ <AutocompleteInput
+ label="table.field.loc.warehouseId"
+ optionText="name"
+ filterToQuery={(val) => ({ name: val })}
+ />
+ </ReferenceInput>,
<TextInput source="uuid" label="table.field.warehouseAreas.uuid" />,
<TextInput source="name" label="table.field.warehouseAreas.name" />,
<TextInput source="code" label="table.field.warehouseAreas.code" />,
@@ -104,7 +178,6 @@
const WarehouseAreasList = () => {
const translate = useTranslate();
-
const [createDialog, setCreateDialog] = useState(false);
const [drawerVal, setDrawerVal] = useState(false);
@@ -118,11 +191,18 @@
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) }} />}
filters={filters}
- sort={{ field: "create_time", order: "desc" }}
+ sort={{ field: "warehouseId", order: "desc" }}
actions={(
<TopToolbar>
<FilterButton />
@@ -133,11 +213,13 @@
)}
perPage={DEFAULT_PAGE_SIZE}
>
- <StyledDatagrid
+ <ScrollableDatagrid
preferenceKey='warehouseAreas'
bulkActionButtons={
<>
- <BatchButton />
+ <WareButton />
+ <MixButton />
+ <StatusButton />
<BulkDeleteButton mutationMode={OPERATE_MODE} />
</>
}
@@ -146,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="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}
@@ -191,7 +273,7 @@
export default WarehouseAreasList;
-const BatchButton = () => {
+const MixButton = () => {
const record = useRecordContext();
const notify = useNotify();
const refresh = useRefresh();
@@ -201,13 +283,62 @@
return (
<>
- <Button onClick={() => setCreateDialog(true)} label={"toolbar.batch"}>
+ <Button onClick={() => setCreateDialog(true)} label={"toolbar.batchMix"}>
<EditIcon />
</Button>
<BatchModal
open={createDialog}
setOpen={setCreateDialog}
+ fieldType={'flagMix'}
+ />
+ </>
+
+ )
+}
+
+const WareButton = () => {
+ const record = useRecordContext();
+ const notify = useNotify();
+ const refresh = useRefresh();
+
+
+ const [createDialog, setCreateDialog] = useState(false);
+
+ return (
+ <>
+ <Button onClick={() => setCreateDialog(true)} label={"toolbar.batchWarehouse"}>
+ <EditIcon />
+ </Button>
+
+ <BatchModal
+ open={createDialog}
+ setOpen={setCreateDialog}
+ fieldType={'wareId'}
+ />
+ </>
+
+ )
+}
+
+const StatusButton = () => {
+ const record = useRecordContext();
+ const notify = useNotify();
+ const refresh = useRefresh();
+
+
+ const [createDialog, setCreateDialog] = useState(false);
+
+ return (
+ <>
+ <Button onClick={() => setCreateDialog(true)} label={"toolbar.batchStatus"}>
+ <EditIcon />
+ </Button>
+
+ <BatchModal
+ open={createDialog}
+ setOpen={setCreateDialog}
+ fieldType={'status'}
/>
</>
--
Gitblit v1.9.1