From bc4e1b4bd792936465b23dffeebbc114f3ae3ac8 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Sat, 23 Sep 2023 18:43:06 +0800 Subject: [PATCH] update --- app/admin/svc/svc_data_statisstics.go | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/app/admin/svc/svc_data_statisstics.go b/app/admin/svc/svc_data_statisstics.go index 0b69e24..389112f 100644 --- a/app/admin/svc/svc_data_statisstics.go +++ b/app/admin/svc/svc_data_statisstics.go @@ -1506,6 +1506,9 @@ func CentralKitchenForSchoolDataStatisticsContrast(req md.CentralKitchenForSchoo for k1, v1 := range list { tmpFileName := k1 + "数据对比_" + utils.Int64ToStr(now.UnixMilli()) + ".xlsx" tmpDownloadPath := "./static/export/central_kitchen_for_school/" + tmpFileName + startDate, _ := time.ParseInLocation("2006-01-02 15:04:05", req.Date1[0], time.Local) + endDate, _ := time.ParseInLocation("2006-01-02 15:04:05", req.Date2[0], time.Local) + for k2, v2 := range v1 { if k2 == "" { //若年级为空,则为教师 @@ -1513,9 +1516,21 @@ func CentralKitchenForSchoolDataStatisticsContrast(req md.CentralKitchenForSchoo } for k3, v3 := range v2 { - titleList = []string{"姓名", "家长联系电话"} xlsx.NewSheet(k3) + titleList = []string{startDate.Format("2006-01") + "~~" + endDate.Format("2006-01") + " [" + k1 + ", " + k3 + "] 班级明细"} xlsx.SetSheetRow(k3, "A1", &titleList) + titleList = []string{"姓名", "家长联系电话"} + xlsx.SetSheetRow(k3, "A2", &titleList) + xlsx.MergeCell(k3, "A1", "B1") //合并单元格 + style, err := xlsx.NewStyle(`{"fill":{"type":"pattern","color":["FFFF00"],"pattern":1}, "alignment":{"horizontal":"center"}}`) + if err != nil { + logx.Error(err) + println("<<<>>>>Error:::", err.Error()) + panic(err) + } + xlsx.SetCellStyle(k3, "A1", "B1", style) + xlsx.SetColWidth(k3, "A", "B", 20) + j := 2 //表头被第一行用了,只能从第二行开始 for k4, v4 := range v3 { //TODO::判断当前用户是否在新的月份里面