From bfc43ca0e4683c1c0322a6cad5d5be2bc07decc3 Mon Sep 17 00:00:00 2001 From: skyouc Date: 星期四, 24 七月 2025 15:00:44 +0800 Subject: [PATCH] 新增调拔单功能 盘点功能优化 --- rsf-admin/src/page/waitPakin/SelectSiteModel.jsx | 44 +++++++++++++++++++++++++++----------------- 1 files changed, 27 insertions(+), 17 deletions(-) diff --git a/rsf-admin/src/page/waitPakin/SelectSiteModel.jsx b/rsf-admin/src/page/waitPakin/SelectSiteModel.jsx index 26ed4ed..cb61972 100644 --- a/rsf-admin/src/page/waitPakin/SelectSiteModel.jsx +++ b/rsf-admin/src/page/waitPakin/SelectSiteModel.jsx @@ -19,6 +19,27 @@ }, })); +const SelectSiteButton = (props) => { + const { source, setOpen, refresh, notify } = props; + const record = useRecordContext(); + + const handleClick = async () => { + setOpen(false); + const id = record.id; + const res = await request.post(`/waitPakin/merge`, {waitPakins: source, siteId: id}); + if (res?.data?.code === 200) { + refresh(); + notify(res.data.msg); + } else { + notify(res.data.msg); + } + }; + + return ( + <Button label="toolbar.selectSite" onClick={handleClick} /> + ); +}; + const SelectSiteModel = (props) => { const { open, setOpen, source } = props; const translate = useTranslate(); @@ -30,11 +51,10 @@ setOpen(false); } }; - console.log(source); return ( <Box> <Dialog - sx={{width: '90%'}} + sx={{width: '100%'}} open={open} onClose={handleClose} fullWidth @@ -43,10 +63,12 @@ > <DialogTitle> {translate('toolbar.selectSite')} + <DialogCloseButton onClose={() => setOpen(false)} /> </DialogTitle> <DialogContent> <List resource='deviceSite' + filter={{type : 1}} sx={{ flexGrow: 1, transition: (theme) => @@ -68,17 +90,7 @@ <StyledDatagrid preferenceKey='deviceSite' bulkActionButtons={false} - rowClick='toggleSelection' - onToggleItem={async (id)=>{ - setOpen(false); - const res = await request.post(`/waitPakin/merge`, {waitPakins: source, siteId: id}); - if (res?.data?.code === 200) { - refresh(); - notify(res.data.msg); - } else { - notify(res.data.msg); - } - }} + rowClick={false} omit={['id','name', 'createTime','label', 'createBy', 'memo', 'updateBy$', 'createBy$', 'createTime', 'updateTime']} > <NumberField source="id" /> @@ -97,13 +109,11 @@ <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"> - <Button label="toolbar.selectSite" onClick={(event)=>{ - setOpen(false) - }}/> + <SelectSiteButton source={source} setOpen={setOpen} refresh={refresh} notify={notify} /> </WrapperField> </StyledDatagrid> </List> - </DialogContent> + </DialogContent> </Dialog> </Box> ) -- Gitblit v1.9.1