| | |
| | | ReferenceArrayInput, |
| | | AutocompleteInput, |
| | | DeleteButton, |
| | | Button, |
| | | 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 AddIcon from '@mui/icons-material/Add'; |
| | | import request from '@/utils/request'; |
| | | |
| | | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ |
| | | '& .css-1vooibu-MuiSvgIcon-root': { |
| | |
| | | > |
| | | <StyledDatagrid |
| | | preferenceKey='waitPakin' |
| | | bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} |
| | | bulkActionButtons={<> <CreateTaskButton /> <BulkDeleteButton mutationMode={OPERATE_MODE} /></>} |
| | | rowClick={(id, resource, record) => false} |
| | | expand={() => <WaitPakinPanel />} |
| | | expandSingle={true} |
| | |
| | | <NumberField source="id" /> |
| | | <TextField source="code" label="table.field.waitPakin.code" /> |
| | | {/* <NumberField source="ansId" label="table.field.waitPakin.ansId" /> */} |
| | | <TextField source="asnCode" label="table.field.waitPakin.asnCode" /> |
| | | {/* <TextField source="asnCode" label="table.field.waitPakin.asnCode" /> */} |
| | | <TextField source="barcode" label="table.field.waitPakin.barcode" /> |
| | | <NumberField source="anfme" label="table.field.waitPakin.anfme" /> |
| | | <TextField source="ioStatus$" label="table.field.waitPakin.ioStatus" sortable={false} /> |
| | |
| | | } |
| | | |
| | | export default WaitPakinList; |
| | | |
| | | const CreateTaskButton = () => { |
| | | const record = useRecordContext(); |
| | | const notify = useNotify(); |
| | | const refresh = useRefresh(); |
| | | const { selectedIds, onUnselectItems, data } = useListContext(); |
| | | const createTask = async () => { |
| | | const rows = data.filter((item) => selectedIds.includes(item.id)) || []; |
| | | const res = await request.post(`/waitPakin/merge`, rows); |
| | | if (res?.data?.code === 200) { |
| | | refresh() |
| | | notify(res.data.msg); |
| | | |
| | | } else { |
| | | notify(res.data.msg); |
| | | } |
| | | } |
| | | |
| | | return ( |
| | | <> |
| | | <Button onClick={() => createTask()} label={"toolbar.createTask"}> |
| | | <AddIcon /> |
| | | </Button> |
| | | |
| | | |
| | | </> |
| | | |
| | | ) |
| | | } |