From b07a6193d605fdf3154bf81faed0244030679b60 Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期三, 19 三月 2025 16:49:09 +0800
Subject: [PATCH] #修改 1.添加库位类型绑定 2.物料添加动态字段
---
rsf-admin/src/page/basicInfo/matnr/MatnrList.jsx | 154 ++++++++++++++++++++++++++++++++++++++------------
1 files changed, 116 insertions(+), 38 deletions(-)
diff --git a/rsf-admin/src/page/basicInfo/matnr/MatnrList.jsx b/rsf-admin/src/page/basicInfo/matnr/MatnrList.jsx
index 9cf7280..af3b2c8 100644
--- a/rsf-admin/src/page/basicInfo/matnr/MatnrList.jsx
+++ b/rsf-admin/src/page/basicInfo/matnr/MatnrList.jsx
@@ -31,8 +31,11 @@
ReferenceArrayInput,
AutocompleteInput,
DeleteButton,
+ useRefresh,
+ Button
+
} from 'react-admin';
-import { Box, Typography, Card, Stack,LinearProgress } from '@mui/material';
+import { Box, Typography, Card, Stack, LinearProgress, Tooltip } from '@mui/material';
import { styled } from '@mui/material/styles';
import MatnrCreate from "./MatnrCreate";
import MatnrPanel from "./MatnrPanel";
@@ -40,33 +43,54 @@
import MyCreateButton from "@/page/components/MyCreateButton";
import MyExportButton from '@/page/components/MyExportButton';
import PageDrawer from "@/page/components/PageDrawer";
-import MyField from "@/page/components/MyField";
+import TooltipField from "@/page/components/TooltipField";
import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting';
import * as Common from '@/utils/common';
-import ImportButton from "@/page/components/ImportButton";
+import ImportButton from "../../components/ImportButton";
import MatListAside from './MatnrListAside';
+import { display, height } from "@mui/system";
+import DashboardIcon from '@mui/icons-material/Dashboard';
+import EditIcon from '@mui/icons-material/Edit';
+import request from '@/utils/request';
+import BatchModal from './BatchModal';
const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({
'& .css-1vooibu-MuiSvgIcon-root': {
height: '.9em'
},
+
'& .RaDatagrid-row': {
cursor: 'auto'
+ },
+ '& .RaList-content': {
+ width: '200px'
+ },
+ '& .RaList-main': {
+ minHeight: '90vh'
},
'& .column-name': {
},
'& .opt': {
width: 200
},
+ '& .name': {
+ width: '100px',
+
+ },
+ '& .name .MuiTypography-root': {
+ whiteSpace: 'nowrap',
+ overflow: 'hidden',
+ textOverflow: 'ellipsis',
+ display: 'block',
+ width: '100px',
+ }
}));
const filters = [
<SearchInput source="condition" alwaysOn />,
- <DateInput label='common.time.after' source="timeStart" alwaysOn />,
- <DateInput label='common.time.before' source="timeEnd" alwaysOn />,
- <TextInput source="name" label="table.field.matnr.name" />,
- <TextInput source="code" label="table.field.matnr.code" />,
+ <TextInput source="name" label="table.field.matnr.name" alwaysOn />,
+ <TextInput source="code" label="table.field.matnr.code" alwaysOn />,
<ReferenceInput source="shipperId$" label="table.field.matnr.shipperId" reference="shipper">
<AutocompleteInput label="table.field.matnr.shipperId" optionText="name" filterToQuery={(val) => ({ name: val })} />
</ReferenceInput>,
@@ -76,7 +100,7 @@
<ReferenceInput source="rglarId" label="table.field.matnr.rglarId" reference="rglarId">
<AutocompleteInput label="table.field.matnr.rglarId" optionText="code" filterToQuery={(val) => ({ code: val })} />
</ReferenceInput>,
- <TextInput source="erpCode" label="table.field.matnr.erpCode" />,
+ <TextInput source="platCode" label="table.field.matnr.platCode" />,
<TextInput source="spec" label="table.field.matnr.spec" />,
<TextInput source="model" label="table.field.matnr.model" />,
<NumberInput source="weight" label="table.field.matnr.weight" />,
@@ -90,14 +114,14 @@
<SelectInput source="stockLeval" label="table.field.matnr.stockLevel"
choices={[
{ id: 0, name: ' A' },
- { id: 1, name: ' B' },
- { id: 2, name: 'C' },
+ { id: 1, name: ' B' },
+ { id: 2, name: 'C' },
]}
/>,
<SelectInput source="isLabelMange" label="table.field.matnr.isLabelMange"
choices={[
{ id: 0, name: ' 鍚�' },
- { id: 1, name: ' 鏄�' },
+ { id: 1, name: ' 鏄�' },
]}
/>,
<NumberInput source="safeQty" label="table.field.matnr.safeQty" />,
@@ -125,42 +149,44 @@
const { isLoading } = useListContext();
return (
- <Box sx={{ position: 'relative' }}>
- {isLoading && (
- <LinearProgress
- sx={{
- height: "2px",
- position: 'absolute',
- top: 0,
- left: 0,
- right: 0,
- }}
- />
- )}
- <StyledDatagrid
+ <Box sx={{ position: 'relative', minHeight: "60vh", }}>
+ {isLoading && (
+ <LinearProgress
+ sx={{
+ height: "2px",
+ position: 'absolute',
+ top: 0,
+ left: 0,
+ right: 0,
+ }}
+ />
+ )}
+
+ <StyledDatagrid
preferenceKey='matnr'
- bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />}
+ bulkActionButtons={<> <BatchButton /><BulkDeleteButton mutationMode={OPERATE_MODE} /></>}
rowClick={(id, resource, record) => false}
expand={() => <MatnrPanel />}
expandSingle={true}
- omit={['id','shipperId','erpCode','spec','model','weight','color','size','describle'
- ,'nromNum','unit','purchaseUnit','stockUnit','stockLeval','isLabelMange','safeQty'
- ,'minQty','maxQty','stagn','valid','validWarn','flagCheck','updateTime', 'updateBy'
- , 'createTime', 'createBy', 'memo']}
+ omit={['id', 'shipperId', 'platCode', 'spec', 'model', 'weight', 'color', 'size', 'describle'
+ , 'nromNum', 'unit', 'purchaseUnit', 'stockUnit', 'stockLeval', 'isLabelMange', 'safeQty'
+ , 'minQty', 'maxQty', 'stagn', 'valid', 'validWarn', 'flagCheck', 'updateTime', 'updateBy'
+ , 'createTime', 'createBy', 'memo', 'rglarId', 'groupId', 'stockLevel', 'isLabelMange']}
>
<NumberField source="id" />
- <TextField source="name" label="table.field.matnr.name" />
+
+ <TooltipField source="name" label="table.field.matnr.name" cellClassName="name" />
<TextField source="code" label="table.field.matnr.code" />
<ReferenceField source="shipperId" label="table.field.matnr.shipperId" reference="shipper" link={false} sortable={false}>
<TextField source="name" />
</ReferenceField>
<ReferenceField source="groupId" label="table.field.matnr.groupId" reference="matnrGroup" link={false} sortable={false}>
- <TextField source="code" />
+ <TextField source="name" />
</ReferenceField>
<ReferenceField source="rglarId" label="table.field.matnr.rglarId" reference="batchRegular" link={false} sortable={false}>
<TextField source="code" />
</ReferenceField>
- <TextField source="erpCode" label="table.field.matnr.erpCode" />
+ <TextField source="platCode" label="table.field.matnr.platCode" />
<TextField source="spec" label="table.field.matnr.spec" />
<TextField source="model" label="table.field.matnr.model" />
<NumberField source="weight" label="table.field.matnr.weight" />
@@ -193,12 +219,13 @@
<TextField source="memo" label="common.field.memo" sortable={false} />
<WrapperField cellClassName="opt" label="common.field.opt">
<EditButton sx={{ padding: '1px', fontSize: '.75rem' }} />
- <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} />
+ {/* <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} /> */}
+ <EnableButton />
</WrapperField>
</StyledDatagrid>
</Box>
);
-
+
}
const MatnrList = () => {
@@ -217,7 +244,7 @@
theme.transitions.create(['all'], {
duration: theme.transitions.duration.enteringScreen,
}),
- marginRight: !!drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0,
+ marginRight: drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0,
}}
title={"menu.matnr"}
empty={<EmptyData onClick={() => { setCreateDialog(true) }} />}
@@ -228,12 +255,12 @@
<FilterButton />
<MyCreateButton onClick={() => { setCreateDialog(true) }} />
<SelectColumnsButton preferenceKey='matnr' />
- <ImportButton />
+ <ImportButton value={'matnr'} parmas={{}} />
<MyExportButton />
</TopToolbar>
)}
perPage={DEFAULT_PAGE_SIZE}
- aside={ <MatListAside /> }
+ aside={<MatListAside />}
>
<MatnrListContent />
</List>
@@ -251,4 +278,55 @@
)
}
-export default MatnrList;
\ No newline at end of file
+MatnrList.Context = React.createContext()
+
+export default MatnrList;
+
+const EnableButton = () => {
+ const record = useRecordContext();
+ const notify = useNotify();
+ const refresh = useRefresh();
+ const enable = async () => {
+ const res = await request.post('/loc/update', {
+ ...record,
+ status: +!record.status
+ });
+ if (res?.data?.code === 200) {
+ refresh()
+ } else {
+ notify(res.data.msg);
+ }
+ }
+ return (
+ record.status === 1 ?
+ (<Button onClick={enable} label={"toolbar.unenable"}>
+ <DashboardIcon />
+ </Button>) : (<Button onClick={enable} label={"toolbar.enable"}>
+ <DashboardIcon />
+ </Button>)
+
+ )
+}
+
+const BatchButton = () => {
+ const record = useRecordContext();
+ const notify = useNotify();
+ const refresh = useRefresh();
+
+
+ const [createDialog, setCreateDialog] = useState(false);
+
+ return (
+ <>
+ <Button onClick={() => setCreateDialog(true)} label={"toolbar.batch"}>
+ <EditIcon />
+ </Button>
+
+ <BatchModal
+ open={createDialog}
+ setOpen={setCreateDialog}
+ />
+ </>
+
+ )
+}
\ No newline at end of file
--
Gitblit v1.9.1