Browse Source

权限信息

master
747575620@qq.com 1 year ago
parent
commit
a043f3fb47
18 changed files with 267 additions and 576 deletions
  1. +39
    -118
      backend/BPA.MES.Base.Application/BPA.MES.Base.Application.xml
  2. +4
    -35
      backend/BPA.MES.Base.Application/Entitys/Sys/EmployeeEntity.cs
  3. +2
    -2
      backend/BPA.MES.Base.Application/Services/SystemService/Dtos/AccountInput.cs
  4. +5
    -0
      backend/BPA.MES.Base.Application/Services/SystemService/Dtos/AuthorModuleItemOutput.cs
  5. +4
    -44
      backend/BPA.MES.Base.Application/Services/SystemService/Dtos/EmployeeInput.cs
  6. +4
    -28
      backend/BPA.MES.Base.Application/Services/SystemService/Dtos/EmployeeOutput.cs
  7. +1
    -4
      backend/BPA.MES.Base.Application/Services/SystemService/Dtos/ModuleInput.cs
  8. +54
    -65
      backend/BPA.MES.Base.Application/Services/SystemService/Services/AuthorizeService.cs
  9. +1
    -1
      backend/BPA.MES.Base.Application/Services/SystemService/Services/IAuthorizeService.cs
  10. +1
    -1
      frontend/config/routes.ts
  11. +1
    -1
      frontend/src/api/AuthTemplate.ts
  12. +5
    -5
      frontend/src/api/Role.ts
  13. +2
    -2
      frontend/src/api/accountService.ts
  14. +29
    -43
      frontend/src/pages/system/account/index.tsx
  15. +17
    -14
      frontend/src/pages/system/authTemplate/index.tsx
  16. +88
    -171
      frontend/src/pages/system/user/index.tsx
  17. +5
    -1
      frontend/src/types/Account.d.ts
  18. +5
    -41
      frontend/src/types/UserTypes.d.ts

+ 39
- 118
backend/BPA.MES.Base.Application/BPA.MES.Base.Application.xml View File

@@ -1312,34 +1312,9 @@
1男2女
</summary>
</member>
<member name="P:BPA.MES.Base.Application.Entitys.EmployeeEntity.Phone">
<member name="P:BPA.MES.Base.Application.Entitys.EmployeeEntity.Status">
<summary>
手机号
</summary>
</member>
<member name="P:BPA.MES.Base.Application.Entitys.EmployeeEntity.ICCard">
<summary>
员工IC卡
</summary>
</member>
<member name="P:BPA.MES.Base.Application.Entitys.EmployeeEntity.Header">
<summary>
头像
</summary>
</member>
<member name="P:BPA.MES.Base.Application.Entitys.EmployeeEntity.OutDate">
<summary>
入职时间
</summary>
</member>
<member name="P:BPA.MES.Base.Application.Entitys.EmployeeEntity.IdCard">
<summary>
身份证
</summary>
</member>
<member name="P:BPA.MES.Base.Application.Entitys.EmployeeEntity.Stutas">
<summary>
1在职2出差3离职
1启用 2禁用
</summary>
</member>
<member name="P:BPA.MES.Base.Application.Entitys.EmployeeEntity.IsAdmin">
@@ -1347,16 +1322,11 @@
超管
</summary>
</member>
<member name="P:BPA.MES.Base.Application.Entitys.EmployeeEntity.TB_RoleId">
<member name="P:BPA.MES.Base.Application.Entitys.EmployeeEntity.RoleId">
<summary>
角色Id
</summary>
</member>
<member name="P:BPA.MES.Base.Application.Entitys.EmployeeEntity.IsDeleted">
<summary>
是否删除
</summary>
</member>
<member name="T:BPA.MES.Base.Application.Entitys.ModuleEntity">
<summary>
名 称 :模块菜单表
@@ -7677,9 +7647,9 @@
主键
</summary>
</member>
<member name="P:BPA.MES.Base.Application.AccountQueryPageInput.Name">
<member name="P:BPA.MES.Base.Application.AccountQueryPageInput.Account">
<summary>
设备名称
账号名称
</summary>
</member>
<member name="T:BPA.MES.Base.Application.AccountOutput">
@@ -8104,6 +8074,11 @@
描 述 :
</summary>
</member>
<member name="P:BPA.MES.Base.Application.AuthorModuleItemOutput.Id">
<summary>
模块编号
</summary>
</member>
<member name="T:BPA.MES.Base.Application.AuthorModuleOutput">
<summary>
名 称 :授权模块输出
@@ -8180,16 +8155,6 @@
描 述 :
</summary>
</member>
<member name="P:BPA.MES.Base.Application.EmployeeInput.Id">
<summary>
主键
</summary>
</member>
<member name="P:BPA.MES.Base.Application.EmployeeInput.Sort">
<summary>
排序
</summary>
</member>
<member name="P:BPA.MES.Base.Application.EmployeeInput.Name">
<summary>
员工姓名
@@ -8197,45 +8162,15 @@
</member>
<member name="P:BPA.MES.Base.Application.EmployeeInput.Gender">
<summary>
1男2女
</summary>
</member>
<member name="P:BPA.MES.Base.Application.EmployeeInput.Phone">
<summary>
手机号
</summary>
</member>
<member name="P:BPA.MES.Base.Application.EmployeeInput.ICCard">
<summary>
员工IC卡
</summary>
</member>
<member name="P:BPA.MES.Base.Application.EmployeeInput.Header">
<summary>
头像
</summary>
</member>
<member name="P:BPA.MES.Base.Application.EmployeeInput.JoinDate">
<summary>
入职时间
</summary>
</member>
<member name="P:BPA.MES.Base.Application.EmployeeInput.OutDate">
<summary>
离职时间
</summary>
</member>
<member name="P:BPA.MES.Base.Application.EmployeeInput.IdCard">
<summary>
身份证
0男1女
</summary>
</member>
<member name="P:BPA.MES.Base.Application.EmployeeInput.Stutas">
<member name="P:BPA.MES.Base.Application.EmployeeInput.Status">
<summary>
1在职2出差3离职
0启用 1禁用
</summary>
</member>
<member name="P:BPA.MES.Base.Application.EmployeeInput.TB_RoleId">
<member name="P:BPA.MES.Base.Application.EmployeeInput.RoleId">
<summary>
角色Id
</summary>
@@ -8340,45 +8275,15 @@
</member>
<member name="P:BPA.MES.Base.Application.EmployeeOutput.Gender">
<summary>
1男2女
</summary>
</member>
<member name="P:BPA.MES.Base.Application.EmployeeOutput.Phone">
<summary>
手机号
0男1女
</summary>
</member>
<member name="P:BPA.MES.Base.Application.EmployeeOutput.ICCard">
<member name="P:BPA.MES.Base.Application.EmployeeOutput.Status">
<summary>
员工IC卡
0启用 1禁用
</summary>
</member>
<member name="P:BPA.MES.Base.Application.EmployeeOutput.Header">
<summary>
头像
</summary>
</member>
<member name="P:BPA.MES.Base.Application.EmployeeOutput.JoinDate">
<summary>
入职时间
</summary>
</member>
<member name="P:BPA.MES.Base.Application.EmployeeOutput.OutDate">
<summary>
离职时间
</summary>
</member>
<member name="P:BPA.MES.Base.Application.EmployeeOutput.IdCard">
<summary>
身份证
</summary>
</member>
<member name="P:BPA.MES.Base.Application.EmployeeOutput.Stutas">
<summary>
1在职2出差3离职
</summary>
</member>
<member name="P:BPA.MES.Base.Application.EmployeeOutput.TB_RoleId">
<member name="P:BPA.MES.Base.Application.EmployeeOutput.RoleId">
<summary>
角色Id
</summary>
@@ -8443,11 +8348,6 @@
[模块信息]添加入参
</summary>
</member>
<member name="P:BPA.MES.Base.Application.ModuleAddInput.Id">
<summary>
主键
</summary>
</member>
<member name="T:BPA.MES.Base.Application.ModuleUpdateInput">
<summary>
[模块信息]修改入参
@@ -8918,6 +8818,27 @@
<param name="getObjectId"></param>
<returns></returns>
</member>
<member name="M:BPA.MES.Base.Application.AuthorizeService.EditEmployee(BPA.MES.Base.Application.EmployeeUpdateInput)">
<summary>
编辑员工
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:BPA.MES.Base.Application.AuthorizeService.QueryEmployee(BPA.MES.Base.Application.EmployeeQueryPageInput)">
<summary>
查询员工
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:BPA.MES.Base.Application.AuthorizeService.RemoveEmployee(System.String)">
<summary>
删除员工
</summary>
<param name="employeeId"></param>
<returns></returns>
</member>
<member name="T:BPA.MES.Base.Application.Subscriber.ToDoEventSubscriber">
<summary>
名 称 :


