|  |  |  | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | })); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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(); | 
|---|
|  |  |  | 
|---|
|  |  |  | setOpen(false); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | console.log(source); | 
|---|
|  |  |  | return ( | 
|---|
|  |  |  | <Box> | 
|---|
|  |  |  | <Dialog | 
|---|
|  |  |  | sx={{width: '90%'}} | 
|---|
|  |  |  | sx={{width: '100%'}} | 
|---|
|  |  |  | open={open} | 
|---|
|  |  |  | onClose={handleClose} | 
|---|
|  |  |  | fullWidth | 
|---|
|  |  |  | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <DialogTitle> | 
|---|
|  |  |  | {translate('toolbar.selectSite')} | 
|---|
|  |  |  | <DialogCloseButton onClose={() => setOpen(false)} /> | 
|---|
|  |  |  | </DialogTitle> | 
|---|
|  |  |  | <DialogContent> | 
|---|
|  |  |  | <List | 
|---|
|  |  |  | resource='deviceSite' | 
|---|
|  |  |  | filter={{type : 1}} | 
|---|
|  |  |  | sx={{ | 
|---|
|  |  |  | flexGrow: 1, | 
|---|
|  |  |  | transition: (theme) => | 
|---|
|  |  |  | 
|---|
|  |  |  | <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" /> | 
|---|
|  |  |  | 
|---|
|  |  |  | <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> | 
|---|
|  |  |  | ) | 
|---|