|  |  | 
 |  |  |         batch: 'batch', | 
 |  |  |         confirm: 'confirm', | 
 |  |  |         cancel: "cancel", | 
 |  |  |         selectSite: 'Select Site', | 
 |  |  |         top: "top", | 
 |  |  |         resort: "sort", | 
 |  |  |         subzone: 'subzone', | 
 
 |  |  | 
 |  |  |                 name: "名称", | 
 |  |  |                 wcsCode: "wcs站点编号", | 
 |  |  |                 label: "站点标签", | 
 |  |  |                 device: "设备类型", | 
 |  |  |                 device: "立库类型", | 
 |  |  |                 deviceCode: "设备编号", | 
 |  |  |                 deviceSite: "设备站点", | 
 |  |  |                 flagInit: "是否初始化", | 
 |  |  | 
 |  |  |         siteInit: '站点初始化', | 
 |  |  |         batch: '批量操作', | 
 |  |  |         confirm: '确认', | 
 |  |  |         selectSite: '选择站点', | 
 |  |  |         cancel: "取消", | 
 |  |  |         top: "置顶", | 
 |  |  |         resort: "排序", | 
 
 |  |  | 
 |  |  |                             {/* {asnId !== '' && <ConfirmButton label={'删除'} variant="outlined" color="error" onConfirm={handleDelete} />} */} | 
 |  |  |                             <ConfirmButton label={'删除'} variant="outlined" color="error" onConfirm={handleDeleteItem} /> | 
 |  |  |                         </Stack> | 
 |  |  |  | 
 |  |  |                     </Box> | 
 |  |  |  | 
 |  |  |                     <Box sx={{ mt: 2 }}> | 
 |  |  |                         <AsnOrderModalTable tabelData={tabelData} setTableData={setTableData} asnId={asnId} selectedRows={selectedRows} setSelectedRows={setSelectedRows} tableRef={tableRef}></AsnOrderModalTable> | 
 |  |  |                     </Box> | 
 
