正在显示
3 个修改的文件
包含
3 行增加
和
8 行删除
@@ -413,12 +413,6 @@ func (c *AuditController) ChanceDataExcel() { | @@ -413,12 +413,6 @@ func (c *AuditController) ChanceDataExcel() { | ||
413 | xlsMaker := exceltool.NewExcelMaker() | 413 | xlsMaker := exceltool.NewExcelMaker() |
414 | xlsMaker.SetListHead(excelHead) | 414 | xlsMaker.SetListHead(excelHead) |
415 | xlsMaker.MakeListExcelForBeego(sourceData) | 415 | xlsMaker.MakeListExcelForBeego(sourceData) |
416 | - err = xlsMaker.Xlsx.Write(c.Ctx.Output.Context.ResponseWriter) | ||
417 | - if err != nil { | ||
418 | - msg = protocol.BadRequestParam("1") | ||
419 | - c.ResposeJson(msg) | ||
420 | - return | ||
421 | - } | ||
422 | c.ResponseExcelByFile(c.Ctx, xlsMaker) | 416 | c.ResponseExcelByFile(c.Ctx, xlsMaker) |
423 | return | 417 | return |
424 | } | 418 | } |
@@ -108,7 +108,8 @@ func (this *BaseController) Valid(obj interface{}) (result bool, msg *protocol.R | @@ -108,7 +108,8 @@ func (this *BaseController) Valid(obj interface{}) (result bool, msg *protocol.R | ||
108 | } | 108 | } |
109 | 109 | ||
110 | func (this *BaseController) ResponseExcelByFile(ctx *context.Context, excelMaker *exceltool.ExcelMaker) error { | 110 | func (this *BaseController) ResponseExcelByFile(ctx *context.Context, excelMaker *exceltool.ExcelMaker) error { |
111 | - ctx.Output.Header("Content-Disposition", "attachment; filename="+excelMaker.GetFileName()) | 111 | + fname := excelMaker.GetFileName() |
112 | + ctx.Output.Header("Content-Disposition", "attachment; filename="+fname) | ||
112 | ctx.Output.Header("Content-Description", "File Transfer") | 113 | ctx.Output.Header("Content-Description", "File Transfer") |
113 | ctx.Output.Header("Content-Type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") | 114 | ctx.Output.Header("Content-Type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") |
114 | ctx.Output.Header("Content-Transfer-Encoding", "binary") | 115 | ctx.Output.Header("Content-Transfer-Encoding", "binary") |
@@ -75,7 +75,7 @@ func (e *ExcelMaker) MakeListExcel(sourData []map[string]string) (err error) { | @@ -75,7 +75,7 @@ func (e *ExcelMaker) MakeListExcel(sourData []map[string]string) (err error) { | ||
75 | e.Xlsx.SetCellStr("Sheet1", cellAlpha, sourData[key1][headEn[i]]) | 75 | e.Xlsx.SetCellStr("Sheet1", cellAlpha, sourData[key1][headEn[i]]) |
76 | } | 76 | } |
77 | } | 77 | } |
78 | - e.fileName = GetRandomString(8) + ".xlsx" | 78 | + e.SetFileName(GetRandomString(8) + ".xlsx") |
79 | return nil | 79 | return nil |
80 | } | 80 | } |
81 | 81 |
-
请 注册 或 登录 后发表评论