diff --git a/Admin.NET/Admin.NET.Core/Entity/SysCodeGen.cs b/Admin.NET/Admin.NET.Core/Entity/SysCodeGen.cs
index f33c4d07..c70414eb 100644
--- a/Admin.NET/Admin.NET.Core/Entity/SysCodeGen.cs
+++ b/Admin.NET/Admin.NET.Core/Entity/SysCodeGen.cs
@@ -193,6 +193,19 @@ public partial class SysCodeGen : EntityBase
[MaxLength(64)]
public string? Template { get; set; }
+ ///
+ /// 表类型
+ ///
+ [SugarColumn(ColumnDescription = "表类型", Length = 64)]
+ public string TabType { get; set; }
+
+ ///
+ /// 树控件PidKey字段
+ ///
+ [SugarColumn(ColumnDescription = "树控件PidKey字段", Length = 64)]
+ [MaxLength(64)]
+ public string? TreeKey { get; set; }
+
///
/// 是否使用 Api Service
///
diff --git a/Admin.NET/Admin.NET.Core/SeedData/SysDictDataSeedData.cs b/Admin.NET/Admin.NET.Core/SeedData/SysDictDataSeedData.cs
index 42960cd4..6d1f8916 100644
--- a/Admin.NET/Admin.NET.Core/SeedData/SysDictDataSeedData.cs
+++ b/Admin.NET/Admin.NET.Core/SeedData/SysDictDataSeedData.cs
@@ -74,6 +74,8 @@ public class SysDictDataSeedData : ISqlSugarEntitySeedData
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") },
+ new SysDictData{ Id=1300000000706, DictTypeId=1300000000202, Label="普通列表", Value="List", OrderNo=105, Remark="普通列表", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-02-10 00:00:00") },
+ new SysDictData{ Id=1300000000707, DictTypeId=1300000000202, Label="树形表", Value="Tree", OrderNo=106, 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/SeedData/SysDictTypeSeedData.cs b/Admin.NET/Admin.NET.Core/SeedData/SysDictTypeSeedData.cs
index 3ad409d9..33ed7222 100644
--- a/Admin.NET/Admin.NET.Core/SeedData/SysDictTypeSeedData.cs
+++ b/Admin.NET/Admin.NET.Core/SeedData/SysDictTypeSeedData.cs
@@ -26,6 +26,7 @@ public class SysDictTypeSeedData : ISqlSugarEntitySeedData
new SysDictType{ Id=1300000000105, Name="代码生成基类", Code="code_gen_base_class", SysFlag=YesNoEnum.Y, OrderNo=104, Remark="代码生成基类", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
new SysDictType{ Id=1300000000106, Name="代码生成打印类型", Code="code_gen_print_type", SysFlag=YesNoEnum.Y, OrderNo=105, Remark="代码生成打印类型", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-12-04 00:00:00") },
new SysDictType{ Id=1300000000201, Name="机构类型", Code="org_type", SysFlag=YesNoEnum.Y, OrderNo=201, Remark="机构类型", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-02-10 00:00:00") },
+ new SysDictType{ Id=1300000000202, Name="代码生成控件表类型", Code="code_gen_tab_type", SysFlag=YesNoEnum.Y, OrderNo=202, 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/CodeGen/CustomViewEngine.cs b/Admin.NET/Admin.NET.Core/Service/CodeGen/CustomViewEngine.cs
index 01fd684e..385aadb8 100644
--- a/Admin.NET/Admin.NET.Core/Service/CodeGen/CustomViewEngine.cs
+++ b/Admin.NET/Admin.NET.Core/Service/CodeGen/CustomViewEngine.cs
@@ -46,6 +46,7 @@ public class CustomViewEngine : ViewEngineModel
}
public string? TreeName { get; set; }
+ public string? TreeKey { get; set; }
public string? LowerTreeName { get; set; }
public string? LeftTab { get; set; }
public string? LowerLeftTab { get; set; }
@@ -60,6 +61,7 @@ public class CustomViewEngine : ViewEngineModel
public string? BottomPrimaryKey { get; set; }
public string? LowerBottomKey { get; set; }
public string? LowerBottomPrimaryKey { get; set; }
+ public string TabType { get; set; }
public string PagePath { get; set; } = "main";
public bool IsJoinTable { get; set; }
diff --git a/Admin.NET/Admin.NET.Core/Service/CodeGen/Dto/CodeGenInput.cs b/Admin.NET/Admin.NET.Core/Service/CodeGen/Dto/CodeGenInput.cs
index 6a243760..1a1d4f7f 100644
--- a/Admin.NET/Admin.NET.Core/Service/CodeGen/Dto/CodeGenInput.cs
+++ b/Admin.NET/Admin.NET.Core/Service/CodeGen/Dto/CodeGenInput.cs
@@ -61,6 +61,11 @@ public class PageCodeGenInput : BasePageInput
///
public string? TreeName { get; set; }
+ ///
+ /// 树控件key
+ ///
+ public string? TreeKey { get; set; }
+
///
/// 命名空间
///
@@ -222,6 +227,11 @@ public class AddCodeGenInput : PageCodeGenInput
/// 模板
///
public string? Template { get; set; }
+
+ ///
+ /// 表类型
+ ///
+ public string TabType { get; set; }
}
public class DeleteCodeGenInput
diff --git a/Admin.NET/Admin.NET.Core/Service/CodeGen/Dto/CodeGenOutput.cs b/Admin.NET/Admin.NET.Core/Service/CodeGen/Dto/CodeGenOutput.cs
index 3b90760d..f7101dea 100644
--- a/Admin.NET/Admin.NET.Core/Service/CodeGen/Dto/CodeGenOutput.cs
+++ b/Admin.NET/Admin.NET.Core/Service/CodeGen/Dto/CodeGenOutput.cs
@@ -41,6 +41,11 @@ public class CodeGenOutput
///
public string TableName { get; set; }
+ ///
+ /// 表类型
+ ///
+ public string TabType { get; set; }
+
///
/// 包名
///
@@ -66,6 +71,15 @@ public class CodeGenOutput
///
public bool GenerateMenu { get; set; }
+ ///
+ /// 树控件名称
+ ///
+ public string? TreeName { get; set; }
+ ///
+ /// 树控件key
+ ///
+ public string? TreeKey { get; set; }
+
///
/// 菜单父级
///
diff --git a/Admin.NET/Admin.NET.Core/Service/CodeGen/SysCodeGenService.cs b/Admin.NET/Admin.NET.Core/Service/CodeGen/SysCodeGenService.cs
index 70b1bd0d..46277959 100644
--- a/Admin.NET/Admin.NET.Core/Service/CodeGen/SysCodeGenService.cs
+++ b/Admin.NET/Admin.NET.Core/Service/CodeGen/SysCodeGenService.cs
@@ -448,6 +448,7 @@ public class SysCodeGenService : IDynamicApiController, ITransient
LowerBottomTab = input.BottomTab?.ToFirstLetterLowerCase() ?? "", // 首字母小写
LowerBottomKey = input.BottomKey?.ToFirstLetterLowerCase() ?? "", // 首字母小写
LowerBottomPrimaryKey = input.BottomPrimaryKey?.ToFirstLetterLowerCase() ?? "", // 首字母小写
+ TabType = input.TabType ?? "",
};
}
@@ -472,6 +473,15 @@ public class SysCodeGenService : IDynamicApiController, ITransient
filename = (!string.IsNullOrEmpty(input.LeftTab) && !string.IsNullOrEmpty(input.BottomTab)) ? "web_views_BottomIndx.vue.vm" : filename; // 左树右上列表下列表属性
filename = (string.IsNullOrEmpty(input.LeftTab) && !string.IsNullOrEmpty(input.BottomTab)) ? "web_views_UDIndx.vue.vm" : filename; // 右上列表下列表属性
}
+ //更改list控件
+ if (filename == "web_views_List.vue.vm")
+ {
+ filename = data.TabType switch
+ {
+ "Tree" => "web_views_TreeList.vue.vm",
+ _ => "web_views_List.vue.vm" // 默认列表
+ };
+ }
var templateFilePath = Path.Combine(templatePath, filename);
if (!File.Exists(templateFilePath)) return null;
diff --git a/Admin.NET/Admin.NET.Web.Entry/wwwroot/template/web_views_BottomIndx.vue.vm b/Admin.NET/Admin.NET.Web.Entry/wwwroot/template/web_views_BottomIndx.vue.vm
index 537c1e64..69d063d2 100644
--- a/Admin.NET/Admin.NET.Web.Entry/wwwroot/template/web_views_BottomIndx.vue.vm
+++ b/Admin.NET/Admin.NET.Web.Entry/wwwroot/template/web_views_BottomIndx.vue.vm
@@ -86,7 +86,7 @@ const handleNodeChange = async (node: any) => {
state.queryParams["@(@Model.LowerLeftPrimaryKey)"] = node.data.@(@Model.LowerLeftKey);//树主表关联字段=树关联字段
console.log('handleNodeChange--', state.queryParams.@(@Model.LowerLeftPrimaryKey));
await indexListRef.value?.listhandleQuery(state.queryParams);
- await @(@Model.LowerBottomTab)BottomRef.value?.listhandleQuery({@(@Model.LowerBottomKey):'0'});//重置下表一个不可能有的条件
+ await @(@Model.LowerBottomTab)BottomRef.value?.listhandleQuery({@(@Model.LowerBottomKey):'1'});//重置下表一个不可能有的条件
};
// 主表List组件点击
const handleIndexChange = async (row: any,column: any) => {
diff --git a/Admin.NET/Admin.NET.Web.Entry/wwwroot/template/web_views_TreeList.vue.vm b/Admin.NET/Admin.NET.Web.Entry/wwwroot/template/web_views_TreeList.vue.vm
new file mode 100644
index 00000000..26a3eaa7
--- /dev/null
+++ b/Admin.NET/Admin.NET.Web.Entry/wwwroot/template/web_views_TreeList.vue.vm
@@ -0,0 +1,566 @@
+@{
+ string LowerFirstLetter(string text)
+ {
+ return text.ToString()[..1].ToLower() + text[1..]; // 首字母小写
+ }
+ var pkField = Model.TableField.Where(c => c.ColumnKey == "True").FirstOrDefault();
+ string pkFieldName = null;
+ if(pkField != null && !string.IsNullOrEmpty(pkField.PropertyName))
+ {
+ pkFieldName = LowerFirstLetter(pkField.PropertyName);
+ }
+ Dictionary definedObjects = new Dictionary();
+ bool haveLikeCdt = false;
+ foreach (var column in Model.TableField){
+ if (column.QueryWhether == "Y" && column.QueryType == "like"){
+ haveLikeCdt = true;
+ }
+ }
+}
+
+
+
+
+ @if(Model.QueryWhetherList.Count > 0){
+
+
+
+
+
+ foreach (var column in Model.QueryWhetherList) {
+ if(@column.EffectType == "Input" || @column.EffectType == "InputTextArea") {
+
+
+
+
+
+ } else if(@column.EffectType == "InputNumber") {
+
+
+
+
+
+ } else if(@column.EffectType == "ForeignKey") {
+
+
+
+
+
+
+
+ } else if(@column.EffectType == "DictSelector") {
+
+
+
+
+
+
+
+ } else if(@column.EffectType == "EnumSelector") {
+
+
+
+
+
+
+
+ } else if(@column.EffectType == "ApiTreeSelector") {
+
+
+
+
+ {{ data.@LowerFirstLetter(@column.DisplayColumn) }}
+ ({{ data.children.length }})
+
+
+
+
+ } else if(@column.EffectType == "DatePicker") {
+
+
+ @if(@column.QueryType == "~"){
+ @:
+ } else {
+ @:
+ }
+
+
+ }
+ }
+ }
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+ 高级查询
+ 隐藏
+
+
+
+
+
+
+
+
+ 新增
+
+ 全部展开
+ 全部折叠
+
+
+
+
+
+
+ @foreach (var column in Model.TableField) {
+
+ if(@column.WhetherTable == "Y") {
+ if(@column.EffectType == "Upload") {
+ @:
+ @:
+ @:
+ @:查看文件
+ @:
+ @:
+ @:
+ @:
+ @:
+ @:暂无文件
+ @:
+ } else if(@column.EffectType == "ForeignKey") {
+ @:
+ @:{{ row.@LowerFirstLetter(@column.PropertyName)@(@column.FkColumnName) }}
+ @:
+ } else if(@column.EffectType == "ApiTreeSelector") {
+ @:
+ @:{{ row.@LowerFirstLetter(@column.PropertyName)@(column.DisplayColumn) }}
+ @:
+ } else if(@column.EffectType == "Switch") {
+ @:
+ @: 是
+ @: 否
+ @:
+ } else if(@column.EffectType == "ConstSelector") {
+ @:
+ @:{{codeToName(row.@(@column.LowerPropertyName), '@(@column.DictTypeCode)')}}
+ @:
+ } else if(@column.EffectType == "DictSelector") {
+ @:
+ @: {{dc('@(@column.DictTypeCode)', row.@column.LowerPropertyName)?.label}}
+ @:
+ } else if(@column.EffectType == "EnumSelector") {
+ @:
+ @: {{dv('@(@column.DictTypeCode)', row.@column.LowerPropertyName)?.name}}
+ @:
+ }
+ }
+ }
+
+
+ @if(@Model.PrintType != "off") {
+
+
+
+ }
+
+
+
+
+
+
+
+
+
+ @if(@Model.PrintType != "off"){
+ @:
+ }
+
+
+
+
+
+
diff --git a/Web/src/views/system/codeGen/component/editCodeGenDialog.vue b/Web/src/views/system/codeGen/component/editCodeGenDialog.vue
index 81e1dab9..5813f2a7 100644
--- a/Web/src/views/system/codeGen/component/editCodeGenDialog.vue
+++ b/Web/src/views/system/codeGen/component/editCodeGenDialog.vue
@@ -73,6 +73,11 @@
+
+
+
+
+
@@ -93,6 +98,25 @@
+
+
+
+
+ PidKey字段
+
+
+
+
+
+
+
+
+
+
@@ -472,10 +496,17 @@ const tableChanged = (item: any) => {
state.ruleForm.tableUniqueList = [];
getColumnInfoList(item);
};
+
+const tabTypeChanged = async (item: any) => {
+ state.ruleForm.tabType = item;
+}
const treeNameChanged = (item: any) => {
state.ruleForm.treeName = item.columnName;
};
+const treeKeyChanged = (item: any) => {
+ state.ruleForm.treeKey = item.columnName;
+};
const leftTableChanged = (item: any) => {
state.ruleForm.leftTab = item.entityName;
console.log('leftTableChanged--', JSON.stringify(item));