feat: 完善用户列表保存

pull/1/head
Yosheng 2023-07-30 15:43:47 +08:00
parent 23d45d7084
commit 63f7abe3ba
3 changed files with 8 additions and 6 deletions

View File

@ -37,7 +37,7 @@ public class UserPointService : IUserPointService
}; };
var count = queryable.Count(); var count = queryable.Count();
var data = await queryable.Paging(req).ToListAsync().ConfigureAwait(false); var data = await queryable.OrderByDescending(x => x.CreateTime).Paging(req).ToListAsync().ConfigureAwait(false);
return new PageResultDto<UserPointDto>() return new PageResultDto<UserPointDto>()
{ {

View File

@ -36,7 +36,7 @@ public class UserService : IUserService
select user; select user;
var count = queryable.Count(); var count = queryable.Count();
var data = await queryable.Paging(req).ToListAsync().ConfigureAwait(false); var data = await queryable.OrderByDescending(x => x.Id).Paging(req).ToListAsync().ConfigureAwait(false);
return new PageResultDto<User>() return new PageResultDto<User>()
{ {

View File

@ -11,7 +11,8 @@ namespace UserPointManagement.Web.Pages.UserManagement;
public class UserManagementBase : ComponentBase public class UserManagementBase : ComponentBase
{ {
[Inject] private IUserService _userService { get; set; } [Inject] private IUserService UserService { get; set; }
[Inject] private MessageService MessageService { get; set; }
protected IDictionary<int, (bool edit, User data)> editCache = protected IDictionary<int, (bool edit, User data)> editCache =
new Dictionary<int, (bool edit, User data)>(); new Dictionary<int, (bool edit, User data)>();
@ -38,7 +39,7 @@ public class UserManagementBase : ComponentBase
protected async Task RefreshTable() protected async Task RefreshTable()
{ {
_loading = true; _loading = true;
var res = await _userService.GetUsers(new GetUserDto() var res = await UserService.GetUsers(new GetUserDto()
{ {
Keyword = _searchValue, Keyword = _searchValue,
PageIndex = _pageIndex, PageIndex = _pageIndex,
@ -72,7 +73,8 @@ public class UserManagementBase : ComponentBase
protected async Task Delete(int userId) protected async Task Delete(int userId)
{ {
await _userService.DeleteUser(userId).ConfigureAwait(false); await UserService.DeleteUser(userId).ConfigureAwait(false);
await MessageService.Success("删除成功!");
await RefreshTable(); await RefreshTable();
} }
@ -92,7 +94,7 @@ public class UserManagementBase : ComponentBase
{ {
var index = _users.FindIndex(item => item.Id == id); var index = _users.FindIndex(item => item.Id == id);
_users[index] = editCache[id].data; // apply the copy to data source _users[index] = editCache[id].data; // apply the copy to data source
await _userService.ModifyUser(editCache[id].data.Id, new ModifyUserDto() await UserService.ModifyUser(editCache[id].data.Id, new ModifyUserDto()
{ {
Mobile = editCache[id].data.Mobile, Mobile = editCache[id].data.Mobile,
Name = editCache[id].data.Name, Name = editCache[id].data.Name,