From d5785f7ecec215960c4d100bf129e1abeca9d5cb Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期二, 30 七月 2024 20:11:03 +0800
Subject: [PATCH] 位置报表多单位使用动态表头及相应数据调整(数据使用存储的多单位数据,并展示在对应单位下面)

---
 service/more_units.go |   13 +++----------
 1 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/service/more_units.go b/service/more_units.go
index 7343b9b..6982f4e 100644
--- a/service/more_units.go
+++ b/service/more_units.go
@@ -67,17 +67,10 @@
 	return moreValueArr
 }
 
-func FillMoreUnitToExcel(amount decimal.Decimal, units []models.UnitItems, startIndex int, column int, f *excelize.File) {
-	columnStr := strconv.Itoa(column)
+func FillMoreUnitToExcel(units []models.UnitItems, startIndex int, row int, unitIndexMap map[string]int, f *excelize.File) {
+	rowStr := strconv.Itoa(row)
 	for _, v := range units {
-		switch v.Unit {
-		case "鍖�":
-			f.SetCellValue("Sheet1", getColumnAlphabet(startIndex)+columnStr, v.Amount.Mul(amount))
-		case "绫�":
-			f.SetCellValue("Sheet1", getColumnAlphabet(startIndex+1)+columnStr, v.Amount.Mul(amount))
-		case "閲嶉噺":
-			f.SetCellValue("Sheet1", getColumnAlphabet(startIndex+2)+columnStr, v.Amount.Mul(amount))
-		}
+		f.SetCellValue("Sheet1", getColumnAlphabet(startIndex+unitIndexMap[v.Unit])+rowStr, v.Amount)
 	}
 	return
 }

--
Gitblit v1.8.0