From e195ec19cd5735c6e925495464fab1c93405cdcd Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Fri, 22 Sep 2023 21:34:13 +0800 Subject: [PATCH] update --- app/admin/svc/svc_data_statisstics.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/admin/svc/svc_data_statisstics.go b/app/admin/svc/svc_data_statisstics.go index d73753e..9da075e 100644 --- a/app/admin/svc/svc_data_statisstics.go +++ b/app/admin/svc/svc_data_statisstics.go @@ -671,8 +671,8 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD 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", req.StartDate, time.Local) - endDate, _ := time.ParseInLocation("2006-01-02", req.EndDate, time.Local) + startDate, _ := time.ParseInLocation("2006-01-02 15:04:05", req.StartDate, time.Local) + endDate, _ := time.ParseInLocation("2006-01-02 15:04:05", req.EndDate, time.Local) titleList = []string{startDate.Format("2006-01-02") + "~~" + endDate.Format("2006-01-02") + " (" + k1 + ") "} xlsx.SetSheetRow("Sheet1", "A1", &titleList) titleList = []string{"年级", "班级", "早餐", "午餐", "晚餐"} @@ -685,6 +685,9 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD panic(err) } xlsx.SetCellStyle("Sheet1", "A1", "E1", style) + style, err = xlsx.NewStyle(`{"alignment":{"horizontal":"center"}}`) + xlsx.SetCellStyle("Sheet1", "A1", "E1", style) + xlsx.SetColWidth("Sheet1", "A", "E", 20) j := 3 //表头前两行用了,只能从第三行开始