2 Komitmen ca6bc89b98 ... 3a0ca53bf6

Pembuat SHA1 Pesan Tanggal
  xiziwen 3a0ca53bf6 Merge branch 'small_291' into debug 2 hari lalu
  xiziwen b5dadf7e88 三级审批人 2 hari lalu
2 mengubah file dengan 44 tambahan dan 22 penghapusan
  1. 42 22
      controllers/seal/seal_approval.go
  2. 2 0
      models/seal/seal.go

+ 42 - 22
controllers/seal/seal_approval.go

@@ -282,33 +282,45 @@ func ApprovalListExport(this *SealApprovalController, condition, joinCondition s
 						keySort = append(keySort, approvalRecord.NodeId)
 					}
 				}
-				for ii, key := range keySort {
-					if ii == 0 {
-						if node, ok := flowNodeMap[key]; ok {
-							for _, vv := range node {
-								if vv.NodeType == "check" {
-									list[i].FirstLevelApprovers += vv.ApproveUserName + ","
-								}
+				approversList := make([][]string, 0)
+				ccList := make([][]string, 0)
+				for _, key := range keySort {
+					approver := make([]string, 0)
+					cc := make([]string, 0)
+					if node, ok := flowNodeMap[key]; ok {
+						for _, vv := range node {
+							if vv.NodeType == "check" {
+								approver = append(approver, vv.ApproveUserName)
+							} else if vv.NodeType == "cc" {
+								cc = append(cc, vv.ApproveUserName)
 							}
 						}
-					} else {
-						if node, ok := flowNodeMap[key]; ok {
-							for _, vv := range node {
-								if vv.NodeType == "check" {
-									list[i].SecondLevelApprovers += vv.ApproveUserName + ","
-								} else if vv.NodeType == "cc"  && list[i].FirstLevelCC == "" {
-									list[i].FirstLevelCC += vv.ApproveUserName + ","
-								} else {
-									list[i].SecondLevelCC += vv.ApproveUserName + ","
-								}
-							}
+						if len(approver) > 0 {
+							approversList = append(approversList, approver)
+						}
+						if len(cc) > 0 {
+							ccList = append(ccList, cc)
 						}
 					}
 				}
-				list[i].FirstLevelApprovers = strings.TrimRight(list[i].FirstLevelApprovers, ",")
-				list[i].FirstLevelCC = strings.TrimRight(list[i].FirstLevelCC, ",")
-				list[i].SecondLevelApprovers = strings.TrimRight(list[i].SecondLevelApprovers, ",")
-				list[i].SecondLevelCC = strings.TrimRight(list[i].SecondLevelCC, ",")
+				if len(approversList) > 0 {
+					list[i].FirstLevelApprovers = strings.Join(approversList[0], ",")
+				}
+				if len(ccList) > 0 {
+					list[i].FirstLevelCC = strings.Join(ccList[0], ",")
+				}
+				if len(approversList) > 1 {
+					list[i].SecondLevelApprovers = strings.Join(approversList[1], ",")
+				}
+				if len(ccList) > 1 {
+					list[i].SecondLevelCC = strings.Join(ccList[1], ",")
+				}
+				if len(approversList) > 2 {
+					list[i].ThirdLevelApprovers = strings.Join(approversList[2], ",")
+				}
+				if len(ccList) > 2 {
+					list[i].ThirdLevelCC = strings.Join(ccList[2], ",")
+				}
 			}
 		}
 	}
@@ -368,6 +380,10 @@ func ApprovalListExport(this *SealApprovalController, condition, joinCondition s
 	cellM.Value = "二级审批人"
 	cellN := rowTitle.AddCell()
 	cellN.Value = "二级抄送人"
+	cellO := rowTitle.AddCell()
+	cellO.Value = "三级审批人"
+	cellP := rowTitle.AddCell()
+	cellP.Value = "三级抄送人"
 
 	for _, v := range list {
 		row := sheet.AddRow()
@@ -399,6 +415,10 @@ func ApprovalListExport(this *SealApprovalController, condition, joinCondition s
 		cellM.Value = v.SecondLevelApprovers
 		cellN := row.AddCell()
 		cellN.Value = v.SecondLevelCC
+		cellO := row.AddCell()
+		cellO.Value = v.ThirdLevelApprovers
+		cellP := row.AddCell()
+		cellP.Value = v.ThirdLevelCC
 	}
 
 	err = xlsxFile.Save(downLoadnFilePath)

+ 2 - 0
models/seal/seal.go

@@ -259,8 +259,10 @@ type SealApprovaExportlItem struct {
 	AffiliatedCompany    string    `description:"归属公司"`
 	FirstLevelApprovers  string    `description:"一级审批人"`
 	SecondLevelApprovers string    `description:"二级审批人"`
+	ThirdLevelApprovers  string    `description:"三级审批人"`
 	FirstLevelCC         string    `description:"一级抄送人"`
 	SecondLevelCC        string    `description:"二级抄送人"`
+	ThirdLevelCC         string    `description:"三级抄送人"`
 }
 
 // GetSealApprovalList 获取用印审批列表