Procházet zdrojové kódy

update

consumeLimit
DengBiao před 1 rokem
rodič
revize
b297dd2103
1 změnil soubory, kde provedl 12 přidání a 8 odebrání
  1. +12
    -8
      app/admin/svc/svc_data_statisstics.go

+ 12
- 8
app/admin/svc/svc_data_statisstics.go Zobrazit soubor

@@ -659,27 +659,31 @@ func SelfSupportForSchoolDataStatisticsExport(req md.SelfSupportForSchoolDataSta
totalData[k2]["amount"] = sumAmount
}

xlsx.NewSheet("Sheet1")
xlsx.NewSheet("所有档口")
titleList = []string{" 设 备 分 餐 数 据 统 计 表 "}
xlsx.SetSheetRow("Sheet1", "A1", &titleList)
xlsx.SetSheetRow("所有档口", "A1", &titleList)
titleList = []string{"名 称", "消费笔数", "消费金额"}
xlsx.SetSheetRow("Sheet1", "A2", &titleList)
xlsx.SetSheetRow("所有档口", "A2", &titleList)
style, err := xlsx.NewStyle(`{"fill":{"type":"pattern","color":["FFFF00"],"pattern":1}, "alignment":{"horizontal":"center"}}`)
if err != nil {
logx.Error(err)
println("<<<<SelfSupportForSchoolDataStatisticsExport4>>>>>Error:::", err.Error())
panic(err)
}
xlsx.MergeCell("Sheet1", "A1", "C1") //合并单元格
xlsx.SetCellStyle("Sheet1", "A1", "C1", style)
xlsx.SetColWidth("Sheet1", "A", "C", 20)
xlsx.MergeCell("所有档口", "A1", "C1") //合并单元格
xlsx.SetCellStyle("所有档口", "A1", "C1", style)
xlsx.SetColWidth("所有档口", "A", "C", 20)
j := 3 //表头前两行用了,只能从第三行开始
var totalNum, totalAmount float64
for key, val := range totalData {
xlsx.SetSheetRow("Sheet1", "A"+strconv.Itoa(j), &[]interface{}{key, val["num"], val["amount"]})
totalNum += val["num"]
totalAmount += val["amount"]
xlsx.SetSheetRow("所有档口", "A"+strconv.Itoa(j), &[]interface{}{key, val["num"], val["amount"]})
j++
}
xlsx.SetSheetRow("所有档口", "A"+strconv.Itoa(j), &[]interface{}{"合计", totalNum, totalAmount})

//xlsx.DeleteSheet("Sheet1") //TODO::只能放这里删除
xlsx.DeleteSheet("Sheet1") //TODO::只能放这里删除
//将文件保存至服务器
err1 := xlsx.SaveAs(tmpDownloadPath)
if err1 != nil {


Načítá se…
Zrušit
Uložit