From 05110338c302a26558e42ffd67dd73fa89e5976f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=86=9B?= <510423039@qq.com> Date: Tue, 18 Jan 2022 14:06:25 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20=E6=B7=BB=E5=8A=A0=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=AD=97=E5=85=B8UI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/UpdateDetailInput.cs | 17 + .../IDataDictionaryAppService.cs | 8 +- .../DataDictionaryAppService.cs | 36 +- .../Aggregates/DataDictionaryDetail.cs | 23 +- .../DataDictionaries/DataDictionaryManager.cs | 27 +- .../DataDictionaryController.cs | 11 +- vben271/src/locales/lang/en/routes/admin.ts | 8 + .../src/locales/lang/zh-CN/routes/admin.ts | 8 + vben271/src/router/routes/modules/admin.ts | 10 + vben271/src/services/ServiceProxies.ts | 254 ++++++++++--- .../views/admin/dictionary/AbpDictionary.ts | 335 ++++++++++++++++++ .../views/admin/dictionary/AbpDictionary.vue | 185 ++++++++++ .../admin/dictionary/CreateAbpDictionary.vue | 77 ++++ .../dictionary/CreateAbpDictionaryType.vue | 69 ++++ .../admin/dictionary/EditAbpDictionary.vue | 74 ++++ 15 files changed, 1063 insertions(+), 79 deletions(-) create mode 100644 aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Application.Contracts/DataDictionaries/Dtos/UpdateDetailInput.cs create mode 100644 vben271/src/views/admin/dictionary/AbpDictionary.ts create mode 100644 vben271/src/views/admin/dictionary/AbpDictionary.vue create mode 100644 vben271/src/views/admin/dictionary/CreateAbpDictionary.vue create mode 100644 vben271/src/views/admin/dictionary/CreateAbpDictionaryType.vue create mode 100644 vben271/src/views/admin/dictionary/EditAbpDictionary.vue diff --git a/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Application.Contracts/DataDictionaries/Dtos/UpdateDetailInput.cs b/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Application.Contracts/DataDictionaries/Dtos/UpdateDetailInput.cs new file mode 100644 index 00000000..a6d66eaf --- /dev/null +++ b/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Application.Contracts/DataDictionaries/Dtos/UpdateDetailInput.cs @@ -0,0 +1,17 @@ +using System; +using System.ComponentModel.DataAnnotations; + +namespace Lion.AbpPro.DataDictionaryManagement.DataDictionaries.Dtos; + +public class UpdateDetailInput +{ + [Required] public Guid DataDictionaryId { get; set; } + + [Required] public Guid Id { get; set; } + + [Required] public string DisplayText { get; set; } + + public string Description { get; set; } + + public int Order { 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 1dfe8cdb..d407f888 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 @@ -15,8 +15,7 @@ namespace Lion.AbpPro.DataDictionaryManagement.DataDictionaries /// /// Task> GetPagingListAsync( - PagingDataDictionaryInput input, - CancellationToken cancellationToken = default); + PagingDataDictionaryInput input); /// /// 分页查询字典项明细 @@ -25,8 +24,7 @@ namespace Lion.AbpPro.DataDictionaryManagement.DataDictionaries /// /// Task> GetPagingDetailListAsync( - PagingDataDictionaryDetailInput input, - CancellationToken cancellationToken = default); + PagingDataDictionaryDetailInput input); /// /// 创建字典类型 @@ -43,5 +41,7 @@ namespace Lion.AbpPro.DataDictionaryManagement.DataDictionaries /// 设置字典明细状态 /// Task SetStatus(SetDataDictinaryDetailInput input); + + Task UpdateDetailAsync(UpdateDetailInput input); } } \ No newline at end of file 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 ace73a03..2902f5f0 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,6 +4,7 @@ using System.Threading; using System.Threading.Tasks; using Lion.AbpPro.DataDictionaryManagement.DataDictionaries.Aggregates; using Lion.AbpPro.DataDictionaryManagement.DataDictionaries.Dtos; +using Lion.AbpPro.Extension.System; using Volo.Abp.Application.Dtos; namespace Lion.AbpPro.DataDictionaryManagement.DataDictionaries @@ -16,8 +17,9 @@ namespace Lion.AbpPro.DataDictionaryManagement.DataDictionaries /// 如果是其他的操作全部通过对应manger进行操作 /// private readonly IDataDictionaryRepository _dataDictionaryRepository; + private readonly DataDictionaryManager _dataDictionaryManager; - + public DataDictionaryAppService( IDataDictionaryRepository dataDictionaryRepository, DataDictionaryManager dataDictionaryManager) @@ -33,21 +35,21 @@ namespace Lion.AbpPro.DataDictionaryManagement.DataDictionaries /// /// public async Task> GetPagingListAsync( - PagingDataDictionaryInput input, - CancellationToken cancellationToken = default) + PagingDataDictionaryInput input) { var result = new PagedResultDto(); - var totalCount = await _dataDictionaryRepository.GetPagingCountAsync(input.Filter, cancellationToken); + var totalCount = await _dataDictionaryRepository.GetPagingCountAsync(input.Filter); result.TotalCount = totalCount; if (totalCount <= 0) return result; var entities = await _dataDictionaryRepository.GetPagingListAsync(input.Filter, input.PageSize, - input.SkipCount, false, cancellationToken); + input.SkipCount, false); result.Items = ObjectMapper.Map, List>(entities); return result; } + /// /// 分页查询字典项明细 /// @@ -55,17 +57,19 @@ namespace Lion.AbpPro.DataDictionaryManagement.DataDictionaries /// /// public async Task> GetPagingDetailListAsync( - PagingDataDictionaryDetailInput input, - CancellationToken cancellationToken = default) + PagingDataDictionaryDetailInput input) { - var entity = await _dataDictionaryRepository.FindByIdAsync(input.DataDictionaryId, true, cancellationToken); - var details = entity.Details.Take(input.PageSize).Skip(input.SkipCount).ToList(); + var entity = await _dataDictionaryRepository.FindByIdAsync(input.DataDictionaryId, true); + var details = entity.Details + .WhereIf(input.Filter.IsNotNullOrWhiteSpace(), e => (e.Code.Contains(input.Filter) || e.DisplayText.Contains(input.Filter))) + .OrderBy(e => e.Order) + .Take(input.PageSize).Skip(input.SkipCount).ToList(); return new PagedResultDto( entity.Details.Count, ObjectMapper.Map, List>(details)); } - - + + /// /// 创建字典类型 /// @@ -78,7 +82,7 @@ namespace Lion.AbpPro.DataDictionaryManagement.DataDictionaries /// /// 新增字典明细 /// - public Task CreateDetailAsync(CreateDataDictinaryDetailInput input) + public Task CreateDetailAsync(CreateDataDictinaryDetailInput input) { return _dataDictionaryManager.CreateDetailAsync(input.Id, input.Code, input.DisplayText, input.Description, input.Order); @@ -87,10 +91,16 @@ namespace Lion.AbpPro.DataDictionaryManagement.DataDictionaries /// /// 设置字典明细状态 /// - public Task SetStatus(SetDataDictinaryDetailInput input) + public Task SetStatus(SetDataDictinaryDetailInput input) { return _dataDictionaryManager.SetStatus(input.DataDictionaryId, input.DataDictionayDetailId, input.IsEnabled); } + + public Task UpdateDetailAsync(UpdateDetailInput input) + { + return _dataDictionaryManager.UpdateDetailAsync(input.DataDictionaryId, input.Id, input.DisplayText, input.Description, + input.Order); + } } } \ No newline at end of file diff --git a/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Domain/DataDictionaries/Aggregates/DataDictionaryDetail.cs b/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Domain/DataDictionaries/Aggregates/DataDictionaryDetail.cs index 66786f68..f22b40a7 100644 --- a/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Domain/DataDictionaries/Aggregates/DataDictionaryDetail.cs +++ b/aspnet-core/modules/DataDictionaryManagement/src/Lion.AbpPro.DataDictionaryManagement.Domain/DataDictionaries/Aggregates/DataDictionaryDetail.cs @@ -61,32 +61,43 @@ namespace Lion.AbpPro.DataDictionaryManagement.DataDictionaries.Aggregates SetDescription(description); } - public void SetCode(string code) + private void SetCode(string code) { Guard.NotNullOrWhiteSpace(code, nameof(code), DataDictionaryMaxLengths.Code); Code = code; } - public void SetOrder(int order) + private void SetOrder(int order) { Order = order; } - public void SetDisplayText(string displayText) + private void SetDisplayText(string displayText) { Guard.NotNullOrWhiteSpace(displayText, nameof(displayText), DataDictionaryMaxLengths.DisplayText); DisplayText = displayText; } + private void SetDescription(string description) + { + Guard.Length(description, nameof(description), DataDictionaryMaxLengths.Description); + Description = Description = description ?? string.Empty; + } + public void SetIsEnabled(bool isEnabled) { IsEnabled = isEnabled; } - public void SetDescription(string description) + public void UpdateDetail( + Guid dataDictionayDetailId, + string displayText, + string description, + int order) { - Guard.Length(description, nameof(description), DataDictionaryMaxLengths.Description); - Description = Description = description ?? string.Empty; + SetDescription(description); + SetDisplayText(displayText); + SetOrder(order); } } } \ 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 6e611539..361471c5 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 @@ -10,7 +10,7 @@ using Volo.Abp.Domain.Services; namespace Lion.AbpPro.DataDictionaryManagement.DataDictionaries { - public class DataDictionaryManager : DataDictionaryDomainService + public class DataDictionaryManager : DataDictionaryDomainService { private readonly IDataDictionaryRepository _dataDictionaryRepository; private readonly IDistributedCache _cache; @@ -89,7 +89,7 @@ namespace Lion.AbpPro.DataDictionaryManagement.DataDictionaries } entity.AddDetail(GuidGenerator.Create(), code, displayText, order, description); - return await _dataDictionaryRepository.InsertAsync(entity); + return await _dataDictionaryRepository.UpdateAsync(entity); } /// @@ -110,5 +110,28 @@ namespace Lion.AbpPro.DataDictionaryManagement.DataDictionaries detail.SetIsEnabled(isEnabled); return await _dataDictionaryRepository.UpdateAsync(entity); } + + /// + /// 更新数据字典明细 + /// + public async Task UpdateDetailAsync( + Guid dataDictionaryId, + Guid dataDictionayDetailId, + string displayText, + string description, + int order) + { + 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: $"字典项不存在"); + } + + detail.UpdateDetail(dataDictionayDetailId,displayText,description,order); + return await _dataDictionaryRepository.UpdateAsync(entity); + } } } \ No newline at end of file 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 ad436a01..1b41925a 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 @@ -8,7 +8,7 @@ using Volo.Abp.Application.Services; namespace Lion.AbpPro.DataDictionaryManagement.DataDictionaries { [Route("DataDictionary")] - public class DataDictionaryController : DataDictionaryManagementController, IApplicationService + public class DataDictionaryController : DataDictionaryManagementController, IDataDictionaryAppService { private readonly IDataDictionaryAppService _dataDictionaryAppService; @@ -25,7 +25,7 @@ namespace Lion.AbpPro.DataDictionaryManagement.DataDictionaries return _dataDictionaryAppService.GetPagingListAsync(input); } - [HttpPost("page/detail")] + [HttpPost("pageDetail")] [SwaggerOperation(summary: "分页字典明细", Tags = new[] { "DataDictionary" })] public Task> GetPagingDetailListAsync( PagingDataDictionaryDetailInput input) @@ -53,5 +53,12 @@ namespace Lion.AbpPro.DataDictionaryManagement.DataDictionaries { return _dataDictionaryAppService.SetStatus(input); } + + [HttpPost("updateDetail")] + [SwaggerOperation(summary: "更新字典明细", Tags = new[] { "DataDictionary" })] + public Task UpdateDetailAsync(UpdateDetailInput input) + { + return _dataDictionaryAppService.UpdateDetailAsync(input); + } } } \ No newline at end of file diff --git a/vben271/src/locales/lang/en/routes/admin.ts b/vben271/src/locales/lang/en/routes/admin.ts index 11191571..0579c34a 100644 --- a/vben271/src/locales/lang/en/routes/admin.ts +++ b/vben271/src/locales/lang/en/routes/admin.ts @@ -52,4 +52,12 @@ export default { logLevel: 'Level', logContent: 'Content', settingManagement: 'SettingManagement', + dictionaryManagement: 'DataDictionary', + dictionaryTypeName: 'Type', + dictionaryCode: 'Code', + dictionaryDisplayText: 'Name', + dictionaryDescription: 'Description', + dictionaryOrder: 'Order', + chooseDictionary: 'Please Choose DataDictionary Type', + nonZeroMessage: 'Please enter a non-zero positive integer', }; diff --git a/vben271/src/locales/lang/zh-CN/routes/admin.ts b/vben271/src/locales/lang/zh-CN/routes/admin.ts index ed91fb9d..17a4cd90 100644 --- a/vben271/src/locales/lang/zh-CN/routes/admin.ts +++ b/vben271/src/locales/lang/zh-CN/routes/admin.ts @@ -51,4 +51,12 @@ export default { logContent: '内容', detail: '详情', settingManagement: '设置管理', + dictionaryManagement: '数据字典', + dictionaryTypeName: '字典类型', + dictionaryCode: '编码', + dictionaryDisplayText: '名称', + dictionaryDescription: '描述', + dictionaryOrder: '排序', + chooseDictionary: '请选择字典类型', + nonZeroMessage: '请输入非零的正整数', }; diff --git a/vben271/src/router/routes/modules/admin.ts b/vben271/src/router/routes/modules/admin.ts index 7ceae6c7..6cd6a09c 100644 --- a/vben271/src/router/routes/modules/admin.ts +++ b/vben271/src/router/routes/modules/admin.ts @@ -63,6 +63,16 @@ const admin: AppRouteModule = { icon: 'ant-design:snippets-twotone', }, }, + { + path: 'dataDictionary', + name: 'dataDictionary', + component: () => import('/@/views/admin/dictionary/AbpDictionary.vue'), + meta: { + title: t('routes.admin.esLogs'), + + icon: 'ant-design:snippets-twotone', + }, + }, ], }; diff --git a/vben271/src/services/ServiceProxies.ts b/vben271/src/services/ServiceProxies.ts index 9eae2cd8..c0697095 100644 --- a/vben271/src/services/ServiceProxies.ts +++ b/vben271/src/services/ServiceProxies.ts @@ -2563,7 +2563,7 @@ export class ClientServiceProxy extends ServiceProxyBase { } } -export class EsLogServiceProxy extends ServiceProxyBase { +export class DataDictionaryServiceProxy extends ServiceProxyBase { private instance: AxiosInstance; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; @@ -2575,12 +2575,12 @@ export class EsLogServiceProxy extends ServiceProxyBase { } /** - * 分页获取Es日志 + * 分页字典类型 * @param body (optional) * @return Success */ - page(body: PagingElasticSearchLogInput | undefined , cancelToken?: CancelToken | undefined): Promise { - let url_ = this.baseUrl + "/EsLog/page"; + page(body: PagingDataDictionaryInput | undefined , cancelToken?: CancelToken | undefined): Promise { + let url_ = this.baseUrl + "/DataDictionary/page"; url_ = url_.replace(/[?&]$/, ""); const content_ = JSON.stringify(body); @@ -2609,7 +2609,7 @@ export class EsLogServiceProxy extends ServiceProxyBase { }); } - protected processPage(response: AxiosResponse): Promise { + protected processPage(response: AxiosResponse): Promise { const status = response.status; let _headers: any = {}; if (response.headers && typeof response.headers === "object") { @@ -2623,7 +2623,7 @@ export class EsLogServiceProxy extends ServiceProxyBase { const _responseText = response.data; let result200: any = null; let resultData200 = _responseText; - result200 = PagingElasticSearchLogOutputCustomePagedResultDto.fromJS(resultData200); + result200 = PagingDataDictionaryOutputPagedResultDto.fromJS(resultData200); return result200; } else if (status === 403) { const _responseText = response.data; @@ -2665,28 +2665,16 @@ export class EsLogServiceProxy extends ServiceProxyBase { const _responseText = response.data; return throwException("An unexpected server error occurred.", status, _responseText, _headers); } - return Promise.resolve(null); - } -} - -export class DataDictionaryServiceProxy extends ServiceProxyBase { - private instance: AxiosInstance; - private baseUrl: string; - protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - - constructor(baseUrl?: string, instance?: AxiosInstance) { - super(); - this.instance = instance ? instance : axios.create(); - this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : ""; + return Promise.resolve(null); } /** - * 分页字典类型 + * 分页字典明细 * @param body (optional) * @return Success */ - page(body: PagingDataDictionaryInput | undefined , cancelToken?: CancelToken | undefined): Promise { - let url_ = this.baseUrl + "/DataDictionary/page"; + pageDetail(body: PagingDataDictionaryDetailInput | undefined , cancelToken?: CancelToken | undefined): Promise { + let url_ = this.baseUrl + "/DataDictionary/pageDetail"; url_ = url_.replace(/[?&]$/, ""); const content_ = JSON.stringify(body); @@ -2711,11 +2699,11 @@ export class DataDictionaryServiceProxy extends ServiceProxyBase { throw _error; } }).then((_response: AxiosResponse) => { - return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processPage(_response)); + return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processPageDetail(_response)); }); } - protected processPage(response: AxiosResponse): Promise { + protected processPageDetail(response: AxiosResponse): Promise { const status = response.status; let _headers: any = {}; if (response.headers && typeof response.headers === "object") { @@ -2729,7 +2717,7 @@ export class DataDictionaryServiceProxy extends ServiceProxyBase { const _responseText = response.data; let result200: any = null; let resultData200 = _responseText; - result200 = PagingDataDictionaryOutputPagedResultDto.fromJS(resultData200); + result200 = PagingDataDictionaryDetailOutputPagedResultDto.fromJS(resultData200); return result200; } else if (status === 403) { const _responseText = response.data; @@ -2771,16 +2759,16 @@ export class DataDictionaryServiceProxy extends ServiceProxyBase { const _responseText = response.data; return throwException("An unexpected server error occurred.", status, _responseText, _headers); } - return Promise.resolve(null); + return Promise.resolve(null); } /** - * 分页字典明细 + * 创建字典类型 * @param body (optional) * @return Success */ - detail(body: PagingDataDictionaryDetailInput | undefined , cancelToken?: CancelToken | undefined): Promise { - let url_ = this.baseUrl + "/DataDictionary/page/detail"; + create(body: CreateDataDictinaryInput | undefined , cancelToken?: CancelToken | undefined): Promise { + let url_ = this.baseUrl + "/DataDictionary/create"; url_ = url_.replace(/[?&]$/, ""); const content_ = JSON.stringify(body); @@ -2791,7 +2779,6 @@ export class DataDictionaryServiceProxy extends ServiceProxyBase { url: url_, headers: { "Content-Type": "application/json", - "Accept": "text/plain" }, cancelToken }; @@ -2805,11 +2792,11 @@ export class DataDictionaryServiceProxy extends ServiceProxyBase { throw _error; } }).then((_response: AxiosResponse) => { - return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processDetail(_response)); + return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processCreate(_response)); }); } - protected processDetail(response: AxiosResponse): Promise { + protected processCreate(response: AxiosResponse): Promise { const status = response.status; let _headers: any = {}; if (response.headers && typeof response.headers === "object") { @@ -2821,10 +2808,7 @@ export class DataDictionaryServiceProxy extends ServiceProxyBase { } if (status === 200) { const _responseText = response.data; - let result200: any = null; - let resultData200 = _responseText; - result200 = PagingDataDictionaryDetailOutputPagedResultDto.fromJS(resultData200); - return result200; + return Promise.resolve(null); } else if (status === 403) { const _responseText = response.data; let result403: any = null; @@ -2865,16 +2849,16 @@ export class DataDictionaryServiceProxy extends ServiceProxyBase { const _responseText = response.data; return throwException("An unexpected server error occurred.", status, _responseText, _headers); } - return Promise.resolve(null); + return Promise.resolve(null); } /** - * 创建字典类型 + * 创建字典明细 * @param body (optional) * @return Success */ - create(body: CreateDataDictinaryInput | undefined , cancelToken?: CancelToken | undefined): Promise { - let url_ = this.baseUrl + "/DataDictionary/create"; + createDetail(body: CreateDataDictinaryDetailInput | undefined , cancelToken?: CancelToken | undefined): Promise { + let url_ = this.baseUrl + "/DataDictionary/createDetail"; url_ = url_.replace(/[?&]$/, ""); const content_ = JSON.stringify(body); @@ -2898,11 +2882,11 @@ export class DataDictionaryServiceProxy extends ServiceProxyBase { throw _error; } }).then((_response: AxiosResponse) => { - return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processCreate(_response)); + return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processCreateDetail(_response)); }); } - protected processCreate(response: AxiosResponse): Promise { + protected processCreateDetail(response: AxiosResponse): Promise { const status = response.status; let _headers: any = {}; if (response.headers && typeof response.headers === "object") { @@ -2959,12 +2943,12 @@ export class DataDictionaryServiceProxy extends ServiceProxyBase { } /** - * 创建字典明细 + * 设置字典明细状态 * @param body (optional) * @return Success */ - createDetail(body: CreateDataDictinaryDetailInput | undefined , cancelToken?: CancelToken | undefined): Promise { - let url_ = this.baseUrl + "/DataDictionary/createDetail"; + status(body: SetDataDictinaryDetailInput | undefined , cancelToken?: CancelToken | undefined): Promise { + let url_ = this.baseUrl + "/DataDictionary/status"; url_ = url_.replace(/[?&]$/, ""); const content_ = JSON.stringify(body); @@ -2988,11 +2972,11 @@ export class DataDictionaryServiceProxy extends ServiceProxyBase { throw _error; } }).then((_response: AxiosResponse) => { - return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processCreateDetail(_response)); + return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processStatus(_response)); }); } - protected processCreateDetail(response: AxiosResponse): Promise { + protected processStatus(response: AxiosResponse): Promise { const status = response.status; let _headers: any = {}; if (response.headers && typeof response.headers === "object") { @@ -3049,12 +3033,12 @@ export class DataDictionaryServiceProxy extends ServiceProxyBase { } /** - * 设置字典明细状态 + * 更新字典明细 * @param body (optional) * @return Success */ - status(body: SetDataDictinaryDetailInput | undefined , cancelToken?: CancelToken | undefined): Promise { - let url_ = this.baseUrl + "/DataDictionary/status"; + updateDetail(body: UpdateDetailInput | undefined , cancelToken?: CancelToken | undefined): Promise { + let url_ = this.baseUrl + "/DataDictionary/updateDetail"; url_ = url_.replace(/[?&]$/, ""); const content_ = JSON.stringify(body); @@ -3078,11 +3062,11 @@ export class DataDictionaryServiceProxy extends ServiceProxyBase { throw _error; } }).then((_response: AxiosResponse) => { - return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processStatus(_response)); + return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processUpdateDetail(_response)); }); } - protected processStatus(response: AxiosResponse): Promise { + protected processUpdateDetail(response: AxiosResponse): Promise { const status = response.status; let _headers: any = {}; if (response.headers && typeof response.headers === "object") { @@ -3724,6 +3708,112 @@ export class IdentityResourceServiceProxy extends ServiceProxyBase { } } +export class EsLogServiceProxy extends ServiceProxyBase { + private instance: AxiosInstance; + private baseUrl: string; + protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; + + constructor(baseUrl?: string, instance?: AxiosInstance) { + super(); + this.instance = instance ? instance : axios.create(); + this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : ""; + } + + /** + * 分页获取Es日志 + * @param body (optional) + * @return Success + */ + page(body: PagingElasticSearchLogInput | undefined , cancelToken?: CancelToken | undefined): Promise { + let url_ = this.baseUrl + "/EsLog/page"; + url_ = url_.replace(/[?&]$/, ""); + + const content_ = JSON.stringify(body); + + let options_ = { + data: content_, + method: "POST", + url: url_, + headers: { + "Content-Type": "application/json", + "Accept": "text/plain" + }, + 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.processPage(_response)); + }); + } + + protected processPage(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; + let result200: any = null; + let resultData200 = _responseText; + result200 = PagingElasticSearchLogOutputCustomePagedResultDto.fromJS(resultData200); + return result200; + } 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 NotificationServiceProxy extends ServiceProxyBase { private instance: AxiosInstance; private baseUrl: string; @@ -8607,6 +8697,8 @@ export class CurrentUserDto implements ICurrentUserDto { tenantId!: string | undefined; impersonatorUserId!: string | undefined; impersonatorTenantId!: string | undefined; + impersonatorUserName!: string | undefined; + impersonatorTenantName!: string | undefined; userName!: string | undefined; name!: string | undefined; surName!: string | undefined; @@ -8632,6 +8724,8 @@ export class CurrentUserDto implements ICurrentUserDto { this.tenantId = _data["tenantId"]; this.impersonatorUserId = _data["impersonatorUserId"]; this.impersonatorTenantId = _data["impersonatorTenantId"]; + this.impersonatorUserName = _data["impersonatorUserName"]; + this.impersonatorTenantName = _data["impersonatorTenantName"]; this.userName = _data["userName"]; this.name = _data["name"]; this.surName = _data["surName"]; @@ -8661,6 +8755,8 @@ export class CurrentUserDto implements ICurrentUserDto { data["tenantId"] = this.tenantId; data["impersonatorUserId"] = this.impersonatorUserId; data["impersonatorTenantId"] = this.impersonatorTenantId; + data["impersonatorUserName"] = this.impersonatorUserName; + data["impersonatorTenantName"] = this.impersonatorTenantName; data["userName"] = this.userName; data["name"] = this.name; data["surName"] = this.surName; @@ -8683,6 +8779,8 @@ export interface ICurrentUserDto { tenantId: string | undefined; impersonatorUserId: string | undefined; impersonatorTenantId: string | undefined; + impersonatorUserName: string | undefined; + impersonatorTenantName: string | undefined; userName: string | undefined; name: string | undefined; surName: string | undefined; @@ -16172,6 +16270,58 @@ export interface IUpdateCreateApiScopeInput { showInDiscoveryDocument: boolean; } +export class UpdateDetailInput implements IUpdateDetailInput { + dataDictionaryId!: string; + id!: string; + displayText!: string; + description!: string | undefined; + order!: number; + + constructor(data?: IUpdateDetailInput) { + 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.id = _data["id"]; + this.displayText = _data["displayText"]; + this.description = _data["description"]; + this.order = _data["order"]; + } + } + + static fromJS(data: any): UpdateDetailInput { + data = typeof data === 'object' ? data : {}; + let result = new UpdateDetailInput(); + result.init(data); + return result; + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {}; + data["dataDictionaryId"] = this.dataDictionaryId; + data["id"] = this.id; + data["displayText"] = this.displayText; + data["description"] = this.description; + data["order"] = this.order; + return data; + } +} + +export interface IUpdateDetailInput { + dataDictionaryId: string; + id: string; + displayText: string; + description: string | undefined; + order: number; +} + export class UpdateEmailSettingsDto implements IUpdateEmailSettingsDto { smtpHost!: string | undefined; smtpPort!: number; diff --git a/vben271/src/views/admin/dictionary/AbpDictionary.ts b/vben271/src/views/admin/dictionary/AbpDictionary.ts new file mode 100644 index 00000000..fd3cd8ed --- /dev/null +++ b/vben271/src/views/admin/dictionary/AbpDictionary.ts @@ -0,0 +1,335 @@ +import { FormSchema } from '/@/components/Table'; +import { BasicColumn } from '/@/components/Table'; +import { message } from 'ant-design-vue'; +import { useI18n } from '/@/hooks/web/useI18n'; +import { + PagingDataDictionaryInput, + DataDictionaryServiceProxy, + SetDataDictinaryDetailInput, +} from '/@/services/ServiceProxies'; +import { h } from 'vue'; +import { Switch } from 'ant-design-vue'; +const { t } = useI18n(); +export const tableColumns: BasicColumn[] = [ + { + title: t('routes.admin.dictionaryCode'), + dataIndex: 'code', + }, + { + title: t('routes.admin.dictionaryDisplayText'), + dataIndex: 'displayText', + }, + { + title: t('routes.admin.dictionaryOrder'), + dataIndex: 'order', + }, + { + title: t('common.status'), + dataIndex: 'isEnabled', + customRender: ({ record }) => { + return h(Switch, { + checked: record.isEnabled, + checkedChildren: '是', + unCheckedChildren: '否', + onChange(checked: boolean) { + const request = new SetDataDictinaryDetailInput(); + request.dataDictionaryId = record.dataDictionaryId; + (request.dataDictionayDetailId = record.id), (request.isEnabled = checked); + enableDictionaryAsync(request) + .then(() => { + record.isEnabled = checked; + message.success(t('common.operationSuccess')); + }) + .catch(() => { + message.error(t('common.operationFail')); + }); + }, + }); + }, + }, + { + dataIndex: 'description', + title: t('routes.admin.dictionaryDescription'), + }, +]; +//字典类型表格 +export const dictionaryTypeTableColumns: BasicColumn[] = [ + { + title: t('routes.admin.dictionaryTypeName'), + dataIndex: 'displayText', + }, +]; +//字典项查询 +export const searchFormSchema: FormSchema[] = [ + { + field: 'filter', + label: '', + component: 'Input', + colProps: { + span: 6, + }, + }, +]; + +//字典类型查询 +export const searchDictionaryFormSchema: FormSchema[] = [ + { + field: 'filter', + label: '', + component: 'Input', + colProps: { + span: 18, + }, + }, +]; + +//新增字典项 +export const createFormSchema: FormSchema[] = [ + { + field: 'id', + label: '', + ifShow: false, + component: 'Input', + colProps: { + span: 18, + }, + }, + { + field: 'typeDisplayText', + label: t('routes.admin.dictionaryTypeName'), + component: 'Input', + colProps: { + span: 18, + }, + componentProps: { + disabled: true, + }, + }, + { + field: 'code', + label: t('routes.admin.dictionaryCode'), + required: true, + component: 'Input', + colProps: { + span: 18, + }, + }, + { + field: 'displayText', + label: t('routes.admin.dictionaryDisplayText'), + component: 'Input', + required: true, + colProps: { + span: 18, + }, + }, + { + field: 'order', + label: t('routes.admin.dictionaryOrder'), + required: true, + component: 'InputNumber', + colProps: { + span: 18, + }, + dynamicRules: () => { + return [ + { + required: true, + validator: (_, value) => { + const regNull = /^[1-9]\d*$/; + if (regNull.test(value)) { + return Promise.resolve(); + } + return Promise.reject(t('routes.admin.nonZeroMessage')); + }, + }, + ]; + }, + }, + { + field: 'description', + label: t('routes.admin.dictionaryDescription'), + component: 'InputTextArea', + colProps: { + span: 18, + }, + }, +]; +//编辑字典项 +export const editFormSchema: FormSchema[] = [ + { + field: 'dataDictionaryId', + label: '', + ifShow: false, + component: 'Input', + colProps: { + span: 18, + }, + }, + { + field: 'id', + label: '', + ifShow: false, + component: 'Input', + colProps: { + span: 18, + }, + }, + { + field: 'code', + label: t('routes.admin.dictionaryCode'), + required: true, + component: 'Input', + colProps: { + span: 18, + }, + componentProps: { + disabled: true, + }, + }, + { + field: 'displayText', + label: t('routes.admin.dictionaryDisplayText'), + component: 'Input', + required: true, + colProps: { + span: 18, + }, + }, + { + field: 'order', + label: t('routes.admin.dictionaryOrder'), + required: true, + component: 'InputNumber', + colProps: { + span: 18, + }, + dynamicRules: () => { + return [ + { + required: true, + validator: (_, value) => { + const regNull = /^[1-9]\d*$/; + if (regNull.test(value)) { + return Promise.resolve(); + } + return Promise.reject(t('routes.admin.nonZeroMessage')); + }, + }, + ]; + }, + }, + { + field: 'description', + label: t('routes.admin.dictionaryDescription'), + component: 'InputTextArea', + colProps: { + span: 18, + }, + }, +]; +//新增字典类型 +export const createDictionaryTypeFormSchema: FormSchema[] = [ + { + field: 'code', + label: t('routes.admin.dictionaryCode'), + component: 'Input', + required: true, + colProps: { + span: 22, + }, + }, + { + field: 'displayText', + label: t('routes.admin.dictionaryDisplayText'), + component: 'Input', + required: true, + colProps: { + span: 22, + }, + }, + { + field: 'description', + label: t('routes.admin.dictionaryDescription'), + component: 'InputTextArea', + colProps: { + span: 22, + }, + }, +]; + +/** + *获取字典类型表格 + * + * @export + * @return {*} + */ +export async function getDictionaryTypeAsync(params: PagingDataDictionaryInput) { + const _dataDictionaryServiceProxy = new DataDictionaryServiceProxy(); + return await _dataDictionaryServiceProxy.page(params); +} + +//新建字典类型 +export async function createDictionaryTypeAsync({ + request, + changeOkLoading, + closeModal, + validate, + resetFields, +}) { + changeOkLoading(true); + await validate(); + const _dataDictionaryServiceProxy = new DataDictionaryServiceProxy(); + await _dataDictionaryServiceProxy.create(request); + message.success(t('common.operationSuccess')); + resetFields(); + changeOkLoading(false); + closeModal(); +} + +//启用|禁用详情字典 +export async function enableDictionaryAsync(input: SetDataDictinaryDetailInput) { + const _dataDictionaryServiceProxy = new DataDictionaryServiceProxy(); + await _dataDictionaryServiceProxy.status(input); +} + +//创建数据详情字典 +export async function createDetailsDictionaryAsync({ + request, + changeOkLoading, + validate, + resetFields, + closeModal, +}) { + changeOkLoading(true); + await validate(); + const _dataDictionaryServiceProxy = new DataDictionaryServiceProxy(); + await _dataDictionaryServiceProxy.createDetail(request); + message.success(t('common.operationSuccess')); + resetFields(); + changeOkLoading(false); + closeModal(); +} + +//分页获取数据字典详情 +export async function getDictionaryDetailsAsync({ params }) { + const _dataDictionaryServiceProxy = new DataDictionaryServiceProxy(); + + return await _dataDictionaryServiceProxy.pageDetail(params); +} + +//编辑数据字典 +export async function editDetailsDictionaryAsync({ + request, + changeOkLoading, + validate, + closeModal, +}) { + changeOkLoading(true); + await validate(); + const _dataDictionaryServiceProxy = new DataDictionaryServiceProxy(); + await _dataDictionaryServiceProxy.updateDetail(request); + message.success(t('common.operationSuccess')); + changeOkLoading(false); + closeModal(); +} diff --git a/vben271/src/views/admin/dictionary/AbpDictionary.vue b/vben271/src/views/admin/dictionary/AbpDictionary.vue new file mode 100644 index 00000000..028f3460 --- /dev/null +++ b/vben271/src/views/admin/dictionary/AbpDictionary.vue @@ -0,0 +1,185 @@ + + + + + diff --git a/vben271/src/views/admin/dictionary/CreateAbpDictionary.vue b/vben271/src/views/admin/dictionary/CreateAbpDictionary.vue new file mode 100644 index 00000000..24bac8f9 --- /dev/null +++ b/vben271/src/views/admin/dictionary/CreateAbpDictionary.vue @@ -0,0 +1,77 @@ + + + + + diff --git a/vben271/src/views/admin/dictionary/CreateAbpDictionaryType.vue b/vben271/src/views/admin/dictionary/CreateAbpDictionaryType.vue new file mode 100644 index 00000000..356e4149 --- /dev/null +++ b/vben271/src/views/admin/dictionary/CreateAbpDictionaryType.vue @@ -0,0 +1,69 @@ + + + + + diff --git a/vben271/src/views/admin/dictionary/EditAbpDictionary.vue b/vben271/src/views/admin/dictionary/EditAbpDictionary.vue new file mode 100644 index 00000000..ca60cd81 --- /dev/null +++ b/vben271/src/views/admin/dictionary/EditAbpDictionary.vue @@ -0,0 +1,74 @@ + + + + +