From 5f13213af588444a59d0b3725f3d028cbdaffca4 Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期三, 07 五月 2025 15:46:22 +0800
Subject: [PATCH] 完成任务优化 删除组托优化
---
rsf-admin/src/page/waitPakin/SelectSiteModel.jsx | 43 +++++++++++++++++++++++++++----------------
1 files changed, 27 insertions(+), 16 deletions(-)
diff --git a/rsf-admin/src/page/waitPakin/SelectSiteModel.jsx b/rsf-admin/src/page/waitPakin/SelectSiteModel.jsx
index 26ed4ed..d152bb5 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();
@@ -34,7 +55,7 @@
return (
<Box>
<Dialog
- sx={{width: '90%'}}
+ sx={{width: '100%'}}
open={open}
onClose={handleClose}
fullWidth
@@ -43,10 +64,12 @@
>
<DialogTitle>
{translate('toolbar.selectSite')}
+ <DialogCloseButton onClose={() => setOpen(false)} />
</DialogTitle>
<DialogContent>
<List
resource='deviceSite'
+ filter={{type : 1}}
sx={{
flexGrow: 1,
transition: (theme) =>
@@ -68,17 +91,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 +110,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