瀏覽代碼

fileStatus: 下发指令增加提示; 消息通知文案改为消息中心

main
unknown 3 年之前
父節點
當前提交
9b6dbb41af
共有 2 個文件被更改,包括 47 次插入23 次删除
  1. +11
    -5
      src/components/FileStatus/FileStatus.tsx
  2. +36
    -18
      src/layouts/nav.tsx

+ 11
- 5
src/components/FileStatus/FileStatus.tsx 查看文件

@@ -6,13 +6,14 @@ import FileIcon from '../FileIcon';
import ATooltip from '../Tooltip'; import ATooltip from '../Tooltip';
import styles from './FileStatus.less'; import styles from './FileStatus.less';
import { CloseCircleFilled, CheckCircleFilled } from '@ant-design/icons'; 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 { NotificationType, TaskStatus, TaskType } from '@/services/API.helper';
import { DATA } from '@/services/API'; import { DATA } from '@/services/API';
import { identity } from 'lodash'; import { identity } from 'lodash';
import { useCallback } from 'react'; import { useCallback } from 'react';
import { fetchLocalApi } from '@/utils/request'; import { fetchLocalApi } from '@/utils/request';
import system from '@/services/system'; import system from '@/services/system';
import { handleRequest } from '@/utils/tool';


interface FileStatusProps { interface FileStatusProps {
className?: string; className?: string;
@@ -35,12 +36,17 @@ export default function FileStatus(props: FileStatusProps) {
: ''; : '';
}, [data]); }, [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]); }, [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]); }, [data.taskId]);


const checkFile = useCallback(() => { const checkFile = useCallback(() => {


+ 36
- 18
src/layouts/nav.tsx 查看文件

@@ -10,11 +10,25 @@ import classNames from 'classnames';
import ATooltip from '@/components/Tooltip'; import ATooltip from '@/components/Tooltip';
import { Link } from 'umi'; import { Link } from 'umi';



const navList = [ 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 { interface NavProps {
@@ -27,18 +41,22 @@ export default function Nav(props: NavProps) {
const { pathname: currentPathname } = props; const { pathname: currentPathname } = props;
return ( return (
<div className={styles.nav}> <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> </div>
)
}
);
}

Loading…
取消
儲存