@@ -6,13 +6,14 @@ import FileIcon from '../FileIcon'; | |||
import ATooltip from '../Tooltip'; | |||
import styles from './FileStatus.less'; | |||
import { CloseCircleFilled, CheckCircleFilled } from '@ant-design/icons'; | |||
import { Progress, Button, ButtonProps } from 'antd'; | |||
import { Progress, Button, ButtonProps, message } from 'antd'; | |||
import { NotificationType, TaskStatus, TaskType } from '@/services/API.helper'; | |||
import { DATA } from '@/services/API'; | |||
import { identity } from 'lodash'; | |||
import { useCallback } from 'react'; | |||
import { fetchLocalApi } from '@/utils/request'; | |||
import system from '@/services/system'; | |||
import { handleRequest } from '@/utils/tool'; | |||
interface FileStatusProps { | |||
className?: string; | |||
@@ -35,12 +36,17 @@ export default function FileStatus(props: FileStatusProps) { | |||
: ''; | |||
}, [data]); | |||
const redoTask = useCallback(() => { | |||
fetchLocalApi('restartTask', { taskIds: data.taskId }); | |||
const redoTask = useCallback(async () => { | |||
const res = await fetchLocalApi('restartTask', { taskIds: data.taskId }); | |||
handleRequest(res).success(() => message.success('指令已发送')); | |||
}, [data.taskId]); | |||
const downloadFile = useCallback(() => { | |||
fetchLocalApi('downloadFileFromMsg', { fileObject: data.originData }); | |||
const downloadFile = useCallback(async () => { | |||
const res = await fetchLocalApi('downloadFileFromMsg', { | |||
fileObject: data.originData, | |||
}); | |||
4; | |||
handleRequest(res).success(() => message.success('下载指令已发送')); | |||
}, [data.taskId]); | |||
const checkFile = useCallback(() => { | |||
@@ -10,11 +10,25 @@ import classNames from 'classnames'; | |||
import ATooltip from '@/components/Tooltip'; | |||
import { Link } from 'umi'; | |||
const navList = [ | |||
{ pathname: '/sync', name: '同步任务', icon: syncImg, activeIcon: syncActiveImg }, | |||
{ pathname: '/messages', name: '消息通知', icon: messagesImg, activeIcon: messagesActiveImg }, | |||
{ pathname: '/log', name: '操作记录', icon: logImg, activeIcon: logActiveImg }, | |||
{ | |||
pathname: '/sync', | |||
name: '同步任务', | |||
icon: syncImg, | |||
activeIcon: syncActiveImg, | |||
}, | |||
{ | |||
pathname: '/messages', | |||
name: '消息中心', | |||
icon: messagesImg, | |||
activeIcon: messagesActiveImg, | |||
}, | |||
{ | |||
pathname: '/log', | |||
name: '操作记录', | |||
icon: logImg, | |||
activeIcon: logActiveImg, | |||
}, | |||
]; | |||
interface NavProps { | |||
@@ -27,18 +41,22 @@ export default function Nav(props: NavProps) { | |||
const { pathname: currentPathname } = props; | |||
return ( | |||
<div className={styles.nav}> | |||
{ | |||
navList.map(({ pathname, name, icon, activeIcon }) => { | |||
const active = pathname.indexOf(currentPathname) === 0; | |||
return ( | |||
<ATooltip key={name} title={name} placement="right"> | |||
<Link className={classNames(styles.navItem, active ? styles.active : '')} to={pathname}> | |||
<img src={active ? activeIcon : icon} alt="" /> | |||
</Link> | |||
</ATooltip> | |||
) | |||
}) | |||
} | |||
{navList.map(({ pathname, name, icon, activeIcon }) => { | |||
const active = pathname.indexOf(currentPathname) === 0; | |||
return ( | |||
<ATooltip key={name} title={name} placement="right"> | |||
<Link | |||
className={classNames( | |||
styles.navItem, | |||
active ? styles.active : '', | |||
)} | |||
to={pathname} | |||
> | |||
<img src={active ? activeIcon : icon} alt="" /> | |||
</Link> | |||
</ATooltip> | |||
); | |||
})} | |||
</div> | |||
) | |||
} | |||
); | |||
} |