Skip to content

Commit 6a383af

Browse files
authored
Merge pull request #150 from dotnetcore/develop
release v2.4.2
2 parents fd3f5f8 + 42782ae commit 6a383af

41 files changed

Lines changed: 683 additions & 47 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
# 更新日志
22

33
## v3.0.x
4-
### v3.0.0 (2019-11-15)
5-
3.0版本正式发布,支持.netcore 3.0,包括2.x最新版本的所有功能
4+
5+
3.0版本正式发布,支持.netcore 3.0,与2.4.x最新版本在功能上同步更新
66

77
## v2.4.x
88

9-
### v2.4.1 (2019-11-15)
9+
### v2.4.2 (2019-11-22)
10+
11+
* **修改:** 修复Add-Migration报错的问题
12+
* **修改:** 修复刷新菜单无效的问题
13+
* **修改:** 修复无法添加多级菜单的问题
14+
* **修改:** 修复在导出时SearchMode仍然为Search的问题
15+
* **修改:** 修复权限控制无法识别中文url的问题
16+
17+
### v2.4.1 (2019-11-16)
1018

1119
* **修改:** 修复同时使用Cookie和jwt登陆时报错的bug(不建议混合两种模式)
1220

demo/WalkingTec.Mvvm.Demo/Controllers/MajorController.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,5 +197,15 @@ public ActionResult Import(MajorImportVM vm, IFormCollection nouse)
197197
}
198198
}
199199
#endregion
200+
201+
[ActionDescription("Export")]
202+
[HttpPost]
203+
public IActionResult ExportExcel(MajorListVM vm)
204+
{
205+
vm.SearcherMode = vm.Ids != null && vm.Ids.Count > 0 ? ListVMSearchModeEnum.CheckExport : ListVMSearchModeEnum.Export;
206+
var data = vm.GenerateExcel();
207+
return File(data, "application/vnd.ms-excel", $"Export_ActionLog_{DateTime.Now.ToString("yyyy-MM-dd")}.xls");
208+
}
209+
200210
}
201211
}

demo/WalkingTec.Mvvm.Demo/Controllers/MyUserController.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,5 +198,15 @@ public ActionResult Import(MyUserImportVM vm, IFormCollection nouse)
198198
}
199199
}
200200
#endregion
201+
202+
[ActionDescription("Export")]
203+
[HttpPost]
204+
public IActionResult ExportExcel(MyUserListVM vm)
205+
{
206+
vm.SearcherMode = vm.Ids != null && vm.Ids.Count > 0 ? ListVMSearchModeEnum.CheckExport : ListVMSearchModeEnum.Export;
207+
var data = vm.GenerateExcel();
208+
return File(data, "application/vnd.ms-excel", $"Export_ActionLog_{DateTime.Now.ToString("yyyy-MM-dd")}.xls");
209+
}
210+
201211
}
202212
}

demo/WalkingTec.Mvvm.Demo/Controllers/SchoolController.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using WalkingTec.Mvvm.Demo.Models;
99
using WalkingTec.Mvvm.Core.Extensions;
1010
using WalkingTec.Mvvm.Core.Auth.Attribute;
11+
using System;
1112

1213
namespace WalkingTec.Mvvm.Demo.Controllers
1314
{
@@ -310,5 +311,14 @@ public ActionResult Edit2(SchoolVM vm)
310311
}
311312
#endregion
312313

314+
[ActionDescription("Export")]
315+
[HttpPost]
316+
public IActionResult ExportExcel(SchoolListVM vm)
317+
{
318+
vm.SearcherMode = vm.Ids != null && vm.Ids.Count > 0 ? ListVMSearchModeEnum.CheckExport : ListVMSearchModeEnum.Export;
319+
var data = vm.GenerateExcel();
320+
return File(data, "application/vnd.ms-excel", $"Export_ActionLog_{DateTime.Now.ToString("yyyy-MM-dd")}.xls");
321+
}
322+
313323
}
314324
}

