Explorar el Código

fix:同步修改Bi审批流关联的分类

zqbao hace 5 meses
padre
commit
e6aa71f212

+ 15 - 10
controllers/bi_dashboard.go

@@ -770,6 +770,12 @@ func (this *BIDaShboardController) EditDashboardClassify() {
 		br.ErrMsg = "编辑失败,Err:" + err.Error()
 		return
 	}
+	err = biapproveSerice.ModifyBiApproveFlowClassify(req.BiDashboardClassifyId, req.ClassifyName)
+	if err != nil {
+		br.Msg = "编辑失败"
+		br.ErrMsg = "编辑失败,Err:" + err.Error()
+		return
+	}
 
 	br.Ret = 200
 	br.Success = true
@@ -1231,9 +1237,9 @@ func (this *BIDaShboardController) HomePage() {
 
 	if item.BiDashboardHomePageId == 0 && len(publicList) > 0 {
 		item = &bi_dashboard.BiDashboardHomePage{
-			AdminId:               publicList[0].SysAdminId,
-			BiDashboardId:         publicList[0].BiDashboardId,
-			FromType:              3,
+			AdminId:       publicList[0].SysAdminId,
+			BiDashboardId: publicList[0].BiDashboardId,
+			FromType:      3,
 		}
 	}
 
@@ -1280,11 +1286,11 @@ func (this *BIDaShboardController) HomePageSave() {
 	}
 
 	homePageItem := &bi_dashboard.BiDashboardHomePage{
-		BiDashboardId:         req.BiDashboardId,
-		AdminId:               this.SysUser.AdminId,
-		CreateTime:            time.Now(),
-		ModifyTime:            time.Now(),
-		FromType:              req.FromType,
+		BiDashboardId: req.BiDashboardId,
+		AdminId:       this.SysUser.AdminId,
+		CreateTime:    time.Now(),
+		ModifyTime:    time.Now(),
+		FromType:      req.FromType,
 	}
 
 	if item.BiDashboardHomePageId > 0 {
@@ -1304,7 +1310,6 @@ func (this *BIDaShboardController) HomePageSave() {
 	return
 }
 
-
 // Editing
 // @Title 标记/查询编辑状态
 // @Description 标记/查询编辑状态
@@ -1354,4 +1359,4 @@ func (this *BIDaShboardController) Editing() {
 	br.Ret = 200
 	br.Success = true
 	br.Msg = "操作成功"
-}
+}

+ 6 - 0
models/bi_approve/bi_approve_flow.go

@@ -177,3 +177,9 @@ func GetBiApproveFlowCountByCondition(condition string, pars []interface{}) (cou
 	err = o.Raw(sql, pars...).Scan(&count).Error
 	return
 }
+
+func UpdateFlowClassifyName(classifyId int, classifyName string) (err error) {
+	o := global.DmSQL["rddp"]
+	err = o.Model(&BiApproveFlow{}).Where("classify_id = ?", classifyId).Update("classify_name", classifyName).Error
+	return
+}

+ 15 - 0
services/bi_approve/bi_approve_flow.go

@@ -241,3 +241,18 @@ func FormatFlowAndNodesItem2Detail(flowItem *biapprove.BiApproveFlow, nodeItems
 	}
 	return
 }
+
+func ModifyBiApproveFlowClassify(classifyId int, classifyName string) (err error) {
+	flow, err := biapprove.GetBiApproveFlowByClassifyId(classifyId)
+	if err != nil && !utils.IsErrNoRow(err) {
+		return
+	}
+	if utils.IsErrNoRow(err) {
+		err = nil
+		return
+	}
+	if classifyName != "" && flow.ClassifyName != classifyName {
+		err = biapprove.UpdateFlowClassifyName(classifyId, classifyName)
+	}
+	return
+}