From 75d3e411d1a6ac9c83b4f595db581c8c337e50a9 Mon Sep 17 00:00:00 2001 From: verou <857149855@qq.com> Date: 星期六, 15 三月 2025 16:55:51 +0800 Subject: [PATCH] feat:asn单据修改 --- rsf-admin/src/page/asnOrder/AsnOrderList.jsx | 55 ++++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 44 insertions(+), 11 deletions(-) diff --git a/rsf-admin/src/page/asnOrder/AsnOrderList.jsx b/rsf-admin/src/page/asnOrder/AsnOrderList.jsx index 2b0d2c7..96dbf12 100644 --- a/rsf-admin/src/page/asnOrder/AsnOrderList.jsx +++ b/rsf-admin/src/page/asnOrder/AsnOrderList.jsx @@ -31,11 +31,11 @@ ReferenceArrayInput, AutocompleteInput, DeleteButton, - Button + Button, } from 'react-admin'; import { Box, Typography, Card, Stack } from '@mui/material'; import { styled } from '@mui/material/styles'; -import AsnOrderCreate from "./AsnOrderCreate"; +import AsnOrderModal from "./AsnOrderModal"; import AsnOrderPanel from "./AsnOrderPanel"; import EmptyData from "../components/EmptyData"; import MyCreateButton from "../components/MyCreateButton"; @@ -46,6 +46,8 @@ import * as Common from '@/utils/common'; import ConstructionIcon from "@mui/icons-material/Construction"; import FileDownloadIcon from '@mui/icons-material/FileDownload'; +import EditIcon from '@mui/icons-material/Edit'; + const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ @@ -98,16 +100,17 @@ const [createDialog, setCreateDialog] = useState(false); const [drawerVal, setDrawerVal] = useState(false); + const [modalType, setmodalType] = useState(0); const navigate = useNavigate(); const assign = (record) => { navigate(`/asnOrderItem?asnId=${record.id}`); }; - const importList = () => { }; - const inspection = () => { }; + const inspection = () => { }; const print = () => { }; + return ( <Box display="flex"> @@ -121,7 +124,7 @@ marginRight: drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, }} title={"menu.asnOrder"} - empty={<EmptyData onClick={() => { setCreateDialog(true) }} />} + empty={<EmptyData onClick={() => { setCreateDialog(true); setmodalType(0) }} />} filters={filters} sort={{ field: "create_time", order: "desc" }} actions={( @@ -131,7 +134,7 @@ <ConstructionIcon /> </Button> <FilterButton /> - <MyCreateButton onClick={() => { setCreateDialog(true) }} /> + <MyCreateButton onClick={() => { setCreateDialog(true); setmodalType(0) }} /> <SelectColumnsButton preferenceKey='asnOrder' /> <MyExportButton /> @@ -143,7 +146,7 @@ preferenceKey='asnOrder' bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} rowClick={(id, resource, record) => false} - expand={() => <AsnOrderPanel />} + expand={(e) => <AsnOrderPanel key={Math.floor(Math.random() * 100)} />} expandSingle={true} omit={['id', 'createTime', 'createBy', 'memo']} > @@ -176,18 +179,28 @@ <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"> + <WrapperField cellClassName="opt" label="common.field.opt" > <Button label="toolbar.print" onClick={print}> <FileDownloadIcon /> </Button> - <EditButton sx={{ padding: '1px', fontSize: '.75rem' }} /> + {/* <EditButton sx={{ padding: '1px', fontSize: '.75rem' }} /> */} + <MyButton setCreateDialog={setCreateDialog} setmodalType={setmodalType} /> + {/* <Button + color="primary" + startIcon={<EditIcon />} + onClick={(event, record) => handleEditClick(record)} + sx={{ ml: 1 }} + label={'ra.action.edit'} + > + </Button> */} <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} /> </WrapperField> </StyledDatagrid> </List> - <AsnOrderCreate + <AsnOrderModal open={createDialog} setOpen={setCreateDialog} + asnId={modalType} /> <PageDrawer title='AsnOrder Detail' @@ -195,7 +208,27 @@ setDrawerVal={setDrawerVal} > </PageDrawer> - </Box> + </Box > ) } export default AsnOrderList; + +const MyButton = ({ setCreateDialog, setmodalType }) => { + const record = useRecordContext(); + const handleEditClick = () => { + const id = record.id; + setmodalType(id); + setCreateDialog(true); + + }; + return ( + <Button + color="primary" + startIcon={<EditIcon />} + onClick={() => handleEditClick()} + sx={{ ml: 1 }} + label={'ra.action.edit'} + > + </Button> + ) +} -- Gitblit v1.9.1