diff --git a/aspnet-core/gateways/Lion.AbpPro.WebGateway/Program.cs b/aspnet-core/gateways/Lion.AbpPro.WebGateway/Program.cs index 9135c40b..3ee6e667 100644 --- a/aspnet-core/gateways/Lion.AbpPro.WebGateway/Program.cs +++ b/aspnet-core/gateways/Lion.AbpPro.WebGateway/Program.cs @@ -16,7 +16,7 @@ namespace Lion.AbpPro.WebGateway CreateHostBuilder(args).Build().Run(); } - public static IHostBuilder CreateHostBuilder(string[] args) => + private static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup(); }) .UseAutofac(); diff --git a/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Application.Contracts/DataDictionaries/Dtos/DeleteDataDictionaryDetailInput.cs b/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Application.Contracts/DataDictionaries/Dtos/DeleteDataDictionaryDetailInput.cs new file mode 100644 index 00000000..4557390a --- /dev/null +++ b/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Application.Contracts/DataDictionaries/Dtos/DeleteDataDictionaryDetailInput.cs @@ -0,0 +1,10 @@ +using System; + +namespace Lion.AbpPro.DataDictionaryManagement.DataDictionaries.Dtos; + +public class DeleteDataDictionaryDetailInput +{ + public Guid DataDictionaryId { get; set; } + + public Guid DataDictionayDetailId { get; set; } +} \ No newline at end of file diff --git a/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Application.Contracts/DataDictionaries/IDataDictionaryAppService.cs b/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Application.Contracts/DataDictionaries/IDataDictionaryAppService.cs index d407f888..6f1b0d93 100644 --- a/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Application.Contracts/DataDictionaries/IDataDictionaryAppService.cs +++ b/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Application.Contracts/DataDictionaries/IDataDictionaryAppService.cs @@ -43,5 +43,12 @@ namespace Lion.AbpPro.DataDictionaryManagement.DataDictionaries Task SetStatus(SetDataDictinaryDetailInput input); Task UpdateDetailAsync(UpdateDetailInput input); + + /// + /// 删除数据字典明细项 + /// + /// + /// + Task DeleteAsync(DeleteDataDictionaryDetailInput input); } } \ No newline at end of file diff --git a/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Application.Contracts/Permissions/DataDictionaryManagementPermissionDefinitionProvider.cs b/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Application.Contracts/Permissions/DataDictionaryManagementPermissionDefinitionProvider.cs index 55a6c30f..bde999d4 100644 --- a/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Application.Contracts/Permissions/DataDictionaryManagementPermissionDefinitionProvider.cs +++ b/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Application.Contracts/Permissions/DataDictionaryManagementPermissionDefinitionProvider.cs @@ -8,7 +8,13 @@ namespace Lion.AbpPro.DataDictionaryManagement.Permissions { public override void Define(IPermissionDefinitionContext context) { - var myGroup = context.AddGroup(DataDictionaryManagementPermissions.GroupName, L("Permission:DataDictionaryManagement")); + var abpIdentityGroup = context.GetGroup("AbpIdentity"); + + var dataDictionaryManagement = abpIdentityGroup.AddPermission(DataDictionaryManagementPermissions.DataDictionaryManagement.Default, + L("Permission:DataDictionaryManagement")); + dataDictionaryManagement.AddChild(DataDictionaryManagementPermissions.DataDictionaryManagement.Create, L("Permission:Create")); + dataDictionaryManagement.AddChild(DataDictionaryManagementPermissions.DataDictionaryManagement.Update, L("Permission:Update")); + dataDictionaryManagement.AddChild(DataDictionaryManagementPermissions.DataDictionaryManagement.Delete, L("Permission:Delete")); } private static LocalizableString L(string name) diff --git a/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Application.Contracts/Permissions/DataDictionaryManagementPermissions.cs b/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Application.Contracts/Permissions/DataDictionaryManagementPermissions.cs index 6c685e28..da2beccb 100644 --- a/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Application.Contracts/Permissions/DataDictionaryManagementPermissions.cs +++ b/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Application.Contracts/Permissions/DataDictionaryManagementPermissions.cs @@ -4,7 +4,15 @@ namespace Lion.AbpPro.DataDictionaryManagement.Permissions { public class DataDictionaryManagementPermissions { - public const string GroupName = "DataDictionaryManagement"; + public const string GroupName = "System"; + + public static class DataDictionaryManagement + { + public const string Default = GroupName + ".DataDictionaryManagement"; + public const string Create = Default + ".Create"; + public const string Update = Default + ".Update"; + public const string Delete = Default + ".Delete"; + } public static string[] GetAll() { diff --git a/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Application/DataDictionaries/DataDictionaryAppService.cs b/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Application/DataDictionaries/DataDictionaryAppService.cs index 2902f5f0..0a7b7462 100644 --- a/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Application/DataDictionaries/DataDictionaryAppService.cs +++ b/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Application/DataDictionaries/DataDictionaryAppService.cs @@ -4,11 +4,14 @@ using System.Threading; using System.Threading.Tasks; using Lion.AbpPro.DataDictionaryManagement.DataDictionaries.Aggregates; using Lion.AbpPro.DataDictionaryManagement.DataDictionaries.Dtos; +using Lion.AbpPro.DataDictionaryManagement.Permissions; using Lion.AbpPro.Extension.System; +using Microsoft.AspNetCore.Authorization; using Volo.Abp.Application.Dtos; namespace Lion.AbpPro.DataDictionaryManagement.DataDictionaries { + [Authorize(DataDictionaryManagementPermissions.DataDictionaryManagement.Default)] public class DataDictionaryAppService : DataDictionaryManagementAppService, IDataDictionaryAppService { /// @@ -74,6 +77,7 @@ namespace Lion.AbpPro.DataDictionaryManagement.DataDictionaries /// 创建字典类型 /// /// + [Authorize(DataDictionaryManagementPermissions.DataDictionaryManagement.Create)] public Task CreateAsync(CreateDataDictinaryInput input) { return _dataDictionaryManager.CreateAsync(input.Code, input.DisplayText, input.Description); @@ -82,6 +86,7 @@ namespace Lion.AbpPro.DataDictionaryManagement.DataDictionaries /// /// 新增字典明细 /// + [Authorize(DataDictionaryManagementPermissions.DataDictionaryManagement.Create)] public Task CreateDetailAsync(CreateDataDictinaryDetailInput input) { return _dataDictionaryManager.CreateDetailAsync(input.Id, input.Code, input.DisplayText, input.Description, @@ -91,16 +96,23 @@ namespace Lion.AbpPro.DataDictionaryManagement.DataDictionaries /// /// 设置字典明细状态 /// + [Authorize(DataDictionaryManagementPermissions.DataDictionaryManagement.Update)] public Task SetStatus(SetDataDictinaryDetailInput input) { return _dataDictionaryManager.SetStatus(input.DataDictionaryId, input.DataDictionayDetailId, input.IsEnabled); } + [Authorize(DataDictionaryManagementPermissions.DataDictionaryManagement.Update)] public Task UpdateDetailAsync(UpdateDetailInput input) { return _dataDictionaryManager.UpdateDetailAsync(input.DataDictionaryId, input.Id, input.DisplayText, input.Description, input.Order); } + + public Task DeleteAsync(DeleteDataDictionaryDetailInput input) + { + return _dataDictionaryManager.DeleteAsync(input.DataDictionaryId, input.DataDictionayDetailId); + } } } \ No newline at end of file diff --git a/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Domain.Shared/Localization/DataDictionaryManagement/en.json b/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Domain.Shared/Localization/DataDictionaryManagement/en.json index 9761915a..c2224548 100644 --- a/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Domain.Shared/Localization/DataDictionaryManagement/en.json +++ b/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Domain.Shared/Localization/DataDictionaryManagement/en.json @@ -2,6 +2,10 @@ "culture": "en", "texts": { "ManageYourProfile": "Manage your profile", - "SamplePageMessage": "A sample page for the DataDictionaryManagement module" + "SamplePageMessage": "A sample page for the DataDictionaryManagement module", + "Permission:DataDictionaryManagement": "DataDictionaryManagement", + "Permission:Create": "Create", + "Permission:Update": "Update", + "Permission:Delete": "Delete" } } \ No newline at end of file diff --git a/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Domain.Shared/Localization/DataDictionaryManagement/zh-Hans.json b/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Domain.Shared/Localization/DataDictionaryManagement/zh-Hans.json index e9beb411..f463a7e2 100644 --- a/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Domain.Shared/Localization/DataDictionaryManagement/zh-Hans.json +++ b/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Domain.Shared/Localization/DataDictionaryManagement/zh-Hans.json @@ -2,6 +2,10 @@ "culture": "zh-Hans", "texts": { "ManageYourProfile": "管理个人资料", - "SamplePageMessage": "DataDictionaryManagement模块的示例页面" + "SamplePageMessage": "DataDictionaryManagement模块的示例页面", + "Permission:DataDictionaryManagement": "数据字典", + "Permission:Create": "创建", + "Permission:Update": "编辑", + "Permission:Delete": "删除" } } \ No newline at end of file diff --git a/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Domain.Shared/Localization/DataDictionaryManagement/zh-Hant.json b/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Domain.Shared/Localization/DataDictionaryManagement/zh-Hant.json index ceea0555..6b70e6ed 100644 --- a/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Domain.Shared/Localization/DataDictionaryManagement/zh-Hant.json +++ b/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Domain.Shared/Localization/DataDictionaryManagement/zh-Hant.json @@ -1,6 +1,6 @@ { "culture": "zh-Hant", "texts": { - "ManageYourProfile": "管理個人資料" + "ManageYourProfile": "管理個人資料" } } \ No newline at end of file diff --git a/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Domain/DataDictionaries/DataDictionaryManager.cs b/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Domain/DataDictionaries/DataDictionaryManager.cs index 361471c5..daa60cd0 100644 --- a/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Domain/DataDictionaries/DataDictionaryManager.cs +++ b/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Domain/DataDictionaries/DataDictionaryManager.cs @@ -110,13 +110,13 @@ namespace Lion.AbpPro.DataDictionaryManagement.DataDictionaries detail.SetIsEnabled(isEnabled); return await _dataDictionaryRepository.UpdateAsync(entity); } - + /// /// 更新数据字典明细 /// public async Task UpdateDetailAsync( Guid dataDictionaryId, - Guid dataDictionayDetailId, + Guid dataDictionayDetailId, string displayText, string description, int order) @@ -130,8 +130,23 @@ namespace Lion.AbpPro.DataDictionaryManagement.DataDictionaries throw new DataDictionaryDomainException(message: $"字典项不存在"); } - detail.UpdateDetail(dataDictionayDetailId,displayText,description,order); + detail.UpdateDetail(dataDictionayDetailId, displayText, description, order); return await _dataDictionaryRepository.UpdateAsync(entity); } + + public async Task DeleteAsync(Guid dataDictionaryId, Guid dataDictionayDetailId) + { + var entity = await _dataDictionaryRepository.FindByIdAsync(dataDictionaryId); + if (entity == null) + throw new DataDictionaryDomainException(message: "数据字典不存在"); + var detail = entity.Details.FirstOrDefault(e => e.Id == dataDictionayDetailId); + if (null == detail) + { + throw new DataDictionaryDomainException(message: $"字典项不存在"); + } + + entity.Details.Remove(detail); + await _dataDictionaryRepository.UpdateAsync(entity); + } } } \ No newline at end of file diff --git a/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.HttpApi.Client/DataDictionaryManagementHttpApiClientModule.cs b/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.HttpApi.Client/DataDictionaryManagementHttpApiClientModule.cs index 6c84f298..bb0aae39 100644 --- a/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.HttpApi.Client/DataDictionaryManagementHttpApiClientModule.cs +++ b/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.HttpApi.Client/DataDictionaryManagementHttpApiClientModule.cs @@ -1,22 +1,22 @@ -// using Microsoft.Extensions.DependencyInjection; -// using Volo.Abp.Http.Client; -// using Volo.Abp.Modularity; -// -// namespace Lion.AbpPro.DataDictionaryManagement -// { -// [DependsOn( -// typeof(DataDictionaryManagementApplicationContractsModule), -// typeof(AbpHttpClientModule))] -// public class DataDictionaryManagementHttpApiClientModule : AbpModule -// { -// public const string RemoteServiceName = "DataDictionaryManagement"; -// -// public override void ConfigureServices(ServiceConfigurationContext context) -// { -// context.Services.AddHttpClientProxies( -// typeof(DataDictionaryManagementApplicationContractsModule).Assembly, -// RemoteServiceName -// ); -// } -// } -// } +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.Http.Client; +using Volo.Abp.Modularity; + +namespace Lion.AbpPro.DataDictionaryManagement +{ + [DependsOn( + typeof(DataDictionaryManagementApplicationContractsModule), + typeof(AbpHttpClientModule))] + public class DataDictionaryManagementHttpApiClientModule : AbpModule + { + public const string RemoteServiceName = "DataDictionaryManagement"; + + public override void ConfigureServices(ServiceConfigurationContext context) + { + context.Services.AddHttpClientProxies( + typeof(DataDictionaryManagementApplicationContractsModule).Assembly, + RemoteServiceName + ); + } + } +} diff --git a/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.HttpApi/DataDictionaries/DataDictionaryController.cs b/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.HttpApi/DataDictionaries/DataDictionaryController.cs index 1b41925a..ecc33061 100644 --- a/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.HttpApi/DataDictionaries/DataDictionaryController.cs +++ b/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.HttpApi/DataDictionaries/DataDictionaryController.cs @@ -60,5 +60,12 @@ namespace Lion.AbpPro.DataDictionaryManagement.DataDictionaries { return _dataDictionaryAppService.UpdateDetailAsync(input); } + + [HttpPost("delete")] + [SwaggerOperation(summary: "删除字典明细", Tags = new[] { "DataDictionary" })] + public Task DeleteAsync(DeleteDataDictionaryDetailInput input) + { + return _dataDictionaryAppService.DeleteAsync(input); + } } } \ No newline at end of file diff --git a/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/AbpProDomainSharedModule.cs b/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/AbpProDomainSharedModule.cs index 50716d32..7d806745 100644 --- a/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/AbpProDomainSharedModule.cs +++ b/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/AbpProDomainSharedModule.cs @@ -1,3 +1,4 @@ +using Lion.AbpPro.DataDictionaryManagement; using Lion.AbpPro.Localization; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Localization; @@ -32,7 +33,8 @@ namespace Lion.AbpPro typeof(AbpIdentityServerDomainSharedModule), typeof(AbpPermissionManagementDomainSharedModule), typeof(AbpSettingManagementDomainSharedModule), - typeof(AbpTenantManagementDomainSharedModule) + typeof(AbpTenantManagementDomainSharedModule), + typeof(DataDictionaryManagementDomainSharedModule) )] public class AbpProDomainSharedModule : AbpModule { diff --git a/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/Lion.AbpPro.Domain.Shared.csproj b/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/Lion.AbpPro.Domain.Shared.csproj index b68cc6df..5c643abf 100644 --- a/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/Lion.AbpPro.Domain.Shared.csproj +++ b/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/Lion.AbpPro.Domain.Shared.csproj @@ -30,6 +30,7 @@ + diff --git a/aspnet-core/services/src/Lion.AbpPro.HttpApi.Client/AbpProHttpApiClientModule.cs b/aspnet-core/services/src/Lion.AbpPro.HttpApi.Client/AbpProHttpApiClientModule.cs index 3fbfb22b..9f34647e 100644 --- a/aspnet-core/services/src/Lion.AbpPro.HttpApi.Client/AbpProHttpApiClientModule.cs +++ b/aspnet-core/services/src/Lion.AbpPro.HttpApi.Client/AbpProHttpApiClientModule.cs @@ -1,3 +1,4 @@ +using Lion.AbpPro.DataDictionaryManagement; using Microsoft.Extensions.DependencyInjection; using Volo.Abp.Account; using Volo.Abp.FeatureManagement; @@ -16,7 +17,8 @@ namespace Lion.AbpPro typeof(AbpPermissionManagementHttpApiClientModule), typeof(AbpTenantManagementHttpApiClientModule), typeof(AbpFeatureManagementHttpApiClientModule), - typeof(AbpSettingManagementHttpApiClientModule) + typeof(AbpSettingManagementHttpApiClientModule), + typeof(DataDictionaryManagementHttpApiClientModule) )] public class AbpProHttpApiClientModule : AbpModule { diff --git a/aspnet-core/services/src/Lion.AbpPro.HttpApi.Client/Lion.AbpPro.HttpApi.Client.csproj b/aspnet-core/services/src/Lion.AbpPro.HttpApi.Client/Lion.AbpPro.HttpApi.Client.csproj index 91788c73..e93b2fbf 100644 --- a/aspnet-core/services/src/Lion.AbpPro.HttpApi.Client/Lion.AbpPro.HttpApi.Client.csproj +++ b/aspnet-core/services/src/Lion.AbpPro.HttpApi.Client/Lion.AbpPro.HttpApi.Client.csproj @@ -8,6 +8,7 @@ + diff --git a/vben271/src/router/routes/modules/admin.ts b/vben271/src/router/routes/modules/admin.ts index 6cd6a09c..d1b41f72 100644 --- a/vben271/src/router/routes/modules/admin.ts +++ b/vben271/src/router/routes/modules/admin.ts @@ -68,9 +68,9 @@ const admin: AppRouteModule = { name: 'dataDictionary', component: () => import('/@/views/admin/dictionary/AbpDictionary.vue'), meta: { - title: t('routes.admin.esLogs'), - - icon: 'ant-design:snippets-twotone', + title: t('routes.admin.dictionaryManagement'), + icon: 'ant-design:table-outlined', + policy: 'System.DataDictionaryManagement', }, }, ], diff --git a/vben271/src/services/ServiceProxies.ts b/vben271/src/services/ServiceProxies.ts index c0697095..134043f3 100644 --- a/vben271/src/services/ServiceProxies.ts +++ b/vben271/src/services/ServiceProxies.ts @@ -3121,6 +3121,96 @@ export class DataDictionaryServiceProxy extends ServiceProxyBase { } return Promise.resolve(null); } + + /** + * 删除字典明细 + * @param body (optional) + * @return Success + */ + delete(body: DeleteDataDictionaryDetailInput | undefined , cancelToken?: CancelToken | undefined): Promise { + let url_ = this.baseUrl + "/DataDictionary/delete"; + url_ = url_.replace(/[?&]$/, ""); + + const content_ = JSON.stringify(body); + + let options_ = { + data: content_, + method: "POST", + url: url_, + headers: { + "Content-Type": "application/json", + }, + cancelToken + }; + + return this.transformOptions(options_).then(transformedOptions_ => { + return this.instance.request(transformedOptions_); + }).catch((_error: any) => { + if (isAxiosError(_error) && _error.response) { + return _error.response; + } else { + throw _error; + } + }).then((_response: AxiosResponse) => { + return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processDelete(_response)); + }); + } + + protected processDelete(response: AxiosResponse): Promise { + const status = response.status; + let _headers: any = {}; + if (response.headers && typeof response.headers === "object") { + for (let k in response.headers) { + if (response.headers.hasOwnProperty(k)) { + _headers[k] = response.headers[k]; + } + } + } + if (status === 200) { + const _responseText = response.data; + return Promise.resolve(null); + } else if (status === 403) { + const _responseText = response.data; + let result403: any = null; + let resultData403 = _responseText; + result403 = RemoteServiceErrorResponse.fromJS(resultData403); + return throwException("Forbidden", status, _responseText, _headers, result403); + } else if (status === 401) { + const _responseText = response.data; + let result401: any = null; + let resultData401 = _responseText; + result401 = RemoteServiceErrorResponse.fromJS(resultData401); + return throwException("Unauthorized", status, _responseText, _headers, result401); + } else if (status === 400) { + const _responseText = response.data; + let result400: any = null; + let resultData400 = _responseText; + result400 = RemoteServiceErrorResponse.fromJS(resultData400); + return throwException("Bad Request", status, _responseText, _headers, result400); + } else if (status === 404) { + const _responseText = response.data; + let result404: any = null; + let resultData404 = _responseText; + result404 = RemoteServiceErrorResponse.fromJS(resultData404); + return throwException("Not Found", status, _responseText, _headers, result404); + } else if (status === 501) { + const _responseText = response.data; + let result501: any = null; + let resultData501 = _responseText; + result501 = RemoteServiceErrorResponse.fromJS(resultData501); + return throwException("Server Error", status, _responseText, _headers, result501); + } else if (status === 500) { + const _responseText = response.data; + let result500: any = null; + let resultData500 = _responseText; + result500 = RemoteServiceErrorResponse.fromJS(resultData500); + return throwException("Server Error", status, _responseText, _headers, result500); + } else if (status !== 200 && status !== 204) { + const _responseText = response.data; + return throwException("An unexpected server error occurred.", status, _responseText, _headers); + } + return Promise.resolve(null); + } } export class FileConfigurationServiceProxy extends ServiceProxyBase { @@ -8851,6 +8941,46 @@ export interface IDateTimeFormatDto { longTimePattern: string | undefined; } +export class DeleteDataDictionaryDetailInput implements IDeleteDataDictionaryDetailInput { + dataDictionaryId!: string; + dataDictionayDetailId!: string; + + constructor(data?: IDeleteDataDictionaryDetailInput) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) + (this)[property] = (data)[property]; + } + } + } + + init(_data?: any) { + if (_data) { + this.dataDictionaryId = _data["dataDictionaryId"]; + this.dataDictionayDetailId = _data["dataDictionayDetailId"]; + } + } + + static fromJS(data: any): DeleteDataDictionaryDetailInput { + data = typeof data === 'object' ? data : {}; + let result = new DeleteDataDictionaryDetailInput(); + result.init(data); + return result; + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {}; + data["dataDictionaryId"] = this.dataDictionaryId; + data["dataDictionayDetailId"] = this.dataDictionayDetailId; + return data; + } +} + +export interface IDeleteDataDictionaryDetailInput { + dataDictionaryId: string; + dataDictionayDetailId: string; +} + export class EmailSettingsDto implements IEmailSettingsDto { smtpHost!: string | undefined; smtpPort!: number; diff --git a/vben271/src/views/admin/dictionary/AbpDictionary.ts b/vben271/src/views/admin/dictionary/AbpDictionary.ts index fd3cd8ed..bcc5e06d 100644 --- a/vben271/src/views/admin/dictionary/AbpDictionary.ts +++ b/vben271/src/views/admin/dictionary/AbpDictionary.ts @@ -6,6 +6,7 @@ import { PagingDataDictionaryInput, DataDictionaryServiceProxy, SetDataDictinaryDetailInput, + DeleteDataDictionaryDetailInput, } from '/@/services/ServiceProxies'; import { h } from 'vue'; import { Switch } from 'ant-design-vue'; @@ -333,3 +334,12 @@ export async function editDetailsDictionaryAsync({ changeOkLoading(false); closeModal(); } + +export async function deleleDetailAsync({ dataDictionaryId, dataDictionayDetailId, reload }) { + const _dataDictionaryServiceProxy = new DataDictionaryServiceProxy(); + const request = new DeleteDataDictionaryDetailInput(); + request.dataDictionaryId = dataDictionaryId; + request.dataDictionayDetailId = dataDictionayDetailId; + await _dataDictionaryServiceProxy.delete(request); + reload(); +} diff --git a/vben271/src/views/admin/dictionary/AbpDictionary.vue b/vben271/src/views/admin/dictionary/AbpDictionary.vue index 028f3460..d51f77f2 100644 --- a/vben271/src/views/admin/dictionary/AbpDictionary.vue +++ b/vben271/src/views/admin/dictionary/AbpDictionary.vue @@ -10,6 +10,7 @@ > @@ -65,8 +78,9 @@ dictionaryTypeTableColumns, searchDictionaryFormSchema, getDictionaryDetailsAsync, + deleleDetailAsync, } from './AbpDictionary'; - + import { useMessage } from '/@/hooks/web/useMessage'; import { Tag, message } from 'ant-design-vue'; export default defineComponent({ name: 'AbpDictionary', @@ -162,7 +176,22 @@ const handleCreateType = () => { createTypeModal(true); }; - + const { createConfirm } = useMessage(); + const handleDelete = async (record: Recordable) => { + let msg = t('common.askDelete'); + createConfirm({ + iconType: 'warning', + title: t('common.tip'), + content: msg, + onOk: async () => { + await deleleDetailAsync({ + dataDictionaryId: record.dataDictionaryId, + dataDictionayDetailId: record.id, + reload, + }); + }, + }); + }; return { registerTable, registerCreateModal, @@ -177,6 +206,7 @@ onSelectChange, clearSelectedRowKeys, t, + handleDelete, }; }, });