caipin 4 年之前
父節點
當前提交
9550a3e880
共有 3 個文件被更改,包括 18 次插入2 次删除
  1. 14 0
      dao/tree_contract_dao.go
  2. 3 2
      services/contract_section_tree_service.go
  3. 1 0
      web/viewmodels/tree_section_contract.go

+ 14 - 0
dao/tree_contract_dao.go

@@ -185,6 +185,20 @@ func (d *TreeContractDao) GetAttribution(attribution string, projectId int, bids
 	}
 }
 
+// 获得谋归属下的项目节-合同
+func (d *TreeContractDao) GetAttributionContract(attribution string, projectId int, bidsectionId int, treeType int) []models.CmTreeContracts {
+	datalist := make([]models.CmTreeContracts, 0)
+	err := d.engine.
+		Asc("serial").
+		Where("attribution like ? and project_id=? and bidsection_id=? and tree_type=? and contract_id!=0", attribution+"%", projectId, bidsectionId, treeType).
+		Find(&datalist)
+	if err != nil {
+		return datalist
+	} else {
+		return datalist
+	}
+}
+
 // 项目节升降级
 func (d *TreeContractDao) MoveDepth(section *models.CmTreeContracts, elderBrother *models.CmTreeContracts, operation string, bidsectionId int, projectId int, treeType int) error {
 

+ 3 - 2
services/contract_section_tree_service.go

@@ -37,9 +37,10 @@ func (s *contractService) GetSecionTreeNotContract(bidsectionId int, projectId i
 	return Node
 }
 
-// 获得项目节树和孩子们下的合同数据
+// 获得项目节树和孩子们下的合同数据-未使用
 func (s *contractService) GetSectionTreeContract(attribution string, bidsectionId int, projectId int, treeType int) []*viewmodels.Contracts {
 	s.treeContractDao.GetAttribution(attribution, bidsectionId, projectId, treeType)
+
 	return nil
 }
 
@@ -215,7 +216,7 @@ func (s *contractService) SectionDelete(treeId int, bidsectionId int, projectId
 	// 	return errors.New("请在项目节第三层开始编辑")
 	// }
 	// 1-2 有合同的不能编辑(包含孩子节点)
-	contractList := s.GetSectionTreeContract(section.Attribution, section.BidsectionId, section.ProjectId, treeType)
+	contractList := s.treeContractDao.GetAttributionContract(section.Attribution, section.ProjectId, section.BidsectionId, treeType)
 	if len(contractList) != 0 {
 		return errors.New("该项目节存在合同")
 	}

+ 1 - 0
web/viewmodels/tree_section_contract.go

@@ -44,6 +44,7 @@ type TreeSectionContract struct {
 
 	// 前端需要
 	Key   string `form:"key" json:"key"`
+	Value string `form:"value" json:"value"`
 	Title string `form:"title" json:"title"`
 }