| | |
| | | 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} |
| | |
| | | <NumberField source="anfme" label="table.field.waitPakin.anfme" /> |
| | | <TextField source="ioStatus$" label="table.field.waitPakin.ioStatus" sortable={false} /> |
| | | <TextField source="updateBy$" label="common.field.updateBy" /> |
| | | <DateField source="updateTime" label="common.field.updateTime" showTime /> |
| | | <DateField source="updateTime" label="common.field.updateTime" showTime /> |
| | | <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> |
| | | </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> |
| | | |
| | | |
| | | </> |
| | | |
| | | ) |
| | | } |