VueWebCoreApi/Controllers/ImportExcelController.cs
@@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Data;
@@ -18,6 +19,12 @@
    //[ChannelActionFilter]
    public class ImportExcelController : Controller
    {
        private readonly IWebHostEnvironment _hostingEnvironment;
        public ImportExcelController(IWebHostEnvironment hostingEnvironment)
        {
            _hostingEnvironment = hostingEnvironment;
        }
        #region[Excel导入模板列表]
        /// <summary>
@@ -55,6 +62,33 @@
            mes.code = "200";
            mes.data = msg;
            return Json(mes);
            //ToMessage mes = new ToMessage();
            //List<ScoreReport> list = ExcelList.ExcelData();
            //list = list.Where(s => s.FileCode == FileCode).ToList();
            //var filename = list[0].FileName + ".xls";
            //var wwwRootPath = _hostingEnvironment.WebRootPath;
            //var fileDirectory = Path.Combine(wwwRootPath, "Excel"); // 替换为您的Excel文件所在目录
            //var filePath = Path.Combine(fileDirectory, $"{filename}.xlsx"); // 假设文件名编码为文件名
            //if (System.IO.File.Exists(filePath))
            //{
            //    var fileInfo = new FileInfo(filePath);
            //    var result = new
            //    {
            //        FileName = fileInfo.Name,
            //        FilePath = filePath,
            //        FileSize = fileInfo.Length
            //    };
            //    return Json(result);
            //}
            //else
            //{
            //    mes.code = "300";
            //    mes.data = "";
            //    mes.message = "文件不存在";
            //}
            //return Json(mes);
        }
        #endregion