| | |
| | | > |
| | | <StyledDatagrid |
| | | preferenceKey='waveItem' |
| | | bulkActionButtons={ |
| | | <> |
| | | <BulkStartButton /> |
| | | </> |
| | | } |
| | | bulkActionButtons={false} |
| | | rowClick={(id, resource, record) => false} |
| | | expand={false} |
| | | expandSingle={false} |
| | |
| | | <DateField source="createTime" label="common.field.createTime" showTime /> |
| | | <TextField source="memo" label="common.field.memo" sortable={false} /> |
| | | <TextField source="exceStatus$" label="table.field.waveItem.exceStatus" /> |
| | | <WrapperField cellClassName="opt" label="common.field.opt"> |
| | | <PauseButton /> |
| | | <ContinueButton /> |
| | | </WrapperField> |
| | | </StyledDatagrid> |
| | | </List> |
| | | <WaveItemEdit |
| | |
| | | event.stopPropagation() |
| | | setEditDialog(true) |
| | | } |
| | | |
| | | return ( |
| | | <Button label="ra.action.edit" onClick={editClick} startIcon={<ContentCreate />} /> |
| | | ) |
| | | } |
| | | |
| | | |
| | | const BulkStartButton = () => { |
| | | const { data, selectedIds, onUnselectItems } = useListContext(); |
| | | const waveId = useGetRecordId(); |
| | | const notify = useNotify(); |
| | | const refresh = useRefresh() |
| | | const startClick = async () => { |
| | | onUnselectItems(); |
| | | const { data: { code, data, msg } } = await request.post('/wave/selects/task', { wave: waveId, waveItem: selectedIds }); |
| | | if (code === 200) { |
| | | notify(msg); |
| | | setAutoExce(false) |
| | | } else { |
| | | notify(msg); |
| | | } |
| | | refresh() |
| | | } |
| | | return ( |
| | | <Button label="toolbar.publicWorking" onClick={startClick} startIcon={<PlayArrowOutlinedIcon />} variant="outlined" /> |
| | | ) |
| | | } |
| | | |
| | | const PauseButton = () => { |
| | | const notify = useNotify() |
| | | const refresh = useRefresh(); |
| | | const record = useRecordContext(); |
| | | const pauseClick = async () => { |
| | | const { data: { code, data, msg } } = await request.post('/waveItem/pause/pub/' + record?.id); |
| | | if (code === 200) { |
| | | notify(msg); |
| | | } else { |
| | | notify(msg); |
| | | } |
| | | refresh() |
| | | } |
| | | return ( |
| | | record?.exceStatus == 1 ? <Button label="toolbar.pause" onClick={pauseClick} startIcon={<StopCircleOutlinedIcon />} /> : <></> |
| | | ) |
| | | } |
| | | |
| | | const ContinueButton = () => { |
| | | const notify = useNotify() |
| | | const refresh = useRefresh(); |
| | | const record = useRecordContext(); |
| | | const continueClick = async () => { |
| | | const { data: { code, data, msg } } = await request.post('/waveItem/continue/pub/' + record?.id); |
| | | if (code === 200) { |
| | | notify(msg); |
| | | } else { |
| | | notify(msg); |
| | | } |
| | | refresh() |
| | | } |
| | | return ( |
| | | record?.exceStatus == 2 ? <Button label="toolbar.continuePub" onClick={continueClick} startIcon={<PauseCircleOutlineIcon />} /> : <></> |
| | | ) |
| | | } |