|
|
|
@ -19,6 +19,7 @@ class NewGtaskForms extends Component{
|
|
|
|
|
|
|
|
|
|
initValue = (data) => {
|
|
|
|
|
|
|
|
|
|
if (data.isEdit===true) {
|
|
|
|
|
const contentFileList = data.attachments.map(item => {
|
|
|
|
|
return {
|
|
|
|
|
id: item.id,
|
|
|
|
@ -31,10 +32,10 @@ class NewGtaskForms extends Component{
|
|
|
|
|
})
|
|
|
|
|
this.setState({
|
|
|
|
|
...data,
|
|
|
|
|
base_on_project: data.group_info.base_on_project,
|
|
|
|
|
base_on_project: data.task_type===2?data.group_info.base_on_project:undefined,
|
|
|
|
|
title_num: parseInt(data.name.length),
|
|
|
|
|
min_num: data.group_info.min_number,
|
|
|
|
|
max_num: data.group_info.max_number,
|
|
|
|
|
min_num: data.task_type===2?data.group_info.min_number:undefined,
|
|
|
|
|
max_num: data.task_type===2?data.group_info.max_number:undefined,
|
|
|
|
|
contentFileList,
|
|
|
|
|
}, () => {
|
|
|
|
|
setTimeout(() => {
|
|
|
|
@ -47,6 +48,8 @@ class NewGtaskForms extends Component{
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -120,27 +123,28 @@ class NewGtaskForms extends Component{
|
|
|
|
|
values.description = mdContnet;
|
|
|
|
|
|
|
|
|
|
if (!err) {
|
|
|
|
|
if (this.props.data.isEdit===true) {
|
|
|
|
|
let url="/task_banks/"+topicId+".json";
|
|
|
|
|
axios.put(url, {
|
|
|
|
|
gtask_bank: {
|
|
|
|
|
name: values.title,
|
|
|
|
|
description: values.description,
|
|
|
|
|
min_num:task_type===1?undefined:min_num,
|
|
|
|
|
max_num:task_type===1?undefined:max_num,
|
|
|
|
|
base_on_project: task_type===1?undefined:base_on_project===true?1:0
|
|
|
|
|
},
|
|
|
|
|
attachment_ids:contentFileList
|
|
|
|
|
gtask_bank: {
|
|
|
|
|
name: values.title,
|
|
|
|
|
description: values.description,
|
|
|
|
|
min_num:task_type===1?undefined:min_num,
|
|
|
|
|
max_num:task_type===1?undefined:max_num,
|
|
|
|
|
base_on_project: task_type===1?undefined:base_on_project===true?1:0
|
|
|
|
|
},
|
|
|
|
|
attachment_ids:contentFileList
|
|
|
|
|
}
|
|
|
|
|
).then((response) => {
|
|
|
|
|
if(response.data.status===0){
|
|
|
|
|
this.props.showNotification(response.data.message)
|
|
|
|
|
}else{
|
|
|
|
|
this.props.showNotification(response.data.message)
|
|
|
|
|
}
|
|
|
|
|
if(response.data.status===0){
|
|
|
|
|
this.props.showNotification(response.data.message)
|
|
|
|
|
}else{
|
|
|
|
|
this.props.showNotification(response.data.message)
|
|
|
|
|
}
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
console.log(error)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$("html").animate({ scrollTop: $('html').scrollTop() - 100 })
|
|
|
|
|
}
|
|
|
|
|