diff --git a/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application.Contracts/LINGYUN/Abp/Identity/Dto/OrganizationUnitMoveDto.cs b/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application.Contracts/LINGYUN/Abp/Identity/Dto/OrganizationUnitMoveDto.cs index 7b63634e6..0ef51015d 100644 --- a/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application.Contracts/LINGYUN/Abp/Identity/Dto/OrganizationUnitMoveDto.cs +++ b/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application.Contracts/LINGYUN/Abp/Identity/Dto/OrganizationUnitMoveDto.cs @@ -1,13 +1,9 @@ using System; -using System.ComponentModel.DataAnnotations; -using Volo.Abp.Application.Dtos; namespace LINGYUN.Abp.Identity { - public class OrganizationUnitMoveDto : IEntityDto + public class OrganizationUnitMoveDto { - [Required] - public Guid Id { get; set; } public Guid? ParentId { get; set; } } } diff --git a/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application.Contracts/LINGYUN/Abp/Identity/IOrganizationUnitAppService.cs b/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application.Contracts/LINGYUN/Abp/Identity/IOrganizationUnitAppService.cs index ae17cb285..d03e2d337 100644 --- a/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application.Contracts/LINGYUN/Abp/Identity/IOrganizationUnitAppService.cs +++ b/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application.Contracts/LINGYUN/Abp/Identity/IOrganizationUnitAppService.cs @@ -14,9 +14,9 @@ namespace LINGYUN.Abp.Identity OrganizationUnitCreateDto, OrganizationUnitUpdateDto> { - Task GetLastChildOrNullAsync([Required] Guid parentId); + Task GetLastChildOrNullAsync(Guid? parentId); - Task MoveAsync(OrganizationUnitMoveDto input); + Task MoveAsync(Guid id, OrganizationUnitMoveDto input); Task> FindChildrenAsync(OrganizationUnitGetChildrenDto input); diff --git a/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application/LINGYUN/Abp/Identity/OrganizationUnitAppService.cs b/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application/LINGYUN/Abp/Identity/OrganizationUnitAppService.cs index 1ad5300d3..e23eaf86d 100644 --- a/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application/LINGYUN/Abp/Identity/OrganizationUnitAppService.cs +++ b/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application/LINGYUN/Abp/Identity/OrganizationUnitAppService.cs @@ -73,7 +73,7 @@ namespace LINGYUN.Abp.Identity return ObjectMapper.Map(origanizationUnit); } - public virtual async Task GetLastChildOrNullAsync(Guid parentId) + public virtual async Task GetLastChildOrNullAsync(Guid? parentId) { var origanizationUnitLastChildren = await OrganizationUnitManager.GetLastChildOrNullAsync(parentId); @@ -114,9 +114,9 @@ namespace LINGYUN.Abp.Identity } [Authorize(IdentityPermissions.OrganizationUnits.Update)] - public virtual async Task MoveAsync(OrganizationUnitMoveDto input) + public virtual async Task MoveAsync(Guid id, OrganizationUnitMoveDto input) { - await OrganizationUnitManager.MoveAsync(input.Id, input.ParentId); + await OrganizationUnitManager.MoveAsync(id, input.ParentId); } [Authorize(IdentityPermissions.OrganizationUnits.Update)] diff --git a/aspnet-core/modules/identity/LINGYUN.Abp.Identity.HttpApi/LINGYUN/Abp/Identity/IOrganizationUnitController.cs b/aspnet-core/modules/identity/LINGYUN.Abp.Identity.HttpApi/LINGYUN/Abp/Identity/OrganizationUnitController.cs similarity index 89% rename from aspnet-core/modules/identity/LINGYUN.Abp.Identity.HttpApi/LINGYUN/Abp/Identity/IOrganizationUnitController.cs rename to aspnet-core/modules/identity/LINGYUN.Abp.Identity.HttpApi/LINGYUN/Abp/Identity/OrganizationUnitController.cs index 87804b7fa..536223d6c 100644 --- a/aspnet-core/modules/identity/LINGYUN.Abp.Identity.HttpApi/LINGYUN/Abp/Identity/IOrganizationUnitController.cs +++ b/aspnet-core/modules/identity/LINGYUN.Abp.Identity.HttpApi/LINGYUN/Abp/Identity/OrganizationUnitController.cs @@ -1,8 +1,6 @@ using Microsoft.AspNetCore.Mvc; using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Text; using System.Threading.Tasks; using Volo.Abp; using Volo.Abp.Application.Dtos; @@ -13,13 +11,13 @@ namespace LINGYUN.Abp.Identity { [RemoteService(Name = IdentityRemoteServiceConsts.RemoteServiceName)] [Area("identity")] - [ControllerName("organization-unit")] - [Route("api/identity/organization-unit")] - public class IOrganizationUnitController : AbpController, IOrganizationUnitAppService + [ControllerName("organization-units")] + [Route("api/identity/organization-units")] + public class OrganizationUnitController : AbpController, IOrganizationUnitAppService { protected IOrganizationUnitAppService OrganizationUnitAppService { get; } - public IOrganizationUnitController( + public OrganizationUnitController( IOrganizationUnitAppService organizationUnitAppService) { OrganizationUnitAppService = organizationUnitAppService; @@ -68,7 +66,7 @@ namespace LINGYUN.Abp.Identity [HttpGet] [Route("last-children")] - public virtual async Task GetLastChildOrNullAsync([Required] Guid parentId) + public virtual async Task GetLastChildOrNullAsync(Guid? parentId) { return await OrganizationUnitAppService.GetLastChildOrNullAsync(parentId); } @@ -95,9 +93,9 @@ namespace LINGYUN.Abp.Identity [HttpPut] [Route("{id}/move")] - public virtual async Task MoveAsync(OrganizationUnitMoveDto input) + public virtual async Task MoveAsync(Guid id, OrganizationUnitMoveDto input) { - await OrganizationUnitAppService.MoveAsync(input); + await OrganizationUnitAppService.MoveAsync(id, input); } [HttpDelete] diff --git a/vueJs/src/api/organizationunit.ts b/vueJs/src/api/organizationunit.ts new file mode 100644 index 000000000..1890f8538 --- /dev/null +++ b/vueJs/src/api/organizationunit.ts @@ -0,0 +1,229 @@ +import ApiService from './serviceBase' +import { pagerFormat } from '@/utils/index' +import { AuditedEntityDto, PagedResultDto, PagedAndSortedResultRequestDto, ListResultDto } from './types' +import { RoleDto } from './roles' +import { UserDataDto } from './users' + +/** 远程服务地址 */ +const serviceUrl = process.env.VUE_APP_BASE_API + +export default class OrganizationUnitService { + /** + * 创建组织机构 + * @param payload 类型为 OrganizationUnitCreate 的对象 + * @returns 返回类型为 OrganizationUnit 的对象 + */ + public static createOrganizationUnit(payload: OrganizationUnitCreate) { + const _url = '/api/identity/organization-units' + return ApiService.Post(_url, payload, serviceUrl) + } + + /** + * 查询组织机构列表 + * @param payload 分页查询对象 + * @returns 返回类型为 OrganizationUnit 的对象列表 + */ + public static getOrganizationUnits(payload: OrganizationUnitGetByPaged) { + let _url = '/api/identity/organization-units' + _url += '?filter=' + payload.filter + _url += '&sorting=' + payload.sorting + _url += '&skipCount=' + pagerFormat(payload.skipCount) + _url += '&maxResultCount=' + payload.maxResultCount + return ApiService.Get>(_url, serviceUrl) + } + + /** + * 查询组织机构 + * @param id 主键标识 + * @returns 返回类型为 OrganizationUnit 的对象 + */ + public static getOrganizationUnit(id: string) { + let _url = '/api/identity/organization-units/' + _url += '?id=' + id + return ApiService.Get(_url, serviceUrl) + } + + /** + * 变更组织机构 + * @param payload 类型为 OrganizationUnitUpdate 的对象 + * @returns 返回类型为 OrganizationUnit 的对象 + */ + public static updateOrganizationUnit(payload: OrganizationUnitUpdate) { + const _url = '/api/identity/organization-units' + return ApiService.Put(_url, payload, serviceUrl) + } + + /** + * 查询组织机构下属列表 + * @param id 主键标识 + * @param recursive 是否查询所有子级 + * @returns 返回类型为 OrganizationUnit 的对象列表 + */ + public static findOrganizationUnitChildren(id: string, recursive: boolean | undefined) { + let _url = 'api/identity/organization-units/find-children' + _url += '?id=' + id + if (recursive !== undefined) { + _url += '&recursive=' + recursive + } + return ApiService.Get>(_url, serviceUrl) + } + + /** + * 查询指定节点的最后一个组织机构 + * @param parentId 父级节点标识 + * @returns 返回类型为 OrganizationUnit 的对象 + */ + public static findOrganizationUnitLastChildren(parentId: string | undefined) { + let _url = 'api/identity/organization-units/last-children' + if (parentId !== undefined) { + _url += '?parentId=' + parentId + } + return ApiService.Get(_url, serviceUrl) + } + + /** + * 移动组织机构 + * @param id 主键标识 + * @param parentId 移动到的父节点标识 + */ + public static moveOrganizationUnit(id: string, parentId: string | undefined) { + let _url = 'api/identity/organization-units/' + id + '/move' + _url += '?id=' + id + return ApiService.Put(_url, { parentId: parentId }, serviceUrl) + } + + /** + * 删除组织机构 + * @param id 主键标识 + */ + public static deleteOrganizationUnit(id: string) { + const _url = 'api/identity/organization-units/' + id + return ApiService.Delete(_url, serviceUrl) + } + + /** + * 获取组织机构角色列表 + * @param payload 类型为 OrganizationUnitGetRoleByPaged 的对象 + * @returns 返回类型为 RoleDto 的对象列表 + */ + public static organizationUnitGetRoles(payload: OrganizationUnitGetRoleByPaged) { + let _url = '/api/identity/organization-units/management-roles' + _url += '?id=' + payload.id + _url += '&filter=' + payload.filter + _url += '&sorting=' + payload.sorting + _url += '&skipCount=' + pagerFormat(payload.skipCount) + _url += '&maxResultCount=' + payload.maxResultCount + return ApiService.Get>(_url, serviceUrl) + } + + /** + * 增加角色 + * @param payload 类型为 OrganizationUnitAddRole 的对象 + */ + public static organizationUnitAddRole(payload: OrganizationUnitAddRole) { + const _url = '/api/identity/organization-units/management-roles' + return ApiService.Post(_url, payload, serviceUrl) + } + + /** + * 删除角色 + * @param id 主键标识 + * @param roleId 角色标识 + */ + public static organizationUnitRemoveRole(id: string, roleId: string) { + let _url = '/api/identity/organization-units/management-roles' + _url += '?id=' + id + _url += '&roleId=' + roleId + return ApiService.Delete(_url, serviceUrl) + } + + /** + * 获取组织机构用户列表 + * @param payload 类型为 OrganizationUnitGetRoleByPaged 的对象 + * @returns 返回类型为 RoleDto 的对象列表 + */ + public static organizationUnitGetUsers(id: string) { + let _url = '/api/identity/organization-units/management-users' + _url += '?id=' + id + return ApiService.Get>(_url, serviceUrl) + } + + /** + * 增加用户 + * @param payload 类型为 OrganizationUnitAddUser 的对象 + */ + public static organizationUnitAddUser(payload: OrganizationUnitAddUser) { + const _url = '/api/identity/organization-units/management-users' + return ApiService.Post(_url, payload, serviceUrl) + } + + /** + * 删除角色 + * @param id 主键标识 + * @param roleId 角色标识 + */ + public static organizationUnitRemoveUser(id: string, userId: string) { + let _url = '/api/identity/organization-units/management-users' + _url += '?id=' + id + _url += '&userId=' + userId + return ApiService.Delete(_url, serviceUrl) + } +} + +/** 组织机构 */ +export class OrganizationUnit extends AuditedEntityDto { + /** 标识 */ + id!: string + /** 父节点标识 */ + parentId?: string + /** 编号 */ + code!: string + /** 显示名称 */ + displayName!: string +} + +/** 组织机构分页查询对象 */ +export class OrganizationUnitGetByPaged extends PagedAndSortedResultRequestDto { + /** 过滤字符 */ + filter!: string +} + +/** 组织机构角色分页查询对象 */ +export class OrganizationUnitGetRoleByPaged extends PagedAndSortedResultRequestDto { + /** 主键标识 */ + id!: string + /** 过滤字符 */ + filter!: string +} + +/** 组织机构创建对象 */ +export class OrganizationUnitCreate { + /** 显示名称 */ + displayName!: string + /** 父节点标识 */ + parentId?: string +} + +/** 组织机构变更对象 */ +export class OrganizationUnitUpdate { + /** 标识 */ + id!: string + /** 显示名称 */ + displayName!: string +} + +/** 组织机构增加部门对象 */ +export class OrganizationUnitAddRole { + /** 标识 */ + id!: string + /** 部门标识 */ + roleId!: string +} + +/** 组织机构增加用户对象 */ +export class OrganizationUnitAddUser { + /** 标识 */ + id!: string + /** 用户标识 */ + userId!: string +} diff --git a/vueJs/src/lang/en.ts b/vueJs/src/lang/en.ts index 68f8c4927..7c7d002bb 100644 --- a/vueJs/src/lang/en.ts +++ b/vueJs/src/lang/en.ts @@ -77,7 +77,8 @@ export default { identityServer: 'identity server', clients: 'clients', apiresources: 'api resources', - identityresources: 'id resources' + identityresources: 'id resources', + organizationUnit: 'organization unit' }, navbar: { logOut: 'Log Out', @@ -209,7 +210,7 @@ export default { passwordSecurity: 'security', systemSetting: 'system', userAccount: 'user account', - mailing: "mailing" + mailing: 'mailing' }, task: { title: 'task' diff --git a/vueJs/src/lang/zh.ts b/vueJs/src/lang/zh.ts index ceac1578f..7ecdd356d 100644 --- a/vueJs/src/lang/zh.ts +++ b/vueJs/src/lang/zh.ts @@ -77,7 +77,8 @@ export default { identityServer: '身份认证服务器', clients: '客户端管理', apiresources: 'Api资源管理', - identityresources: '身份资源管理' + identityresources: '身份资源管理', + organizationUnit: '组织机构管理' }, navbar: { logOut: '退出登录', @@ -209,7 +210,7 @@ export default { passwordSecurity: '密码安全', systemSetting: '系统配置', userAccount: '用户账户', - mailing: "邮件配置" + mailing: '邮件配置' }, task: { title: '任务管理' diff --git a/vueJs/src/router/modules/admin.ts b/vueJs/src/router/modules/admin.ts index c12e7a889..3c969a189 100644 --- a/vueJs/src/router/modules/admin.ts +++ b/vueJs/src/router/modules/admin.ts @@ -50,6 +50,16 @@ const adminRouter: RouteConfig = { icon: 'tenants', roles: ['AbpTenantManagement.Tenants'] } + }, + { + path: 'organization-unit', + component: () => import('@/views/admin/organization-unit/index.vue'), + name: 'organization-unit', + meta: { + title: 'organizationUnit', + icon: 'tenants', + roles: ['AbpIdentity.OrganizationUnits'] + } } ] } diff --git a/vueJs/src/views/admin/organization-unit/components/EditOrganizationUint.vue b/vueJs/src/views/admin/organization-unit/components/EditOrganizationUint.vue new file mode 100644 index 000000000..11a0d9f8d --- /dev/null +++ b/vueJs/src/views/admin/organization-unit/components/EditOrganizationUint.vue @@ -0,0 +1,235 @@ + + + + + diff --git a/vueJs/src/views/admin/organization-unit/components/RoleOrganizationUint.vue b/vueJs/src/views/admin/organization-unit/components/RoleOrganizationUint.vue new file mode 100644 index 000000000..5c4e6501d --- /dev/null +++ b/vueJs/src/views/admin/organization-unit/components/RoleOrganizationUint.vue @@ -0,0 +1,118 @@ + + + + + diff --git a/vueJs/src/views/admin/organization-unit/components/UserOrganizationUint.vue b/vueJs/src/views/admin/organization-unit/components/UserOrganizationUint.vue new file mode 100644 index 000000000..ca6893072 --- /dev/null +++ b/vueJs/src/views/admin/organization-unit/components/UserOrganizationUint.vue @@ -0,0 +1,136 @@ + + + + + diff --git a/vueJs/src/views/admin/organization-unit/index.vue b/vueJs/src/views/admin/organization-unit/index.vue new file mode 100644 index 000000000..417adad1e --- /dev/null +++ b/vueJs/src/views/admin/organization-unit/index.vue @@ -0,0 +1,58 @@ + + + + + diff --git a/vueJs/src/views/admin/roles/index.vue b/vueJs/src/views/admin/roles/index.vue index ca3b80be9..eff81a0f0 100644 --- a/vueJs/src/views/admin/roles/index.vue +++ b/vueJs/src/views/admin/roles/index.vue @@ -274,7 +274,7 @@ export default class extends Vue { /** 设置默认角色 */ private handleSetDefaultRole(role: RoleDto, setDefault: boolean) { - console.log('handleSetDefaultRole:' + role.id) + // console.log('handleSetDefaultRole:' + role.id) const setDefaultRoleDto = new UpdateRoleDto() setDefaultRoleDto.name = role.name setDefaultRoleDto.isDefault = setDefault