|  |  | 
 |  |  | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting'; | 
 |  |  | import * as Common from '@/utils/common'; | 
 |  |  | import PublicIcon from '@mui/icons-material/Public'; | 
 |  |  | import ItemToTaskModal from "./ItemToTaskModal"; | 
 |  |  | import ConfirmButton from "../../components/ConfirmButton"; | 
 |  |  |  | 
 |  |  |  | 
 |  |  | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ | 
 |  |  | 
 |  |  |     '& .column-name': { | 
 |  |  |     }, | 
 |  |  |     '& .opt': { | 
 |  |  |         width: 200 | 
 |  |  |         width: 260 | 
 |  |  |     }, | 
 |  |  | })); | 
 |  |  |  | 
 |  |  | 
 |  |  |     <SearchInput source="condition" alwaysOn />, | 
 |  |  |     <DateInput label='common.time.after' source="timeStart" alwaysOn />, | 
 |  |  |     <DateInput label='common.time.before' source="timeEnd" alwaysOn />, | 
 |  |  |  | 
 |  |  |     <TextInput source="code" label="table.field.wave.code" />, | 
 |  |  |     <SelectInput source="type" label="table.field.wave.type" | 
 |  |  |         choices={[ | 
 |  |  | 
 |  |  |     <NumberInput source="anfme" label="table.field.wave.anfme" />, | 
 |  |  |     <NumberInput source="qty" label="table.field.wave.qty" />, | 
 |  |  |     <NumberInput source="orderNum" label="table.field.wave.orderNum" />, | 
 |  |  |  | 
 |  |  |     <TextInput label="common.field.memo" source="memo" />, | 
 |  |  |     <SelectInput | 
 |  |  |         label="common.field.status" | 
 |  |  | 
 |  |  | const WaveList = () => { | 
 |  |  |     const translate = useTranslate(); | 
 |  |  |     const [createDialog, setCreateDialog] = useState(false); | 
 |  |  |     const [detailDialog, setDetailDialog] = useState(false); | 
 |  |  |     const [select, setSelectIds] = useState({}); | 
 |  |  |     const [drawerVal, setDrawerVal] = useState(false); | 
 |  |  |  | 
 |  |  |     return ( | 
 |  |  | 
 |  |  |             > | 
 |  |  |                 <StyledDatagrid | 
 |  |  |                     preferenceKey='wave' | 
 |  |  |                     bulkActionButtons={ | 
 |  |  |                         <PublicTaskButton /> | 
 |  |  |                     } | 
 |  |  |                     bulkActionButtons={false} | 
 |  |  |                     rowClick={(id, resource, record) => false} | 
 |  |  |                     expand={false} | 
 |  |  |                     expandSingle={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"> | 
 |  |  |                         <PublicTaskButton setSelectIds={setSelectIds} setDetailDialog={setDetailDialog} /> | 
 |  |  |                         <EditButton sx={{ padding: '1px', fontSize: '.75rem' }} /> | 
 |  |  |                         <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} /> | 
 |  |  |                     </WrapperField> | 
 |  |  |                 </StyledDatagrid> | 
 |  |  |             </List> | 
 |  |  |             <ItemToTaskModal | 
 |  |  |                 open={detailDialog} | 
 |  |  |                 record={select} | 
 |  |  |                 setOpen={setDetailDialog} | 
 |  |  |             /> | 
 |  |  |             <WaveCreate | 
 |  |  |                 open={createDialog} | 
 |  |  |                 setOpen={setCreateDialog} | 
 |  |  | 
 |  |  |  | 
 |  |  | export default WaveList; | 
 |  |  |  | 
 |  |  | const PublicTaskButton = () => { | 
 |  |  | const PublicTaskButton = ({ setSelectIds, setDetailDialog }) => { | 
 |  |  |     const record = useRecordContext(); | 
 |  |  |     const { selectedIds, onUnselectItems } = useListContext(); | 
 |  |  |     const notify = useNotify(); | 
 |  |  |     const refresh = useRefresh(); | 
 |  |  |     const redirect = useRedirect(); | 
 |  |  |  | 
 |  |  |      | 
 |  |  |     const pubClick = async (event) => { | 
 |  |  |         event.stopPropagation(); | 
 |  |  |         console.log('=========>'); | 
 |  |  |          | 
 |  |  |         onUnselectItems(); | 
 |  |  |         const res = await request.post(`/wave/public/task`, { ids: selectedIds }); | 
 |  |  |         if (res?.data?.code === 200) { | 
 |  |  |             notify(res.data.msg); | 
 |  |  |             redirect("/task") | 
 |  |  |         } else { | 
 |  |  |             notify(res.data.msg); | 
 |  |  |         } | 
 |  |  |         refresh(); | 
 |  |  |         setSelectIds(record); | 
 |  |  |         setDetailDialog(true); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     return ( | 
 |  |  |         <Button | 
 |  |  |             onClick={pubClick} | 
 |  |  |             label={"toolbar.createTask"} | 
 |  |  |             startIcon={<PublicIcon />} | 
 |  |  |         />); | 
 |  |  |         record?.exceStatus == 0 ? <ConfirmButton label={"toolbar.createTask"} startIcon={<PublicIcon /> } onConfirm={pubClick} size='small' /> : <></> | 
 |  |  |     ); | 
 |  |  | } |