删除调整

dev_hss
杨树明 5 years ago
parent f26aa7b19b
commit a449496d59

@ -159,7 +159,8 @@ class GraduationTasksSubmitedit extends Component{
onAttachmentRemove = (file) => {
if(!file.percent || file.percent == 100){
let {attachments,fileList}=this.state;
const url = `/attachments/${file}.json`
let id=file.response ==undefined ? file.id : file.response.id;
const url = `/attachments/${id}.json`
axios.delete(url, {
})
.then((response) => {

@ -168,36 +168,38 @@ class GraduationTasksSubmitnew extends Component{
}
deleteAttachment = (file) => {
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')
this.setState({
Modalstype:true,
Modalstopval:response.data.message,
ModalSave:this.cancelAttachment,
Loadtype:true,
})
if(!file.percent || file.percent == 100){
let id = file.response == undefined ? file.id : file.response.id;
const url = `/attachments/${id}.json`
axios.delete(url, {})
.then((response) => {
if (response.data) {
// const { status } = response.data;
if (response.data.status === 0) {
console.log('--- success')
this.setState({
Modalstype: true,
Modalstopval: response.data.message,
ModalSave: this.cancelAttachment,
Loadtype: true,
})
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)=>{

Loading…
Cancel
Save