| | |
| | | entryAngle: 'Set the lane entry angle (0-360). -1 means no restriction', |
| | | maximum: 'Adjust the maximum load capacity. -1 means no restriction', |
| | | }, |
| | | actions: { |
| | | deleteAll: 'DELETE ALL', |
| | | deleteAllSuccess: 'Delete all successfully.', |
| | | deleteAllError: 'Failed to delete all.', |
| | | }, |
| | | }, |
| | | agv: { |
| | | show: { |
| | |
| | | entryAngle: '设置车体进入巷道角度 (0-360),-1表示无限制', |
| | | maximum: '调整巷道车体承载量,-1表示无限制', |
| | | }, |
| | | actions: { |
| | | deleteAll: '清空巷道', |
| | | deleteAllSuccess: '巷道已全部删除', |
| | | deleteAllError: '清空巷道失败', |
| | | }, |
| | | }, |
| | | agv: { |
| | | show: { |
| | |
| | | import React, { useState, useRef, useEffect, useMemo, useCallback } from "react"; |
| | | import { Button, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle } from '@mui/material'; |
| | | import { |
| | | useTranslate, |
| | | useTranslate |
| | | } from 'react-admin'; |
| | | |
| | | const ConfirmButton = (props) => { |
| | | const { label, onConfirm, data, ...rest } = props; |
| | | const { label, onConfirm, renderButton, ...rest } = props; |
| | | const translate = useTranslate(); |
| | | const buttonRef = useRef(null); |
| | | const [open, setOpen] = useState(false); |
| | |
| | | onConfirm(); |
| | | }; |
| | | |
| | | return ( |
| | | <> |
| | | const buttonElement = renderButton |
| | | ? renderButton({ |
| | | buttonProps: { |
| | | ref: buttonRef, |
| | | onClick: handleClickOpen, |
| | | 'aria-label': translate(label), |
| | | ...rest, |
| | | }, |
| | | label, |
| | | translate, |
| | | }) |
| | | : ( |
| | | <Button |
| | | ref={buttonRef} |
| | | onClick={handleClickOpen} |
| | |
| | | > |
| | | {translate(label)} |
| | | </Button> |
| | | ); |
| | | |
| | | return ( |
| | | <> |
| | | {buttonElement} |
| | | <Dialog |
| | | aria-labelledby="dialog-title" |
| | | aria-describedby="dialog-description" |
| New file |
| | |
| | | import React, { useCallback, useState } from "react"; |
| | | import DeleteSweepIcon from '@mui/icons-material/DeleteSweep'; |
| | | import { |
| | | useDataProvider, |
| | | useNotify, |
| | | useRefresh, |
| | | Button as RaButton, |
| | | } from 'react-admin'; |
| | | import ConfirmButton from "../components/ConfirmButton"; |
| | | |
| | | const LaneDeleteAllButton = () => { |
| | | const dataProvider = useDataProvider(); |
| | | const notify = useNotify(); |
| | | const refresh = useRefresh(); |
| | | const [loading, setLoading] = useState(false); |
| | | |
| | | const handleConfirm = useCallback(() => { |
| | | setLoading(true); |
| | | dataProvider.delete('lane', { |
| | | id: '__purge_all__', |
| | | meta: { deleteAll: true }, |
| | | }).then(() => { |
| | | notify('page.lane.actions.deleteAllSuccess', { type: 'info' }); |
| | | refresh(); |
| | | }).catch((error) => { |
| | | console.error(error); |
| | | notify('page.lane.actions.deleteAllError', { type: 'error' }); |
| | | }).finally(() => { |
| | | setLoading(false); |
| | | }); |
| | | }, [dataProvider, notify, refresh]); |
| | | |
| | | return ( |
| | | <ConfirmButton |
| | | label="page.lane.actions.deleteAll" |
| | | onConfirm={handleConfirm} |
| | | disabled={loading} |
| | | renderButton={({ buttonProps }) => ( |
| | | <RaButton |
| | | {...buttonProps} |
| | | label="page.lane.actions.deleteAll" |
| | | color="error" |
| | | size="small" |
| | | startIcon={<DeleteSweepIcon />} |
| | | sx={{ |
| | | fontWeight: 600, |
| | | textTransform: 'none', |
| | | }} |
| | | /> |
| | | )} |
| | | /> |
| | | ); |
| | | }; |
| | | |
| | | export default LaneDeleteAllButton; |
| | |
| | | import MyField from "../components/MyField"; |
| | | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting'; |
| | | import * as Common from '@/utils/common'; |
| | | import LaneDeleteAllButton from "./LaneDeleteAllButton"; |
| | | |
| | | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ |
| | | '& .css-1vooibu-MuiSvgIcon-root': { |
| | |
| | | |
| | | const filters = [ |
| | | <SearchInput source="condition" alwaysOn />, |
| | | <DateInput label='common.time.after' source="timeStart" alwaysOn />, |
| | | <DateInput label='common.time.before' source="timeEnd" alwaysOn />, |
| | | // <DateInput label='common.time.after' source="timeStart" alwaysOn />, |
| | | // <DateInput label='common.time.before' source="timeEnd" alwaysOn />, |
| | | |
| | | <TextInput source="uuid" label="table.field.lane.uuid" />, |
| | | // <TextInput source="uuid" label="table.field.lane.uuid" />, |
| | | <ReferenceInput source="zoneId" label="table.field.lane.zoneId" reference="zone"> |
| | | <AutocompleteInput label="table.field.lane.zoneId" optionText="name" filterToQuery={(val) => ({ name: val })} /> |
| | | </ReferenceInput>, |
| | | <TextInput source="name" label="table.field.lane.name" />, |
| | | <TextInput source="hashCode" label="table.field.lane.hashCode" />, |
| | | <TextInput source="codes" label="table.field.lane.codes" />, |
| | | <NumberInput source="entryAngle" label="table.field.lane.entryAngle" />, |
| | | <NumberInput source="maximum" label="table.field.lane.maximum" />, |
| | | // <TextInput source="name" label="table.field.lane.name" />, |
| | | // <TextInput source="hashCode" label="table.field.lane.hashCode" />, |
| | | // <TextInput source="codes" label="table.field.lane.codes" />, |
| | | // <NumberInput source="entryAngle" label="table.field.lane.entryAngle" />, |
| | | // <NumberInput source="maximum" label="table.field.lane.maximum" />, |
| | | |
| | | <TextInput label="common.field.memo" source="memo" />, |
| | | <SelectInput |
| | |
| | | { id: '0', name: 'common.enums.statusFalse' }, |
| | | ]} |
| | | resettable |
| | | alwaysOn |
| | | />, |
| | | ] |
| | | |
| | |
| | | sort={{ field: "create_time", order: "desc" }} |
| | | actions={( |
| | | <TopToolbar> |
| | | <FilterButton /> |
| | | {/* <FilterButton /> */} |
| | | {/* <MyCreateButton onClick={() => { setCreateDialog(true) }} /> */} |
| | | <LaneDeleteAllButton /> |
| | | <SelectColumnsButton preferenceKey='lane' /> |
| | | <MyExportButton /> |
| | | </TopToolbar> |