| | |
| | | import AddIcon from '@mui/icons-material/Add'; |
| | | import DeleteIcon from '@mui/icons-material/Delete'; |
| | | import EditIcon from '@mui/icons-material/Edit'; |
| | | import MyLocationIcon from '@mui/icons-material/MyLocation'; |
| | | |
| | | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ |
| | | '& .css-1vooibu-MuiSvgIcon-root': { |
| | |
| | | cursor: 'auto' |
| | | }, |
| | | '& .opt': { |
| | | width: 150 |
| | | width: 220 |
| | | }, |
| | | })); |
| | | |
| | |
| | | } |
| | | }; |
| | | |
| | | const handleJumpCurrent = async (item) => { |
| | | try { |
| | | const res = await request.post(`/flowStepInstance/jumpCurrent/${item.id}`); |
| | | if (res.data.code === 200) { |
| | | notify(res.data.msg || translate('common.response.success'), { type: 'success' }); |
| | | fetchData(); |
| | | } else { |
| | | notify(res.data.msg, { type: 'error' }); |
| | | } |
| | | } catch (error) { |
| | | notify('Jump current failed', { type: 'error' }); |
| | | } |
| | | }; |
| | | |
| | | const handleFormClose = () => { |
| | | setFormOpen(false); |
| | | setFormData({}); |
| | |
| | | <TextField source="taskNo" label={translate("table.field.flowStepInstance.taskNo")} /> |
| | | <DateField source="createTime" label={translate("table.field.flowStepInstance.createTime")} showTime /> |
| | | <WrapperField cellClassName="opt" label="common.field.opt" onClick={(e) => e.stopPropagation()} > |
| | | <RowActions onEdit={handleEdit} onDelete={handleDelete} /> |
| | | <RowActions onEdit={handleEdit} onDelete={handleDelete} onJumpCurrent={handleJumpCurrent} /> |
| | | </WrapperField> |
| | | </StyledDatagrid> |
| | | </DialogContent> |
| | |
| | | ); |
| | | }; |
| | | |
| | | const RowActions = ({ onEdit, onDelete }) => { |
| | | const RowActions = ({ onEdit, onDelete, onJumpCurrent }) => { |
| | | const record = useRecordContext(); |
| | | const translate = useTranslate(); |
| | | return ( |
| | | <Box display="flex"> |
| | | <Tooltip title="Edit"> |
| | |
| | | <EditIcon fontSize="small" /> |
| | | </IconButton> |
| | | </Tooltip> |
| | | <Tooltip title={translate("toolbar.jumpCurrent")}> |
| | | <IconButton onClick={() => onJumpCurrent(record)} size="small" color="secondary"> |
| | | <MyLocationIcon fontSize="small" /> |
| | | </IconButton> |
| | | </Tooltip> |
| | | {/* If there's an issue with event propagation you might need to handle it in onClick */} |
| | | <Tooltip title="Delete"> |
| | | <IconButton onClick={() => onDelete(record)} size="small" color="error"> |