From 34de248a46755b2309f5ac8e95261c25fe1e210d Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期二, 30 七月 2024 19:12:47 +0800
Subject: [PATCH] 月度报表多单位使用动态表头及相应调整

---
 service/more_units.go |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/service/more_units.go b/service/more_units.go
index 1e01506..7343b9b 100644
--- a/service/more_units.go
+++ b/service/more_units.go
@@ -132,3 +132,18 @@
 	}
 	return f.NewStyle(style)
 }
+
+func GetAllUnits() (allUnits []string, unitIndexMap map[string]int) {
+	units, err := models.NewUnitDictSearch().FindNotTotal()
+	allUnits = make([]string, 0, len(units))
+	unitIndexMap = make(map[string]int)
+	if err != nil {
+		return
+	}
+
+	for k, v := range units {
+		allUnits = append(allUnits, v.Name)
+		unitIndexMap[v.Name] = k
+	}
+	return
+}

--
Gitblit v1.8.0