caipin 4 years ago
parent
commit
5b0ea2dd74
1 changed files with 19 additions and 5 deletions
  1. 19 5
      web/api/contract_api.go

+ 19 - 5
web/api/contract_api.go

@@ -193,7 +193,7 @@ func (c *ContractApi) GetIncome() {
 // @Success 200 {object} viewmodels.TreeSectionContract "{code:0成功,-1参数类错误,msg:错误信息}"
 // @Router /api/contract/income/create [post]
 func (c *ContractApi) PostIncomeCreate() {
-	// 获得模板号
+	// 验证参数
 	contractData, err := c.ServiceContract.ValidRuleContractAdd(c.Ctx)
 	if err != nil {
 		c.Ctx.JSON(iris.Map{"code": -1, "msg": fmt.Sprintf("%s", err)})
@@ -225,7 +225,17 @@ func (c *ContractApi) PostIncomeCreate() {
 		return
 	}
 
-	c.Ctx.JSON(iris.Map{"code": 0, "msg": "新增成功"})
+	// 获得项目节
+	sectionDetail := c.ServiceContract.Get(treeId, bidsectionId, projectIdInt)
+	// 合同ID
+	contractId, _ := utils.GetDecryptId(sectionDetail.ContractId)
+	contractDetail := c.ServiceContract.GetContract(contractId)
+
+	c.Ctx.JSON(iris.Map{
+		"code":     0,
+		"msg":      "新增成功",
+		"contract": contractDetail,
+	})
 }
 
 // @Summary 编辑合同
@@ -284,11 +294,15 @@ func (c *ContractApi) PostIncomeUpdate() {
 	//2.请求当前项目信息
 	// 1.验证项目节ID
 	sectionDetail := c.ServiceContract.Get(treeId, bidsectionId, projectIdInt)
+	// 合同ID
+	contractId, _ := utils.GetDecryptId(sectionDetail.ContractId)
+	contractDetail := c.ServiceContract.GetContract(contractId)
 
 	c.Ctx.JSON(iris.Map{
-		"code":    0,
-		"msg":     "编辑成功",
-		"section": sectionDetail,
+		"code":     0,
+		"msg":      "编辑成功",
+		"section":  sectionDetail,
+		"contract": contractDetail,
 	})
 }