fix 前端通用下载方法

This commit is contained in:
不做码农 2022-04-15 17:07:35 +08:00
parent 429f12ef01
commit e2031a2377
2 changed files with 4 additions and 4 deletions

View File

@ -8,7 +8,6 @@ using OfficeOpenXml;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using ZR.Admin.WebApi.Filters;
namespace ZR.Admin.WebApi.Controllers namespace ZR.Admin.WebApi.Controllers
{ {
@ -157,7 +156,8 @@ namespace ZR.Admin.WebApi.Controllers
{ {
// 添加worksheet // 添加worksheet
ExcelWorksheet worksheet = package.Workbook.Worksheets.Add(fileName); ExcelWorksheet worksheet = package.Workbook.Worksheets.Add(fileName);
//单元格自动适应大小
worksheet.Cells.Style.ShrinkToFit = true;
//全部字段导出 //全部字段导出
worksheet.Cells.LoadFromCollection(list, true, OfficeOpenXml.Table.TableStyles.Light13); worksheet.Cells.LoadFromCollection(list, true, OfficeOpenXml.Table.TableStyles.Light13);
package.SaveAs(stream); package.SaveAs(stream);

View File

@ -135,10 +135,10 @@ export function showColumn(columns, value) {
} }
// 通用下载方法 // 通用下载方法
export function download(fileName) { export function download(url, fileName) {
// window.location.href = baseURL + "/common/download?fileName=" + encodeURI(fileName) + "&delete=" + true; // window.location.href = baseURL + "/common/download?fileName=" + encodeURI(fileName) + "&delete=" + true;
// window.open(baseURL + "/common/download?fileName=" + encodeURI(fileName) + "&delete=" + true) // window.open(baseURL + "/common/download?fileName=" + encodeURI(fileName) + "&delete=" + true)
window.open(baseURL + fileName) window.open(baseURL + url)
} }
// 字符串格式化(%s ) // 字符串格式化(%s )