demo/WalkingTec.Mvvm.Demo/Controllers/StudentController.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,5 +206,15 @@ public ActionResult Import(StudentImportVM vm, IFormCollection nouse)
206206
}
207207
}
208208
#endregion
209+
210+
[ActionDescription("Export")]
211+
[HttpPost]
212+
public IActionResult ExportExcel(StudentListVM vm)
213+
{
214+
vm.SearcherMode = vm.Ids != null && vm.Ids.Count > 0 ? ListVMSearchModeEnum.CheckExport : ListVMSearchModeEnum.Export;
215+
var data = vm.GenerateExcel();
216+
return File(data, "application/vnd.ms-excel", $"Export_ActionLog_{DateTime.Now.ToString("yyyy-MM-dd")}.xls");
217+
}
218+
209219
}
210220
}
Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
1+
using Microsoft.AspNetCore.Http;
2+
using Microsoft.AspNetCore.Mvc;
3+
using System;
4+
using WalkingTec.Mvvm.Core;
5+
using WalkingTec.Mvvm.Mvc;
6+
using WalkingTec.Mvvm.Core.Extensions;
7+
using WalkingTec.Mvvm.Demo.ViewModels.不要用中文模型名VMs;
8+
9+
namespace WalkingTec.Mvvm.Demo.Controllers
10+
{
11+
12+
[ActionDescription("123")]
13+
public partial class 不要用中文模型名Controller : BaseController
14+
{
15+
#region 搜索
16+
[ActionDescription("搜索")]
17+
public ActionResult Index()
18+
{
19+
var vm = CreateVM<不要用中文模型名ListVM>();
20+
return PartialView(vm);
21+
}
22+
23+
[ActionDescription("搜索")]
24+
[HttpPost]
25+
public string Search(不要用中文模型名ListVM vm)
26+
{
27+
return vm.GetJson(false);
28+
}
29+
30+
#endregion
31+
32+
#region 新建
33+
[ActionDescription("新建")]
34+
public ActionResult Create()
35+
{
36+
var vm = CreateVM<不要用中文模型名VM>();
37+
return PartialView(vm);
38+
}
39+
40+
[HttpPost]
41+
[ActionDescription("新建")]
42+
public ActionResult Create(不要用中文模型名VM vm)
43+
{
44+
if (!ModelState.IsValid)
45+
{
46+
return PartialView(vm);
47+
}
48+
else
49+
{
50+
vm.DoAdd();
51+
if (!ModelState.IsValid)
52+
{
53+
vm.DoReInit();
54+
return PartialView(vm);
55+
}
56+
else
57+
{
58+
return FFResult().CloseDialog().RefreshGrid();
59+
}
60+
}
61+
}
62+
#endregion
63+
64+
#region 修改
65+
[ActionDescription("修改")]
66+
public ActionResult Edit(string id)
67+
{
68+
var vm = CreateVM<不要用中文模型名VM>(id);
69+
return PartialView(vm);
70+
}
71+
72+
[ActionDescription("修改")]
73+
[HttpPost]
74+
[ValidateFormItemOnly]
75+
public ActionResult Edit(不要用中文模型名VM vm)
76+
{
77+
if (!ModelState.IsValid)
78+
{
79+
return PartialView(vm);
80+
}
81+
else
82+
{
83+
vm.DoEdit();
84+
if (!ModelState.IsValid)
85+
{
86+
vm.DoReInit();
87+
return PartialView(vm);
88+
}
89+
else
90+
{
91+
return FFResult().CloseDialog().RefreshGridRow(vm.Entity.ID);
92+
}
93+
}
94+
}
95+
#endregion
96+
97+
#region 删除
98+
[ActionDescription("删除")]
99+
public ActionResult Delete(string id)
100+
{
101+
var vm = CreateVM<不要用中文模型名VM>(id);
102+
return PartialView(vm);
103+
}
104+
105+
[ActionDescription("删除")]
106+
[HttpPost]
107+
public ActionResult Delete(string id, IFormCollection nouse)
108+
{
109+
var vm = CreateVM<不要用中文模型名VM>(id);
110+
vm.DoDelete();
111+
if (!ModelState.IsValid)
112+
{
113+
return PartialView(vm);
114+
}
115+
else
116+
{
117+
return FFResult().CloseDialog().RefreshGrid();
118+
}
119+
}
120+
#endregion
121+
122+
#region 详细
123+
[ActionDescription("详细")]
124+
public ActionResult Details(string id)
125+
{
126+
var vm = CreateVM<不要用中文模型名VM>(id);
127+
return PartialView(vm);
128+
}
129+
#endregion
130+
131+
#region 批量修改
132+
[HttpPost]
133+
[ActionDescription("批量修改")]
134+
public ActionResult BatchEdit(string[] IDs)
135+
{
136+
var vm = CreateVM<不要用中文模型名BatchVM>(Ids: IDs);
137+
return PartialView(vm);
138+
}
139+
140+
[HttpPost]
141+
[ActionDescription("批量修改")]
142+
public ActionResult DoBatchEdit(不要用中文模型名BatchVM vm, IFormCollection nouse)
143+
{
144+
if (!ModelState.IsValid || !vm.DoBatchEdit())
145+
{
146+
return PartialView("BatchEdit",vm);
147+
}
148+
else
149+
{
150+
return FFResult().CloseDialog().RefreshGrid().Alert("操作成功,共有"+vm.Ids.Length+"条数据被修改");
151+
}
152+
}
153+
#endregion
154+
155+
#region 批量删除
156+
[HttpPost]
157+
[ActionDescription("批量删除")]
158+
public ActionResult BatchDelete(string[] IDs)
159+
{
160+
var vm = CreateVM<不要用中文模型名BatchVM>(Ids: IDs);
161+
return PartialView(vm);
162+
}
163+
164+
[HttpPost]
165+
[ActionDescription("批量删除")]
166+
public ActionResult DoBatchDelete(不要用中文模型名BatchVM vm, IFormCollection nouse)
167+
{
168+
if (!ModelState.IsValid || !vm.DoBatchDelete())
169+
{
170+
return PartialView("BatchDelete",vm);
171+
}
172+
else
173+
{
174+
return FFResult().CloseDialog().RefreshGrid().Alert("操作成功,共有"+vm.Ids.Length+"条数据被删除");
175+
}
176+
}
177+
#endregion
178+
179+
#region 导入
180+
[ActionDescription("导入")]
181+
public ActionResult Import()
182+
{
183+
var vm = CreateVM<不要用中文模型名ImportVM>();
184+
return PartialView(vm);
185+
}
186+
187+
[HttpPost]
188+
[ActionDescription("导入")]
189+
public ActionResult Import(不要用中文模型名ImportVM vm, IFormCollection nouse)
190+
{
191+
if (vm.ErrorListVM.EntityList.Count > 0 || !vm.BatchSaveData())
192+
{
193+
return PartialView(vm);
194+
}
195+
else
196+
{
197+
return FFResult().CloseDialog().RefreshGrid().Alert("成功导入 " + vm.EntityList.Count.ToString() + " 行数据");
198+
}
199+
}
200+
#endregion
201+
202+
[ActionDescription("导出")]
203+
[HttpPost]
204+
public IActionResult ExportExcel(不要用中文模型名ListVM vm)
205+
{
206+
vm.SearcherMode = vm.Ids != null && vm.Ids.Count > 0 ? ListVMSearchModeEnum.CheckExport : ListVMSearchModeEnum.Export;
207+
var data = vm.GenerateExcel();
208+
return File(data, "application/vnd.ms-excel", $"Export_不要用中文模型名_{DateTime.Now.ToString("yyyy-MM-dd")}.xls");
209+
}
210+
211+
}
212+
}

