| | |
| | | DeleteButton, |
| | | FunctionField, |
| | | Count, |
| | | useNotify, |
| | | } from 'react-admin'; |
| | | import { Box, Typography, Stack, useMediaQuery, Tabs, Tab, Divider } 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 ClearIcon from '@mui/icons-material/Clear'; |
| | | import request from '@/utils/request'; |
| | | |
| | | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ |
| | | '& .css-1vooibu-MuiSvgIcon-root': { |
| | |
| | | '& .column-name': { |
| | | }, |
| | | '& .opt': { |
| | | width: 200 |
| | | width: 120 |
| | | }, |
| | | })); |
| | | |
| | | const filters = [ |
| | | // <SearchInput source="condition" alwaysOn />, |
| | | <TextInput source="groupId" label="table.field.segment.groupId" alwaysOn/>, |
| | | <TextInput source="groupId" label="table.field.segment.groupId" alwaysOn />, |
| | | <ReferenceInput source="agvId" label="table.field.segment.agvId" reference="agv" alwaysOn> |
| | | <AutocompleteInput label="table.field.segment.agvId" optionText="uuid" filterToQuery={(val) => ({ uuid: val })} /> |
| | | </ReferenceInput>, |
| | |
| | | |
| | | const TabbedDatagrid = () => { |
| | | const translate = useTranslate(); |
| | | const notify = useNotify(); |
| | | const { filterValues, setFilters, displayedFilters } = useListContext(); |
| | | const isXSmall = useMediaQuery(theme => |
| | | theme.breakpoints.down('sm') |
| | |
| | | ); |
| | | }, [filterValues, setFilters, displayedFilters]); |
| | | |
| | | const handleDeprecate = (segmentId) => { |
| | | request.get("/segment/cancel/" + segmentId).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 ( |
| | | <> |
| | |
| | | <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} /> |
| | | {/* <FunctionField label="common.field.opt" cellClassName="opt" render={record => ( |
| | | <> |
| | | </> |
| | | )} /> */} |
| | | {filterValues.state === 'RUNNING' && ( |
| | | <FunctionField label="common.field.opt" cellClassName="opt" render={record => ( |
| | | <> |
| | | <ConfirmButton |
| | | label="common.action.deprecate" |
| | | size="small" |
| | | color="error" |
| | | startIcon={<ClearIcon />} |
| | | sx={{ |
| | | padding: '1px', |
| | | fontSize: '.75rem', |
| | | '& .MuiButton-startIcon': { |
| | | marginRight: '2px' |
| | | }, |
| | | }} |
| | | data={record.id} |
| | | onConfirm={() => { |
| | | handleDeprecate(record.id); |
| | | }} |
| | | /> |
| | | </> |
| | | )} /> |
| | | )} |
| | | </StyledDatagrid> |
| | | </> |
| | | )} |