| | |
| | | }, |
| | | loadMore: 'Load More Data', |
| | | complete: 'Complete', |
| | | deprecated: 'Deprecated', |
| | | }, |
| | | msg: { |
| | | confirm: { |
| | |
| | | }, |
| | | }, |
| | | }, |
| | | jam: { |
| | | enums: { |
| | | state: { |
| | | running: 'RUNNING', |
| | | finish: 'FINISH', |
| | | fail: 'FAIL', |
| | | deprecated: 'DEPRECATED', |
| | | }, |
| | | }, |
| | | }, |
| | | } |
| | | }; |
| | | |
| | |
| | | }, |
| | | loadMore: '加载更多', |
| | | complete: '完成', |
| | | deprecated: '废弃', |
| | | }, |
| | | msg: { |
| | | confirm: { |
| | |
| | | }, |
| | | }, |
| | | }, |
| | | jam: { |
| | | enums: { |
| | | state: { |
| | | running: '正在运行', |
| | | finish: '已完成', |
| | | fail: '失败', |
| | | deprecated: '废弃', |
| | | }, |
| | | }, |
| | | }, |
| | | } |
| | | }; |
| | | |
| | |
| | | ReferenceArrayInput, |
| | | AutocompleteInput, |
| | | DeleteButton, |
| | | FunctionField, |
| | | useNotify, |
| | | useRefresh, |
| | | } from 'react-admin'; |
| | | import { Box, Typography, Card, Stack } from '@mui/material'; |
| | | import { styled } from '@mui/material/styles'; |
| | |
| | | import MyField from "../components/MyField"; |
| | | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting'; |
| | | import * as Common from '@/utils/common'; |
| | | import ConfirmButton from "../components/ConfirmButton"; |
| | | import CloseIcon from '@mui/icons-material/Close'; |
| | | import request from '@/utils/request'; |
| | | |
| | | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ |
| | | '& .css-1vooibu-MuiSvgIcon-root': { |
| | |
| | | />, |
| | | ] |
| | | |
| | | const states = [ |
| | | { id: 'RUNNING', name: 'page.jam.enums.state.running' }, |
| | | { id: 'FINISH', name: 'page.jam.enums.state.finish' }, |
| | | { id: 'FAIL', name: 'page.jam.enums.state.fail' }, |
| | | { id: 'DEPRECATED', name: 'page.jam.enums.state.deprecated' }, |
| | | ]; |
| | | |
| | | const JamList = () => { |
| | | const translate = useTranslate(); |
| | | |
| | | const notify = useNotify(); |
| | | const refresh = useRefresh(); |
| | | const [createDialog, setCreateDialog] = useState(false); |
| | | const [drawerVal, setDrawerVal] = useState(false); |
| | | |
| | | const onDeprecated = (jamId) => { |
| | | request.get("/jam/deprecated/" + jamId).then(res => { |
| | | const { code, msg, data } = res.data; |
| | | if (code === 200) { |
| | | notify(msg || 'common.response.success', { type: 'success', messageArgs: { _: msg } }); |
| | | refresh(); |
| | | } else { |
| | | notify(msg || 'common.response.fail', { type: 'error', messageArgs: { _: msg } }); |
| | | } |
| | | }).catch(error => { |
| | | notify(error.message || 'common.response.fail', { type: 'error', messageArgs: { _: error.message } }); |
| | | }) |
| | | } |
| | | |
| | | return ( |
| | | <Box display="flex"> |
| | |
| | | <DateField source="notifyTime" label="table.field.jam.notifyTime" showTime /> |
| | | <DateField source="endTime" label="table.field.jam.endTime" showTime /> |
| | | <NumberField source="duration" label="table.field.jam.duration" /> |
| | | <TextField source="state" label="table.field.jam.state" /> |
| | | |
| | | <FunctionField label="table.field.segment.state" cellClassName="state" render={record => ( |
| | | <> |
| | | {translate(states.find(item => item.id === record.state)?.name)} |
| | | </> |
| | | )} /> |
| | | <ReferenceField source="updateBy" label="common.field.updateBy" reference="user" link={false} sortable={false}> |
| | | <TextField source="nickname" /> |
| | | </ReferenceField> |
| | |
| | | <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.state === "RUNNING" || record.state === "FINISH") && ( |
| | | <> |
| | | <ConfirmButton |
| | | label="common.action.deprecated" |
| | | size="small" |
| | | color="primary" |
| | | startIcon={<CloseIcon />} |
| | | sx={{ |
| | | padding: '1px', |
| | | fontSize: '.75rem', |
| | | '& .MuiButton-startIcon': { |
| | | marginRight: '2px' |
| | | }, |
| | | }} |
| | | data={record.uuid} |
| | | onConfirm={() => { |
| | | onDeprecated(record.id); |
| | | }} |
| | | /> |
| | | </> |
| | | ) |
| | | )} /> |
| | | </StyledDatagrid> |
| | | </List> |
| | | <JamCreate |
| | |
| | | } else { |
| | | notify(msg || 'common.response.fail', { type: 'error', messageArgs: { _: msg } }); |
| | | } |
| | | }).catch(error => { |
| | | notify(error.message || 'common.response.fail', { type: 'error', messageArgs: { _: error.message } }); |
| | | }) |
| | | } |
| | | |
| | |
| | | } else { |
| | | notify(msg || 'common.response.fail', { type: 'error', messageArgs: { _: msg } }); |
| | | } |
| | | }).catch(error => { |
| | | notify(error.message || 'common.response.fail', { type: 'error', messageArgs: { _: error.message } }); |
| | | }) |
| | | } |
| | | |
| | |
| | | RUNNING, |
| | | FINISH, |
| | | FAIL, |
| | | DEPRECATED, |
| | | ; |
| | | |
| | | } |