|
@@ -100,8 +100,9 @@ func (s *contractService) ContractSectionAdd(sectionData *viewmodels.TreeSection
|
|
|
return nil, err
|
|
|
}
|
|
|
sectionFather := s.treeContractDao.Get(treeId, bidsectionId, projectId, treeType)
|
|
|
+
|
|
|
if sectionFather.Id == 0 {
|
|
|
- return nil, errors.New("未找到合同项目节")
|
|
|
+ return nil, errors.New("未找到项目节")
|
|
|
}
|
|
|
|
|
|
// 1-1 深度为>=2才能新增项目节
|
|
@@ -121,7 +122,7 @@ func (s *contractService) ContractSectionAdd(sectionData *viewmodels.TreeSection
|
|
|
// 新建合同,项目层级必须在第二层以下,当第一层没有孩子可以添加合同
|
|
|
if sectionFather.Depth == 0 {
|
|
|
if len(childrenList) != 0 {
|
|
|
- return nil, errors.New("该项目节不允许添加合同")
|
|
|
+ return nil, errors.New("该项目节不允许添加合同,请在下一层级新建合同")
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -326,6 +327,10 @@ func (s *contractService) MoveDepth(sectionData *viewmodels.TreeSectionContract,
|
|
|
return errors.New("项目节不能降级")
|
|
|
}
|
|
|
elderBrother = &elderBrotherList[0]
|
|
|
+ // 前一个兄弟节点 不能有合同
|
|
|
+ if elderBrother.ContractId != 0 {
|
|
|
+ return errors.New(elderBrother.Code + "已存在合同,不能降级")
|
|
|
+ }
|
|
|
} else if sectionData.Operation == "upDepth" { // 3.层级升级-只要有父亲都能升级
|
|
|
// 2-1 父节点深度为2不能升级
|
|
|
// if (section.Depth - 1) < 2 {
|
|
@@ -335,6 +340,7 @@ func (s *contractService) MoveDepth(sectionData *viewmodels.TreeSectionContract,
|
|
|
if section.ParentId == 0 {
|
|
|
return errors.New("项目节不能升级")
|
|
|
}
|
|
|
+
|
|
|
} else {
|
|
|
return errors.New("参数错误")
|
|
|
}
|