Ver Fonte

后端: 日常评价企管法规处评价可编辑保存

baichengfei há 4 anos atrás
pai
commit
af8a92f633

+ 63 - 2
src/dashoo.cn/backend/api/controllers/oilcontract/contractReview.go

@@ -383,7 +383,7 @@ func If(condition bool, trueVal, falseVal interface{}) interface{} {
 }
 
 // @Title 添加
-// @Description 二级科室保存评价
+// @Description 业务处室保存评价
 // @Param 	body body contractReview.OilContractReviewWorkFlow
 // @Success	200	{object} controllers.Request
 // @router /save-sec-evaluation/:id [post]
@@ -438,6 +438,67 @@ func (this *OilContractReviewController) SaveEvaluationItemsBySec() {
 	}
 }
 
+// @Title 修改实体
+// @Description 企管法规处修改二级单位的评价内容
+// @Param 	body body contractReview.OilContractReviewWorkFlow
+// @Success	200	{object} controllers.Request
+// @router /prof-update/:id [post]
+func (this *OilContractReviewController) ProfUpdateSecEvaEntity() {
+	id := this.Ctx.Input.Param(":id")
+	var errinfo ErrorInfo
+	if id == "" {
+		errinfo.Message = "操作失败!请求信息不完整"
+		errinfo.Code = -2
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+		return
+	}
+
+	var modeVO contractReview.OilContractReviewVo
+	itemSvc := contractEvaluationItems.GetOilContractEvaluationItemsService(utils.DBE)
+	var jsonBlob = this.Ctx.Input.RequestBody
+	json.Unmarshal(jsonBlob, &modeVO)
+
+	where := "ContentReviewId=" + id + " AND Category = 0 "
+	// 清除掉之前的
+	itemSvc.DeleteEntityBytbl(OilContractEvaluationItemsName, where)
+
+	var items []contractEvaluationItems.OilContractEvaluationItems
+	// 新增配置项
+	for i, v := range modeVO.Items {
+		fmt.Print(i)
+		var temp contractEvaluationItems.OilContractEvaluationItems
+		temp.ContentReviewId, _ = strconv.Atoi(id)
+		temp.Type = v.Category //v.Type
+		temp.ItemId = v.Id
+		temp.Category = 0
+		temp.ParentId = v.ParentId
+		temp.SequenceNo = v.SequenceNo
+		temp.Content = v.Content
+		temp.NormalScore = v.NormalScore
+		temp.Score = v.Score
+		temp.Value = v.Value
+		temp.LevelCode = v.LevelCode
+		temp.Remark = v.Remark
+		temp.Content = v.Content
+		items = append(items, temp)
+	}
+
+	_, err := itemSvc.DBE.Insert(items)
+
+	if err == nil {
+		errinfo.Message = "修改成功!"
+		errinfo.Code = 0
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+	} else {
+		errinfo.Message = "修改失败!" + utils.AlertProcess(err.Error())
+		errinfo.Code = -1
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+	}
+}
+
 // @Title 修改实体
 // @Description 修改实体
 // @Param 	body body contractReview.OilContractReviewWorkFlow
@@ -604,7 +665,7 @@ func (this *OilContractReviewController) DeleteEntity() {
 	whereAudit := "AuditStepCode='PROF_REGULATION'"
 	orgSvc.GetEntity(&setting, whereAudit)
 	res := orgSvc.UserInRoleById(this.User.Id, strconv.Itoa(setting.RoleId))
-	if model.Status == "8" && !res{
+	if model.Status == "8" && !res {
 		errinfo.Message = "无权删除!"
 		errinfo.Code = -1
 		this.Data["json"] = &errinfo