浏览代码

fix:审批流研报类别显示错误

zqbao 5 月之前
父节点
当前提交
da1b228df3
共有 1 个文件被更改,包括 26 次插入6 次删除
  1. 26 6
      controllers/report_approve/report_approve_flow.go

+ 26 - 6
controllers/report_approve/report_approve_flow.go

@@ -8,10 +8,11 @@ import (
 	"eta/eta_api/services"
 	"eta/eta_api/utils"
 	"fmt"
-	"github.com/rdlucklib/rdluck_tools/paging"
 	"strings"
 	"sync"
 	"time"
+
+	"github.com/rdlucklib/rdluck_tools/paging"
 )
 
 // ReportApproveFlowController 报告审批流
@@ -141,16 +142,35 @@ func (this *ReportApproveFlowController) List() {
 	for _, v := range list {
 		t := report_approve.FormatReportApproveFlow2Item(v)
 		if v.ReportType == report_approve.FlowReportTypeEnglish {
-			t.ReportClassify = fmt.Sprintf("%s/%s/%s/%s", report_approve.FlowReportTypeMap[v.ReportType], enClassifyIdName[enRootIdMap[v.ClassifySecondId]], enClassifyIdName[v.ClassifyFirstId], enClassifyIdName[v.ClassifySecondId])
+			var classifyPath []string
+			if v.ReportType > 0 {
+				classifyPath = append(classifyPath, report_approve.FlowReportTypeMap[v.ReportType])
+			}
+			if v.ClassifyFirstId > 0 {
+				classifyPath = append(classifyPath, enClassifyIdName[v.ClassifyFirstId])
+			}
+			if v.ClassifySecondId > 0 {
+				classifyPath = append(classifyPath, enClassifyIdName[v.ClassifySecondId])
+			}
+			if v.ClassifyThirdId > 0 {
+				classifyPath = append(classifyPath, enClassifyIdName[v.ClassifyThirdId])
+			}
+			t.ReportClassify = strings.Join(classifyPath, "/")
 		} else {
-			reportClassify := fmt.Sprintf("%s/%s", report_approve.FlowReportTypeMap[v.ReportType], cnClassifyIdName[v.ClassifyFirstId])
+			var classifyPath []string
+			if v.ReportType > 0 {
+				classifyPath = append(classifyPath, report_approve.FlowReportTypeMap[v.ReportType])
+			}
+			if v.ClassifyFirstId > 0 {
+				classifyPath = append(classifyPath, cnClassifyIdName[v.ClassifyFirstId])
+			}
 			if v.ClassifySecondId > 0 {
-				reportClassify = fmt.Sprintf("%s/%s", reportClassify, cnClassifyIdName[v.ClassifySecondId])
+				classifyPath = append(classifyPath, cnClassifyIdName[v.ClassifySecondId])
 			}
 			if v.ClassifyThirdId > 0 {
-				reportClassify = fmt.Sprintf("%s/%s", reportClassify, cnClassifyIdName[v.ClassifyThirdId])
+				classifyPath = append(classifyPath, cnClassifyIdName[v.ClassifyThirdId])
 			}
-			t.ReportClassify = reportClassify
+			t.ReportClassify = strings.Join(classifyPath, "/")
 		}
 		resp.List = append(resp.List, t)
 	}