demo/WalkingTec.Mvvm.Demo/DataContext.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public DataContext(string cs, DBTypeEnum dbtype)
1919

2020
public DbSet<MyUser> MyUsers { get; set; }
2121

22+
public DbSet<不要用中文模型名> 不要中文 { get; set; }
2223

2324
}
2425
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Threading.Tasks;
5+
using WalkingTec.Mvvm.Core;
6+
7+
namespace WalkingTec.Mvvm.Demo.Models
8+
{
9+
public class 不要用中文模型名 : TopBasePoco
10+
{
11+
public string 不要 { get; set; }
12+
public int { get; set; }
13+
14+
public DateTime? 中文 { get; set; }
15+
16+
public bool 模型名 { get; set; }
17+
}
18+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.ComponentModel.DataAnnotations;
4+
using System.Linq;
5+
using System.Threading.Tasks;
6+
using WalkingTec.Mvvm.Core;
7+
using WalkingTec.Mvvm.Core.Extensions;
8+
using WalkingTec.Mvvm.Demo.Models;
9+
10+
11+
namespace WalkingTec.Mvvm.Demo.ViewModels.不要用中文模型名VMs
12+
{
13+
public partial class 不要用中文模型名BatchVM : BaseBatchVM<不要用中文模型名, 不要用中文模型名_BatchEdit>
14+
{
15+
public 不要用中文模型名BatchVM()
16+
{
17+
ListVM = new 不要用中文模型名ListVM();
18+
LinkedVM = new 不要用中文模型名_BatchEdit();
19+
}
20+
21+
}
22+
23+
/// <summary>
24+
/// 批量编辑字段类
25+
/// </summary>
26+
public class 不要用中文模型名_BatchEdit : BaseVM
27+
{
28+
29+
protected override void InitVM()
30+
{
31+
}
32+
33+
}
34+
35+
}

0 commit comments

Comments
 (0)