😎1、获取用户信息返回角色详细集合 2、完善角色相关翻译文件 3、更新前端请求文件
This commit is contained in:
parent
f7d298df36
commit
699063658b
@ -212,7 +212,10 @@ public class AppAuthService : IDynamicApiController, ITransient
|
||||
// 职位
|
||||
var pos = await _sysUserRep.ChangeRepository<SqlSugarRepository<SysPos>>().GetByIdAsync(user.PosId);
|
||||
// 角色集合
|
||||
var roleIds = await _sysUserRep.ChangeRepository<SqlSugarRepository<SysUserRole>>().AsQueryable().Where(u => u.UserId == user.Id).Select(u => u.RoleId).ToListAsync();
|
||||
var roles = await _sysUserRep.ChangeRepository<SqlSugarRepository<SysUserRole>>().AsQueryable()
|
||||
.LeftJoin<SysRole>((u, a) => u.RoleId == a.Id)
|
||||
.Where(u => u.UserId == user.Id)
|
||||
.Select((u, a) => new RoleDto { Id = a.Id, Name = a.Name, Code = a.Code }).ToListAsync();
|
||||
// 接口集合
|
||||
var apis = (await _sysRoleService.GetUserApiList())[0];
|
||||
|
||||
@ -233,7 +236,7 @@ public class AppAuthService : IDynamicApiController, ITransient
|
||||
OrgType = org?.Type,
|
||||
PosName = pos?.Name,
|
||||
Apis = apis,
|
||||
RoleIds = roleIds
|
||||
Roles = roles
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -99,7 +99,7 @@ public class LoginUserOutput
|
||||
/// <summary>
|
||||
/// 角色集合
|
||||
/// </summary>
|
||||
public List<long> RoleIds { get; set; }
|
||||
public List<RoleDto> Roles { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 水印文字
|
||||
@ -110,4 +110,25 @@ public class LoginUserOutput
|
||||
/// 最新密码修改时间
|
||||
/// </summary>
|
||||
public DateTime? LastChangePasswordTime;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 角色
|
||||
/// </summary>
|
||||
public class RoleDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 角色Id
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 编码
|
||||
/// </summary>
|
||||
public string Code { get; set; }
|
||||
}
|
||||
@ -293,7 +293,10 @@ public class SysAuthService : IDynamicApiController, ITransient
|
||||
// 职位
|
||||
var pos = await _sysUserRep.ChangeRepository<SqlSugarRepository<SysPos>>().GetByIdAsync(user.PosId);
|
||||
// 角色集合
|
||||
var roleIds = await _sysUserRep.ChangeRepository<SqlSugarRepository<SysUserRole>>().AsQueryable().Where(u => u.UserId == user.Id).Select(u => u.RoleId).ToListAsync();
|
||||
var roles = await _sysUserRep.ChangeRepository<SqlSugarRepository<SysUserRole>>().AsQueryable()
|
||||
.LeftJoin<SysRole>((u, a) => u.RoleId == a.Id)
|
||||
.Where(u => u.UserId == user.Id)
|
||||
.Select((u, a) => new RoleDto { Id = a.Id, Name=a.Name, Code = a.Code }).ToListAsync();
|
||||
// 接口集合
|
||||
var apis = (await App.GetRequiredService<SysRoleService>().GetUserApiList())[0];
|
||||
// 个性化水印文字(若系统水印为空则不显示)
|
||||
@ -319,7 +322,7 @@ public class SysAuthService : IDynamicApiController, ITransient
|
||||
OrgType = org?.Type,
|
||||
PosName = pos?.Name,
|
||||
Apis = apis,
|
||||
RoleIds = roleIds,
|
||||
Roles = roles,
|
||||
WatermarkText = watermarkText,
|
||||
LastChangePasswordTime = user.LastChangePasswordTime
|
||||
};
|
||||
|
||||
@ -397,6 +397,7 @@ export * from './report-data-source-output';
|
||||
export * from './reset-column-custom-input';
|
||||
export * from './reset-pwd-user-input';
|
||||
export * from './role-api-input';
|
||||
export * from './role-dto';
|
||||
export * from './role-input';
|
||||
export * from './role-menu-input';
|
||||
export * from './role-org-input';
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
*/
|
||||
|
||||
import { AccountTypeEnum } from './account-type-enum';
|
||||
import { RoleDto } from './role-dto';
|
||||
/**
|
||||
* 用户登录信息
|
||||
*
|
||||
@ -158,10 +159,10 @@ export interface LoginUserOutput {
|
||||
/**
|
||||
* 角色集合
|
||||
*
|
||||
* @type {Array<number>}
|
||||
* @type {Array<RoleDto>}
|
||||
* @memberof LoginUserOutput
|
||||
*/
|
||||
roleIds?: Array<number> | null;
|
||||
roles?: Array<RoleDto> | null;
|
||||
|
||||
/**
|
||||
* 水印文字
|
||||
|
||||
46
Web/src/api-services/models/role-dto.ts
Normal file
46
Web/src/api-services/models/role-dto.ts
Normal file
@ -0,0 +1,46 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Admin.NET 通用权限开发平台
|
||||
* 让 .NET 开发更简单、更通用、更流行。整合最新技术,模块插件式开发,前后端分离,开箱即用。<br/><u><b><font color='FF0000'> 👮不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!</font></b></u>
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
/**
|
||||
* 角色
|
||||
*
|
||||
* @export
|
||||
* @interface RoleDto
|
||||
*/
|
||||
export interface RoleDto {
|
||||
|
||||
/**
|
||||
* 角色Id
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof RoleDto
|
||||
*/
|
||||
id?: number;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof RoleDto
|
||||
*/
|
||||
name?: string | null;
|
||||
|
||||
/**
|
||||
* 编码
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof RoleDto
|
||||
*/
|
||||
code?: string | null;
|
||||
}
|
||||
@ -221,6 +221,7 @@ export default {
|
||||
editRole: 'Edit Role',
|
||||
confirmDeleteRole: 'Are you sure to delete role: [{roleName}]?',
|
||||
dataScope: 'Data Scope',
|
||||
sysFlag: 'System Flag',
|
||||
tenantName: 'Tenant Name',
|
||||
roleCodeRequired: 'Role code is required',
|
||||
roleNameRequired: 'Role name is required',
|
||||
|
||||
@ -223,6 +223,7 @@ export default {
|
||||
editRole: '编辑角色',
|
||||
confirmDeleteRole: '确定删除角色:【{roleName}】?',
|
||||
dataScope: '数据范围',
|
||||
sysFlag: '是否内置',
|
||||
tenantName: '租户名称',
|
||||
role: '角色',
|
||||
apiRoute: 'API路由',
|
||||
|
||||
@ -87,7 +87,7 @@ export const useUserInfo = defineStore('userInfo', {
|
||||
orgName: d.orgName,
|
||||
posName: d.posName,
|
||||
posId: d.posId,
|
||||
roles: d.roleIds,
|
||||
roles: d.roles,
|
||||
authApiList: d.apis,
|
||||
lastChangePasswordTime: d.lastChangePasswordTime,
|
||||
time: new Date().getTime(),
|
||||
|
||||
@ -139,7 +139,7 @@ const options = useVxeTable<PageRoleOutput>(
|
||||
{ field: 'name', title: i18n.t('message.list.roleName'), minWidth: 150, showOverflow: 'tooltip' },
|
||||
{ field: 'code', title: i18n.t('message.list.roleCode'), minWidth: 150, showOverflow: 'tooltip' },
|
||||
{ field: 'dataScope', title: i18n.t('message.list.dataScope'), minWidth: 150, showOverflow: 'tooltip', slots: { default: 'row_dataScope' } },
|
||||
{ field: 'sysFlag', title: '是否内置', width: 80, showOverflow: 'tooltip', slots: { default: 'row_sysFlag' } },
|
||||
{ field: 'sysFlag', title: i18n.t('message.list.sysFlag'), width: 80, showOverflow: 'tooltip', slots: { default: 'row_sysFlag' } },
|
||||
{ field: 'tenantName', title: i18n.t('message.list.tenantName'), minWidth: 180, showOverflow: 'tooltip' },
|
||||
{ field: 'orderNo', title: i18n.t('message.list.orderNo'), width: 80, showOverflow: 'tooltip' },
|
||||
{ field: 'status', title: i18n.t('message.list.status'), width: 80, showOverflow: 'tooltip', slots: { default: 'row_status' } },
|
||||
|
||||
Loading…
Reference in New Issue
Block a user