diff --git a/.gitignore b/.gitignore index 91c5d327fb3cb2ecc8a49c66640e148c679055ed..e8d8005c24a96ea486c4605330c9834efb5d6124 100644 --- a/.gitignore +++ b/.gitignore @@ -271,3 +271,4 @@ __pycache__/ /ZR.Admin.WebApi/DataProtection /Quartz.NET.WindowsService /ZRAdmin-vue +/ZR.Admin.WebApi/appsettings.Development.json diff --git a/ZR.Admin.WebApi/Controllers/BaseController.cs b/ZR.Admin.WebApi/Controllers/BaseController.cs index fe5f6131c2e86a7ec38397427f3dc54152673faf..b85b3048be12bea13a3ea624c6a3d6e736e1b33b 100644 --- a/ZR.Admin.WebApi/Controllers/BaseController.cs +++ b/ZR.Admin.WebApi/Controllers/BaseController.cs @@ -63,11 +63,7 @@ namespace ZR.Admin.WebApi.Controllers /// protected IActionResult ExportExcel(string path, string fileName) { - //IWebHostEnvironment webHostEnvironment = (IWebHostEnvironment)App.ServiceProvider.GetService(typeof(IWebHostEnvironment)); - //string fileDir = Path.Combine(webHostEnvironment.WebRootPath, path, fileName); - - var stream = ff.File.OpenRead(path); //创建文件流 - return File(stream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", HttpUtility.UrlEncode(fileName)); + return SUCCESS(new { path = path, fileName = fileName }); } #region 方法 @@ -142,7 +138,7 @@ namespace ZR.Admin.WebApi.Controllers Directory.CreateDirectory(Path.GetDirectoryName(fullPath)); MiniExcel.SaveAs(fullPath, list, sheetName: sheetName); - return (sFileName, fullPath); + return (sFileName, "/export/" + sFileName); } /// @@ -160,7 +156,7 @@ namespace ZR.Admin.WebApi.Controllers Directory.CreateDirectory(Path.GetDirectoryName(fullPath)); MiniExcel.SaveAs(fullPath, sheets); - return (sFileName, fullPath); + return (sFileName, "/export/" + sFileName); } /// diff --git a/ZR.Admin.WebApi/Properties/launchSettings.json b/ZR.Admin.WebApi/Properties/launchSettings.json index a3bb2fda73711c84d7bfb70a70a261e3b7c99608..16b84cad979dbbfa371cc094aa75679bdc1cd2e9 100644 --- a/ZR.Admin.WebApi/Properties/launchSettings.json +++ b/ZR.Admin.WebApi/Properties/launchSettings.json @@ -1,4 +1,14 @@ -{ +{ + "profiles": { + "ZR.Admin.WebApi": { + "commandName": "Project", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "dotnetRunMessages": true, + "applicationUrl": "http://localhost:8888" + } + }, "$schema": "https://json.schemastore.org/launchsettings.json", "iisSettings": { "windowsAuthentication": false, @@ -7,16 +17,5 @@ "applicationUrl": "http://localhost:63521", "sslPort": 44395 } - }, - "profiles": { - "ZR.Admin.WebApi": { - "commandName": "Project", - "dotnetRunMessages": true, - "launchUrl": "", - "applicationUrl": "http://localhost:8888", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "" - } - } } -} +} \ No newline at end of file diff --git a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVue.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVue.txt index f4f5d5aca4b279df7ac6c05da99049abe948829b..9dddbd5764a9e090ff810fa0012dbc05bdcf041f 100644 --- a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVue.txt +++ b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVue.txt @@ -77,6 +77,7 @@ $end