caipin 4 éve
szülő
commit
dbb027e1ef

+ 17 - 0
dao/contract_return_dao.go

@@ -54,6 +54,23 @@ func (d *ContractReturnDao) GetAll(projectId int, bidsectionId int, contractsId
 	}
 }
 
+//回款分页
+func (d *ContractReturnDao) GetPage(projectId int, bidsectionId int, contractsId int, page int) []models.CmContractsReturn {
+	datalist := make([]models.CmContractsReturn, 0)
+	size := 8
+	if page == 1 {
+		page = 0
+	} else {
+		page--
+		page = page * size
+	}
+
+	_ = d.engine.Where("project_id = ? and bidsection_id =? and contracts_id=?", projectId, bidsectionId, contractsId).
+		Limit(size, page).
+		Find(&datalist)
+	return datalist
+}
+
 // 创建回款
 func (d *ContractReturnDao) Add(contractsReturn *models.CmContractsReturn) error {
 	_, err := d.engine.Insert(contractsReturn)

+ 2 - 1
services/contract_return_service.go

@@ -104,8 +104,9 @@ func (s *contractService) ValidRuleContractRetrunDel(ctx iris.Context) (*viewmod
 }
 
 // 获得合同下回款列表
-func (s *contractService) ReturnAll(projectId int, bidsectionId int, contractsId int) []*viewmodels.ContractsReturn {
+func (s *contractService) ReturnAll(projectId int, bidsectionId int, contractsId int, page int) []*viewmodels.ContractsReturn {
 	// 1.获得合同回款列表
+	// data := s.contractReturnDao.GetPage(projectId, bidsectionId, contractsId, page)
 	data := s.contractReturnDao.GetAll(projectId, bidsectionId, contractsId)
 
 	contractsReturnVM := make([]*viewmodels.ContractsReturn, 0)

+ 1 - 1
services/contract_service.go

@@ -58,7 +58,7 @@ type ContractService interface {
 
 	ReturnCreate(returnData *viewmodels.ContractsReturn, projectId int, bidsectionId int, contractsId int, projectAccountId int) error
 	ReturnUpdate(returnData *viewmodels.ContractsReturn, projectId int, bidsectionId int, contractsId int, id int) error
-	ReturnAll(projectId int, bidsectionId int, contractsId int) []*viewmodels.ContractsReturn
+	ReturnAll(projectId int, bidsectionId int, contractsId int, page int) []*viewmodels.ContractsReturn
 	ReturnDelete(projectId int, bidsectionId int, contractsId int, id int) error
 }
 

+ 3 - 2
web/api/contract_return_api.go

@@ -46,7 +46,7 @@ func (c *ContractApi) GetReturnWay() {
 func (c *ContractApi) GetReturnList() {
 	returnData, err := c.ServiceContract.ValidRuleContractRetrun(c.Ctx)
 
-	// 项目IDtes
+	// 项目ID
 	projectId, err := utils.GetProjectId(c.Ctx)
 	if err != nil {
 		c.Ctx.JSON(iris.Map{"code": -1, "msg": fmt.Sprintf("%s", err)})
@@ -65,7 +65,8 @@ func (c *ContractApi) GetReturnList() {
 		return
 	}
 
-	returnList := c.ServiceContract.ReturnAll(projectId, bidsectionId, contractsId)
+	returnList := c.ServiceContract.ReturnAll(projectId, bidsectionId, contractsId, returnData.Page)
+	//returnCount:=c.ServiceContract.ReturnCount(projectId, bidsectionId, contractsId,)
 	c.Ctx.JSON(iris.Map{
 		"code": 0,
 		"msg":  "",

+ 33 - 7
web/api/contract_section_tree_api.go

@@ -50,9 +50,15 @@ func (c *ContractApi) PostSectionDepth() {
 		c.Ctx.JSON(iris.Map{"code": -1, "msg": fmt.Sprintf("%s", err)})
 		return
 	}
+	//2.请求当前项目信息
+	// 1.验证项目节ID
+	treeId, _ := utils.GetDecryptId(sectionData.Id)
+	sectionDetail := c.ServiceContract.Get(treeId, bidsectionId, projectIdInt)
+
 	c.Ctx.JSON(iris.Map{
-		"code": 0,
-		"msg":  "操作成功",
+		"code":    0,
+		"msg":     "操作成功",
+		"section": sectionDetail,
 	})
 }
 
@@ -91,9 +97,16 @@ func (c *ContractApi) PostSectionSerial() {
 		c.Ctx.JSON(iris.Map{"code": -1, "msg": fmt.Sprintf("%s", err)})
 		return
 	}
+
+	//2.请求当前项目信息
+	// 1.验证项目节ID
+	treeId, _ := utils.GetDecryptId(sectionData.Id)
+	sectionDetail := c.ServiceContract.Get(treeId, bidsectionId, projectIdInt)
+
 	c.Ctx.JSON(iris.Map{
-		"code": 0,
-		"msg":  "操作成功",
+		"code":    0,
+		"msg":     "操作成功",
+		"section": sectionDetail,
 	})
 }
 
@@ -132,9 +145,16 @@ func (c *ContractApi) PostSectionSerialUpdate() {
 		c.Ctx.JSON(iris.Map{"code": -1, "msg": fmt.Sprintf("%s", err)})
 		return
 	}
+
+	//2.请求当前项目信息
+	// 1.验证项目节ID
+	treeId, _ := utils.GetDecryptId(sectionData.Id)
+	sectionDetail := c.ServiceContract.Get(treeId, bidsectionId, projectIdInt)
+
 	c.Ctx.JSON(iris.Map{
-		"code": 0,
-		"msg":  "操作成功",
+		"code":    0,
+		"msg":     "操作成功",
+		"section": sectionDetail,
 	})
 }
 
@@ -265,7 +285,13 @@ func (c *ContractApi) PostSectionSave() {
 		c.Ctx.JSON(iris.Map{"code": -1, "msg": fmt.Sprintf("%s", err)})
 		return
 	}
-	c.Ctx.JSON(iris.Map{"code": 0, "msg": "修改成功"})
+
+	//2.请求当前项目信息
+	// 1.验证项目节ID
+	treeId, _ := utils.GetDecryptId(sectionData.Id)
+	sectionDetail := c.ServiceContract.Get(treeId, bidsectionId, projectIdInt)
+
+	c.Ctx.JSON(iris.Map{"code": 0, "msg": "修改成功", "section": sectionDetail})
 }
 
 // @Summary 删除 合同项目节

+ 3 - 0
web/viewmodels/contracts_return.go

@@ -22,6 +22,8 @@ type ContractsReturn struct {
 	Remarks    string `form:"remarks" json:"remarks" `
 	Annexes    int    `form:"annexes" json:"annexes" `
 	CreateTime string `form:"createTime" json:"createTime" `
+
+	Page int `form:"page" json:"page" `
 }
 
 // 验证方法
@@ -29,6 +31,7 @@ func (l ContractsReturn) Validate() error {
 	return validation.ValidateStruct(&l,
 		validation.Field(&l.ContractsId, validation.Required.Error("合同ID不能为空")),
 		validation.Field(&l.BidsectionId, validation.Required.Error("标段ID不能为空")),
+		validation.Field(&l.Page, validation.Required.Error("页数不能为空")),
 	)
 }