From ea713b790d07cdb4f9d54838c53b8226e207a296 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=96=B5=E4=BD=A0=E4=B8=AA=E6=97=BA=E5=91=80?= Date: Tue, 11 Feb 2025 16:25:38 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=94=B9=E5=86=99=E5=AD=97=E5=85=B8?= =?UTF-8?q?=E5=90=8D=E7=A7=B0=EF=BC=8C=E6=B6=88=E9=99=A4=E6=98=93=E6=B7=B7?= =?UTF-8?q?=E6=B7=86=E5=AD=97=E6=AE=B5=E5=90=8D=E7=A7=B0=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=8C=E5=B9=B6=E4=BD=BF=E7=94=A8=E5=85=A8=E5=B1=80?= =?UTF-8?q?=E5=AD=97=E5=85=B8=E7=BB=84=E4=BB=B6=E6=B8=B2=E6=9F=93=E5=AD=97?= =?UTF-8?q?=E5=85=B8=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin.NET.Core/Entity/SysDictData.cs | 19 +-- .../Entity/SysDictDataTenant.cs | 12 +- .../Admin.NET.Core/Enum/ErrorCodeEnum.cs | 6 + Admin.NET/Admin.NET.Core/Job/EnumToDictJob.cs | 11 +- .../SeedData/SysDictDataSeedData.cs | 98 +++++++------- .../Service/Dict/Dto/DictDataInput.cs | 10 +- .../Service/Dict/SysDictDataService.cs | 4 +- .../Service/Dict/SysDictTypeService.cs | 3 +- Admin.NET/Admin.NET.Core/Utils/CommonUtil.cs | 8 +- Admin.NET/Admin.NET.Core/Utils/ExcelHelper.cs | 4 +- Web/src/components/sysDict/sysDict.vue | 120 ++++++++++++++++++ Web/src/main.ts | 5 + .../codeGen/component/editCodeGenDialog.vue | 9 +- .../system/database/component/genEntity.vue | 5 +- .../system/dict/component/editDictData.vue | 12 +- .../system/dict/component/editDictType.vue | 24 ++-- Web/src/views/system/dict/index.vue | 34 +++-- 17 files changed, 265 insertions(+), 119 deletions(-) create mode 100644 Web/src/components/sysDict/sysDict.vue diff --git a/Admin.NET/Admin.NET.Core/Entity/SysDictData.cs b/Admin.NET/Admin.NET.Core/Entity/SysDictData.cs index 4d8fe9eb..1040cb5c 100644 --- a/Admin.NET/Admin.NET.Core/Entity/SysDictData.cs +++ b/Admin.NET/Admin.NET.Core/Entity/SysDictData.cs @@ -28,6 +28,13 @@ public partial class SysDictData : EntityBase [Navigate(NavigateType.OneToOne, nameof(DictTypeId))] public SysDictType DictType { get; set; } + /// + /// 显示文本 + /// + [SugarColumn(ColumnDescription = "显示文本", Length = 256)] + [Required, MaxLength(256)] + public virtual string Label { get; set; } + /// /// 值 /// @@ -38,16 +45,10 @@ public partial class SysDictData : EntityBase /// /// 编码 /// + /// + /// [SugarColumn(ColumnDescription = "编码", Length = 256)] - [Required, MaxLength(256)] - public virtual string Code { get; set; } - - /// - /// 名称 - /// - [SugarColumn(ColumnDescription = "名称", Length = 256)] - [MaxLength(256)] - public virtual string? Name { get; set; } + public virtual string? Code { get; set; } /// /// 显示样式-标签颜色 diff --git a/Admin.NET/Admin.NET.Core/Entity/SysDictDataTenant.cs b/Admin.NET/Admin.NET.Core/Entity/SysDictDataTenant.cs index e9e30fd5..2ec35c76 100644 --- a/Admin.NET/Admin.NET.Core/Entity/SysDictDataTenant.cs +++ b/Admin.NET/Admin.NET.Core/Entity/SysDictDataTenant.cs @@ -28,6 +28,13 @@ public partial class SysDictDataTenant : EntityTenant [Navigate(NavigateType.OneToOne, nameof(DictTypeId))] public SysDictType DictType { get; set; } + /// + /// 显示文本 + /// + [SugarColumn(ColumnDescription = "显示文本", Length = 256)] + [Required, MaxLength(256)] + public virtual string Label { get; set; } + /// /// 值 /// @@ -38,9 +45,10 @@ public partial class SysDictDataTenant : EntityTenant /// /// 编码 /// + /// + /// [SugarColumn(ColumnDescription = "编码", Length = 256)] - [Required, MaxLength(256)] - public virtual string Code { get; set; } + public virtual string? Code { get; set; } /// /// 名称 diff --git a/Admin.NET/Admin.NET.Core/Enum/ErrorCodeEnum.cs b/Admin.NET/Admin.NET.Core/Enum/ErrorCodeEnum.cs index 4222a04f..261b1ec1 100644 --- a/Admin.NET/Admin.NET.Core/Enum/ErrorCodeEnum.cs +++ b/Admin.NET/Admin.NET.Core/Enum/ErrorCodeEnum.cs @@ -373,6 +373,12 @@ public enum ErrorCodeEnum [ErrorCodeItemMetadata("获取字典值集合入参有误")] D3011, + /// + /// 禁止修改租户字典状态 + /// + [ErrorCodeItemMetadata("禁止修改租户字典状态")] + D3012, + /// /// 菜单已存在 /// diff --git a/Admin.NET/Admin.NET.Core/Job/EnumToDictJob.cs b/Admin.NET/Admin.NET.Core/Job/EnumToDictJob.cs index 622e47cc..94671824 100644 --- a/Admin.NET/Admin.NET.Core/Job/EnumToDictJob.cs +++ b/Admin.NET/Admin.NET.Core/Job/EnumToDictJob.cs @@ -128,9 +128,9 @@ public class EnumToDictJob : IJob { Id = YitIdHelper.NextId(), DictTypeId = t2.Id, - Name = u.Describe, - Value = u.Value.ToString(), Code = u.Name, + Label = u.Describe, + Value = u.Value.ToString(), Remark = t2.Remark, OrderNo = u.Value + OrderOffset, TagType = u.Theme != "" ? u.Theme : DefaultTagType, @@ -178,9 +178,10 @@ public class EnumToDictJob : IJob var enumData = e.EnumEntities.FirstOrDefault(u => dictData.Code == u.Name); if (enumData != null) { + dictData.Code = enumData.Name; + dictData.Label = enumData.Describe; dictData.Value = enumData.Value.ToString(); dictData.OrderNo = enumData.Value + OrderOffset; - dictData.Name = enumData.Describe; dictData.TagType = enumData.Theme != "" ? enumData.Theme : dictData.TagType != "" ? dictData.TagType : DefaultTagType; updatedSysDictData.Add(dictData); } @@ -197,9 +198,9 @@ public class EnumToDictJob : IJob { Id = YitIdHelper.NextId(), DictTypeId = updatedDictType.Id, - Name = enumData.Describe, - Value = enumData.Value.ToString(), Code = enumData.Name, + Label = enumData.Describe, + Value = enumData.Value.ToString(), Remark = updatedDictType.Remark, OrderNo = enumData.Value + OrderOffset, TagType = enumData.Theme != "" ? enumData.Theme : DefaultTagType, diff --git a/Admin.NET/Admin.NET.Core/SeedData/SysDictDataSeedData.cs b/Admin.NET/Admin.NET.Core/SeedData/SysDictDataSeedData.cs index 4047cbe4..42960cd4 100644 --- a/Admin.NET/Admin.NET.Core/SeedData/SysDictDataSeedData.cs +++ b/Admin.NET/Admin.NET.Core/SeedData/SysDictDataSeedData.cs @@ -19,61 +19,61 @@ public class SysDictDataSeedData : ISqlSugarEntitySeedData { return [ - new SysDictData{ Id=1300000000101, DictTypeId=1300000000101, Value="输入框", Code="Input", OrderNo=100, Remark="输入框", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, - new SysDictData{ Id=1300000000102, DictTypeId=1300000000101, Value="字典选择器", Code="DictSelector", OrderNo=100, Remark="字典选择器", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, - new SysDictData{ Id=1300000000103, DictTypeId=1300000000101, Value="常量选择器", Code="ConstSelector", OrderNo=100, Remark="常量选择器", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, - new SysDictData{ Id=1300000000104, DictTypeId=1300000000101, Value="枚举选择器", Code="EnumSelector", OrderNo=100, Remark="枚举选择器", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, - new SysDictData{ Id=1300000000105, DictTypeId=1300000000101, Value="树选择器", Code="ApiTreeSelector", OrderNo=100, Remark="树选择器", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, - new SysDictData{ Id=1300000000106, DictTypeId=1300000000101, Value="外键", Code="ForeignKey", OrderNo=100, Remark="外键", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, - new SysDictData{ Id=1300000000107, DictTypeId=1300000000101, Value="数字输入框", Code="InputNumber", OrderNo=100, Remark="数字输入框", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, - new SysDictData{ Id=1300000000108, DictTypeId=1300000000101, Value="时间选择", Code="DatePicker", OrderNo=100, Remark="时间选择", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, - new SysDictData{ Id=1300000000109, DictTypeId=1300000000101, Value="文本域", Code="InputTextArea", OrderNo=100, Remark="文本域", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, - new SysDictData{ Id=1300000000110, DictTypeId=1300000000101, Value="上传", Code="Upload", OrderNo=100, Remark="上传", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, - new SysDictData{ Id=1300000000111, DictTypeId=1300000000101, Value="开关", Code="Switch", OrderNo=100, Remark="开关", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, + new SysDictData{ Id=1300000000101, DictTypeId=1300000000101, Label="输入框", Value="Input", OrderNo=100, Remark="输入框", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, + new SysDictData{ Id=1300000000102, DictTypeId=1300000000101, Label="字典选择器", Value="DictSelector", OrderNo=100, Remark="字典选择器", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, + new SysDictData{ Id=1300000000103, DictTypeId=1300000000101, Label="常量选择器", Value="ConstSelector", OrderNo=100, Remark="常量选择器", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, + new SysDictData{ Id=1300000000104, DictTypeId=1300000000101, Label="枚举选择器", Value="EnumSelector", OrderNo=100, Remark="枚举选择器", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, + new SysDictData{ Id=1300000000105, DictTypeId=1300000000101, Label="树选择器", Value="ApiTreeSelector", OrderNo=100, Remark="树选择器", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, + new SysDictData{ Id=1300000000106, DictTypeId=1300000000101, Label="外键", Value="ForeignKey", OrderNo=100, Remark="外键", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, + new SysDictData{ Id=1300000000107, DictTypeId=1300000000101, Label="数字输入框", Value="InputNumber", OrderNo=100, Remark="数字输入框", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, + new SysDictData{ Id=1300000000108, DictTypeId=1300000000101, Label="时间选择", Value="DatePicker", OrderNo=100, Remark="时间选择", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, + new SysDictData{ Id=1300000000109, DictTypeId=1300000000101, Label="文本域", Value="InputTextArea", OrderNo=100, Remark="文本域", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, + new SysDictData{ Id=1300000000110, DictTypeId=1300000000101, Label="上传", Value="Upload", OrderNo=100, Remark="上传", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, + new SysDictData{ Id=1300000000111, DictTypeId=1300000000101, Label="开关", Value="Switch", OrderNo=100, Remark="开关", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, - new SysDictData{ Id=1300000000201, DictTypeId=1300000000102, Value="等于", Code="==", OrderNo=1, Remark="等于", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, - new SysDictData{ Id=1300000000202, DictTypeId=1300000000102, Value="模糊", Code="like", OrderNo=1, Remark="模糊", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, - new SysDictData{ Id=1300000000203, DictTypeId=1300000000102, Value="大于", Code=">", OrderNo=1, Remark="大于", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, - new SysDictData{ Id=1300000000204, DictTypeId=1300000000102, Value="小于", Code="<", OrderNo=1, Remark="小于", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, - new SysDictData{ Id=1300000000205, DictTypeId=1300000000102, Value="不等于", Code="!=", OrderNo=1, Remark="不等于", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, - new SysDictData{ Id=1300000000206, DictTypeId=1300000000102, Value="大于等于", Code=">=", OrderNo=1, Remark="大于等于", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, - new SysDictData{ Id=1300000000207, DictTypeId=1300000000102, Value="小于等于", Code="<=", OrderNo=1, Remark="小于等于", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, - new SysDictData{ Id=1300000000208, DictTypeId=1300000000102, Value="不为空", Code="isNotNull", OrderNo=1, Remark="不为空", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, - new SysDictData{ Id=1300000000209, DictTypeId=1300000000102, Value="时间范围", Code="~", OrderNo=1, Remark="时间范围", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, + new SysDictData{ Id=1300000000201, DictTypeId=1300000000102, Label="等于", Value="==", OrderNo=1, Remark="等于", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, + new SysDictData{ Id=1300000000202, DictTypeId=1300000000102, Label="模糊", Value="like", OrderNo=1, Remark="模糊", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, + new SysDictData{ Id=1300000000203, DictTypeId=1300000000102, Label="大于", Value=">", OrderNo=1, Remark="大于", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, + new SysDictData{ Id=1300000000204, DictTypeId=1300000000102, Label="小于", Value="<", OrderNo=1, Remark="小于", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, + new SysDictData{ Id=1300000000205, DictTypeId=1300000000102, Label="不等于", Value="!=", OrderNo=1, Remark="不等于", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, + new SysDictData{ Id=1300000000206, DictTypeId=1300000000102, Label="大于等于", Value=">=", OrderNo=1, Remark="大于等于", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, + new SysDictData{ Id=1300000000207, DictTypeId=1300000000102, Label="小于等于", Value="<=", OrderNo=1, Remark="小于等于", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, + new SysDictData{ Id=1300000000208, DictTypeId=1300000000102, Label="不为空", Value="isNotNull", OrderNo=1, Remark="不为空", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, + new SysDictData{ Id=1300000000209, DictTypeId=1300000000102, Label="时间范围", Value="~", OrderNo=1, Remark="时间范围", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, - new SysDictData{ Id=1300000000301, DictTypeId=1300000000103, Value="long", Code="long", OrderNo=1, Remark="long", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, - new SysDictData{ Id=1300000000302, DictTypeId=1300000000103, Value="string", Code="string", OrderNo=1, Remark="string", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, - new SysDictData{ Id=1300000000303, DictTypeId=1300000000103, Value="DateTime", Code="DateTime", OrderNo=1, Remark="DateTime", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, - new SysDictData{ Id=1300000000304, DictTypeId=1300000000103, Value="bool", Code="bool", OrderNo=1, Remark="bool", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, - new SysDictData{ Id=1300000000305, DictTypeId=1300000000103, Value="int", Code="int", OrderNo=1, Remark="int", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, - new SysDictData{ Id=1300000000306, DictTypeId=1300000000103, Value="double", Code="double", OrderNo=1, Remark="double", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, - new SysDictData{ Id=1300000000307, DictTypeId=1300000000103, Value="float", Code="float", OrderNo=1, Remark="float", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, - new SysDictData{ Id=1300000000308, DictTypeId=1300000000103, Value="decimal", Code="decimal", OrderNo=1, Remark="decimal", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, - new SysDictData{ Id=1300000000309, DictTypeId=1300000000103, Value="Guid", Code="Guid", OrderNo=1, Remark="Guid", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, - new SysDictData{ Id=1300000000310, DictTypeId=1300000000103, Value="DateTimeOffset", Code="DateTimeOffset", OrderNo=1, Remark="DateTimeOffset", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, + new SysDictData{ Id=1300000000301, DictTypeId=1300000000103, Label="long", Value="long", OrderNo=1, Remark="long", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, + new SysDictData{ Id=1300000000302, DictTypeId=1300000000103, Label="string", Value="string", OrderNo=1, Remark="string", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, + new SysDictData{ Id=1300000000303, DictTypeId=1300000000103, Label="DateTime", Value="DateTime", OrderNo=1, Remark="DateTime", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, + new SysDictData{ Id=1300000000304, DictTypeId=1300000000103, Label="bool", Value="bool", OrderNo=1, Remark="bool", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, + new SysDictData{ Id=1300000000305, DictTypeId=1300000000103, Label="int", Value="int", OrderNo=1, Remark="int", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, + new SysDictData{ Id=1300000000306, DictTypeId=1300000000103, Label="double", Value="double", OrderNo=1, Remark="double", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, + new SysDictData{ Id=1300000000307, DictTypeId=1300000000103, Label="float", Value="float", OrderNo=1, Remark="float", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, + new SysDictData{ Id=1300000000308, DictTypeId=1300000000103, Label="decimal", Value="decimal", OrderNo=1, Remark="decimal", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, + new SysDictData{ Id=1300000000309, DictTypeId=1300000000103, Label="Guid", Value="Guid", OrderNo=1, Remark="Guid", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, + new SysDictData{ Id=1300000000310, DictTypeId=1300000000103, Label="DateTimeOffset", Value="DateTimeOffset", OrderNo=1, Remark="DateTimeOffset", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, - new SysDictData{ Id=1300000000401, DictTypeId=1300000000104, Value="下载压缩包", Code="100", OrderNo=1, Remark="下载压缩包", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, - new SysDictData{ Id=1300000000402, DictTypeId=1300000000104, Value="下载压缩包(前端)", Code="111", OrderNo=2, Remark="下载压缩包(前端)", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, - new SysDictData{ Id=1300000000403, DictTypeId=1300000000104, Value="下载压缩包(后端)", Code="121", OrderNo=3, Remark="下载压缩包(后端)", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, - new SysDictData{ Id=1300000000404, DictTypeId=1300000000104, Value="生成到本项目", Code="200", OrderNo=4, Remark="生成到本项目", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, - new SysDictData{ Id=1300000000405, DictTypeId=1300000000104, Value="生成到本项目(前端)", Code="211", OrderNo=5, Remark="生成到本项目(前端)", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, - new SysDictData{ Id=1300000000406, DictTypeId=1300000000104, Value="生成到本项目(后端)", Code="221", OrderNo=6, Remark="生成到本项目(后端)", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, + new SysDictData{ Id=1300000000401, DictTypeId=1300000000104, Label="下载压缩包", Value="100", OrderNo=1, Remark="下载压缩包", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, + new SysDictData{ Id=1300000000402, DictTypeId=1300000000104, Label="下载压缩包(前端)", Value="111", OrderNo=2, Remark="下载压缩包(前端)", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, + new SysDictData{ Id=1300000000403, DictTypeId=1300000000104, Label="下载压缩包(后端)", Value="121", OrderNo=3, Remark="下载压缩包(后端)", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, + new SysDictData{ Id=1300000000404, DictTypeId=1300000000104, Label="生成到本项目", Value="200", OrderNo=4, Remark="生成到本项目", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, + new SysDictData{ Id=1300000000405, DictTypeId=1300000000104, Label="生成到本项目(前端)", Value="211", OrderNo=5, Remark="生成到本项目(前端)", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, + new SysDictData{ Id=1300000000406, DictTypeId=1300000000104, Label="生成到本项目(后端)", Value="221", OrderNo=6, Remark="生成到本项目(后端)", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, - new SysDictData{ Id=1300000000501, DictTypeId=1300000000105, Value="EntityBaseId【基础实体Id】", Code="EntityBaseId", OrderNo=1, Remark="【基础实体Id】", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, - new SysDictData{ Id=1300000000502, DictTypeId=1300000000105, Value="EntityBase【基础实体】", Code="EntityBase", OrderNo=1, Remark="【基础实体】", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, - new SysDictData{ Id=1300000000503, DictTypeId=1300000000105, Value="EntityTenantId【租户实体Id】", Code="EntityTenantId", OrderNo=1, Remark="【租户实体Id】", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, - new SysDictData{ Id=1300000000504, DictTypeId=1300000000105, Value="EntityTenant【租户实体】", Code="EntityTenant", OrderNo=1, Remark="【租户实体】", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, - new SysDictData{ Id=1300000000505, DictTypeId=1300000000105, Value="EntityBaseData【业务实体】", Code="EntityBaseData", OrderNo=1, Remark="【业务实体】", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, - new SysDictData{ Id=1300000000506, DictTypeId=1300000000105, Value="EntityTenantBaseData【租户业务实体】", Code="EntityTenantBaseData", OrderNo=1, Remark="【租户业务实体】", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, + new SysDictData{ Id=1300000000501, DictTypeId=1300000000105, Label="EntityBaseId【基础实体Id】", Value="EntityBaseId", OrderNo=1, Remark="【基础实体Id】", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, + new SysDictData{ Id=1300000000502, DictTypeId=1300000000105, Label="EntityBase【基础实体】", Value="EntityBase", OrderNo=1, Remark="【基础实体】", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, + new SysDictData{ Id=1300000000503, DictTypeId=1300000000105, Label="EntityTenantId【租户实体Id】", Value="EntityTenantId", OrderNo=1, Remark="【租户实体Id】", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, + new SysDictData{ Id=1300000000504, DictTypeId=1300000000105, Label="EntityTenant【租户实体】", Value="EntityTenant", OrderNo=1, Remark="【租户实体】", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, + new SysDictData{ Id=1300000000505, DictTypeId=1300000000105, Label="EntityBaseData【业务实体】", Value="EntityBaseData", OrderNo=1, Remark="【业务实体】", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, + new SysDictData{ Id=1300000000506, DictTypeId=1300000000105, Label="EntityTenantBaseData【租户业务实体】", Value="EntityTenantBaseData", OrderNo=1, Remark="【租户业务实体】", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") }, - new SysDictData{ Id=1300000000601, DictTypeId=1300000000106, Value="不需要", Code="off", OrderNo=100, Remark="不需要打印支持", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-12-04 00:00:00") }, - new SysDictData{ Id=1300000000602, DictTypeId=1300000000106, Value="绑定打印模版", Code="custom", OrderNo=101, Remark="绑定打印模版", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-12-04 00:00:00") }, + new SysDictData{ Id=1300000000601, DictTypeId=1300000000106, Label="不需要", Value="off", OrderNo=100, Remark="不需要打印支持", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-12-04 00:00:00") }, + new SysDictData{ Id=1300000000602, DictTypeId=1300000000106, Label="绑定打印模版", Value="custom", OrderNo=101, Remark="绑定打印模版", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-12-04 00:00:00") }, - new SysDictData{ Id=1300000000701, DictTypeId=1300000000201, Value="集团", Code="101", OrderNo=100, Remark="集团", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-02-10 00:00:00") }, - new SysDictData{ Id=1300000000702, DictTypeId=1300000000201, Value="公司", Code="201", OrderNo=101, Remark="公司", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-02-10 00:00:00") }, - new SysDictData{ Id=1300000000703, DictTypeId=1300000000201, Value="部门", Code="301", OrderNo=102, Remark="部门", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-02-10 00:00:00") }, - new SysDictData{ Id=1300000000704, DictTypeId=1300000000201, Value="区域", Code="401", OrderNo=103, Remark="区域", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-02-10 00:00:00") }, - new SysDictData{ Id=1300000000705, DictTypeId=1300000000201, Value="组", Code="501", OrderNo=104, Remark="组", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-02-10 00:00:00") }, + new SysDictData{ Id=1300000000701, DictTypeId=1300000000201, Label="集团", Value="101", OrderNo=100, Remark="集团", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-02-10 00:00:00") }, + new SysDictData{ Id=1300000000702, DictTypeId=1300000000201, Label="公司", Value="201", OrderNo=101, Remark="公司", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-02-10 00:00:00") }, + new SysDictData{ Id=1300000000703, DictTypeId=1300000000201, Label="部门", Value="301", OrderNo=102, Remark="部门", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-02-10 00:00:00") }, + new SysDictData{ Id=1300000000704, DictTypeId=1300000000201, Label="区域", Value="401", OrderNo=103, Remark="区域", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-02-10 00:00:00") }, + new SysDictData{ Id=1300000000705, DictTypeId=1300000000201, Label="组", Value="501", OrderNo=104, Remark="组", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-02-10 00:00:00") }, ]; } } \ No newline at end of file diff --git a/Admin.NET/Admin.NET.Core/Service/Dict/Dto/DictDataInput.cs b/Admin.NET/Admin.NET.Core/Service/Dict/Dto/DictDataInput.cs index fa757d05..9a56ae79 100644 --- a/Admin.NET/Admin.NET.Core/Service/Dict/Dto/DictDataInput.cs +++ b/Admin.NET/Admin.NET.Core/Service/Dict/Dto/DictDataInput.cs @@ -18,9 +18,9 @@ public class PageDictDataInput : BasePageInput public long DictTypeId { get; set; } /// - /// 值 + /// 文本 /// - public string Value { get; set; } + public string Label { get; set; } /// /// 编码 @@ -52,10 +52,10 @@ public class GetDataDictDataInput public class QueryDictDataInput { /// - /// 编码 + /// 值 /// - [Required(ErrorMessage = "字典唯一编码不能为空")] - public string Code { get; set; } + [Required(ErrorMessage = "字典值不能为空")] + public string Value { get; set; } /// /// 状态 diff --git a/Admin.NET/Admin.NET.Core/Service/Dict/SysDictDataService.cs b/Admin.NET/Admin.NET.Core/Service/Dict/SysDictDataService.cs index 4ef73f0b..ff87762d 100644 --- a/Admin.NET/Admin.NET.Core/Service/Dict/SysDictDataService.cs +++ b/Admin.NET/Admin.NET.Core/Service/Dict/SysDictDataService.cs @@ -41,7 +41,7 @@ public class SysDictDataService : IDynamicApiController, ITransient return await VSysDictData .Where(u => u.DictTypeId == input.DictTypeId) .WhereIF(!string.IsNullOrEmpty(input.Code?.Trim()), u => u.Code.Contains(input.Code)) - .WhereIF(!string.IsNullOrEmpty(input.Value?.Trim()), u => u.Value.Contains(input.Value)) + .WhereIF(!string.IsNullOrEmpty(input.Label?.Trim()), u => u.Label.Contains(input.Label)) .OrderBy(u => new { u.OrderNo, u.Code }) .ToPagedListAsync(input.Page, input.PageSize); } @@ -219,7 +219,7 @@ public class SysDictDataService : IDynamicApiController, ITransient [DisplayName("根据查询条件获取字典值集合")] public async Task> GetDataList([FromQuery] QueryDictDataInput input) { - var dataList = await GetDataList(input.Code); + var dataList = await GetDataList(input.Value); if (input.Status.HasValue) return dataList.Where(u => u.Status == (StatusEnum)input.Status.Value).ToList(); return dataList; } diff --git a/Admin.NET/Admin.NET.Core/Service/Dict/SysDictTypeService.cs b/Admin.NET/Admin.NET.Core/Service/Dict/SysDictTypeService.cs index 6f79be5a..66e3fffa 100644 --- a/Admin.NET/Admin.NET.Core/Service/Dict/SysDictTypeService.cs +++ b/Admin.NET/Admin.NET.Core/Service/Dict/SysDictTypeService.cs @@ -94,6 +94,7 @@ public class SysDictTypeService : IDynamicApiController, ITransient public async Task UpdateDictType(UpdateDictTypeInput input) { var dict = await _sysDictTypeRep.GetFirstAsync(x => x.Id == input.Id); + if (dict.IsTenant != input.IsTenant) throw Oops.Oh(ErrorCodeEnum.D3012); if (dict == null) throw Oops.Oh(ErrorCodeEnum.D3000); if (dict.Code.ToLower().EndsWith("enum") && input.Code != dict.Code) throw Oops.Oh(ErrorCodeEnum.D3007); @@ -163,7 +164,7 @@ public class SysDictTypeService : IDynamicApiController, ITransient var ds = await _sysDictTypeRep.AsQueryable() .InnerJoin(_sysDictDataService.VSysDictData, (u, a) => u.Id == a.DictTypeId) .Where((u, a) => u.Status == StatusEnum.Enable && a.Status == StatusEnum.Enable) - .Select((u, a) => new { TypeCode = u.Code, a.Code, a.Name, a.Value, a.Remark, a.OrderNo, a.TagType, a.ExtData }) + .Select((u, a) => new { TypeCode = u.Code, a.Label, a.Value, a.Code, a.Remark, a.OrderNo, a.TagType, a.ExtData }) .ToListAsync(); return ds.OrderBy(u => u.OrderNo).GroupBy(u => u.TypeCode).ToDictionary(u => u.Key, u => u); } diff --git a/Admin.NET/Admin.NET.Core/Utils/CommonUtil.cs b/Admin.NET/Admin.NET.Core/Utils/CommonUtil.cs index 1008a3eb..a2c62022 100644 --- a/Admin.NET/Admin.NET.Core/Utils/CommonUtil.cs +++ b/Admin.NET/Admin.NET.Core/Utils/CommonUtil.cs @@ -389,8 +389,8 @@ public static class CommonUtil .Where((u, a) => u.Status == StatusEnum.Enable && a.Status == StatusEnum.Enable) .Select((u, a) => new { - Label = a.Value, - Value = a.Code + a.Label, + a.Value }).ToList() .ToDictionary(u => u.Label, u => u.Value.ParseTo(targetProp.PropertyType)); propMappings.Add(propertyInfo.Name, new Tuple, PropertyInfo, PropertyInfo>(mappingValues, propertyInfo, targetProp)); @@ -431,8 +431,8 @@ public static class CommonUtil .Where((u, a) => u.Status == StatusEnum.Enable && a.Status == StatusEnum.Enable) .Select((u, a) => new { - Label = a.Value, - Value = a.Code + a.Label, + a.Value }).ToList() .ToDictionary(u => u.Value.ParseTo(targetProp.PropertyType), u => u.Label); propMappings.Add(propertyInfo.Name, new Tuple, PropertyInfo, PropertyInfo>(mappingValues, targetProp, propertyInfo)); diff --git a/Admin.NET/Admin.NET.Core/Utils/ExcelHelper.cs b/Admin.NET/Admin.NET.Core/Utils/ExcelHelper.cs index b073bff1..a15a5a52 100644 --- a/Admin.NET/Admin.NET.Core/Utils/ExcelHelper.cs +++ b/Admin.NET/Admin.NET.Core/Utils/ExcelHelper.cs @@ -115,8 +115,8 @@ public class ExcelHelper var dict = prop.GetCustomAttribute(); if (dict != null) { - // 填充字典值value为下列列表 - dataList = sysDictTypeService.GetDataList(new GetDataDictTypeInput { Code = dict.DictTypeCode }).Result?.Select(u => u.Value).ToList(); + // 填充字典值value为下拉列表 + dataList = sysDictTypeService.GetDataList(new GetDataDictTypeInput { Code = dict.DictTypeCode }).Result?.Select(u => u.Label).ToList(); } } } diff --git a/Web/src/components/sysDict/sysDict.vue b/Web/src/components/sysDict/sysDict.vue new file mode 100644 index 00000000..d51b5ee7 --- /dev/null +++ b/Web/src/components/sysDict/sysDict.vue @@ -0,0 +1,120 @@ + + + + + + diff --git a/Web/src/main.ts b/Web/src/main.ts index e01f0a37..88050b0d 100644 --- a/Web/src/main.ts +++ b/Web/src/main.ts @@ -24,6 +24,8 @@ import { setupVXETable } from '/@/hooks/setupVXETableHook'; // IM聊天框 import JwChat from 'jwchat'; import 'jwchat/lib/style.css'; +// 自定义字典组件 +import sysDict from "/@/components/sysDict/sysDict.vue"; // 关闭自动打印 import { disAutoConnect } from 'vue-plugin-hiprint'; @@ -37,4 +39,7 @@ const app = createApp(App); directive(app); other.elSvg(app); +// 注册全局字典组件 +app.component('GSysDict', sysDict); + app.use(pinia).use(router).use(ElementPlus).use(setupVXETable).use(i18n).use(VueGridLayout).use(VForm3).use(VueSignaturePad).use(vue3TreeOrg).use(JwChat).mount('#app'); diff --git a/Web/src/views/system/codeGen/component/editCodeGenDialog.vue b/Web/src/views/system/codeGen/component/editCodeGenDialog.vue index 984b9fb2..81e1dab9 100644 --- a/Web/src/views/system/codeGen/component/editCodeGenDialog.vue +++ b/Web/src/views/system/codeGen/component/editCodeGenDialog.vue @@ -146,9 +146,7 @@ - - - + @@ -169,9 +167,7 @@ - - - + @@ -374,7 +370,6 @@ const props = defineProps({ title: String, applicationNamespaces: Array, }); -const getDictDataByCode = useUserInfo().getDictDataByCode; const emits = defineEmits(['handleQuery']); const ruleFormRef = ref(); const state = reactive({ diff --git a/Web/src/views/system/database/component/genEntity.vue b/Web/src/views/system/database/component/genEntity.vue index 9cd3e99b..07b12204 100644 --- a/Web/src/views/system/database/component/genEntity.vue +++ b/Web/src/views/system/database/component/genEntity.vue @@ -21,9 +21,7 @@ - - - + @@ -55,7 +53,6 @@ import { useUserInfo } from '/@/stores/userInfo'; import { getAPI } from '/@/utils/axios-utils'; import { SysDatabaseApi } from '/@/api-services/api'; -const getDictDataByCode = useUserInfo().getDictDataByCode; const emits = defineEmits(['handleQueryColumn']); const ruleFormRef = ref(); const state = reactive({ diff --git a/Web/src/views/system/dict/component/editDictData.vue b/Web/src/views/system/dict/component/editDictData.vue index c0611131..d52901db 100644 --- a/Web/src/views/system/dict/component/editDictData.vue +++ b/Web/src/views/system/dict/component/editDictData.vue @@ -9,21 +9,21 @@ + + + + + - + - - - - - diff --git a/Web/src/views/system/dict/component/editDictType.vue b/Web/src/views/system/dict/component/editDictType.vue index 9802da2c..59b9ee55 100644 --- a/Web/src/views/system/dict/component/editDictType.vue +++ b/Web/src/views/system/dict/component/editDictType.vue @@ -19,17 +19,14 @@ - - - - 启用 - 禁用 - + + + - - - + + + @@ -37,6 +34,11 @@ + + + + +