|
|
@@ -10,6 +10,9 @@ import { Progress, Button } from 'antd'; |
|
|
|
import { 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'; |
|
|
|
|
|
|
|
interface FileStatusProps { |
|
|
|
className?: string; |
|
|
@@ -31,6 +34,15 @@ export default function FileStatus(props: FileStatusProps) { |
|
|
|
? `${data.createUserName}同步` |
|
|
|
: ''; |
|
|
|
}, [data]); |
|
|
|
|
|
|
|
const redoTask = useCallback(() => { |
|
|
|
fetchLocalApi('restartTask', { taskIds: data.taskId }); |
|
|
|
}, [data.taskId]); |
|
|
|
|
|
|
|
const checkFile = useCallback(() => { |
|
|
|
system.openFilePosition(data); |
|
|
|
}, [data]); |
|
|
|
|
|
|
|
return ( |
|
|
|
<div className={classNames(styles.fileStatus, className)} style={style}> |
|
|
|
<div className={styles.left}> |
|
|
@@ -61,7 +73,12 @@ export default function FileStatus(props: FileStatusProps) { |
|
|
|
<div className={styles.right}> |
|
|
|
{/* 查看1: 已下载 文件打开文件夹 */} |
|
|
|
{data.taskSyncStatus === TaskStatus.FINISH ? ( |
|
|
|
<Button type="link" className={styles.button} size="small"> |
|
|
|
<Button |
|
|
|
type="link" |
|
|
|
className={styles.button} |
|
|
|
size="small" |
|
|
|
onClick={checkFile} |
|
|
|
> |
|
|
|
查看 |
|
|
|
</Button> |
|
|
|
) : null} |
|
|
@@ -69,6 +86,16 @@ export default function FileStatus(props: FileStatusProps) { |
|
|
|
{/* 下载: 未下载 且 未删除 文件 */} |
|
|
|
{/* 重新下载: 下载失败时出现 */} |
|
|
|
{/* 重新上传: 上传失败时出现 */} |
|
|
|
{data.taskSyncStatus === TaskStatus.FAILED ? ( |
|
|
|
<Button |
|
|
|
type="link" |
|
|
|
className={styles.button} |
|
|
|
size="small" |
|
|
|
onClick={redoTask} |
|
|
|
> |
|
|
|
{data.taskType === TaskType.DOWNLOAD ? '重新下载' : '重新上传'} |
|
|
|
</Button> |
|
|
|
) : null} |
|
|
|
{/* <Button type="link" className={styles.button} size="small">重新上传</Button> */} |
|
|
|
{/* <Button type="link" className={styles.button} size="small">暂停</Button> */} |
|
|
|
{/* <Button type="link" className={styles.button} size="small">取消</Button> */} |
|
|
|