Merge branch 'master' of http://118.178.224.202:3000/ewide/ewide_core
This commit is contained in:
@@ -6,7 +6,7 @@ namespace Ewide.Core.Service
|
|||||||
{
|
{
|
||||||
public interface ISysUserService
|
public interface ISysUserService
|
||||||
{
|
{
|
||||||
Task AddUser(AddUserInput input);
|
Task<dynamic> AddUser(AddUserInput input);
|
||||||
Task ChangeUserStatus(UpdateUserInput input);
|
Task ChangeUserStatus(UpdateUserInput input);
|
||||||
Task DeleteUser(DeleteUserInput input);
|
Task DeleteUser(DeleteUserInput input);
|
||||||
Task ExportUser([FromQuery] UserInput input);
|
Task ExportUser([FromQuery] UserInput input);
|
||||||
|
|||||||
@@ -91,10 +91,10 @@ namespace Ewide.Core.Service
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("/sysUser/add")]
|
[HttpPost("/sysUser/add")]
|
||||||
[UnitOfWork]
|
[UnitOfWork]
|
||||||
public async Task AddUser(AddUserInput input)
|
public async Task<dynamic> AddUser(AddUserInput input)
|
||||||
{
|
{
|
||||||
// 数据范围检查
|
// 数据范围检查
|
||||||
CheckDataScope(input);
|
await CheckDataScope(input);
|
||||||
|
|
||||||
var isExist = await _sysUserRep.AnyAsync(u => u.Account == input.Account, false);
|
var isExist = await _sysUserRep.AnyAsync(u => u.Account == input.Account, false);
|
||||||
if (isExist) throw Oops.Oh(ErrorCode.D1003);
|
if (isExist) throw Oops.Oh(ErrorCode.D1003);
|
||||||
@@ -105,10 +105,14 @@ namespace Ewide.Core.Service
|
|||||||
user.Name = user.Account;
|
user.Name = user.Account;
|
||||||
if (string.IsNullOrEmpty(user.NickName))
|
if (string.IsNullOrEmpty(user.NickName))
|
||||||
user.NickName = user.Account;
|
user.NickName = user.Account;
|
||||||
var newUser = await _sysUserRep.InsertNowAsync(user);
|
var id = Guid.NewGuid().ToString();
|
||||||
input.SysEmpParam.Id = newUser.Entity.Id.ToString();
|
user.Id = id;
|
||||||
|
await _sysUserRep.InsertAsync(user);
|
||||||
|
input.SysEmpParam.Id = id;
|
||||||
// 增加员工信息
|
// 增加员工信息
|
||||||
await _sysEmpService.AddOrUpdate(input.SysEmpParam);
|
await _sysEmpService.AddOrUpdate(input.SysEmpParam);
|
||||||
|
|
||||||
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -125,7 +129,7 @@ namespace Ewide.Core.Service
|
|||||||
throw Oops.Oh(ErrorCode.D1014);
|
throw Oops.Oh(ErrorCode.D1014);
|
||||||
|
|
||||||
// 数据范围检查
|
// 数据范围检查
|
||||||
CheckDataScope(input);
|
await CheckDataScope(input);
|
||||||
|
|
||||||
// 直接删除用户
|
// 直接删除用户
|
||||||
await user.DeleteAsync();
|
await user.DeleteAsync();
|
||||||
@@ -150,7 +154,7 @@ namespace Ewide.Core.Service
|
|||||||
public async Task UpdateUser(UpdateUserInput input)
|
public async Task UpdateUser(UpdateUserInput input)
|
||||||
{
|
{
|
||||||
// 数据范围检查
|
// 数据范围检查
|
||||||
CheckDataScope(input);
|
await CheckDataScope(input);
|
||||||
|
|
||||||
// 排除自己并且判断与其他是否相同
|
// 排除自己并且判断与其他是否相同
|
||||||
var isExist = await _sysUserRep.AnyAsync(u => u.Account == input.Account && u.Id != input.Id, false);
|
var isExist = await _sysUserRep.AnyAsync(u => u.Account == input.Account && u.Id != input.Id, false);
|
||||||
@@ -207,7 +211,7 @@ namespace Ewide.Core.Service
|
|||||||
public async Task GrantUserRole(UpdateUserInput input)
|
public async Task GrantUserRole(UpdateUserInput input)
|
||||||
{
|
{
|
||||||
// 数据范围检查
|
// 数据范围检查
|
||||||
CheckDataScope(input);
|
await CheckDataScope(input);
|
||||||
await _sysUserRoleService.GrantRole(input);
|
await _sysUserRoleService.GrantRole(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -220,7 +224,7 @@ namespace Ewide.Core.Service
|
|||||||
public async Task GrantUserData(UpdateUserInput input)
|
public async Task GrantUserData(UpdateUserInput input)
|
||||||
{
|
{
|
||||||
// 数据范围检查
|
// 数据范围检查
|
||||||
CheckDataScope(input);
|
await CheckDataScope(input);
|
||||||
await _sysUserDataScopeService.GrantData(input);
|
await _sysUserDataScopeService.GrantData(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -380,6 +384,7 @@ namespace Ewide.Core.Service
|
|||||||
/// <param name="userId"></param>
|
/// <param name="userId"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[NonAction]
|
[NonAction]
|
||||||
|
[UnitOfWork]
|
||||||
public async Task<List<string>> GetUserDataScopeIdList(string userId)
|
public async Task<List<string>> GetUserDataScopeIdList(string userId)
|
||||||
{
|
{
|
||||||
var dataScopes = await _sysCacheService.GetDataScope(userId); // 先从缓存里面读取
|
var dataScopes = await _sysCacheService.GetDataScope(userId); // 先从缓存里面读取
|
||||||
@@ -420,7 +425,7 @@ namespace Ewide.Core.Service
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="userParam"></param>
|
/// <param name="userParam"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private async void CheckDataScope(UserInput userParam)
|
private async Task CheckDataScope(UserInput userParam)
|
||||||
{
|
{
|
||||||
// 如果当前用户不是超级管理员,则进行数据范围校验
|
// 如果当前用户不是超级管理员,则进行数据范围校验
|
||||||
if (!_userManager.SuperAdmin)
|
if (!_userManager.SuperAdmin)
|
||||||
|
|||||||
@@ -25,4 +25,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
>.ant-pagination {
|
||||||
|
margin: @padding-md 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,6 +125,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ant-table-pagination {
|
||||||
|
float: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.yo-table-actions {
|
.yo-table-actions {
|
||||||
|
|||||||
@@ -99,12 +99,21 @@ export default {
|
|||||||
</a-button-group>
|
</a-button-group>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="yo-list">
|
||||||
<a-list {...{ props, on, scopedSlots: { ...this.$scopedSlots } }}>
|
<a-list {...{ props, on, scopedSlots: { ...this.$scopedSlots } }}>
|
||||||
{Object.keys(this.$slots).map((name) => (
|
{Object.keys(this.$slots).map((name) => (
|
||||||
<template slot={name}>{this.$slots[name]}</template>
|
<template slot={name}>{this.$slots[name]}</template>
|
||||||
))}
|
))}
|
||||||
</a-list>
|
</a-list>
|
||||||
<a-pagination size="small" {... { props: this.pagination }} onChange={this.onListChange} onShowSizeChange={this.onListChange} />
|
{
|
||||||
|
!!this.data && !!this.data.length && <a-pagination
|
||||||
|
size="small"
|
||||||
|
{... { props: this.pagination }}
|
||||||
|
onChange={this.onListChange}
|
||||||
|
onShowSizeChange={this.onListChange}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
</section>
|
</section>
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user