From 5ddf26e390c8ba6e35dfbf93502c9a46f1bc356c Mon Sep 17 00:00:00 2001 From: skyouc Date: 星期三, 19 三月 2025 11:35:52 +0800 Subject: [PATCH] Merge branch 'front' into devlop --- rsf-admin/src/page/basicInfo/matnr/MatnrList.jsx | 70 +++++++++++++++++++++++++++++++---- 1 files changed, 62 insertions(+), 8 deletions(-) diff --git a/rsf-admin/src/page/basicInfo/matnr/MatnrList.jsx b/rsf-admin/src/page/basicInfo/matnr/MatnrList.jsx index 937a8e4..af3b2c8 100644 --- a/rsf-admin/src/page/basicInfo/matnr/MatnrList.jsx +++ b/rsf-admin/src/page/basicInfo/matnr/MatnrList.jsx @@ -31,6 +31,8 @@ ReferenceArrayInput, AutocompleteInput, DeleteButton, + useRefresh, + Button } from 'react-admin'; import { Box, Typography, Card, Stack, LinearProgress, Tooltip } from '@mui/material'; @@ -47,6 +49,10 @@ 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': { @@ -60,7 +66,7 @@ width: '200px' }, '& .RaList-main': { - minHeight: '80vh' + minHeight: '90vh' }, '& .column-name': { }, @@ -143,7 +149,7 @@ const { isLoading } = useListContext(); return ( - <Box sx={{ position: 'relative', minHeight: "40vh", }}> + <Box sx={{ position: 'relative', minHeight: "60vh", }}> {isLoading && ( <LinearProgress sx={{ @@ -158,14 +164,14 @@ <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', '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']} + , 'createTime', 'createBy', 'memo', 'rglarId', 'groupId', 'stockLevel', 'isLabelMange']} > <NumberField source="id" /> @@ -214,6 +220,7 @@ <WrapperField cellClassName="opt" label="common.field.opt"> <EditButton sx={{ padding: '1px', fontSize: '.75rem' }} /> {/* <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} /> */} + <EnableButton /> </WrapperField> </StyledDatagrid> </Box> @@ -248,9 +255,7 @@ <FilterButton /> <MyCreateButton onClick={() => { setCreateDialog(true) }} /> <SelectColumnsButton preferenceKey='matnr' /> - <MatnrList.Context.Provider value={'matnr'}> - <ImportButton /> - </MatnrList.Context.Provider> + <ImportButton value={'matnr'} parmas={{}} /> <MyExportButton /> </TopToolbar> )} @@ -275,4 +280,53 @@ MatnrList.Context = React.createContext() -export default MatnrList; \ No newline at end of file +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