diff --git a/ZR.Admin.WebApi/Controllers/BaseController.cs b/ZR.Admin.WebApi/Controllers/BaseController.cs
index fe5f6131c2e86a7ec38397427f3dc54152673faf..840e8acb3295dec304961a25334a08f0588b5a79 100644
--- a/ZR.Admin.WebApi/Controllers/BaseController.cs
+++ b/ZR.Admin.WebApi/Controllers/BaseController.cs
@@ -1,5 +1,6 @@
using Infrastructure;
using Infrastructure.Model;
+using JinianNet.JNTemplate;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using MiniExcelLibs;
@@ -63,13 +64,11 @@ 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 });
+ //var stream = ff.File.OpenRead(path); //创建文件流
+ //return File(stream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", HttpUtility.UrlEncode(fileName));
}
-
+
#region 方法
///
@@ -138,11 +137,11 @@ namespace ZR.Admin.WebApi.Controllers
IWebHostEnvironment webHostEnvironment = (IWebHostEnvironment)App.ServiceProvider.GetService(typeof(IWebHostEnvironment));
string sFileName = $"{fileName}{DateTime.Now:MM-dd-HHmmss}.xlsx";
string fullPath = Path.Combine(webHostEnvironment.WebRootPath, "export", sFileName);
-
+
Directory.CreateDirectory(Path.GetDirectoryName(fullPath));
MiniExcel.SaveAs(fullPath, list, sheetName: sheetName);
- return (sFileName, fullPath);
+ return (sFileName, "/export/" + sFileName);
}
///
@@ -176,7 +175,7 @@ namespace ZR.Admin.WebApi.Controllers
IWebHostEnvironment webHostEnvironment = (IWebHostEnvironment)App.ServiceProvider.GetService(typeof(IWebHostEnvironment));
string sFileName = $"{fileName}模板.xlsx";
string newFileName = Path.Combine(webHostEnvironment.WebRootPath, "importTemplate", sFileName);
-
+
if (!Directory.Exists(newFileName))
{
Directory.CreateDirectory(Path.GetDirectoryName(newFileName));
diff --git a/ZR.Admin.WebApi/appsettings.json b/ZR.Admin.WebApi/appsettings.json
index a68645112199d0442fef8e57edf711182e7ad18f..280a3aebe69170c295fc62f49b5c209917e75822 100644
--- a/ZR.Admin.WebApi/appsettings.json
+++ b/ZR.Admin.WebApi/appsettings.json
@@ -7,7 +7,7 @@
}
},
"ConnectionStrings": {
- "conn_db": "Data Source=LAPTOP-STKF2M8H\\SQLEXPRESS;User ID=sa;Password=zradmin123;Initial Catalog=ZrAdmin;Integrated Security=SSPI", //其他连接字符串请看官方文档
+ "conn_db": "data source=.;initial catalog=zradmindev;integrated security=True;MultipleActiveResultSets=True;", //其他连接字符串请看官方文档
"conn_db_type": "1" //数据库类型 MySql = 0, SqlServer = 1, Oracle = 3
},
"urls": "http://localhost:8888", //项目启动url,如果改动端口前端对应devServer也需要进行修改
@@ -43,7 +43,7 @@
"SendUser": "@all"
},
"gen": {
- "conn": "Data Source=LAPTOP-STKF2M8H\\SQLEXPRESS;User ID=sa;Password=zradmin123;Initial Catalog=ZrAdmin;Integrated Security=SSPI",
+ "conn": "data source=.;initial catalog=zradmindev;integrated security=True;MultipleActiveResultSets=True;",
"dbType": 1, //MySql = 0, SqlServer = 1
"autoPre": true, //自动去除表前缀
"author": "admin",
diff --git a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVue.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVue.txt
index f4f5d5aca4b279df7ac6c05da99049abe948829b..859c2def0159dcf88cab47e9fd1b6e2afcc9151f 100644
--- a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVue.txt
+++ b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVue.txt
@@ -77,6 +77,7 @@ $end