feat: rbac查询页面
This commit is contained in:
@@ -8,6 +8,6 @@ namespace Yi.Framework.Data.Entities
|
||||
{
|
||||
public interface IState
|
||||
{
|
||||
public bool? State { get; set; }
|
||||
public bool State { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,13 +10,12 @@ namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
public class DeptGetOutputDto : IEntityDto<long>
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
public long? CreatorId { get; set; }
|
||||
public bool State { get; set; }
|
||||
public string DeptName { get; set; }=string.Empty;
|
||||
public string DeptCode { get; set; } = string.Empty;
|
||||
public string? Leader { get; set; }
|
||||
public long ParentId { get; set; }
|
||||
public string? Remark { get; set; }
|
||||
|
||||
public long? deptId { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
public long? CreatorId { get; set; }
|
||||
public bool State { get; set; }
|
||||
public string PostCode { get; set; }=string.Empty;
|
||||
public string PostName { get; set; } = string.Empty;
|
||||
|
||||
@@ -14,8 +14,6 @@ namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
public string? Name { get; set; }
|
||||
public int? Age { get; set; }
|
||||
public string UserName { get; set; } = string.Empty;
|
||||
public string Password { get; set; } = string.Empty;
|
||||
public string Salt { get; set; } = string.Empty;
|
||||
public string? Icon { get; set; }
|
||||
public string? Nick { get; set; }
|
||||
public string? Email { get; set; }
|
||||
@@ -25,10 +23,13 @@ namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
public string? Introduction { get; set; }
|
||||
public string? Remark { get; set; }
|
||||
public SexEnum Sex { get; set; } = SexEnum.Unknown;
|
||||
public long? DeptId { get; set; }
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
public long? CreatorId { get; set; }
|
||||
|
||||
public bool State { get; set; }
|
||||
public DateTime CreationTime { get; set; }
|
||||
|
||||
public DeptGetOutputDto Dept { get; set; }
|
||||
|
||||
public List<PostGetListOutputDto> Posts { get; set; }
|
||||
|
||||
public List<RoleGetListOutputDto> Roles { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Mapster;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -9,12 +10,12 @@ namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
{
|
||||
public class UserUpdateInputVo
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public string? Name { get; set; }
|
||||
public int? Age { get; set; }
|
||||
public string UserName { get; set; } = string.Empty;
|
||||
public string Password { get; set; } = string.Empty;
|
||||
public string Salt { get; set; } = string.Empty;
|
||||
public string? UserName { get; set; }
|
||||
|
||||
[AdaptIgnore]
|
||||
public string? Password { get; set; }
|
||||
public string? Icon { get; set; }
|
||||
public string? Nick { get; set; }
|
||||
public string? Email { get; set; }
|
||||
@@ -23,11 +24,11 @@ namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
public long? Phone { get; set; }
|
||||
public string? Introduction { get; set; }
|
||||
public string? Remark { get; set; }
|
||||
public SexEnum Sex { get; set; } = SexEnum.Unknown;
|
||||
public SexEnum? Sex { get; set; }
|
||||
public long? DeptId { get; set; }
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
public long? CreatorId { get; set; }
|
||||
public List<long>? PostIds { get; set; }
|
||||
|
||||
public bool State { get; set; }
|
||||
public List<long>? RoleIds { get; set; }
|
||||
public bool? State { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,5 +111,20 @@
|
||||
<returns></returns>
|
||||
<exception cref="T:Yi.Framework.Core.Exceptions.UserFriendlyException"></exception>
|
||||
</member>
|
||||
<member name="M:Yi.RBAC.Application.Identity.UserService.GetAsync(System.Int64)">
|
||||
<summary>
|
||||
单查
|
||||
</summary>
|
||||
<param name="id"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.RBAC.Application.Identity.UserService.UpdateAsync(System.Int64,Yi.RBAC.Application.Contracts.Identity.Dtos.UserUpdateInputVo)">
|
||||
<summary>
|
||||
更新用户
|
||||
</summary>
|
||||
<param name="id"></param>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
|
||||
@@ -8,6 +8,8 @@ using Yi.RBAC.Domain.Identity;
|
||||
using Yi.Framework.Uow;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
using Yi.RBAC.Domain.Identity.Repositories;
|
||||
using SqlSugar;
|
||||
using Mapster;
|
||||
|
||||
namespace Yi.RBAC.Application.Identity
|
||||
{
|
||||
@@ -36,7 +38,7 @@ namespace Yi.RBAC.Application.Identity
|
||||
{
|
||||
var entity = await MapToEntityAsync(input);
|
||||
|
||||
int total = 0;
|
||||
RefAsync<int> total = 0;
|
||||
|
||||
var entities = await _DbQueryable.WhereIF(!string.IsNullOrEmpty(input.UserName), x => x.UserName.Contains(input.UserName!)).
|
||||
WhereIF(input.Phone is not null, x => x.Phone.ToString()!.Contains(input.Phone.ToString()!)).
|
||||
@@ -80,5 +82,47 @@ namespace Yi.RBAC.Application.Identity
|
||||
return result;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 单查
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public override async Task<UserGetOutputDto> GetAsync(long id)
|
||||
{
|
||||
//使用导航树形查询
|
||||
var entity = await _DbQueryable.Includes(u => u.Roles).Includes(u => u.Posts).Includes(u => u.Dept).InSingleAsync(id);
|
||||
|
||||
return await MapToGetOutputDtoAsync(entity);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新用户
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public async override Task<UserGetOutputDto> UpdateAsync(long id, UserUpdateInputVo input)
|
||||
{
|
||||
if (await _repository.IsAnyAsync(u => input.UserName!.Equals(u.UserName) && !id.Equals(u.Id)))
|
||||
{
|
||||
throw new UserFriendlyException("用户已经在,更新失败");
|
||||
}
|
||||
var entity = await _repository.GetByIdAsync(id);
|
||||
//更新密码,特殊处理
|
||||
if (input.Password is not null)
|
||||
{
|
||||
entity.Password = input.Password;
|
||||
entity.BuildPassword();
|
||||
}
|
||||
await MapToEntityAsync(input, entity);
|
||||
using (var uow = _unitOfWorkManager.CreateContext())
|
||||
{
|
||||
var res1 = await _repository.UpdateAsync(entity);
|
||||
await _userManager.GiveUserSetRoleAsync(new List<long> { id }, input.RoleIds);
|
||||
await _userManager.GiveUserSetPostAsync(new List<long> { id }, input.PostIds);
|
||||
uow.Commit();
|
||||
}
|
||||
return await MapToGetOutputDtoAsync(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Data.DataSeeds;
|
||||
using Yi.Framework.Ddd.Repositories;
|
||||
using Yi.RBAC.Domain.Dictionary.Entities;
|
||||
using Yi.RBAC.Domain.Identity.Entities;
|
||||
|
||||
namespace Yi.RBAC.Domain.DataSeeds
|
||||
{
|
||||
[AppService(typeof(IDataSeed))]
|
||||
public class DeptDataSeed : AbstractDataSeed<DeptEntity>
|
||||
{
|
||||
public DeptDataSeed(IRepository<DeptEntity> repository) : base(repository)
|
||||
{
|
||||
}
|
||||
|
||||
public override List<DeptEntity> GetSeedData()
|
||||
{
|
||||
var entities =new List<DeptEntity>();
|
||||
|
||||
DeptEntity chengziDept = new DeptEntity()
|
||||
{
|
||||
Id = SnowflakeHelper.NextId,
|
||||
DeptName = "橙子科技",
|
||||
DeptCode = "Yi",
|
||||
OrderNum = 100,
|
||||
IsDeleted = false,
|
||||
ParentId = 0,
|
||||
Leader = "橙子",
|
||||
Remark = "如名所指"
|
||||
};
|
||||
entities.Add(chengziDept);
|
||||
|
||||
|
||||
DeptEntity shenzhenDept = new DeptEntity()
|
||||
{
|
||||
Id = SnowflakeHelper.NextId,
|
||||
DeptName = "深圳总公司",
|
||||
OrderNum = 100,
|
||||
IsDeleted = false,
|
||||
ParentId = chengziDept.Id
|
||||
};
|
||||
entities.Add(shenzhenDept);
|
||||
|
||||
|
||||
DeptEntity jiangxiDept = new DeptEntity()
|
||||
{
|
||||
Id = SnowflakeHelper.NextId,
|
||||
DeptName = "江西总公司",
|
||||
OrderNum = 100,
|
||||
IsDeleted = false,
|
||||
ParentId = chengziDept.Id
|
||||
};
|
||||
entities.Add(jiangxiDept);
|
||||
|
||||
|
||||
|
||||
DeptEntity szDept1 = new DeptEntity()
|
||||
{
|
||||
Id = SnowflakeHelper.NextId,
|
||||
DeptName = "研发部门",
|
||||
OrderNum = 100,
|
||||
IsDeleted = false,
|
||||
ParentId = shenzhenDept.Id
|
||||
};
|
||||
entities.Add(szDept1);
|
||||
|
||||
DeptEntity szDept2 = new DeptEntity()
|
||||
{
|
||||
Id = SnowflakeHelper.NextId,
|
||||
DeptName = "市场部门",
|
||||
OrderNum = 100,
|
||||
IsDeleted = false,
|
||||
ParentId = shenzhenDept.Id
|
||||
};
|
||||
entities.Add(szDept2);
|
||||
|
||||
DeptEntity szDept3 = new DeptEntity()
|
||||
{
|
||||
Id = SnowflakeHelper.NextId,
|
||||
DeptName = "测试部门",
|
||||
OrderNum = 100,
|
||||
IsDeleted = false,
|
||||
ParentId = shenzhenDept.Id
|
||||
};
|
||||
entities.Add(szDept3);
|
||||
|
||||
DeptEntity szDept4 = new DeptEntity()
|
||||
{
|
||||
Id = SnowflakeHelper.NextId,
|
||||
DeptName = "财务部门",
|
||||
OrderNum = 100,
|
||||
IsDeleted = false,
|
||||
ParentId = shenzhenDept.Id
|
||||
};
|
||||
entities.Add(szDept4);
|
||||
|
||||
DeptEntity szDept5 = new DeptEntity()
|
||||
{
|
||||
Id = SnowflakeHelper.NextId,
|
||||
DeptName = "运维部门",
|
||||
OrderNum = 100,
|
||||
IsDeleted = false,
|
||||
ParentId = shenzhenDept.Id
|
||||
};
|
||||
entities.Add(szDept5);
|
||||
|
||||
|
||||
DeptEntity jxDept1 = new DeptEntity()
|
||||
{
|
||||
Id = SnowflakeHelper.NextId,
|
||||
DeptName = "市场部门",
|
||||
OrderNum = 100,
|
||||
IsDeleted = false,
|
||||
ParentId = jiangxiDept.Id
|
||||
};
|
||||
entities.Add(jxDept1);
|
||||
|
||||
|
||||
DeptEntity jxDept2 = new DeptEntity()
|
||||
{
|
||||
Id = SnowflakeHelper.NextId,
|
||||
DeptName = "财务部门",
|
||||
OrderNum = 100,
|
||||
IsDeleted = false,
|
||||
ParentId = jiangxiDept.Id
|
||||
};
|
||||
entities.Add(jxDept2);
|
||||
|
||||
|
||||
return entities;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Data.DataSeeds;
|
||||
using Yi.Framework.Ddd.Repositories;
|
||||
using Yi.RBAC.Domain.Identity.Entities;
|
||||
|
||||
namespace Yi.RBAC.Domain.DataSeeds
|
||||
{
|
||||
[AppService(typeof(IDataSeed))]
|
||||
public class PostDataSeed : AbstractDataSeed<PostEntity>
|
||||
{
|
||||
public PostDataSeed(IRepository<PostEntity> repository) : base(repository)
|
||||
{
|
||||
}
|
||||
|
||||
public override List<PostEntity> GetSeedData()
|
||||
{
|
||||
var entites=new List<PostEntity>();
|
||||
|
||||
PostEntity Post1 = new PostEntity()
|
||||
{
|
||||
Id = SnowflakeHelper.NextId,
|
||||
PostName = "董事长",
|
||||
PostCode = "ceo",
|
||||
OrderNum = 100,
|
||||
IsDeleted = false
|
||||
};
|
||||
entites.Add(Post1);
|
||||
|
||||
PostEntity Post2 = new PostEntity()
|
||||
{
|
||||
Id = SnowflakeHelper.NextId,
|
||||
PostName = "项目经理",
|
||||
PostCode = "se",
|
||||
OrderNum = 100,
|
||||
IsDeleted = false
|
||||
};
|
||||
entites.Add(Post2);
|
||||
|
||||
PostEntity Post3 = new PostEntity()
|
||||
{
|
||||
Id = SnowflakeHelper.NextId,
|
||||
PostName = "人力资源",
|
||||
PostCode = "hr",
|
||||
OrderNum = 100,
|
||||
IsDeleted = false
|
||||
};
|
||||
entites.Add(Post3);
|
||||
|
||||
PostEntity Post4 = new PostEntity()
|
||||
{
|
||||
Id = SnowflakeHelper.NextId,
|
||||
PostName = "普通员工",
|
||||
PostCode = "user",
|
||||
OrderNum = 100,
|
||||
IsDeleted = false
|
||||
};
|
||||
|
||||
entites.Add(Post4);
|
||||
return entites;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Data.DataSeeds;
|
||||
using Yi.Framework.Ddd.Repositories;
|
||||
using Yi.RBAC.Domain.Identity.Entities;
|
||||
using Yi.RBAC.Domain.Shared.Identity.EnumClasses;
|
||||
|
||||
namespace Yi.RBAC.Domain.DataSeeds
|
||||
{
|
||||
[AppService(typeof(IDataSeed))]
|
||||
public class RoleDataSeed : AbstractDataSeed<RoleEntity>
|
||||
{
|
||||
public RoleDataSeed(IRepository<RoleEntity> repository) : base(repository)
|
||||
{
|
||||
}
|
||||
|
||||
public override List<RoleEntity> GetSeedData()
|
||||
{
|
||||
var entities = new List<RoleEntity>();
|
||||
RoleEntity role1 = new RoleEntity()
|
||||
{
|
||||
Id = SnowflakeHelper.NextId,
|
||||
RoleName = "管理员",
|
||||
RoleCode = "admin",
|
||||
DataScope = DataScopeEnum.ALL,
|
||||
OrderNum = 999,
|
||||
Remark = "管理员",
|
||||
IsDeleted = false
|
||||
};
|
||||
entities.Add(role1);
|
||||
|
||||
RoleEntity role2 = new RoleEntity()
|
||||
{
|
||||
Id = SnowflakeHelper.NextId,
|
||||
RoleName = "测试角色",
|
||||
RoleCode = "test",
|
||||
DataScope = DataScopeEnum.ALL,
|
||||
OrderNum = 1,
|
||||
Remark = "测试用的角色",
|
||||
IsDeleted = false
|
||||
};
|
||||
entities.Add(role2);
|
||||
|
||||
return entities;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,7 @@ namespace Yi.RBAC.Domain.Dictionary.Entities
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
public bool? State { get; set; } = true;
|
||||
public bool State { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// 描述
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace Yi.RBAC.Domain.Identity.Entities
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
public bool? State { get; set; }
|
||||
public bool State { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// 部门名称
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace Yi.RBAC.Domain.Identity.Entities
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
public bool? State { get; set; }
|
||||
public bool State { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 菜单名
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace Yi.RBAC.Domain.Identity.Entities
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
public bool? State { get; set; }
|
||||
public bool State { get; set; }=true;
|
||||
|
||||
/// <summary>
|
||||
/// 岗位编码
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace Yi.RBAC.Domain.Identity.Entities
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
public bool? State { get; set; }
|
||||
public bool State { get; set; }=true;
|
||||
|
||||
|
||||
[Navigate(typeof(RoleMenuEntity), nameof(RoleMenuEntity.RoleId), nameof(RoleMenuEntity.MenuId))]
|
||||
|
||||
@@ -133,7 +133,7 @@ namespace Yi.RBAC.Domain.Identity.Entities
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
public bool? State { get; set; } = true;
|
||||
public bool State { get; set; } = true;
|
||||
|
||||
|
||||
/// <summary>
|
||||
|
||||
Binary file not shown.
@@ -3,7 +3,7 @@ import request from '@/utils/request'
|
||||
// 查询部门列表
|
||||
export function listDept(query) {
|
||||
return request({
|
||||
url: '/dept/SelctGetList',
|
||||
url: '/dept',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
@@ -20,7 +20,7 @@ export function listDept(query) {
|
||||
// 查询部门详细
|
||||
export function getDept(deptId) {
|
||||
return request({
|
||||
url: '/dept/getById/' + deptId,
|
||||
url: '/dept/' + deptId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
@@ -28,7 +28,7 @@ export function getDept(deptId) {
|
||||
// 新增部门
|
||||
export function addDept(data) {
|
||||
return request({
|
||||
url: '/dept/add',
|
||||
url: '/dept',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
@@ -37,7 +37,7 @@ export function addDept(data) {
|
||||
// 修改部门
|
||||
export function updateDept(data) {
|
||||
return request({
|
||||
url: '/dept/update',
|
||||
url: '/dept',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
@@ -45,14 +45,9 @@ export function updateDept(data) {
|
||||
|
||||
// 删除部门
|
||||
export function delDept(deptId) {
|
||||
if("string"==typeof(deptId))
|
||||
{
|
||||
deptId=[deptId];
|
||||
}
|
||||
return request({
|
||||
url: '/dept/delList',
|
||||
method: 'delete',
|
||||
data:deptId
|
||||
url: `/dept/${deptId}`,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import request from '@/utils/request'
|
||||
// 查询菜单列表
|
||||
export function listMenu(query) {
|
||||
return request({
|
||||
url: '/menu/selctGetList',
|
||||
url: '/menu',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
@@ -12,7 +12,7 @@ export function listMenu(query) {
|
||||
// 查询菜单详细
|
||||
export function getMenu(menuId) {
|
||||
return request({
|
||||
url: '/menu/getById/' + menuId,
|
||||
url: '/menu/' + menuId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
@@ -36,7 +36,7 @@ export function roleMenuTreeselect(roleId) {
|
||||
// 新增菜单
|
||||
export function addMenu(data) {
|
||||
return request({
|
||||
url: '/menu/add',
|
||||
url: '/menu',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
@@ -45,7 +45,7 @@ export function addMenu(data) {
|
||||
// 修改菜单
|
||||
export function updateMenu(data) {
|
||||
return request({
|
||||
url: '/menu/update',
|
||||
url: '/menu',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
@@ -53,13 +53,9 @@ export function updateMenu(data) {
|
||||
|
||||
// 删除菜单
|
||||
export function delMenu(menuId) {
|
||||
if("string"==typeof(menuId))
|
||||
{
|
||||
menuId=[menuId];
|
||||
}
|
||||
|
||||
return request({
|
||||
url: '/menu/delList',
|
||||
method: 'delete',
|
||||
data:menuId
|
||||
url: `/menu/${menuId}`,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
@@ -3,7 +3,7 @@ import request from '@/utils/request'
|
||||
// 查询岗位列表
|
||||
export function listPost(query) {
|
||||
return request({
|
||||
url: '/post/pageList',
|
||||
url: '/post',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
@@ -12,7 +12,7 @@ export function listPost(query) {
|
||||
// 查询岗位详细
|
||||
export function getPost(postId) {
|
||||
return request({
|
||||
url: '/post/getById/' + postId,
|
||||
url: '/post/' + postId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
@@ -20,7 +20,7 @@ export function getPost(postId) {
|
||||
// 新增岗位
|
||||
export function addPost(data) {
|
||||
return request({
|
||||
url: '/post/add',
|
||||
url: '/post',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
@@ -29,7 +29,7 @@ export function addPost(data) {
|
||||
// 修改岗位
|
||||
export function updatePost(data) {
|
||||
return request({
|
||||
url: '/post/update',
|
||||
url: '/post',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
@@ -37,21 +37,16 @@ export function updatePost(data) {
|
||||
|
||||
// 删除岗位
|
||||
export function delPost(postId) {
|
||||
if("string"==typeof(postId))
|
||||
{
|
||||
postId=[postId];
|
||||
}
|
||||
return request({
|
||||
url: '/post/delList',
|
||||
method: 'delete',
|
||||
data:postId
|
||||
url: `/post/${postId}`,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 获取角色选择框列表
|
||||
export function postOptionselect() {
|
||||
return request({
|
||||
url: '/post/getList',
|
||||
url: '/post',
|
||||
method: 'get'
|
||||
})
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import request from '@/utils/request'
|
||||
// 查询角色列表
|
||||
export function listRole(query) {
|
||||
return request({
|
||||
url: '/role/pageList',
|
||||
url: '/role',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
@@ -14,7 +14,7 @@ export function listRole(query) {
|
||||
// 查询角色详细
|
||||
export function getRole(roleId) {
|
||||
return request({
|
||||
url: '/role/getById/' + roleId,
|
||||
url: '/role/' + roleId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
@@ -22,7 +22,7 @@ export function getRole(roleId) {
|
||||
// 新增角色
|
||||
export function addRole(data) {
|
||||
return request({
|
||||
url: '/role/add',
|
||||
url: '/role',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
@@ -31,7 +31,7 @@ export function addRole(data) {
|
||||
// 修改角色
|
||||
export function updateRole(data) {
|
||||
return request({
|
||||
url: '/role/update',
|
||||
url: '/role',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
@@ -56,14 +56,9 @@ export function changeRoleStatus(roleId, isDel) {
|
||||
|
||||
// 删除角色
|
||||
export function delRole(roleId) {
|
||||
if("string"==typeof(roleId))
|
||||
{
|
||||
roleId=[roleId];
|
||||
}
|
||||
return request({
|
||||
url: '/role/delList',
|
||||
url: `/role/${roleId}`,
|
||||
method: 'delete',
|
||||
data:roleId
|
||||
})
|
||||
}
|
||||
|
||||
@@ -122,7 +117,7 @@ export function authUserSelectAll(data) {
|
||||
// 获取角色选择框列表
|
||||
export function roleOptionselect() {
|
||||
return request({
|
||||
url: '/role/getList',
|
||||
url: '/role',
|
||||
method: 'get'
|
||||
})
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import { parseStrEmpty } from "@/utils/ruoyi";
|
||||
// 查询用户列表
|
||||
export function listUser(query) {
|
||||
return request({
|
||||
url: '/user/pageList',
|
||||
url: '/user',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
@@ -13,7 +13,7 @@ export function listUser(query) {
|
||||
// 查询用户详细
|
||||
export function getUser(userId) {
|
||||
return request({
|
||||
url: '/user/getById/' + parseStrEmpty(userId),
|
||||
url: '/user/' + parseStrEmpty(userId),
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
@@ -28,24 +28,34 @@ export function addUser(data) {
|
||||
}
|
||||
|
||||
// 修改用户
|
||||
export function updateUser(data) {
|
||||
export function updateUser(id, data) {
|
||||
return request({
|
||||
url: '/user/update',
|
||||
url: `/user/${id}`,
|
||||
method: 'put',
|
||||
data: data
|
||||
data: {
|
||||
|
||||
userName: data.user.userName,
|
||||
nick: data.user.nick,
|
||||
password: data.user.password,
|
||||
phone: data.user.phone,
|
||||
email: data.user.email,
|
||||
sex: data.user.sex,
|
||||
state: data.user.state,
|
||||
remark: data.user.remark,
|
||||
postIds: data.postIds,
|
||||
roleIds: data.roleIds,
|
||||
deptId: data.deptId
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 删除用户
|
||||
export function delUser(userId) {
|
||||
if("string"==typeof(userId))
|
||||
{
|
||||
userId=[userId];
|
||||
}
|
||||
return request({
|
||||
url: '/user/delList',
|
||||
url: `/user/${userId}`,
|
||||
method: 'delete',
|
||||
data:userId
|
||||
})
|
||||
}
|
||||
|
||||
@@ -85,7 +95,7 @@ export function updateUserProfile(data) {
|
||||
return request({
|
||||
url: '/user/UpdateProfile',
|
||||
method: 'put',
|
||||
data: {user:data}
|
||||
data: { user: data }
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -191,7 +191,7 @@ const { queryParams, form, rules } = toRefs(data);
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
listDept(queryParams.value).then(response => {
|
||||
deptList.value = proxy.handleTree(response.data, "id");
|
||||
deptList.value = proxy.handleTree(response.data.items, "id");
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -329,7 +329,7 @@ const { queryParams, form, rules } = toRefs(data);
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
listMenu(queryParams.value).then(response => {
|
||||
menuList.value = proxy.handleTree(response.data, "id");
|
||||
menuList.value = proxy.handleTree(response.data.items, "id");
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
@@ -338,7 +338,7 @@ function getTreeselect() {
|
||||
menuOptions.value = [];
|
||||
listMenu().then(response => {
|
||||
const menu = { id: 0, menuName: "主类目", children: [] };
|
||||
menu.children = proxy.handleTree(response.data, "id");
|
||||
menu.children = proxy.handleTree(response.data.items, "id");
|
||||
menuOptions.value.push(menu);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ const { queryParams, form, rules } = toRefs(data);
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
listPost(queryParams.value).then(response => {
|
||||
postList.value = response.data.data;
|
||||
postList.value = response.data.items;
|
||||
total.value = response.data.total;
|
||||
loading.value = false;
|
||||
});
|
||||
|
||||
@@ -442,7 +442,7 @@ function getList() {
|
||||
loading.value = true;
|
||||
listRole(proxy.addDateRange(queryParams.value, dateRange.value)).then(
|
||||
(response) => {
|
||||
roleList.value = response.data.data;
|
||||
roleList.value = response.data.items;
|
||||
total.value = response.data.total;
|
||||
loading.value = false;
|
||||
}
|
||||
@@ -525,7 +525,7 @@ function handleAuthUser(row) {
|
||||
function getMenuTreeselect() {
|
||||
listMenu().then((response) => {
|
||||
const options = [];
|
||||
response.data.forEach((m) => {
|
||||
response.data.items.forEach((m) => {
|
||||
options.push({
|
||||
id: m.id,
|
||||
label: m.menuName,
|
||||
|
||||
@@ -81,9 +81,9 @@
|
||||
@change="handleStatusChange(scope.row)"></el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" v-if="columns[6].visible" width="160">
|
||||
<el-table-column label="创建时间" align="center" prop="creationTime" v-if="columns[6].visible" width="160">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
<span>{{ parseTime(scope.row.creationTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" width="150" class-name="small-padding fixed-width">
|
||||
@@ -321,7 +321,7 @@ watch(deptName, val => {
|
||||
function getDeptTree() {
|
||||
listDept().then(response => {
|
||||
const selectList = [];
|
||||
response.data.forEach(res => {
|
||||
response.data.items.forEach(res => {
|
||||
selectList.push({ id: res.id, label: res.deptName, parentId: res.parentId, orderNum: res.orderNum, children: [] })
|
||||
}
|
||||
|
||||
@@ -335,7 +335,7 @@ function getList() {
|
||||
listUser(proxy.addDateRange(queryParams.value, dateRange.value)).then(res => {
|
||||
|
||||
loading.value = false;
|
||||
userList.value = res.data.data;
|
||||
userList.value = res.data.items;
|
||||
total.value = res.data.total;
|
||||
});
|
||||
};
|
||||
@@ -469,10 +469,10 @@ function reset() {
|
||||
if (postOptions.value.length == 0 || roleOptions.value.length == 0) {
|
||||
roleOptionselect().then(response => {
|
||||
//岗位从另一个接口获取全量
|
||||
roleOptions.value = response.data;
|
||||
roleOptions.value = response.data.items;
|
||||
})
|
||||
postOptionselect().then(response => {
|
||||
postOptions.value = response.data;
|
||||
postOptions.value = response.data.items;
|
||||
|
||||
}
|
||||
|
||||
@@ -512,7 +512,6 @@ response.data.posts.forEach(post => {
|
||||
});
|
||||
|
||||
form.value.deptId= response.data.deptId;
|
||||
|
||||
response.data.roles.forEach(role => {
|
||||
form.value.roleIds.push(role.id)
|
||||
});
|
||||
@@ -529,7 +528,7 @@ function submitForm() {
|
||||
proxy.$refs["userRef"].validate(valid => {
|
||||
if (valid) {
|
||||
if (form.value.user.id != undefined) {
|
||||
updateUser(form.value).then(response => {
|
||||
updateUser(form.value.user.id,form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
|
||||
@@ -269,7 +269,7 @@ function setSubTableColumns(value) {
|
||||
/** 查询菜单下拉树结构 */
|
||||
function getMenuTreeselect() {
|
||||
listMenu().then(response => {
|
||||
menuOptions.value = proxy.handleTree(response.data, "menuId");
|
||||
menuOptions.value = proxy.handleTree(response.data.items, "menuId");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user