fix 前端通用下载方法
This commit is contained in:
parent
429f12ef01
commit
e2031a2377
@ -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);
|
||||||
|
|||||||
@ -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 )
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user