From abe9da01a8fb1ac1d887b8542b1f97523521527a Mon Sep 17 00:00:00 2001 From: verou <857149855@qq.com> Date: 星期五, 28 三月 2025 08:41:38 +0800 Subject: [PATCH] feat:报检 --- rsf-admin/src/page/asnOrder/AsnOrderList.jsx | 76 ++++++++++++++++++++++++++++++++------ 1 files changed, 64 insertions(+), 12 deletions(-) diff --git a/rsf-admin/src/page/asnOrder/AsnOrderList.jsx b/rsf-admin/src/page/asnOrder/AsnOrderList.jsx index cd9fdb1..8862faa 100644 --- a/rsf-admin/src/page/asnOrder/AsnOrderList.jsx +++ b/rsf-admin/src/page/asnOrder/AsnOrderList.jsx @@ -15,6 +15,7 @@ useRecordContext, useTranslate, useNotify, + useRefresh, useListContext, FunctionField, TextField, @@ -47,7 +48,7 @@ import ConstructionIcon from "@mui/icons-material/Construction"; import FileDownloadIcon from '@mui/icons-material/FileDownload'; import EditIcon from '@mui/icons-material/Edit'; - +import request from '@/utils/request'; const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ @@ -107,13 +108,6 @@ navigate(`/asnOrderItem?asnId=${record.id}`); }; - - const inspection = () => { }; - - const print = () => { - }; - - return ( <Box display="flex"> <List @@ -132,9 +126,6 @@ actions={( <TopToolbar> - <Button onClick={inspection} label={"toolbar.inspection"}> - <ConstructionIcon /> - </Button> <FilterButton /> <MyCreateButton onClick={() => { setCreateDialog(true); setmodalType(0) }} /> <SelectColumnsButton preferenceKey='asnOrder' /> @@ -146,7 +137,7 @@ > <StyledDatagrid preferenceKey='asnOrder' - bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} + bulkActionButtons={<> <InspectionsButton /><BulkDeleteButton mutationMode={OPERATE_MODE} /></>} rowClick={(id, resource, record) => false} expand={(e) => <AsnOrderPanel key={Math.floor(Math.random() * 100)} />} expandSingle={true} @@ -188,6 +179,7 @@ label={'ra.action.edit'} > </Button> */} + <InspectionButton /> <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} /> </WrapperField> </StyledDatagrid> @@ -227,3 +219,63 @@ </Button> ) } + +const InspectionButton = () => { + const record = useRecordContext(); + const notify = useNotify(); + const refresh = useRefresh(); + const inspection = () => { + requestInspect([record]) + }; + + const requestInspect = async (rows) => { + const { data: { code, data, msg } } = await request.post(`/asnOrder/inspect`, rows); + + if (code === 200) { + notify(msg); + refresh() + } else { + notify(msg); + } + } + + + return ( + <Button onClick={inspection} label={"toolbar.inspection"}> + <ConstructionIcon /> + </Button> + ) +} + +const InspectionsButton = () => { + const { selectedIds, onUnselectItems, data } = useListContext(); + const notify = useNotify(); + const refresh = useRefresh(); + const inspection = () => { + if (selectedIds.length === 0) { + notify('璇烽�夋嫨閫氱煡鍗�'); + return; + } else { + const rows = data.filter((item) => selectedIds.includes(item.id)) + requestInspect(rows) + } + }; + + const requestInspect = async (rows) => { + const { data: { code, data, msg } } = await request.post(`/asnOrder/inspect`, rows); + + if (code === 200) { + notify(msg); + refresh() + } else { + notify(msg); + } + } + + + return ( + <Button onClick={inspection} label={"toolbar.inspection"}> + <ConstructionIcon /> + </Button> + ) +} -- Gitblit v1.9.1