|
|
|
@ -157,49 +157,52 @@ class GraduationTasksSubmitedit extends Component{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onAttachmentRemove = (file) => {
|
|
|
|
|
let {attachments,fileList}=this.state;
|
|
|
|
|
const url = `/attachments/${file}.json`
|
|
|
|
|
axios.delete(url, {
|
|
|
|
|
})
|
|
|
|
|
.then((response) => {
|
|
|
|
|
if (response.data) {
|
|
|
|
|
// const { status } = response.data;
|
|
|
|
|
if (response.data.status === 0) {
|
|
|
|
|
console.log('--- success')
|
|
|
|
|
let newattachments=attachments;
|
|
|
|
|
if(file.uid===undefined){
|
|
|
|
|
for(var i=0; i<newattachments.length; i++){
|
|
|
|
|
if(newattachments[i].id===file.id){
|
|
|
|
|
newattachments.splice(i, 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(file.response!=undefined){
|
|
|
|
|
let {attachments,fileList}=this.state;
|
|
|
|
|
const url = `/attachments/${file}.json`
|
|
|
|
|
axios.delete(url, {
|
|
|
|
|
})
|
|
|
|
|
.then((response) => {
|
|
|
|
|
if (response.data) {
|
|
|
|
|
// const { status } = response.data;
|
|
|
|
|
if (response.data.status === 0) {
|
|
|
|
|
console.log('--- success')
|
|
|
|
|
let newattachments=attachments;
|
|
|
|
|
if(file.uid===undefined){
|
|
|
|
|
for(var i=0; i<newattachments.length; i++){
|
|
|
|
|
if(newattachments[i].id===file.id){
|
|
|
|
|
newattachments.splice(i, 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
Modalstype:true,
|
|
|
|
|
Modalstopval:response.data.message,
|
|
|
|
|
ModalSave:this.cancelAttachment,
|
|
|
|
|
Loadtype:true,
|
|
|
|
|
attachments:newattachments
|
|
|
|
|
})
|
|
|
|
|
this.setState({
|
|
|
|
|
Modalstype:true,
|
|
|
|
|
Modalstopval:response.data.message,
|
|
|
|
|
ModalSave:this.cancelAttachment,
|
|
|
|
|
Loadtype:true,
|
|
|
|
|
attachments:newattachments
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setState((state) => {
|
|
|
|
|
const index = state.fileList.indexOf(file);
|
|
|
|
|
const newFileList = state.fileList.slice();
|
|
|
|
|
newFileList.splice(index, 1);
|
|
|
|
|
return {
|
|
|
|
|
fileList: newFileList,
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.catch(function (error) {
|
|
|
|
|
console.log(error);
|
|
|
|
|
});
|
|
|
|
|
this.setState((state) => {
|
|
|
|
|
const index = state.fileList.indexOf(file);
|
|
|
|
|
const newFileList = state.fileList.slice();
|
|
|
|
|
newFileList.splice(index, 1);
|
|
|
|
|
return {
|
|
|
|
|
fileList: newFileList,
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.catch(function (error) {
|
|
|
|
|
console.log(error);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inputSearchValue=(e)=>{
|
|
|
|
|