From 3d704220f38a82c49440c5f675271e2d42c2ea7c Mon Sep 17 00:00:00 2001 From: JiangCYkk <1581850110@qq.com> Date: Fri, 28 Mar 2025 16:32:35 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E4=B8=8A=E4=B8=8B=E6=96=87=E6=94=B9=E4=B8=BA=20servic?= =?UTF-8?q?es.Add()=20=E6=96=B9=E6=B3=95=EF=BC=8CTryAdd()=20=E8=AE=A9?= =?UTF-8?q?=E5=90=8E=E9=9D=A2=E7=9A=84=20YiRbacDbContext=20=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E6=B3=A8=E5=85=A5=EF=BC=8C=E5=AF=BC=E8=87=B4=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=9D=83=E9=99=90=E8=BF=87=E6=BB=A4=E5=A4=B1=E6=95=88?= =?UTF-8?q?=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Yi.Framework.SqlSugarCore/SqlSugarCoreExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Yi.Abp.Net8/framework/Yi.Framework.SqlSugarCore/SqlSugarCoreExtensions.cs b/Yi.Abp.Net8/framework/Yi.Framework.SqlSugarCore/SqlSugarCoreExtensions.cs index 535cd3ff..1f1fc627 100644 --- a/Yi.Abp.Net8/framework/Yi.Framework.SqlSugarCore/SqlSugarCoreExtensions.cs +++ b/Yi.Abp.Net8/framework/Yi.Framework.SqlSugarCore/SqlSugarCoreExtensions.cs @@ -26,7 +26,7 @@ public static class SqlSugarCoreExtensions ServiceLifetime serviceLifetime = ServiceLifetime.Transient) where TDbContext : class, ISqlSugarDbContextDependencies { - services.TryAdd(new ServiceDescriptor( + services.Add(new ServiceDescriptor( typeof(ISqlSugarDbContextDependencies), typeof(TDbContext), serviceLifetime)); From c5d636d69794ddab95913a17260976473e2957eb Mon Sep 17 00:00:00 2001 From: JiangCYkk <1581850110@qq.com> Date: Fri, 28 Mar 2025 16:33:42 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E4=B8=8B=E6=8B=89=E6=A1=86=EF=BC=8C=E5=8F=AF?= =?UTF-8?q?=E4=BB=A5=E9=80=9A=E8=BF=87=E4=B8=8B=E6=8B=89=E6=A1=86=E7=AD=9B?= =?UTF-8?q?=E9=80=89=E8=8E=B7=E5=8F=96=E5=90=8E=E5=8F=B0=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=EF=BC=9B=20=E6=9C=AA=E5=AE=9E=E7=8E=B0=E6=BB=9A=E5=8A=A8?= =?UTF-8?q?=E5=88=86=E9=A1=B5=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../YiCrudAppService.cs | 40 ++++++--- .../src/components/SelectDataTag/index.vue | 83 +++++++++++++++++++ Yi.RuoYi.Vue3/src/main.js | 3 + 3 files changed, 114 insertions(+), 12 deletions(-) create mode 100644 Yi.RuoYi.Vue3/src/components/SelectDataTag/index.vue diff --git a/Yi.Abp.Net8/framework/Yi.Framework.Ddd.Application/YiCrudAppService.cs b/Yi.Abp.Net8/framework/Yi.Framework.Ddd.Application/YiCrudAppService.cs index 3ead8bcc..dae1a753 100644 --- a/Yi.Abp.Net8/framework/Yi.Framework.Ddd.Application/YiCrudAppService.cs +++ b/Yi.Abp.Net8/framework/Yi.Framework.Ddd.Application/YiCrudAppService.cs @@ -11,12 +11,12 @@ namespace Yi.Framework.Ddd.Application /// /// CRUD应用服务基类 - 基础版本 /// - public abstract class YiCrudAppService + public abstract class YiCrudAppService : YiCrudAppService where TEntity : class, IEntity where TEntityDto : IEntityDto { - protected YiCrudAppService(IRepository repository) + protected YiCrudAppService(IRepository repository) : base(repository) { } @@ -30,7 +30,7 @@ namespace Yi.Framework.Ddd.Application where TEntity : class, IEntity where TEntityDto : IEntityDto { - protected YiCrudAppService(IRepository repository) + protected YiCrudAppService(IRepository repository) : base(repository) { } @@ -44,7 +44,7 @@ namespace Yi.Framework.Ddd.Application where TEntity : class, IEntity where TEntityDto : IEntityDto { - protected YiCrudAppService(IRepository repository) + protected YiCrudAppService(IRepository repository) : base(repository) { } @@ -58,7 +58,7 @@ namespace Yi.Framework.Ddd.Application where TEntity : class, IEntity where TEntityDto : IEntityDto { - protected YiCrudAppService(IRepository repository) + protected YiCrudAppService(IRepository repository) : base(repository) { } @@ -78,7 +78,7 @@ namespace Yi.Framework.Ddd.Application /// private const string TempFilePath = "/wwwroot/temp"; - protected YiCrudAppService(IRepository repository) + protected YiCrudAppService(IRepository repository) : base(repository) { } @@ -96,7 +96,7 @@ namespace Yi.Framework.Ddd.Application // 获取并验证实体 var entity = await GetEntityByIdAsync(id); - + // 检查更新输入 await CheckUpdateInputDtoAsync(entity, input); @@ -124,10 +124,10 @@ namespace Yi.Framework.Ddd.Application { // 检查创建权限 await CheckCreatePolicyAsync(); - + // 检查创建输入 await CheckCreateInputDtoAsync(input); - + // 映射到实体 var entity = await MapToEntityAsync(input); @@ -156,13 +156,13 @@ namespace Yi.Framework.Ddd.Application public override async Task> GetListAsync(TGetListInput input) { List entities; - + // 根据输入类型决定查询方式 if (input is IPagedResultRequest pagedInput) { // 分页查询 entities = await Repository.GetPagedListAsync( - pagedInput.SkipCount, + pagedInput.SkipCount, pagedInput.MaxResultCount, string.Empty ); @@ -176,7 +176,23 @@ namespace Yi.Framework.Ddd.Application // 获取总数并映射结果 var totalCount = await Repository.GetCountAsync(); var dtos = await MapToGetListOutputDtosAsync(entities); - + + return new PagedResultDto(totalCount, dtos); + } + + /// + /// 获取实体动态下拉框列表,子类重写该方法,通过 keywords 进行筛选 + /// + /// 查询关键字 + /// + public virtual async Task> GetSelectDataListAsync(string? keywords = null) + { + List entities = await Repository.GetListAsync(); + + // 获取总数并映射结果 + var totalCount = entities.Count; + var dtos = await MapToGetListOutputDtosAsync(entities); + return new PagedResultDto(totalCount, dtos); } diff --git a/Yi.RuoYi.Vue3/src/components/SelectDataTag/index.vue b/Yi.RuoYi.Vue3/src/components/SelectDataTag/index.vue new file mode 100644 index 00000000..49ed7803 --- /dev/null +++ b/Yi.RuoYi.Vue3/src/components/SelectDataTag/index.vue @@ -0,0 +1,83 @@ + + + diff --git a/Yi.RuoYi.Vue3/src/main.js b/Yi.RuoYi.Vue3/src/main.js index 4e2f787e..cf792a22 100644 --- a/Yi.RuoYi.Vue3/src/main.js +++ b/Yi.RuoYi.Vue3/src/main.js @@ -43,6 +43,8 @@ import ImagePreview from "@/components/ImagePreview" import TreeSelect from '@/components/TreeSelect' // 字典标签组件 import DictTag from '@/components/DictTag' +// 动态数据下拉选择框组件 +import SelectDataTag from '@/components/SelectDataTag' const app = createApp(App) @@ -57,6 +59,7 @@ app.config.globalProperties.selectDictLabel = selectDictLabel app.config.globalProperties.selectDictLabels = selectDictLabels // 全局组件挂载 +app.component('SelectDataTag', SelectDataTag) app.component('DictTag', DictTag) app.component('Pagination', Pagination) app.component('TreeSelect', TreeSelect) From 83a6ec1b9891d9d3a191f02bdb84ae89085eb07c Mon Sep 17 00:00:00 2001 From: JiangCYkk <1581850110@qq.com> Date: Fri, 28 Mar 2025 16:39:14 +0800 Subject: [PATCH 3/3] =?UTF-8?q?1.=E5=A4=84=E7=90=86=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=E4=BC=A0=E5=8F=82=E9=94=99=E8=AF=AF=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=9B=202.=E5=A4=84=E7=90=86=E5=AD=97?= =?UTF-8?q?=E5=85=B8=E6=95=B0=E6=8D=AE=E6=96=B0=E5=A2=9E=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E7=AA=97=E5=8F=A3=E6=B2=A1=E6=9C=89=E6=8F=90=E4=BA=A4=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Yi.RuoYi.Vue3/src/api/system/menu.js | 2 +- Yi.RuoYi.Vue3/src/views/system/dict/data.vue | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Yi.RuoYi.Vue3/src/api/system/menu.js b/Yi.RuoYi.Vue3/src/api/system/menu.js index 03ff3ab7..b14253ab 100644 --- a/Yi.RuoYi.Vue3/src/api/system/menu.js +++ b/Yi.RuoYi.Vue3/src/api/system/menu.js @@ -59,6 +59,6 @@ export function delMenu(menuId) { return request({ url: `/menu`, method: 'delete', - params:{id:menuId} + params:{ids:menuId} }) } \ No newline at end of file diff --git a/Yi.RuoYi.Vue3/src/views/system/dict/data.vue b/Yi.RuoYi.Vue3/src/views/system/dict/data.vue index 3f6a2d9b..6df8d842 100644 --- a/Yi.RuoYi.Vue3/src/views/system/dict/data.vue +++ b/Yi.RuoYi.Vue3/src/views/system/dict/data.vue @@ -230,6 +230,13 @@ > + +