| | |
| | | import * as Common from '@/utils/common'; |
| | | import TaskListAside from "./TaskListAside"; |
| | | import { getTaskStsChipColor } from '@/utils/color-util'; |
| | | import ConfirmButton from "../components/ConfirmButton"; |
| | | import ClearIcon from '@mui/icons-material/Clear'; |
| | | import CheckIcon from '@mui/icons-material/Check'; |
| | | import request from '@/utils/request'; |
| | | |
| | | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ |
| | | '& .css-1vooibu-MuiSvgIcon-root': { |
| | |
| | | |
| | | const [createDialog, setCreateDialog] = useState(false); |
| | | const [drawerVal, setDrawerVal] = useState(false); |
| | | |
| | | const onComplete = (taskId) => { |
| | | request.get("/task/complete/" + taskId).then(res => { |
| | | const { code, msg, data } = res.data; |
| | | if (code === 200) { |
| | | notify(msg || 'common.response.success', { type: 'success', messageArgs: { _: msg } }); |
| | | } else { |
| | | notify(msg || 'common.response.fail', { type: 'error', messageArgs: { _: msg } }); |
| | | } |
| | | }) |
| | | } |
| | | |
| | | const onCancel = (taskId) => { |
| | | request.get("/task/cancel/" + taskId).then(res => { |
| | | const { code, msg, data } = res.data; |
| | | if (code === 200) { |
| | | notify(msg || 'common.response.success', { type: 'success', messageArgs: { _: msg } }); |
| | | } else { |
| | | notify(msg || 'common.response.fail', { type: 'error', messageArgs: { _: msg } }); |
| | | } |
| | | }) |
| | | } |
| | | |
| | | return ( |
| | | <Box display="flex"> |
| | |
| | | <DateField source="createTime" label="common.field.createTime" showTime /> |
| | | <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"> |
| | | <EditButton sx={{ padding: '1px', fontSize: '.75rem' }} /> |
| | | <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} /> |
| | | </WrapperField> |
| | | <FunctionField label="common.field.opt" cellClassName="opt" render={record => ( |
| | | (record.taskSts === 15 || true) && ( |
| | | <> |
| | | <ConfirmButton |
| | | label="common.action.complete" |
| | | size="small" |
| | | color="primary" |
| | | startIcon={<CheckIcon />} |
| | | sx={{ |
| | | padding: '1px', |
| | | fontSize: '.75rem', |
| | | '& .MuiButton-startIcon': { |
| | | marginRight: '2px' |
| | | }, |
| | | mr: 1 |
| | | }} |
| | | data={record.seqNum} |
| | | onConfirm={() => { |
| | | onComplete(record.id); |
| | | }} |
| | | /> |
| | | <ConfirmButton |
| | | label="ra.action.cancel" |
| | | size="small" |
| | | color="error" |
| | | startIcon={<ClearIcon />} |
| | | sx={{ |
| | | padding: '1px', |
| | | fontSize: '.75rem', |
| | | '& .MuiButton-startIcon': { |
| | | marginRight: '1.5px' |
| | | }, |
| | | }} |
| | | data={record.seqNum} |
| | | onConfirm={() => { |
| | | onCancel(record.id); |
| | | }} |
| | | /> |
| | | </> |
| | | ) |
| | | )} /> |
| | | </StyledDatagrid> |
| | | </List> |
| | | <TaskCreate |