|
|
@@ -416,6 +416,58 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers |
|
|
|
return Success("操作成功!"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// 导出列表 |
|
|
|
/// </summary> |
|
|
|
/// <returns></returns> |
|
|
|
[HttpPost, ValidateInput(false)] |
|
|
|
public ActionResult ExportInputScoreList(string headdata,string rowdata) |
|
|
|
{ |
|
|
|
var headData = JsonConvert.DeserializeObject<List<colModel>>(headdata); |
|
|
|
var rowData = JsonConvert.DeserializeObject<List<List<colModel>>>(rowdata); |
|
|
|
|
|
|
|
var result = new List<Dictionary<string, string>>(); |
|
|
|
foreach (var item in rowData) |
|
|
|
{ |
|
|
|
var aaa = new Dictionary<string, string>(); |
|
|
|
foreach (var i in item) |
|
|
|
{ |
|
|
|
aaa.Add(i.label, i.name); |
|
|
|
} |
|
|
|
|
|
|
|
result.Add(aaa); |
|
|
|
} |
|
|
|
var resultStr = JsonConvert.SerializeObject(result); |
|
|
|
|
|
|
|
//成绩源 |
|
|
|
var exportTable = resultStr.ToTable(); |
|
|
|
//设置导出格式 |
|
|
|
ExcelConfig excelconfig = new ExcelConfig(); |
|
|
|
excelconfig.Title = "全员补考成绩管理"; |
|
|
|
excelconfig.TitleFont = "微软雅黑"; |
|
|
|
excelconfig.TitlePoint = 20; |
|
|
|
excelconfig.FileName = "全员补考成绩管理.xls"; |
|
|
|
excelconfig.IsAllSizeColumn = true; |
|
|
|
//每一列的设置,没有设置的列信息,系统将按datatable中的列名导出 |
|
|
|
excelconfig.ColumnEntity = new List<ColumnModel>(); |
|
|
|
foreach (var item in headData) |
|
|
|
{ |
|
|
|
excelconfig.ColumnEntity.Add(new ColumnModel() { Column = item.name, ExcelColumn = item.label }); |
|
|
|
} |
|
|
|
|
|
|
|
//调用导出方法 |
|
|
|
ExcelHelper.ExcelDownload(exportTable, excelconfig); |
|
|
|
|
|
|
|
return Success("导出成功!"); |
|
|
|
} |
|
|
|
/// <summary> |
|
|
|
/// 列 |
|
|
|
/// </summary> |
|
|
|
public class colModel { |
|
|
|
public string label { get; set; } |
|
|
|
public string name { get; set; } |
|
|
|
} |
|
|
|
#endregion |
|
|
|
} |
|
|
|
} |