+ 4
- 35
backend/BPA.MES.Base.Application/Entitys/Sys/EmployeeEntity.cs View File

@@ -20,38 +20,10 @@
[SugarColumn(IsNullable = true)]
public int Gender { get; set; }
/// <summary>
/// 手机号
/// 1启用 2禁用
/// </summary>
[SugarColumn(IsNullable = false)]
public string Phone { get; set; }
/// <summary>
/// 员工IC卡
/// </summary>
[SugarColumn(IsNullable = true)]
public string ICCard { get; set; }
/// <summary>
/// 头像
/// </summary>
[SugarColumn(IsNullable = true)]
public string Header { get; set; }

[SugarColumn(IsNullable = false)]
public DateTime JoinDate { get; set; }
/// <summary>
/// 入职时间
/// </summary>
[SugarColumn(IsNullable = true)]
public DateTime? OutDate { get; set; }
/// <summary>
/// 身份证
/// </summary>
[SugarColumn(IsNullable = true)]
public string IdCard { get; set; }
/// <summary>
/// 1在职2出差3离职
/// </summary>
[SugarColumn(IsNullable = false)]
public int Stutas { get; set; }
public int Status { get; set; }
/// <summary>
/// 超管
/// </summary>
@@ -60,10 +32,7 @@
/// <summary>
/// 角色Id
/// </summary>
public string TB_RoleId { get; set; }
/// <summary>
/// 是否删除
/// </summary>
public bool IsDeleted { get; set; }
public string RoleId { get; set; }
}
}

+ 2
- 2
backend/BPA.MES.Base.Application/Services/SystemService/Dtos/AccountInput.cs View File

@@ -87,8 +87,8 @@ namespace BPA.MES.Base.Application
/// </summary>
public string? Id { get; set; }
/// <summary>
/// 设备名称
/// 账号名称
/// </summary>
public string Name { get; set; }
public string Account { get; set; }
}
}

+ 5
- 0
backend/BPA.MES.Base.Application/Services/SystemService/Dtos/AuthorModuleItemOutput.cs View File

