| | |
| | | DeleteButton, |
| | | |
| | | } from 'react-admin'; |
| | | import { Box, Typography, Card, Stack } from '@mui/material'; |
| | | import { Box, Typography, Card, Stack, Button } from '@mui/material'; |
| | | import ContentCopyIcon from '@mui/icons-material/ContentCopy'; |
| | | import { styled } from '@mui/material/styles'; |
| | | import BasStationCreate from "./BasStationCreate"; |
| | | import BasStationPanel from "./BasStationPanel"; |
| | |
| | | '& .column-name': { |
| | | }, |
| | | '& .opt': { |
| | | width: 200 |
| | | width: 220 |
| | | }, |
| | | })); |
| | | |
| | |
| | | resettable |
| | | />, |
| | | ] |
| | | |
| | | const CopyButton = ({ setCopyRecord, setCreateDialog }) => { |
| | | const record = useRecordContext(); |
| | | const translate = useTranslate(); |
| | | if (!record) return null; |
| | | return ( |
| | | <Button |
| | | size="small" |
| | | startIcon={<ContentCopyIcon fontSize="small" />} |
| | | sx={{ padding: '1px', fontSize: '.75rem', minWidth: 'auto' }} |
| | | onClick={(e) => { |
| | | e.stopPropagation(); |
| | | const { id, createTime, updateTime, createBy, updateBy, createBy$, updateBy$, ...rest } = record; |
| | | const copied = { ...rest }; |
| | | if (record.areaIds) copied.areaIds = [...(Array.isArray(record.areaIds) ? record.areaIds : [])]; |
| | | if (record.containerTypes) copied.containerTypes = [...(Array.isArray(record.containerTypes) ? record.containerTypes : [])]; |
| | | setCopyRecord(copied); |
| | | setCreateDialog(true); |
| | | }} |
| | | > |
| | | {translate('toolbar.copy')} |
| | | </Button> |
| | | ); |
| | | }; |
| | | const BasStationList = () => { |
| | | const translate = useTranslate(); |
| | | |
| | |
| | | const [drawerVal, setDrawerVal] = useState(false); |
| | | const [areaFieldDialog, setAreaFieldDialog] = useState(false); |
| | | const [areaFieldDialog2, setAreaFieldDialog2] = useState(false); |
| | | const [copyRecord, setCopyRecord] = useState(null); |
| | | return ( |
| | | <Box display="flex"> |
| | | <List |
| | |
| | | bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} |
| | | rowClick={(id, resource, record) => false} |
| | | expandSingle={true} |
| | | omit={['id', 'createTime', 'createBy', 'memo', 'updateBy', 'autoTransfer']} |
| | | omit={['id', 'createTime', 'createBy', 'createBy$', 'memo', 'updateBy$', 'updateTime', 'autoTransfer', 'isCrossZone', 'isWcs', 'area$', 'memo']} |
| | | > |
| | | <NumberField source="id" /> |
| | | {/* <TextField source="type$" label="table.field.basStation.type" /> */} |
| | | {/* <TextField source="type$" label="table.field.basStation.type" /> */} |
| | | <TextField source="stationName" label="table.field.basStation.stationName" /> |
| | | <TextField source="stationId" label="table.field.basStation.stationId" /> |
| | | <FunctionField |
| | | source="type" |
| | | label="table.field.basStation.type" |
| | | render={record => record.type === 1 ? '普通站点' : '智能站点'} |
| | | /> |
| | | <TextField source="stationName" label="table.field.basStation.stationName" /> |
| | | <TextField source="stationId" label="table.field.basStation.stationId" /> |
| | | <TextField source="useStatus$" label="table.field.basStation.useStatus" /> |
| | | <WrapperField cellClassName="containerType" label="table.field.basStation.containerType"> |
| | | <ChipArrayField |
| | | source="containerTypes$" |
| | | apiEndpoint="/dictData/many/{ids}" |
| | | labelField="label" |
| | | dialogTitle={translate('table.field.basStation.containerType')} |
| | | initialDisplayCount={1} |
| | | placeholderText="{count} 个区域" |
| | | /> |
| | | </WrapperField> |
| | | <TextField source="barcode" label="table.field.basStation.barcode" /> |
| | | <FunctionField |
| | | source="inAble" |
| | |
| | | open={areaFieldDialog} |
| | | setOpen={setAreaFieldDialog} |
| | | /> */} |
| | | |
| | | <ChipArrayField |
| | | source="areaIds" |
| | | apiEndpoint="/warehouseAreas/many/{ids}" |
| | |
| | | label="table.field.basStation.isWcs" |
| | | render={record => record.inAble === 1 ? '是' : '否'} |
| | | /> |
| | | <WrapperField cellClassName="containerType" label="table.field.basStation.containerType"> |
| | | <ChipArrayField |
| | | source="containerTypes$" |
| | | apiEndpoint="/dictData/many/{ids}" |
| | | labelField="label" |
| | | dialogTitle={translate('table.field.basStation.containerType')} |
| | | initialDisplayCount={1} |
| | | placeholderText="{count} 个区域" |
| | | /> |
| | | </WrapperField> |
| | | <FunctionField |
| | | source="autoTransfer" |
| | | label="table.field.basStation.autoTransfer" |
| | |
| | | <DateField source="updateTime" label="common.field.updateTime" showTime /> |
| | | <TextField source="createBy$" label="common.field.createBy" /> |
| | | <DateField source="createTime" label="common.field.createTime" showTime /> |
| | | <BooleanField source="statusBool" label="common.field.status" sortable={false} /> |
| | | {/* <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"> |
| | | <CopyButton setCopyRecord={setCopyRecord} setCreateDialog={setCreateDialog} /> |
| | | <EditButton sx={{ padding: '1px', fontSize: '.75rem' }} /> |
| | | <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} /> |
| | | </WrapperField> |
| | |
| | | <BasStationCreate |
| | | open={createDialog} |
| | | setOpen={setCreateDialog} |
| | | copyRecord={copyRecord} |
| | | onClose={() => setCopyRecord(null)} |
| | | /> |
| | | |
| | | <PageDrawer |