| import { useEffect, useState } from 'react'; | 
| import { DragDropContext } from '@hello-pangea/dnd'; | 
| import { Box, LinearProgress } from '@mui/material'; | 
| import { | 
|     useDataProvider, | 
|     useListContext, | 
|     useNotify, | 
|     useRefresh, | 
|     useTranslate, | 
| } from 'react-admin'; | 
| import { MissionColumn } from './MissionColumn'; | 
| import request from '@/utils/request'; | 
| import { CUSTOM_PAGES_DATA_INTERVAL } from '@/config/setting'; | 
|   | 
| export const MissionListContent = () => { | 
|     const translate = useTranslate(); | 
|     const notify = useNotify(); | 
|     const refresh = useRefresh(); | 
|     const dataProvider = useDataProvider(); | 
|     const { data, isPending, refetch } = useListContext(); | 
|   | 
|     const [stages, setStages] = useState([]); | 
|   | 
|     useEffect(() => { | 
|         const httpStages = async () => { | 
|             request.post('/mission/posType/list').then(res => { | 
|                 const { code, msg, data } = res.data; | 
|                 if (code === 200) { | 
|                     setStages(data); | 
|                 } else { | 
|                     notify(msg || 'common.response.fail', { type: 'error', messageArgs: { _: msg } }); | 
|                 } | 
|             }).catch(error => { | 
|                 notify(error.message || 'common.response.fail', { type: 'error', messageArgs: { _: error.message } }); | 
|             }) | 
|         } | 
|         httpStages(); | 
|     }, [notify]); | 
|   | 
|     useEffect(() => { | 
|         const intervalId = setInterval(() => { | 
|             refetch(); | 
|         }, CUSTOM_PAGES_DATA_INTERVAL); | 
|   | 
|         return () => clearInterval(intervalId); | 
|     }, [refetch]) | 
|   | 
|     if (isPending) return <LinearProgress />; | 
|   | 
|     const onDragEnd = result => { | 
|         const { destination, source } = result; | 
|         if (!destination) { | 
|             return; | 
|         } | 
|         const { droppableId: sourceStage, index: sourceIdx } = source; | 
|         const { droppableId: destinationStage, index: destinationIdx } = destination; | 
|   | 
|         if (destinationStage === sourceStage | 
|             && destinationIdx === sourceIdx) { | 
|             return; | 
|         } | 
|     }; | 
|   | 
|     return ( | 
|         <DragDropContext onDragEnd={onDragEnd}> | 
|             <Box display="flex"> | 
|                 {stages.map(stage => ( | 
|                     <MissionColumn | 
|                         key={stage} | 
|                         stage={stage} | 
|                         missions={data.filter(item => item.posType === stage)} | 
|                     /> | 
|                 ))} | 
|             </Box> | 
|         </DragDropContext> | 
|     ); | 
| }; |