@@ -8,5 +8,10 @@
/// </summary>
public class AuthorModuleItemOutput
{
/// <summary>
/// 模块编号
/// </summary>
public string Id { get; set; }

}
}

+ 4
- 44
backend/BPA.MES.Base.Application/Services/SystemService/Dtos/EmployeeInput.cs View File

@@ -8,63 +8,23 @@
/// </summary>
public class EmployeeInput
{
/// <summary>
/// 主键
/// </summary>
public string Id { get; set; }
/// <summary>
/// 排序
/// </summary>
public int Sort { get; set; }
/// <summary>
/// 员工姓名
/// </summary>

public string Name { get; set; }
/// <summary>
/// 1男2
/// 0男1女
/// </summary>

public int Gender { get; set; }
/// <summary>
/// 手机号
/// </summary>

public string Phone { get; set; }
/// <summary>
/// 员工IC卡
/// 0启用 1禁用
/// </summary>

public string ICCard { get; set; }
/// <summary>
/// 头像
/// </summary>

public string Header { get; set; }
/// <summary>
/// 入职时间
/// </summary>

public DateTime JoinDate { get; set; }

/// <summary>
/// 离职时间
/// </summary>
public DateTime? OutDate { get; set; }
/// <summary>
/// 身份证
/// </summary>

public string IdCard { get; set; }
/// <summary>
/// 1在职2出差3离职
/// </summary>

public int Stutas { get; set; }
public int Status { get; set; }
/// <summary>
/// 角色Id
/// </summary>
public string TB_RoleId { get; set; }
public string RoleId { get; set; }
/// <summary>
/// 是否存在账号
/// </summary>


+ 4
- 28
backend/BPA.MES.Base.Application/Services/SystemService/Dtos/EmployeeOutput.cs View File

@@ -21,42 +21,18 @@
/// </summary>
public string Name { get; set; }
/// <summary>
/// 1男2
/// 0男1
/// </summary>

public int Gender { get; set; }
/// <summary>
/// 手机号
/// 0启用 1禁用
/// </summary>
public string Phone { get; set; }
/// <summary>
/// 员工IC卡
/// </summary>
public string ICCard { get; set; }
/// <summary>
/// 头像
/// </summary>
public string Header { get; set; }
/// <summary>
/// 入职时间
/// </summary>
public DateTime JoinDate { get; set; }
/// <summary>
/// 离职时间
/// </summary>
public DateTime? OutDate { get; set; }
/// <summary>
/// 身份证
/// </summary>
public string IdCard { get; set; }
/// <summary>
/// 1在职2出差3离职
/// </summary>
public int Stutas { get; set; }
public int Status { get; set; }
/// <summary>
/// 角色Id
/// </summary>
public string TB_RoleId { get; set; }
public string RoleId { get; set; }
/// <summary>
/// 是否存在账号
/// </summary>


+ 1
- 4
backend/BPA.MES.Base.Application/Services/SystemService/Dtos/ModuleInput.cs View File

@@ -49,10 +49,7 @@ namespace BPA.MES.Base.Application
/// </summary>
public class ModuleAddInput : ModuleInput
{
/// <summary>
/// 主键
/// </summary>
public string Id { get; set; }
}
/// <summary>
/// [模块信息]修改入参


+ 54
- 65
backend/BPA.MES.Base.Application/Services/SystemService/Services/AuthorizeService.cs View File

@@ -69,7 +69,7 @@
public async Task<object> GetUserInfo()
{
string userId = App.User?.FindFirst(ClaimConst.CLAINM_USERID)?.Value;
var user = await db.Queryable<EmployeeEntity>().LeftJoin<RoleEntity>((t, x) => t.TB_RoleId == x.Id)
var user = await db.Queryable<EmployeeEntity>().LeftJoin<RoleEntity>((t, x) => t.RoleId == x.Id)
.Where((t, x) => t.Id == userId).Select((t, x) => new
{
RoleName = x.Name,
@@ -157,7 +157,7 @@
}
if (category == 2)
{
return user.TB_RoleId;
return user.RoleId;
}
else
{
@@ -177,6 +177,7 @@
public async Task<SqlSugarPagedList<AccountOutput>> AccountPageList(AccountQueryPageInput input)
{
var entity = await _dbContext.Queryable<AccountEntity>()
.WhereIF(!string.IsNullOrEmpty(input.Account),x=>x.Account==input.Account)
.ToPagedListAsync(input.PageIndex,input.PageSize);
SqlSugarPagedList<AccountOutput> output = entity.Adapt<SqlSugarPagedList<AccountOutput>>();
return output;
@@ -259,7 +260,7 @@
[HttpGet]
public async Task<bool> RemoveRole(string input)
{
return await db.Updateable<RoleEntity>().Where(t => t.Id == input).ExecuteCommandHasChangeAsync();
return await db.Deleteable<RoleEntity>().Where(t => t.Id == input).ExecuteCommandHasChangeAsync();
}
[HttpGet]
public async Task<RoleOutput> GetRole(string input)
@@ -289,8 +290,9 @@
public async Task<bool> AddModule(ModuleAddInput input)
{
input.ParentId = input.ParentId ?? string.Empty;
input.Id = null;
return (await db.Insertable(input.Adapt<ModuleEntity>()).ExecuteCommandAsync()) > 0;
var entity = input.Adapt<ModuleEntity>();
await db.Insertable(entity).IgnoreColumns(true).ExecuteCommandAsync();
return true;
}
[HttpPost]

@@ -315,7 +317,7 @@
await RemoveModule(item.Id);
}
}
await _dbContext.Updateable<ModuleEntity>().Where(it => it.Id == input).ExecuteCommandAsync();
await _dbContext.Deleteable<ModuleEntity>().Where(it => it.Id == input).ExecuteCommandAsync();
}
[HttpPost]
public async Task<List<ModuleTreeOutput>> GetTreeGrid(ModuleTreeQueryInput input)
@@ -332,12 +334,12 @@

if (modules.HasVal())
{
foreach (var item in modules.Where(it => it.Category == 1))
foreach (var item in modules.Where(it=>it.ParentId=="").ToList())
{
item.Children = modules.Where(it => it.ParentId == item.Id && it.Category == 2).OrderBy(it => it.Sort).ToList();
item.Children = modules.Where(it => it.ParentId == item.Id ).OrderBy(it => it.Sort).ToList();
foreach (var view in item.Children)
{
view.Children = modules.Where(it => it.ParentId == view.Id && it.Category == 3).OrderBy(it => it.Sort).ToList();
view.Children = modules.Where(it => it.ParentId == view.Id ).OrderBy(it => it.Sort).ToList();
}

list.Add(item);
@@ -392,45 +394,34 @@

#region 授权模板详情
[HttpGet]
public async Task<List<AuthorModuleOutput>> GetModuleByTemplateId(string input)
public async Task<List<AuthorizeTemplateItemEntity>> GetModuleByTemplateId(string input)
{
List<AuthorModuleOutput> result = new List<AuthorModuleOutput>();
var modules = await db.Queryable<ModuleEntity>().ToListAsync();
var roots = modules.Adapt<List<AuthorModuleOutput>>();
db.ThenMapper(roots, item =>
{
item.HasPermission = db.Queryable<AuthorizeTemplateItemEntity>().Where(m => m.TB_TemplateId == input && m.TB_ModuleId == item.Id).Any();
});
if (roots.HasVal())
{
foreach (var item in roots.Where(it => it.Category == 1))
{
item.Childrens = roots.Where(it => it.ParentId == item.Id && it.Category == 2).OrderBy(it => it.Name).ToList();

foreach (var view in item.Childrens)
{
view.Childrens = roots.Where(it => it.ParentId == view.Id && it.Category == 3).OrderBy(it => it.Name).ToList();
}

result.Add(item);
}
}
return result;
var entity =await db.Queryable<AuthorizeTemplateItemEntity>().Where(m => m.TB_TemplateId == input).ToListAsync();
return entity;
}
[HttpPost]
public async Task<bool> EditTemplateItem(AuthorModuleItemUpdateInput input)
{
var temp = await db.Queryable<AuthorizeTemplateEntity>().FirstAsync(t => t.Id == input.TB_TemplateId && t.IsDeleted == false);
await db.Updateable<AuthorizeTemplateItemEntity>().SetColumns(T => T.IsDeleted == true)
.Where(t => t.TB_TemplateId == input.TB_TemplateId).ExecuteCommandHasChangeAsync();

var entity = input.TB_ModuleIds.Distinct().ToList().ConvertAll(t => new AuthorizeTemplateItemEntity
try
{
TB_ModuleId = t,
TB_TemplateId = input.TB_TemplateId
});
var res = await db.Insertable(entity).ExecuteCommandAsync();
return res > 0;
db.Ado.BeginTran();
await db.Deleteable<AuthorizeTemplateItemEntity>()
.Where(t => t.TB_TemplateId == input.TB_TemplateId).ExecuteCommandAsync();
var entity = input.TB_ModuleIds.Distinct().ToList().ConvertAll(t => new AuthorizeTemplateItemEntity
{
TB_ModuleId = t,
TB_TemplateId = input.TB_TemplateId
});
await db.Insertable(entity).ExecuteCommandAsync();
db.Ado.CommitTran();
return true;
}
catch (Exception ex)
{
throw Oops.Bah(ex.Message);
}
}
[HttpPost]
public async Task<List<AuthorizeOutput>> GetAuthorizeObjects(AuthorizeInput input)
@@ -457,7 +448,6 @@
{
var temp = await db.Queryable<EmployeeEntity>()
.Where(t => t.IsAdmin == false)
.Where(t => t.IsDeleted == false)
.WhereIF(!string.IsNullOrWhiteSpace(input.Keyword), t => t.Name.Contains(input.Keyword))
.OrderBy(t => t.Name)
.ToListAsync();
@@ -548,6 +538,7 @@
var model = input.Adapt<AccountEntity>();
//默认123456
model.Pwd = "123456".ToMD5Encrypt();
model.EmployeeId = input.TB_Employee_Id;
return await db.Insertable(model).ExecuteCommandAsync() > 0;
}
}
@@ -571,35 +562,36 @@
{
var model = input.Adapt<EmployeeEntity>();
model.IsAdmin = false;
var temp = await db.Queryable<EmployeeEntity>().FirstAsync(t => t.Name.Equals(input.Name) && t.Phone.Equals(input.Phone) && t.IsDeleted == false);
if (temp != null) throw Oops.Bah("该员工已经存在");
return await db.Insertable(model).ExecuteCommandAsync() > 0;
return await db.Insertable(model).IgnoreColumns(true).ExecuteCommandAsync() > 0;
}
/// <summary>
/// 编辑员工
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
public async Task<bool> EditEmployee(EmployeeUpdateInput input)
{
var temp = await db.Queryable<EmployeeEntity>().FirstAsync(t => t.Id == input.Id);
temp.Header = input.Header;
temp.IdCard = input.IdCard;
temp.Gender = input.Gender;
temp.JoinDate = input.JoinDate;
temp.OutDate = input.OutDate;
temp.Name = input.Name;
temp.Phone = input.Phone;
temp.Stutas = input.Stutas;
temp.Status = input.Status;
return await db.Updateable(temp).ExecuteCommandHasChangeAsync();
}
/// <summary>
/// 查询员工
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
public async Task<SqlSugarPagedList<EmployeeOutput>> QueryEmployee(EmployeeQueryPageInput input)
{
var entity = await db.Queryable<EmployeeEntity>()

.WhereIF(!string.IsNullOrEmpty(input.Keyword), t => t.Name.Contains(input.Keyword) || t.Phone.Contains(input.Keyword))
.WhereIF(input.Status > 0, t => t.Stutas == input.Status).WhereIF(input.Gender > 0, t => t.Gender == input.Gender)
.WhereIF(input.JoinDate.HasValue, t => t.JoinDate <= input.JoinDate.Value)
.WhereIF(!string.IsNullOrEmpty(input.Keyword), t => t.Name.Contains(input.Keyword))
.WhereIF(input.Status > 0, t => t.Status == input.Status).WhereIF(input.Gender > 0, t => t.Gender == input.Gender)
.Where(t => t.IsAdmin == false)
.Where(t => t.IsDeleted == false)
.Select(t => new EmployeeOutput()
{
Id = t.Id.SelectAll(),
@@ -609,30 +601,27 @@
.ToPagedListAsync(input.PageIndex, input.PageSize);
return entity;
}
/// <summary>
/// 删除员工
/// </summary>
/// <param name="employeeId"></param>
/// <returns></returns>
[HttpGet]
public async Task<bool> RemoveEmployee([FromQuery] string employeeId)
{
bool result = false;
var entity =await db.Queryable<AccountEntity>().FirstAsync(x=>x.EmployeeId== employeeId);
try
{
db.Ado.BeginTran();
await db.Deleteable<EmployeeEntity>().Where(t => t.Id == employeeId).ExecuteCommandAsync();
if (entity!=null)
{
entity.EmployeeId = string.Empty;
await db.Updateable(entity).IgnoreColumns(true).ExecuteCommandAsync();
}
await db.Deleteable<AccountEntity>().Where(t => t.EmployeeId == employeeId).ExecuteCommandAsync();
db.Ado.CommitTran();
result = true;
return true;
}
catch (Exception ex)
{
db.Ado.RollbackTran();
throw Oops.Bah("删除失败!");
}
return result;
}
[HttpGet]
public async Task<List<EmployeeOutput>> EmployeeList()


+ 1
- 1
backend/BPA.MES.Base.Application/Services/SystemService/Services/IAuthorizeService.cs View File

@@ -53,7 +53,7 @@ public interface IAuthorizeService
#endregion

#region 授权模板详情
Task<List<AuthorModuleOutput>> GetModuleByTemplateId(string input);
Task<List<AuthorizeTemplateItemEntity>> GetModuleByTemplateId(string input);
Task<bool> EditTemplateItem(AuthorModuleItemUpdateInput input);
Task<List<AuthorizeOutput>> GetAuthorizeObjects(AuthorizeInput input);
Task<bool> RemoveAuthorize(AuthorizeInput input);


+ 1
- 1
frontend/config/routes.ts View File

@@ -6,7 +6,7 @@
path: '/system',
name: '系统管理',
routes: [
{ path: '/system/account', name: '账号管理', component: './system/account' },
// { path: '/system/account', name: '账号管理', component: './system/account' },
{ path: '/system/user', name: '人员管理', component: './system/user' },
{ path: '/system/role', name: '角色管理', component: './system/role' },
{ path: '/system/module', name: '模块管理', component: './system/module' },


+ 1
- 1
frontend/src/api/AuthTemplate.ts View File

@@ -112,7 +112,7 @@ export default {
* @param templateId
*/
GetModules(templateId: string) {
return request(`/api/authorize/GetModuleByTemplateId/${templateId}`, {
return request(`/api/authorize/getmodulebytemplateid/${templateId}`, {
method: 'GET'
});
}

+ 5
- 5
frontend/src/api/Role.ts View File

@@ -3,7 +3,7 @@ import { request } from '@umijs/max';
export default {
//创建角色
CreateRole(parms: RolelTypes.RoleType) {
return request('/api/authorize/AddRole', {
return request('/api/authorize/addrole', {
method: 'POST',
data: {
...parms,
@@ -13,14 +13,14 @@ export default {

//删除角色
DeleteRole(id: string) {
return request(`/api/authorize/RemoveRole/${id}`, {
return request(`/api/authorize/removerole/${id}`, {
method: 'GET'
});
},

//修改角色
ModifyRole(parms: RolelTypes.RoleType) {
return request('/api/authorize/EditRole', {
return request('/api/authorize/editrole', {
method: 'POST',
data: {
...parms,
@@ -31,7 +31,7 @@ export default {

//获取角色列表
GetRoleList() {
return request('/api/authorize/GetRoleList', {
return request('/api/authorize/getroleList', {
method: 'GET',
});
},
@@ -42,7 +42,7 @@ export default {
* @returns
*/
GetRolePagedList(parms: RolelTypes.RolePageParams) {
return request('/api/authorize/QueryRole', {
return request('/api/authorize/queryrole', {
method: 'POST',
data: {
...parms,


+ 2
- 2
frontend/src/api/accountService.ts View File

@@ -4,7 +4,7 @@ import { request } from '@umijs/max';
export default {
//创建
Add(parms: Account.TBAccountDTO) {
return request('/api/authorize/add', {
return request('/api/authorize/addaccount', {
method: 'POST',
data: {
...parms,
@@ -40,7 +40,7 @@ export default {
* @param parms
* @returns
*/
PagedList(parms: Account.TBAccountDTO) {
PagedList(parms: Account.Page) {
return request('/api/authorize/accountpagelist', {
method: 'POST',
data: {


+ 29
- 43
frontend/src/pages/system/account/index.tsx View File

@@ -38,33 +38,33 @@
typeForm.setFieldsValue(copyFormData);
}}
>
编辑
重置密码
</Button>,
<Popconfirm
key="del"
title="确定要删除此条数据吗?"
onConfirm={() => {
// <Popconfirm
// key="del"
// title="确定要删除此条数据吗?"
// onConfirm={() => {
const EnablejsonData: Account.TBAccountDTO = {
id: record.id,
name: '',
code: ''
};
AccountAPI.Del(EnablejsonData).then((r) => {
if (r.statusCode === 200) {
message.success(r.statusCode === 200 ? '删除成功' : r.message);
actionRef.current?.reload();
}
});
}}
onCancel={() => {
message.info('已取消删除');
}}
okText="确认"
cancelText="关闭"
>
<Button type="primary" danger ghost>删除</Button>
</Popconfirm>,
// const EnablejsonData: Account.TBAccountDTO = {
// id: record.id,
// name: '',
// code: ''
// };
// AccountAPI.Del(EnablejsonData).then((r) => {
// if (r.statusCode === 200) {
// message.success(r.statusCode === 200 ? '删除成功' : r.message);
// actionRef.current?.reload();
// }
// });
// }}
// onCancel={() => {
// message.info('已取消删除');
// }}
// okText="确认"
// cancelText="关闭"
// >
// <Button type="primary" danger ghost>删除</Button>
// </Popconfirm>,
],
},
];
@@ -113,12 +113,10 @@
actionRef={actionRef}
cardBordered
request={async (params = {}) => {
const jsonData: DeviceTypes.Page = {
const jsonData: Account.Page = {
pageIndex: params.current || 1,
pageSize: params.pageSize || 10,
name: params.name || '',
id: '',
code: ''
account: params.account || '',
};
const response = await AccountAPI.PagedList(jsonData);
if (response.statusCode === 200) {
@@ -140,20 +138,8 @@
pageSize: 10,
}}
dateFormatter="string"
headerTitle="设备列表"
toolBarRender={() => [
<Button
key="button"
type="primary"
onClick={() => {
typeForm.resetFields();
setIsModalOpen(true);
setModelTitle('新增信息');
}}
>
新建
</Button>,
]}
headerTitle="账号列表"
toolBarRender={false}
/>
<Modal
key="01"


+ 17
- 14
frontend/src/pages/system/authTemplate/index.tsx View File

@@ -118,22 +118,25 @@ const AuthTemplate: React.FC = () => {
const response = await authTempAPI.GetModules(values.id);
setIsLoading(false);
if (response.statusCode === 200) {
console.log(' response.data', response.data);
const selectKeys: string[] = [];
response.data.forEach((item: AuthTemplateTypes.ModuleType) => {
if (item.hasPermission) {
if (item.childrens.length > 0) {
item.childrens.forEach((cItem: AuthTemplateTypes.ModuleType) => {
if (cItem.hasPermission) {
selectKeys.push(cItem.id);
if (cItem.childrens.length > 0) {
cItem.childrens.forEach((fItem: AuthTemplateTypes.ModuleType) => {
selectKeys.push(fItem.id);
})
}
}
});
}
}
// if (item.hasPermission) {
selectKeys.push(item.tB_ModuleId);
// if (item.childrens.length > 0) {
// item.childrens.forEach((cItem: AuthTemplateTypes.ModuleType) => {
// if (cItem.hasPermission) {
// selectKeys.push(cItem.id);
// if (cItem.childrens.length > 0) {
// cItem.childrens.forEach((fItem: AuthTemplateTypes.ModuleType) => {
// selectKeys.push(fItem.id);
// })
// }
// }
// });
// }
// }
});
console.log('selectKeys', selectKeys);
setSelectTempRowKeys(selectKeys);


+ 88
- 171
frontend/src/pages/system/user/index.tsx View File

@@ -8,7 +8,6 @@ import md5 from 'js-md5'
import { PlusOutlined } from '@ant-design/icons';
import type { ActionType, ProColumns } from '@ant-design/pro-components';
import { ProTable } from '@ant-design/pro-components';
import Password from 'antd/es/input/Password';

const DatePicker: any = TDatePicker;

@@ -19,17 +18,13 @@ const User: React.FC = () => {
const [isAccountVisible, setIsAccountVisible] = useState<boolean>(false);

const [currentPerson, setCurrentPerson] = useState<UserTypes.PersonnelType>({
phone: '',
joinDate: '',
outDate: '',
idCard: '',
stutas: 1,
tB_RoleId: '',
status: 1,
roleId: '',
gender: 1,
id: '',
sort: 1,
name: '',
iCCard: ''
isAccount: false
});
const [form] = Form.useForm();
const [formAccount] = Form.useForm();
@@ -47,24 +42,6 @@ const User: React.FC = () => {
dataIndex: 'account',
key: 'account',
},
{
title: '电话',
search: false,
dataIndex: 'phone',
key: 'phone'
},
{
title: 'IC卡',
search: false,
dataIndex: 'icCard',
key: 'icCard'
},
{
title: '身份证',
search: false,
dataIndex: 'idCard',
key: 'idCard'
},
{
title: '性别',
dataIndex: 'gender',
@@ -72,19 +49,16 @@ const User: React.FC = () => {
valueType: 'select',
valueEnum: {
0: {
text: '全部'
},
1: {
text: '男'
},
2: {
1: {
text: '女',
}
},
render: (_, record) => (
<>
{
record.gender === 1 ?
record.gender === 0 ?
<div style={{ color: 'green' }}>
</div>
@@ -96,32 +70,6 @@ const User: React.FC = () => {
</>
)
},
{
title: '入职时间',
dataIndex: 'joinDate',
key: 'joinDate',
valueType: 'date',
render: (_, record) => (<>
{
(() => {
return <div>{moment(record.joinDate).format('yyyy-MM-DD')}</div>
})()
}
</>)
},
{
title: '离职时间',
dataIndex: 'outDate',
search: false,
key: 'outDate',
render: (_, record) => (<>
{
(() => {
return record.outDate === null ? '-' : <div>{moment(record.outDate).format('yyyy-MM-DD')}</div>
})()
}
</>)
},
{
title: '角色',
search: false,
@@ -131,7 +79,7 @@ const User: React.FC = () => {
<>
{
(() => {
const role = roleList.find(item => item.id === record.tB_RoleId);
const role = roleList.find(item => item.id === record.roleId);
if (role) {
return <div>{role.name}</div>
} else {
@@ -144,32 +92,29 @@ const User: React.FC = () => {
},
{
title: '状态',
dataIndex: 'stutas',
key: 'stutas',
dataIndex: 'status',
key: 'status',
valueType: 'select',
valueEnum: {
0: {
text: '全部'
},
1: {
text: '在职'
},
2: {
1: {
text: '出差',
},
3: {
2: {
text: '离职',
}
},
render: (_, record) => (
<>
{
record.stutas === 1 ?
record.status === 0 ?
<div style={{ color: 'green' }}>
在职
</div>
:
(record.stutas === 2 ? <div style={{ color: 'Orange' }}>
(record.status === 1 ? <div style={{ color: 'Orange' }}>
出差
</div> : <div style={{ color: 'red' }}>
离职
@@ -185,53 +130,60 @@ const User: React.FC = () => {
key: 'action',
render: (_, record) => (
<Space size="middle" >
{
<a onClick={() => {
setIsAccountVisible(true);
formAccount.setFieldValue('tB_Employee_Id', record.id);
formAccount.setFieldValue('account', record.account!);
}}>账户设置</a>
{
<a onClick={() => {
setIsAccountVisible(true);
formAccount.setFieldValue('tB_Employee_Id', record.id);
formAccount.setFieldValue('account', record.account!);
}}>设置登录账号</a>
}
<a onClick={async () => {
const response = await userAPI.RestoreAccount(record.id!);
if (response.data === true) {
message.success('成功!');
} else {
message.error(response.msg || '重置失败');
}
}}>重置密码</a>
<Popconfirm
key="del"
title="确定要重置密码吗?"
onConfirm={async () => {
const response = await userAPI.RestoreAccount(record.id!);
if (response.data === true) {
message.success('成功!');
} else {
message.error(response.msg || '重置失败');
}
}}
onCancel={() => {
message.info('已取消删除');
}}
okText="确认"
cancelText="关闭"
>
<a >重置密码</a>
</Popconfirm>
<a onClick={() => {
setIsPersonDetailVisible(true);
setCurrentPerson(record);
const tempRecord = JSON.parse(JSON.stringify(record));
tempRecord.joinDate = moment(record.joinDate)
if (record.outDate !== null) {
tempRecord.outDate = moment(record.outDate)
}
form.setFieldsValue(tempRecord);
}}>查看详情</a>
}}>编辑</a>
<Popconfirm
key="del"
title="确定要删除此条数据吗?"
onConfirm={ async() => {
const response = await userAPI.RemoveUser(record.id!);
if (response.data === true) {
message.success('删除成功!');
actionRef.current?.reload();
} else {
message.error(response.msg || '删除失败');
}
}}
onCancel={() => {
message.info('已取消删除');
}}
okText="确认"
cancelText="关闭"
>
<Button type="primary" danger ghost>删除员工</Button>
</Popconfirm>
key="del"
title="确定要删除此条数据吗?"
onConfirm={async () => {
const response = await userAPI.RemoveUser(record.id!);
if (response.data === true) {
message.success('删除成功!');
actionRef.current?.reload();
} else {
message.error(response.msg || '删除失败');
}
}}
onCancel={() => {
message.info('已取消删除');
}}
okText="确认"
cancelText="关闭"
>
<Button type="primary" danger ghost>删除员工</Button>
</Popconfirm>
</Space>
),
},
@@ -239,17 +191,12 @@ const User: React.FC = () => {

const onAddPerson = () => {
setCurrentPerson({
phone: '',
joinDate: '',
outDate: '',
idCard: '',
stutas: 1,
tB_RoleId: '',
status: 1,
roleId: '',
gender: 1,
id: '',
sort: 1,
name: '',
iCCard: ''
name: ''
});
form.resetFields();
setIsPersonDetailVisible(true);
@@ -266,14 +213,18 @@ const User: React.FC = () => {
message.error(response.msg || '获取角色列表失败');
}
}

useEffect(() => {
if (isPersonDetailVisible) {
onFetchRoleList();
}
}, [isPersonDetailVisible])
/**
* 新增/更新人员信息
*/
const onFinishPerson = async (user: UserTypes.PersonnelType) => {
if (user.id) {
const response = await userAPI.ModifyUser(user);
if (response.data===true) {
if (response.data === true) {
message.success('更新用户信息成功!');
setIsPersonDetailVisible(false);
} else {
@@ -289,7 +240,7 @@ const User: React.FC = () => {
}
}
actionRef.current?.reload();
onFetchRoleList();
}
/**
* 绑定用户账户
@@ -307,7 +258,7 @@ const User: React.FC = () => {
}
}


useEffect(() => {
onFetchRoleList();
@@ -321,8 +272,7 @@ const User: React.FC = () => {
cardBordered
request={async (params = {}) => {
const response = await userAPI.GetUserPagedList({
keyword: params.name,
joinDate: params.joinDate,
name: params.name,
status: params.status,
pageIndex: params.current || 1,
pageSize: params.pageSize || 10,
@@ -369,14 +319,6 @@ const User: React.FC = () => {
<Input />
</Form.Item>

<Form.Item
label="电话"
name="phone"
rules={[{ required: true, message: '请输入联系电话!' }]}
>
<Input />
</Form.Item>

<Form.Item
label="姓名"
name="name"
@@ -385,28 +327,20 @@ const User: React.FC = () => {
<Input />
</Form.Item>

<Form.Item
label="身份证"
name="idCard"
rules={[{ required: true, message: '请输入身份证!' }]}
>
<Input />
</Form.Item>

<Form.Item
label="性别"
name="gender"
rules={[{ required: true, message: '请选择性别!' }]}
>
<Select style={{ width: '100%' }}>
<Select.Option value={1}>男</Select.Option>
<Select.Option value={2}>女</Select.Option>
<Select.Option value={0}>男</Select.Option>
<Select.Option value={1}>女</Select.Option>
</Select>
</Form.Item>

<Form.Item
label="角色"
name="tB_RoleId"
name="roleId"
rules={[{ required: true, message: '请选择角色!' }]}
>
<Select style={{ width: '100%' }}>
@@ -420,32 +354,16 @@ const User: React.FC = () => {

<Form.Item
label="状态"
name="stutas"
name="status"
rules={[{ required: true, message: '请选择状态!' }]}
>
<Select style={{ width: '100%' }}>
<Select.Option value={1}>在职</Select.Option>
<Select.Option value={2}>出差</Select.Option>
<Select.Option value={3}>离职</Select.Option>
<Select.Option value={0}>在职</Select.Option>
<Select.Option value={1}>出差</Select.Option>
<Select.Option value={2}>离职</Select.Option>
</Select>
</Form.Item>

<Form.Item
label="入职日期"
name="joinDate"
rules={[{ required: true, message: '请输入入职日期!' }]}
>
<DatePicker format="YYYY-MM-DD" />
</Form.Item>

<Form.Item
label="离职日期"
name="outDate"
rules={[{ required: false, message: '请输入离职日期!' }]}
>
<DatePicker format="YYYY-MM-DD" />
</Form.Item>

<Form.Item >
<Button type="primary" htmlType="submit">
确定
@@ -453,18 +371,17 @@ const User: React.FC = () => {
</Form.Item>
</Form>
</Modal>
<Modal footer={null} width={500} title='用户账户' open={isAccountVisible}
onOk={()=>
{
formAccount?.resetFields();
setIsAccountVisible(false)
}}
onCancel={()=>{
formAccount?.resetFields();
setIsAccountVisible(false)
<Modal footer={null} width={500} title='用户账户' open={isAccountVisible}
onOk={() => {
formAccount?.resetFields();
setIsAccountVisible(false)

}}
onCancel={() => {
formAccount?.resetFields();
setIsAccountVisible(false)
}
}>
}>
<Form
form={formAccount}
name="basic"


+ 5
- 1
frontend/src/types/Account.d.ts View File

@@ -42,5 +42,9 @@ declare namespace Account {
*/
newPwd: string;
}

interface Page {
pageIndex:number,
pageSize:number
account:string
}
}

+ 5
- 41
frontend/src/types/UserTypes.d.ts View File

@@ -31,62 +31,26 @@ declare namespace UserTypes {
* @memberof TBEmployeeDTO
*/
gender?: number;
/**
* 手机号
* @type {string}
* @memberof TBEmployeeDTO
*/
phone?: string | null;
/**
* 员工IC卡
* @type {string}
* @memberof TBEmployeeDTO
*/
icCard?: string | null;
/**
* 头像
* @type {string}
* @memberof TBEmployeeDTO
*/
header?: string | null;
/**
* 入职时间
* @type {Date}
* @memberof TBEmployeeDTO
*/
joinDate?: Date;
/**
* 离职时间
* @type {Date}
* @memberof TBEmployeeDTO
*/
outDate?: Date | null;
/**
* 身份证
* @type {string}
* @memberof TBEmployeeDTO
*/
idCard?: string | null;
/**
* 1在职2出差3离职
* @type {number}
* @memberof TBEmployeeDTO
*/
stutas?: number;
status?: number;
/**
* 角色Id
* @type {string}
* @memberof TBEmployeeDTO
*/
tB_Role_Id?: string | null;
roleId?: string | null;

isAccount: boolean;
isAccount?: null | boolean ;
}

//人员分页查询参数
type UserPageParams = {
keyword: string,
joinDate: string?,
name: string,
status: number?,
pageIndex: number,
pageSize: number,


Loading…
Cancel
Save