| New file | 
 |  |  | 
 |  |  | import { Dialog, DialogTitle, Box, DialogActions, DialogContent } from "@mui/material"; | 
 |  |  | import React, { useState, useRef, useEffect, useMemo, useCallback, Form } from "react"; | 
 |  |  | import { styled } from '@mui/material/styles'; | 
 |  |  | import { FilterButton, TopToolbar, Toolbar, useTranslate, SaveButton, List, SelectInput, NumberField, WrapperField, EditButton, DeleteButton, TextField, DateField, TextInput, BooleanField, NumberInput, ReferenceField, SearchInput, SelectColumnsButton, DatagridConfigurable, Button } from "react-admin"; | 
 |  |  | import DialogCloseButton from "../components/DialogCloseButton"; | 
 |  |  | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_ITEM_PAGE_SIZE } from '@/config/setting'; | 
 |  |  |  | 
 |  |  | const filters = [ | 
 |  |  |     <SearchInput source="condition" alwaysOn />, | 
 |  |  |     <NumberInput source="type" label="table.field.deviceSite.type" />, | 
 |  |  |     <TextInput source="site" label="table.field.deviceSite.site" />, | 
 |  |  |     <TextInput source="name" label="table.field.deviceSite.name" />, | 
 |  |  |     <TextInput source="wcsCode" label="table.field.deviceSite.wcsCode" />, | 
 |  |  |     <TextInput source="label" label="table.field.deviceSite.label" />, | 
 |  |  |     <TextInput source="device" label="table.field.deviceSite.device" />, | 
 |  |  |     <TextInput source="deviceCode" label="table.field.deviceSite.deviceCode" />, | 
 |  |  |     <TextInput source="deviceSite" label="table.field.deviceSite.deviceSite" />, | 
 |  |  |     <TextInput label="common.field.memo" source="memo" />, | 
 |  |  |     <SelectInput | 
 |  |  |         label="common.field.status" | 
 |  |  |         source="status" | 
 |  |  |         choices={[ | 
 |  |  |             { id: '1', name: 'common.enums.statusTrue' }, | 
 |  |  |             { id: '0', name: 'common.enums.statusFalse' }, | 
 |  |  |         ]} | 
 |  |  |         resettable | 
 |  |  |     /> | 
 |  |  | ] | 
 |  |  | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ | 
 |  |  |     '& .css-1vooibu-MuiSvgIcon-root': { | 
 |  |  |         height: '.9em' | 
 |  |  |     }, | 
 |  |  |     '& .RaDatagrid-row': { | 
 |  |  |         cursor: 'auto' | 
 |  |  |     }, | 
 |  |  |     '& .column-name': { | 
 |  |  |     }, | 
 |  |  |     '& .opt': { | 
 |  |  |         width: 200 | 
 |  |  |     }, | 
 |  |  | })); | 
 |  |  |  | 
 |  |  | const SelectSiteModel = (props) => { | 
 |  |  |     const { open, setOpen, record } = props; | 
 |  |  |     const translate = useTranslate(); | 
 |  |  |     const [drawerVal, setDrawerVal] = useState(false); | 
 |  |  |     const handleClose = (event, reason) => { | 
 |  |  |         if (reason !== "backdropClick") { | 
 |  |  |             setOpen(false); | 
 |  |  |         } | 
 |  |  |     }; | 
 |  |  |  | 
 |  |  |     return ( | 
 |  |  |         <Box> | 
 |  |  |             <Dialog | 
 |  |  |                 open={open} | 
 |  |  |                 onClose={handleClose} | 
 |  |  |                 fullWidth | 
 |  |  |                 disableRestoreFocus | 
 |  |  |                 maxWidth="md" | 
 |  |  |             > | 
 |  |  |                 <DialogTitle> | 
 |  |  |                     {translate('toolbar.selectSite')} | 
 |  |  |                 </DialogTitle> | 
 |  |  |                 <DialogContent> | 
 |  |  |                     <List | 
 |  |  |                         resource='deviceSite' | 
 |  |  |                         sx={{ | 
 |  |  |                             flexGrow: 1, | 
 |  |  |                             transition: (theme) => | 
 |  |  |                                 theme.transitions.create(['all'], { | 
 |  |  |                                     duration: theme.transitions.duration.enteringScreen, | 
 |  |  |                                 }), | 
 |  |  |                             marginRight: drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, | 
 |  |  |                         }} | 
 |  |  |                         title={"menu.deviceSite"} | 
 |  |  |                         empty={false} | 
 |  |  |                         filters={filters} | 
 |  |  |                         sort={{ field: "create_time", order: "desc" }} | 
 |  |  |                         actions={( | 
 |  |  |                             <TopToolbar> | 
 |  |  |                                 <FilterButton /> | 
 |  |  |                                 <SelectColumnsButton preferenceKey='deviceSite' /> | 
 |  |  |                             </TopToolbar> | 
 |  |  |                         )} | 
 |  |  |                         perPage={DEFAULT_ITEM_PAGE_SIZE} | 
 |  |  |                     > | 
 |  |  |                         <StyledDatagrid | 
 |  |  |                             preferenceKey='deviceSite' | 
 |  |  |                             bulkActionButtons={false} | 
 |  |  |                             rowClick={(id, resource, record) => false} | 
 |  |  |                             omit={['id', 'createTime', 'createBy', 'memo', 'updateBy$', 'createBy$', 'createTime', 'updateTime']} | 
 |  |  |                         > | 
 |  |  |                             <NumberField source="id" /> | 
 |  |  |                             <TextField source="name" label="table.field.deviceSite.name" /> | 
 |  |  |                             <NumberField source="type$" label="table.field.deviceSite.type" /> | 
 |  |  |                             <TextField source="site" label="table.field.deviceSite.site" /> | 
 |  |  |                             <TextField source="wcsCode" label="table.field.deviceSite.wcsCode" /> | 
 |  |  |                             <TextField source="label" label="table.field.deviceSite.label" /> | 
 |  |  |                             <TextField source="device$" label="table.field.deviceSite.device" /> | 
 |  |  |                             <TextField source="deviceCode" label="table.field.deviceSite.deviceCode" /> | 
 |  |  |                             <TextField source="deviceSite" label="table.field.deviceSite.deviceSite" /> | 
 |  |  |                             <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} /> | 
 |  |  |                         </StyledDatagrid> | 
 |  |  |                     </List> | 
 |  |  |                 </DialogContent> | 
 |  |  |             </Dialog> | 
 |  |  |         </Box> | 
 |  |  |     ) | 
 |  |  | } | 
 |  |  |  | 
 |  |  | export default SelectSiteModel; | 
 
 |  |  | 
 |  |  |                     preferenceKey='waitPakinItem' | 
 |  |  |                     bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} | 
 |  |  |                     rowClick={(id, resource, record) => false} | 
 |  |  |                     omit={['id', 'createTime', 'createBy', 'memo']} | 
 |  |  |                     omit={['id', 'pakinId', 'createTime', 'createBy', 'memo']} | 
 |  |  |                 > | 
 |  |  |                     <NumberField source="id" /> | 
 |  |  |                     <NumberField source="pakinId" label="table.field.waitPakinItem.pakinId" /> | 
 
 |  |  | 
 |  |  | import { Box, Typography, Card, Stack } from '@mui/material'; | 
 |  |  | import { styled } from '@mui/material/styles'; | 
 |  |  | import WaitPakinCreate from "./WaitPakinCreate"; | 
 |  |  | import WaitPakinPanel from "./WaitPakinPanel"; | 
 |  |  | import ConfirmButton from "../components/ConfirmButton"; | 
 |  |  | import EmptyData from "../components/EmptyData"; | 
 |  |  | import MyExportButton from '../components/MyExportButton'; | 
 |  |  | import PageDrawer from "../components/PageDrawer"; | 
 |  |  | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting'; | 
 |  |  | import AddIcon from '@mui/icons-material/Add'; | 
 |  |  | import request from '@/utils/request'; | 
 |  |  | import TaskIcon from '@mui/icons-material/Task'; | 
 |  |  | import { width } from "@mui/system"; | 
 |  |  | import SelectSiteModel from "./SelectSiteModel"; | 
 |  |  |  | 
 |  |  | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ | 
 |  |  |     '& .css-1vooibu-MuiSvgIcon-root': { | 
 |  |  | 
 |  |  |     }, | 
 |  |  |     '& .column-name': { | 
 |  |  |     }, | 
 |  |  |     '& .column-statusBool': { | 
 |  |  |         width: 90 | 
 |  |  |     }, | 
 |  |  |     '& .opt': { | 
 |  |  |         width: 200 | 
 |  |  |         width: 180 | 
 |  |  |     }, | 
 |  |  | })); | 
 |  |  |  | 
 |  |  | 
 |  |  | const WaitPakinList = () => { | 
 |  |  |     const translate = useTranslate(); | 
 |  |  |     const [createDialog, setCreateDialog] = useState(false); | 
 |  |  |     const [siteDialog, setSiteDialog] = useState(false); | 
 |  |  |     const [drawerVal, setDrawerVal] = useState(false); | 
 |  |  |  | 
 |  |  |     return ( | 
 |  |  | 
 |  |  |             > | 
 |  |  |                 <StyledDatagrid | 
 |  |  |                     preferenceKey='waitPakin' | 
 |  |  |                     bulkActionButtons={<> <CreateTaskButton /> <BulkDeleteButton mutationMode={OPERATE_MODE} /></>} | 
 |  |  |                     bulkActionButtons={<Box> <Button label="ra.action.edit" onClick={()=>{ | 
 |  |  |                         setSiteDialog(true) | 
 |  |  |                     }} /> <BulkDeleteButton mutationMode={OPERATE_MODE} /></Box>} | 
 |  |  |                     rowClick='edit' | 
 |  |  |                     expand={false} | 
 |  |  |                     expandSingle={true} | 
 |  |  | 
 |  |  |                     </WrapperField> | 
 |  |  |                 </StyledDatagrid> | 
 |  |  |             </List> | 
 |  |  |             <SelectSiteModel open={siteDialog} setOpen={setSiteDialog}/> | 
 |  |  |             <WaitPakinCreate | 
 |  |  |                 open={createDialog} | 
 |  |  |                 setOpen={setCreateDialog} | 
 |  |  | 
 |  |  |  | 
 |  |  | const CreateTaskButton = () => { | 
 |  |  |     const record = useRecordContext(); | 
 |  |  |     const [siteDialog, setSiteDialog] = useState(false); | 
 |  |  |     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); | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |     const createTask = () => { | 
 |  |  |         // 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); | 
 |  |  |         // } | 
 |  |  |         console.log('-------->'); | 
 |  |  |         setSiteDialog(true) | 
 |  |  |  | 
 |  |  |     } | 
 |  |  |     // return ( | 
 |  |  |     //     <ConfirmButton label={"toolbar.createTask"} startIcon={<TaskIcon />} onConfirm={createTask} /> | 
 |  |  |     // ) | 
 |  |  |     return ( | 
 |  |  |         <> | 
 |  |  |             <Button onClick={() => createTask()} label={"toolbar.createTask"}> | 
 |  |  |                 <AddIcon /> | 
 |  |  |             </Button> | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         </> | 
 |  |  |  | 
 |  |  |     ) | 
 |  |  | } |