|
|
@ -1797,80 +1797,57 @@ export default { |
|
|
this.menuStory = false; |
|
|
this.menuStory = false; |
|
|
}, |
|
|
}, |
|
|
onTaskTemplatesSelected(taskTemplates) { |
|
|
onTaskTemplatesSelected(taskTemplates) { |
|
|
|
|
|
|
|
|
if (taskTemplates == null || taskTemplates.length == 0) { |
|
|
if (taskTemplates == null || taskTemplates.length == 0) { |
|
|
this.taskTemplateVisible = false; |
|
|
this.taskTemplateVisible = false; |
|
|
this.parentTask = null; |
|
|
this.parentTask = null; |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
var taskTemplates2 = JSON.parse(JSON.stringify(taskTemplates)); |
|
|
var taskTemplates2 = JSON.parse(JSON.stringify(taskTemplates)); |
|
|
|
|
|
taskTemplates2.forEach(i=>{ |
|
|
|
|
|
if(!i.parentTaskid){ |
|
|
|
|
|
i.parentTaskid=this.parentTask?this.parentTask.id:null; |
|
|
|
|
|
i.parentTaskname=this.parentTask?this.parentTask.name:null; |
|
|
|
|
|
} else if(!taskTemplates2.some(k=>k.id==i.parentTaskid)){ |
|
|
|
|
|
i.parentTaskid=this.parentTask?this.parentTask.id:null; |
|
|
|
|
|
i.parentTaskname=this.parentTask?this.parentTask.name:null; |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
this.load.add = true; |
|
|
this.load.add = true; |
|
|
let parents = taskTemplates2.filter((value) => { |
|
|
|
|
|
//如果我的上级为空,则我是最上级 |
|
|
|
|
|
if ( |
|
|
|
|
|
value.parentTaskid == "undefined" || |
|
|
|
|
|
value.parentTaskid == null || |
|
|
|
|
|
value.parentTaskid == "" |
|
|
|
|
|
) { |
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
|
|
//如果我的上级不在列表中,我作为最上级 |
|
|
|
|
|
} else if (taskTemplates2.some((i) => value.parentTaskid == i.id)) { |
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
var projectId=null; |
|
|
|
|
|
var productId=null; |
|
|
|
|
|
if(this.ptype==='0'){ |
|
|
|
|
|
if(this.parentTask && this.parentTask.id){ |
|
|
|
|
|
projectId=this.parentTask.projectId |
|
|
}else{ |
|
|
}else{ |
|
|
return true; |
|
|
|
|
|
|
|
|
projectId=this.filters.selProject.id |
|
|
} |
|
|
} |
|
|
}); |
|
|
|
|
|
if (this.parentTask != null && this.parentTask != undefined) { |
|
|
|
|
|
parents.forEach((i) => (i.parentTaskid = this.parentTask.id)); |
|
|
|
|
|
}else{ |
|
|
}else{ |
|
|
parents.forEach((i) => (i.parentTaskid = null)); |
|
|
|
|
|
} |
|
|
|
|
|
let children = taskTemplates2.filter((value) => { |
|
|
|
|
|
if (taskTemplates2.some((i) => value.parentTaskid == i.id)) { |
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
|
if(this.parentTask && this.parentTask.id){ |
|
|
|
|
|
productId=this.parentTask.productId |
|
|
}else{ |
|
|
}else{ |
|
|
return false; |
|
|
|
|
|
|
|
|
productId=this.filters.product.id |
|
|
} |
|
|
} |
|
|
}); |
|
|
|
|
|
let translator = (parents, children) => { |
|
|
|
|
|
parents.forEach((parent) => { |
|
|
|
|
|
var newId = sn(); |
|
|
|
|
|
var myChildren = []; |
|
|
|
|
|
if (children != null && children.length > 0) { |
|
|
|
|
|
myChildren = children.filter( |
|
|
|
|
|
(current) => current.parentTaskid === parent.id |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
} |
|
|
myChildren.forEach((current, index) => { |
|
|
|
|
|
current.parentTaskid = newId; |
|
|
|
|
|
var mySubChildren = children.filter( |
|
|
|
|
|
(c) => c.parentTaskid === current.id |
|
|
|
|
|
); |
|
|
|
|
|
translator([current], mySubChildren); |
|
|
|
|
|
}); |
|
|
|
|
|
parent.id = newId; |
|
|
|
|
|
}); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
translator(parents, children); |
|
|
|
|
|
taskTemplates2.forEach((i) => { |
|
|
taskTemplates2.forEach((i) => { |
|
|
if(this.ptype==='1'){ |
|
|
if(this.ptype==='1'){ |
|
|
i.branchId=this.xmProduct.branchId; |
|
|
|
|
|
i.ptype="1" |
|
|
i.ptype="1" |
|
|
i.projectId=null; |
|
|
i.projectId=null; |
|
|
i.projectName=null; |
|
|
i.projectName=null; |
|
|
i.productId=this.xmProduct.id |
|
|
|
|
|
|
|
|
if(productId!=i.productId){ |
|
|
i.menuId=null; |
|
|
i.menuId=null; |
|
|
i.menuName=null; |
|
|
i.menuName=null; |
|
|
|
|
|
} |
|
|
|
|
|
i.productId=productId |
|
|
}else if(this.ptype==='0'){ |
|
|
}else if(this.ptype==='0'){ |
|
|
i.branchId=this.filters.selProject.branchId; |
|
|
|
|
|
i.ptype="0" |
|
|
i.ptype="0" |
|
|
i.projectId=this.filters.selProject.id; |
|
|
|
|
|
i.projectName=this.filters.selProject.name; |
|
|
|
|
|
i.productId=null |
|
|
|
|
|
|
|
|
if(i.isTpl=='1'){ |
|
|
|
|
|
i.productId=null; |
|
|
i.menuId=null; |
|
|
i.menuId=null; |
|
|
i.menuName=null; |
|
|
i.menuName=null; |
|
|
} |
|
|
} |
|
|
|
|
|
i.projectId=projectId |
|
|
|
|
|
} |
|
|
i.budgetCost = 0; |
|
|
i.budgetCost = 0; |
|
|
i.budgetWorkload = 80; |
|
|
i.budgetWorkload = 80; |
|
|
i.level = i.level ? i.level : "3"; |
|
|
i.level = i.level ? i.level : "3"; |
|
|
@ -1896,8 +1873,20 @@ export default { |
|
|
i.startTime = util.formatDate.format(startTime, "yyyy-MM-dd HH:mm:ss"); |
|
|
i.startTime = util.formatDate.format(startTime, "yyyy-MM-dd HH:mm:ss"); |
|
|
i.endTime = util.formatDate.format(endTime, "yyyy-MM-dd HH:mm:ss"); |
|
|
i.endTime = util.formatDate.format(endTime, "yyyy-MM-dd HH:mm:ss"); |
|
|
}); |
|
|
}); |
|
|
|
|
|
var params={ |
|
|
|
|
|
xmTasks:taskTemplates2, |
|
|
|
|
|
ptype:this.ptype |
|
|
|
|
|
} |
|
|
|
|
|
if(this.ptype==='0'){ |
|
|
|
|
|
params.projectId=projectId |
|
|
|
|
|
}else{ |
|
|
|
|
|
params.productId=productId |
|
|
|
|
|
} |
|
|
|
|
|
if(this.parentTask && this.parentTask.id){ |
|
|
|
|
|
params.parentTaskid=this.parentTask.id |
|
|
|
|
|
} |
|
|
////////////////// |
|
|
////////////////// |
|
|
batchImportTaskFromTemplate(taskTemplates2) |
|
|
|
|
|
|
|
|
batchImportTaskFromTemplate(params) |
|
|
.then((res) => { |
|
|
.then((res) => { |
|
|
var tips = res.data.tips; |
|
|
var tips = res.data.tips; |
|
|
if (tips.isOk) { |
|
|
if (tips.isOk) { |
|
|
|