数据集附件删除
This commit is contained in:
parent
3e2e195a5f
commit
b921926c23
|
|
@ -1,5 +1,7 @@
|
|||
import React, { useState , useEffect } from 'react';
|
||||
import { Button , Table , Tooltip } from 'antd';
|
||||
import { Button , Table , Tooltip, message } from 'antd';
|
||||
import Modals from '../Component/PublicModal/Index';
|
||||
import { AlignCenter } from '../Component/layout';
|
||||
import { getImageUrl } from 'educoder';
|
||||
import paperImg from './image/paperImg.png';
|
||||
import NewModal from './component/new';
|
||||
|
|
@ -17,6 +19,8 @@ function Index(props){
|
|||
const [ page , setPage ] = useState(1);
|
||||
const [ visible , setVisible ] = useState(false);
|
||||
const [ detail , setDetail ] = useState({});
|
||||
const [ delVisible , setDelVisible ] = useState(false);
|
||||
const [ delId , setDelId ] = useState(undefined);
|
||||
const pageSize = 10;
|
||||
|
||||
useEffect(()=>{
|
||||
|
|
@ -82,10 +86,14 @@ function Index(props){
|
|||
{
|
||||
title:"操作",
|
||||
dataIndex:"url",
|
||||
align:"center",
|
||||
key:6,
|
||||
width:"10%",
|
||||
width:"12%",
|
||||
render:(value,item)=>{
|
||||
return <a href={value} className="color-blue" download={value}>下载</a>
|
||||
return <React.Fragment>
|
||||
<a href={value} className="color-blue" download={value}>下载</a>
|
||||
<a className='color-red ml20' onClick={()=>{setDelVisible(true);setDelId(item.id);}}>删除</a>
|
||||
</React.Fragment>
|
||||
}
|
||||
},
|
||||
]
|
||||
|
|
@ -97,9 +105,24 @@ function Index(props){
|
|||
getProject && getProject();
|
||||
detail && detail.id && Init();
|
||||
}
|
||||
|
||||
// 确定删除数据集
|
||||
function delDataSetFunc(){
|
||||
if(delId){
|
||||
const url = `/attachments/${delId}.json`;
|
||||
axios.delete(url).then(res=>{
|
||||
if(res){
|
||||
message.info("数据集附件删除");
|
||||
setDelVisible(false);
|
||||
setDelId(undefined);
|
||||
Init();
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
return(
|
||||
<div className={`dataset`}>
|
||||
<NewModal visible={visible} detail={detail} owner={owner} repo={projectsId} onCancel={()=>setVisible(false)} onOk={addFunc}/>
|
||||
<NewModal visible={visible} detail={detail} owner={owner} repo={projectsId} onCancel={()=>{setVisible(false);}} onOk={addFunc}/>
|
||||
<div className={`mnistData`}>
|
||||
{empty ?
|
||||
<span className="font-16">数据集</span>
|
||||
|
|
@ -140,6 +163,23 @@ function Index(props){
|
|||
</div>
|
||||
:""
|
||||
}
|
||||
|
||||
<Modals
|
||||
visible={delVisible}
|
||||
onCancel={()=>{setDelVisible(false);setDelId(undefined);}}
|
||||
title={"删除附件"}
|
||||
btn={
|
||||
<div>
|
||||
<Button size={'large'} onClick={()=>{setDelVisible(false);setDelId(undefined);}}>取消</Button>
|
||||
<Button type={"danger"} size={"large"} onClick={delDataSetFunc}>确认</Button>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<div className="desc center">
|
||||
<AlignCenter className="descMain">
|
||||
<i className="iconfont icon-jinggao1 mr10 font-20 red"></i>确定删除该文件?</AlignCenter>
|
||||
</div>
|
||||
</Modals>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue