|  |  |  | 
|---|
|  |  |  | const filters = [ | 
|---|
|  |  |  | <SearchInput source="condition" alwaysOn />, | 
|---|
|  |  |  | <TextInput source="code" label="table.field.waitPakin.code" />, | 
|---|
|  |  |  | <NumberInput source="ansId" label="table.field.waitPakin.ansId" />, | 
|---|
|  |  |  | <TextInput source="asnCode" label="table.field.waitPakin.asnCode" />, | 
|---|
|  |  |  | <TextInput source="barcode" label="table.field.waitPakin.barcode" />, | 
|---|
|  |  |  | <NumberInput source="anfme" label="table.field.waitPakin.anfme" />, | 
|---|
|  |  |  | <SelectInput source="ioStatus" label="table.field.waitPakin.ioStatus" | 
|---|
|  |  |  | 
|---|
|  |  |  | const translate = useTranslate(); | 
|---|
|  |  |  | const [createDialog, setCreateDialog] = useState(false); | 
|---|
|  |  |  | const [siteDialog, setSiteDialog] = useState(false); | 
|---|
|  |  |  | const [source, setSource] = useState(false); | 
|---|
|  |  |  | const [drawerVal, setDrawerVal] = useState(false); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const CreateTaskButton = () => { | 
|---|
|  |  |  | const record = useRecordContext(); | 
|---|
|  |  |  | const notify = useNotify(); | 
|---|
|  |  |  | const refresh = useRefresh(); | 
|---|
|  |  |  | const { selectedIds, onUnselectItems, data } = useListContext(); | 
|---|
|  |  |  | const rows = data.filter(map => selectedIds.includes(map.id)); | 
|---|
|  |  |  | const createTask = () => { | 
|---|
|  |  |  | setSiteDialog(true) | 
|---|
|  |  |  | setSource(rows) | 
|---|
|  |  |  | refresh() | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return ( | 
|---|
|  |  |  | <> | 
|---|
|  |  |  | <Button onClick={() => createTask()} label={"toolbar.createTask"}> | 
|---|
|  |  |  | <AddIcon /> | 
|---|
|  |  |  | </Button> | 
|---|
|  |  |  | </> | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const BulkActionButtons = () => { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return ( | 
|---|
|  |  |  | <Box display="flex"> | 
|---|
|  |  |  | <List | 
|---|
|  |  |  | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <StyledDatagrid | 
|---|
|  |  |  | preferenceKey='waitPakin' | 
|---|
|  |  |  | bulkActionButtons={<Box> <Button label="ra.action.edit" onClick={() => { | 
|---|
|  |  |  | setSiteDialog(true) | 
|---|
|  |  |  | }} /> <BulkDeleteButton mutationMode={OPERATE_MODE} /></Box>} | 
|---|
|  |  |  | bulkActionButtons={ | 
|---|
|  |  |  | <> | 
|---|
|  |  |  | <CreateTaskButton /> | 
|---|
|  |  |  | <BulkDeleteButton mutationMode={OPERATE_MODE} /> | 
|---|
|  |  |  | </>} | 
|---|
|  |  |  | rowClick='edit' | 
|---|
|  |  |  | expand={false} | 
|---|
|  |  |  | expandSingle={true} | 
|---|
|  |  |  | omit={['id', 'createTime', 'createBy', 'memo']} | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <NumberField source="id" /> | 
|---|
|  |  |  | <TextField source="code" label="table.field.waitPakin.code" /> | 
|---|
|  |  |  | {/* <NumberField source="ansId" label="table.field.waitPakin.ansId" /> */} | 
|---|
|  |  |  | {/* <TextField source="asnCode" label="table.field.waitPakin.asnCode" /> */} | 
|---|
|  |  |  | <TextField source="barcode" label="table.field.waitPakin.barcode" /> | 
|---|
|  |  |  | <NumberField source="anfme" label="table.field.waitPakin.anfme" /> | 
|---|
|  |  |  | <TextField source="ioStatus$" label="table.field.waitPakin.ioStatus" sortable={false} /> | 
|---|
|  |  |  | 
|---|
|  |  |  | </WrapperField> | 
|---|
|  |  |  | </StyledDatagrid> | 
|---|
|  |  |  | </List> | 
|---|
|  |  |  | <SelectSiteModel open={siteDialog} setOpen={setSiteDialog} /> | 
|---|
|  |  |  | <SelectSiteModel open={siteDialog} setOpen={setSiteDialog} source={source} /> | 
|---|
|  |  |  | <WaitPakinCreate | 
|---|
|  |  |  | open={createDialog} | 
|---|
|  |  |  | setOpen={setCreateDialog} | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | export default WaitPakinList; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const CreateTaskButton = () => { | 
|---|
|  |  |  | const record = useRecordContext(); | 
|---|
|  |  |  | const [siteDialog, setSiteDialog] = useState(false); | 
|---|
|  |  |  | const notify = useNotify(); | 
|---|
|  |  |  | const refresh = useRefresh(); | 
|---|
|  |  |  | const { selectedIds, onUnselectItems, data } = useListContext(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const createTask = () => { | 
|---|
|  |  |  | // const rows = data.filter((item) => selectedIds.includes(item.id)) || []; | 
|---|
|  |  |  | // const res = await request.post(`/waitPakin/merge`, rows); | 
|---|
|  |  |  | // if (res?.data?.code === 200) { | 
|---|
|  |  |  | //     refresh(); | 
|---|
|  |  |  | //     notify(res.data.msg); | 
|---|
|  |  |  | // } else { | 
|---|
|  |  |  | //     notify(res.data.msg); | 
|---|
|  |  |  | // } | 
|---|
|  |  |  | console.log('-------->'); | 
|---|
|  |  |  | setSiteDialog(true) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // return ( | 
|---|
|  |  |  | //     <ConfirmButton label={"toolbar.createTask"} startIcon={<TaskIcon />} onConfirm={createTask} /> | 
|---|
|  |  |  | // ) | 
|---|
|  |  |  | return ( | 
|---|
|  |  |  | <> | 
|---|
|  |  |  | <Button onClick={() => createTask()} label={"toolbar.createTask"}> | 
|---|
|  |  |  | <AddIcon /> | 
|---|
|  |  |  | </Button> | 
|---|
|  |  |  | </> | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | } | 
|---|