|  |  |  | 
|---|
|  |  |  | SearchInput, | 
|---|
|  |  |  | TopToolbar, | 
|---|
|  |  |  | SelectColumnsButton, | 
|---|
|  |  |  | EditButton, | 
|---|
|  |  |  | FilterButton, | 
|---|
|  |  |  | CreateButton, | 
|---|
|  |  |  | ExportButton, | 
|---|
|  |  |  | BulkDeleteButton, | 
|---|
|  |  |  | WrapperField, | 
|---|
|  |  |  | useRecordContext, | 
|---|
|  |  |  | useTranslate, | 
|---|
|  |  |  | useNotify, | 
|---|
|  |  |  | useListContext, | 
|---|
|  |  |  | FunctionField, | 
|---|
|  |  |  | TextField, | 
|---|
|  |  |  | NumberField, | 
|---|
|  |  |  | DateField, | 
|---|
|  |  |  | BooleanField, | 
|---|
|  |  |  | ReferenceField, | 
|---|
|  |  |  | TextInput, | 
|---|
|  |  |  | DateTimeInput, | 
|---|
|  |  |  | DateInput, | 
|---|
|  |  |  | SelectInput, | 
|---|
|  |  |  | NumberInput, | 
|---|
|  |  |  | ReferenceInput, | 
|---|
|  |  |  | ReferenceArrayInput, | 
|---|
|  |  |  | AutocompleteInput, | 
|---|
|  |  |  | DeleteButton, | 
|---|
|  |  |  | useGetRecordId, | 
|---|
|  |  |  | Button, | 
|---|
|  |  |  | useRefresh, | 
|---|
|  |  |  | } from 'react-admin'; | 
|---|
|  |  |  | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting'; | 
|---|
|  |  |  | import PauseCircleOutlineIcon from '@mui/icons-material/PauseCircleOutline'; | 
|---|
|  |  |  | import StopCircleOutlinedIcon from '@mui/icons-material/StopCircleOutlined'; | 
|---|
|  |  |  | import PlayArrowOutlinedIcon from '@mui/icons-material/PlayArrowOutlined'; | 
|---|
|  |  |  | import { Box, Typography, Card, Stack } from '@mui/material'; | 
|---|
|  |  |  | import ContentCreate from '@mui/icons-material/Create'; | 
|---|
|  |  |  | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <StyledDatagrid | 
|---|
|  |  |  | preferenceKey='waveItem' | 
|---|
|  |  |  | bulkActionButtons={ | 
|---|
|  |  |  | <> | 
|---|
|  |  |  | <BulkStartButton /> | 
|---|
|  |  |  | </> | 
|---|
|  |  |  | } | 
|---|
|  |  |  | bulkActionButtons={false} | 
|---|
|  |  |  | rowClick={(id, resource, record) => false} | 
|---|
|  |  |  | expand={false} | 
|---|
|  |  |  | expandSingle={false} | 
|---|
|  |  |  | 
|---|
|  |  |  | <TextField source="fieldsIndex" label="table.field.waveItem.fieldsIndex" /> | 
|---|
|  |  |  | <NumberField source="workQty" label="table.field.waveItem.workQty" /> | 
|---|
|  |  |  | <TextField source="unit" label="table.field.waveItem.unit" /> | 
|---|
|  |  |  | <TextField source="exceStatus" label="table.field.waveItem.exceStatus" /> | 
|---|
|  |  |  | <TextField source="updateBy$" label="common.field.updateBy" /> | 
|---|
|  |  |  | <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} /> | 
|---|
|  |  |  | <TextField source="memo" label="common.field.memo" sortable={false} /> | 
|---|
|  |  |  | <WrapperField cellClassName="opt" label="common.field.opt"> | 
|---|
|  |  |  | <BulkPauseButton /> | 
|---|
|  |  |  | </WrapperField> | 
|---|
|  |  |  | <TextField source="exceStatus$" label="table.field.waveItem.exceStatus" /> | 
|---|
|  |  |  | </StyledDatagrid> | 
|---|
|  |  |  | </List> | 
|---|
|  |  |  | <WaveItemEdit | 
|---|
|  |  |  | 
|---|
|  |  |  | event.stopPropagation() | 
|---|
|  |  |  | setEditDialog(true) | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return ( | 
|---|
|  |  |  | <Button label="ra.action.edit" onClick={editClick} startIcon={<ContentCreate />} /> | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const BulkStartButton = () => { | 
|---|
|  |  |  | const { data, selectedIds, onUnselectItems } = useListContext(); | 
|---|
|  |  |  | const waveId = useGetRecordId(); | 
|---|
|  |  |  | const notify = useNotify(); | 
|---|
|  |  |  | const startClick = async () => { | 
|---|
|  |  |  | onUnselectItems(); | 
|---|
|  |  |  | const { data: { code, data, msg } } = await request.post('/wave/selects/task', { wave: waveId, waveItem: selectedIds }); | 
|---|
|  |  |  | if (code === 200) { | 
|---|
|  |  |  | notify(msg); | 
|---|
|  |  |  | setAutoExce(false) | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | notify(msg); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return ( | 
|---|
|  |  |  | <Button label="toolbar.publicWorking" onClick={startClick} startIcon={<PlayArrowOutlinedIcon />} variant="outlined" /> | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const BulkPauseButton = () => { | 
|---|
|  |  |  | const { data, selectedIds, onUnselectItems } = useListContext(); | 
|---|
|  |  |  | const record = useRecordContext(); | 
|---|
|  |  |  | const pauseClick = () => { | 
|---|
|  |  |  | onUnselectItems(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return ( | 
|---|
|  |  |  | record?.exceStatus == 2 ? <Button label="toolbar.pause" onClick={pauseClick} startIcon={<PauseCircleOutlineIcon />} /> : <></> | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | } | 
|---|