diff --git a/code/src/Modules/BaseService/BaseService.Application/UserManagement/RoleAppService.cs b/code/src/Modules/BaseService/BaseService.Application/UserManagement/RoleAppService.cs index 1b9822fb..7259ac48 100644 --- a/code/src/Modules/BaseService/BaseService.Application/UserManagement/RoleAppService.cs +++ b/code/src/Modules/BaseService/BaseService.Application/UserManagement/RoleAppService.cs @@ -23,6 +23,14 @@ namespace BaseService.UserManagement _repository = roleRepository; } + [HttpGet] + public async Task> GetAllAsync() + { + var items = await _repository.GetListAsync().ConfigureAwait(false); + var dtos = ObjectMapper.Map, List>(items); + return new ListResultDto(dtos); + } + [HttpGet] public async Task> GetListAsync(GetIdentityRolesInput input) { @@ -33,6 +41,15 @@ namespace BaseService.UserManagement return new PagedResultDto(totalCount, dtos); } + [HttpGet("{id}")] + [Authorize(IdentityPermissions.Roles.Delete)] + public async Task Details(Guid id) + { + var role = await _roleManager.GetByIdAsync(id).ConfigureAwait(false); + var dto = ObjectMapper.Map(role); + return dto; + } + [HttpPost] [Authorize(IdentityPermissions.Roles.Create)] public async Task CreateAsync(IdentityRoleCreateDto input) diff --git a/code/src/Modules/BaseService/BaseService.Application/UserManagement/UserAppService.cs b/code/src/Modules/BaseService/BaseService.Application/UserManagement/UserAppService.cs index 609fc6ad..80cae7fb 100644 --- a/code/src/Modules/BaseService/BaseService.Application/UserManagement/UserAppService.cs +++ b/code/src/Modules/BaseService/BaseService.Application/UserManagement/UserAppService.cs @@ -1,4 +1,4 @@ -using BaseService.BaseData; +using BaseService.BaseData; using BaseService.BaseData.Permissions.Dto; using BaseService.RelationBaseData; using BaseService.RelationData.Dto; @@ -408,5 +408,14 @@ namespace BaseService.Systems.UserManagement return dto; } + + [HttpDelete("{id}")] + [Authorize(IdentityPermissions.Roles.Delete)] + public async Task Delete(Guid id) + { + var entity = await UserManager.GetByIdAsync(id).ConfigureAwait(false); + await UserManager.DeleteAsync(entity).ConfigureAwait(false); + return new OkResult(); + } } -} \ No newline at end of file +} diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/form/form-input.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/form/form-input.js index 6ea4e459..a7c27f10 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/form/form-input.js +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/form/form-input.js @@ -122,7 +122,7 @@ export default { } else if (props.schema.url) { try { const url = `${props.schema.url}`; - const result = await request(url, null, { method: "POST" }); + const result = await request(url, null, { method: props.schema.method ?? "POST" }); options.value = result.data?.items.map((o) => ({ value: o[props.schema.value], label: o[props.schema.label], diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/list/index.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/list/index.js index 075b776e..3e61c4df 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/list/index.js +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/list/index.js @@ -656,9 +656,10 @@ export default { } const method = editFormMode.value === "create" ? config.edit.createMethod : config.edit.updateMethod; const response = await request(url, editFormModel.value, { method }); - if (!response.errors) { + if (response.errors) { ElMessageBox.alert(`错误:${response.errors?.error?.message}`, `代码:${response.errors?.error?.code}`); //model.errors = response.errors; //?? + } else { await load(); editFormMode.value = null; dialogVisible.value = false; diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/role.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/role.js index 6a4d3b5d..be94b800 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/role.js +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/role.js @@ -20,10 +20,12 @@ const schema = { }; const queryUrl = "role/get-list"; +const detailsUrl = "role/details/%s"; const deleteUrl = "role/delete/%s"; const updateUrl = "role/update/%s"; const createUrl = "role/create"; const queryMethod = "GET"; +const detailsMethod = "GET"; const deleteMethod = "DELETE"; const updateMethod = "PUT"; const createMethod = "POST"; @@ -56,10 +58,11 @@ export default function () { schema: schema, }, edit: { + detailsUrl, deleteUrl, updateUrl, createUrl, - + detailsMethod, deleteMethod, updateMethod, createMethod, diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/user.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/user.js index 600b21cf..07f136d8 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/user.js +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/user.js @@ -69,7 +69,8 @@ const schema = { type: "array", input: "select", multiple: true, - url: "identity/roles/all", + url: "role/get-all", + method: "get", value: "name", label: "name", items: { @@ -84,7 +85,7 @@ const queryUrl = `${baseUrl}`; const detailsUrl = `${baseUrl}/%s`; const createUrl = `${baseUrl}`; const updateUrl = `${baseUrl}/%s`; -const deleteUrl = "identity/users/%s"; +const deleteUrl = `${baseUrl}/%s`; const queryMethod = "GET"; const detailsMethod = "GET"; const createMethod = "POST";