浏览代码

fix:研报审批详情

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

+ 45 - 18
controllers/report_approve/report_approve.go

@@ -626,26 +626,53 @@ func (this *ReportApproveController) Detail() {
 	detail.Report.ReportLayout = 1
 
 	// 报告分类路由
-	if approveItem.ReportType == report_approve.FlowReportTypeChinese {
-		reportInfo, e := models.GetReportLayoutByReportId(approveItem.ReportId)
-		if e != nil {
-			br.Msg = "获取失败"
-			br.ErrMsg = "获取报告失败, Err: " + e.Error()
-			return
+	{
+		if approveItem.ReportType == report_approve.FlowReportTypeChinese {
+			reportInfo, e := models.GetReportLayoutByReportId(approveItem.ReportId)
+			if e != nil {
+				br.Msg = "获取失败"
+				br.ErrMsg = "获取报告失败, Err: " + e.Error()
+				return
+			}
+			detail.Report.ReportLayout = reportInfo.ReportLayout
+
+			detail.Report.ReportCode = utils.MD5(strconv.Itoa(approveItem.ReportId))
+		}
+		if approveItem.ReportType == report_approve.FlowReportTypeEnglish {
+			detail.Report.ReportCode = utils.MD5(strconv.Itoa(approveItem.ReportId))
+		}
+		if approveItem.ReportType == report_approve.FlowReportTypeSmart {
+			detail.Report.ReportLayout = 2
+			detail.Report.ReportCode = utils.MD5(fmt.Sprint("smart_", approveItem.ReportId))
 		}
-		detail.Report.ReportLayout = reportInfo.ReportLayout
 
-		detail.Report.ReportCode = utils.MD5(strconv.Itoa(approveItem.ReportId))
-		detail.Report.ReportClassify = fmt.Sprintf("%s/%s/%s", report_approve.FlowReportTypeMap[approveItem.ReportType], cnClassifyIdName[approveItem.ClassifyFirstId], cnClassifyIdName[approveItem.ClassifySecondId])
-	}
-	if approveItem.ReportType == report_approve.FlowReportTypeEnglish {
-		detail.Report.ReportCode = utils.MD5(strconv.Itoa(approveItem.ReportId))
-		detail.Report.ReportClassify = fmt.Sprintf("%s/%s/%s/%s", report_approve.FlowReportTypeMap[approveItem.ReportType], enClassifyIdName[enRootIdMap[approveItem.ClassifySecondId]], enClassifyIdName[approveItem.ClassifyFirstId], enClassifyIdName[approveItem.ClassifySecondId])
-	}
-	if approveItem.ReportType == report_approve.FlowReportTypeSmart {
-		detail.Report.ReportLayout = 2
-		detail.Report.ReportCode = utils.MD5(fmt.Sprint("smart_", approveItem.ReportId))
-		detail.Report.ReportClassify = fmt.Sprintf("%s/%s/%s", report_approve.FlowReportTypeMap[approveItem.ReportType], cnClassifyIdName[approveItem.ClassifyFirstId], cnClassifyIdName[approveItem.ClassifySecondId])
+		var classifyPath []string
+		if approveItem.ReportType > 0 {
+			classifyPath = append(classifyPath, report_approve.FlowReportTypeMap[approveItem.ReportType])
+		}
+		if approveItem.ReportType == report_approve.FlowReportTypeEnglish {
+			if approveItem.ClassifyFirstId > 0 {
+				classifyPath = append(classifyPath, enClassifyIdName[approveItem.ClassifyFirstId])
+			}
+			if approveItem.ClassifySecondId > 0 {
+				classifyPath = append(classifyPath, enClassifyIdName[approveItem.ClassifySecondId])
+			}
+			if approveItem.ClassifyThirdId > 0 {
+				classifyPath = append(classifyPath, enClassifyIdName[approveItem.ClassifyThirdId])
+			}
+			detail.Report.ReportClassify = strings.Join(classifyPath, "/")
+		} else {
+			if approveItem.ClassifyFirstId > 0 {
+				classifyPath = append(classifyPath, cnClassifyIdName[approveItem.ClassifyFirstId])
+			}
+			if approveItem.ClassifySecondId > 0 {
+				classifyPath = append(classifyPath, cnClassifyIdName[approveItem.ClassifySecondId])
+			}
+			if approveItem.ClassifyThirdId > 0 {
+				classifyPath = append(classifyPath, cnClassifyIdName[approveItem.ClassifyThirdId])
+			}
+			detail.Report.ReportClassify = strings.Join(classifyPath, "/")
+		}
 	}
 
 	br.Data = detail