diff --git a/OpenAuth.App/BuilderTable/BuilderTableApp.cs b/OpenAuth.App/BuilderTable/BuilderTableApp.cs index 11187e00..bc712324 100644 --- a/OpenAuth.App/BuilderTable/BuilderTableApp.cs +++ b/OpenAuth.App/BuilderTable/BuilderTableApp.cs @@ -642,14 +642,29 @@ public void CreateVue(CreateVueReq req) if (subTable == null) //如果子表不存在,则用单模版生成 { - if (sysTableInfo.IsDynamicHeader) + if (req.Version == "vue3") { - domainContent = FileHelper.ReadFile(@"Template\\SingleTable\\BuildVueWithDynamicHeader.html"); + if (sysTableInfo.IsDynamicHeader) + { + domainContent = FileHelper.ReadFile(@"Template\\SingleTable\\BuildVue3WithDynamicHeader.html"); + } + else + { + domainContent = FileHelper.ReadFile(@"Template\\SingleTable\\BuildVue3.html"); + } } else { - domainContent = FileHelper.ReadFile(@"Template\\SingleTable\\BuildVue.html"); + if (sysTableInfo.IsDynamicHeader) + { + domainContent = FileHelper.ReadFile(@"Template\\SingleTable\\BuildVueWithDynamicHeader.html"); + } + else + { + domainContent = FileHelper.ReadFile(@"Template\\SingleTable\\BuildVue.html"); + } } + domainContent = domainContent.Replace("{ClassName}", sysTableInfo.ClassName) .Replace("{TableName}", sysTableInfo.ClassName.ToCamelCase()) @@ -660,16 +675,32 @@ public void CreateVue(CreateVueReq req) var subTableColumns = _builderTableColumnApp.Find(subTable.Id); if (subTableColumns.Count == 0) throw new Exception($"未找到子表{subTable.ClassName}的字段定义"); - - if (sysTableInfo.IsDynamicHeader) + + if (req.Version == "vue3") { - domainContent = FileHelper.ReadFile(@"Template\\MultiTable\\BuildVueWithDynamicHeader.html"); + if (sysTableInfo.IsDynamicHeader) + { + domainContent = FileHelper.ReadFile(@"Template\\MultiTable\\BuildVue3WithDynamicHeader.html"); + } + else + { + domainContent = FileHelper.ReadFile(@"Template\\MultiTable\\BuildVue3.html"); + } } else { - domainContent = FileHelper.ReadFile(@"Template\\MultiTable\\BuildVue.html"); + if (sysTableInfo.IsDynamicHeader) + { + domainContent = FileHelper.ReadFile(@"Template\\MultiTable\\BuildVueWithDynamicHeader.html"); + } + else + { + domainContent = FileHelper.ReadFile(@"Template\\MultiTable\\BuildVue.html"); + } } + + domainContent = domainContent.Replace("{ParentTableId}", subTable.ForeignKey.ToCamelCase()) .Replace("{FirstTableName}", sysTableInfo.ClassName.ToCamelCase()) .Replace("{SecondTableName}", subTable.ClassName.ToCamelCase()) diff --git a/OpenAuth.App/BuilderTable/Request/CreateVueReq.cs b/OpenAuth.App/BuilderTable/Request/CreateVueReq.cs index da86006b..8ce0a2dd 100644 --- a/OpenAuth.App/BuilderTable/Request/CreateVueReq.cs +++ b/OpenAuth.App/BuilderTable/Request/CreateVueReq.cs @@ -29,5 +29,11 @@ public class CreateVueReq /// vue项目所在的根目录,如:D:\OpenAuth.Pro\Client /// public string VueProjRootPath { get; set; } + + /// + /// 版本信息 + /// 值为vue2/vue3,默认为vue2 + /// + public string Version { get; set; } } } \ No newline at end of file diff --git a/OpenAuth.WebApi/Template/MultiTable/BuildVue3.html b/OpenAuth.WebApi/Template/MultiTable/BuildVue3.html new file mode 100644 index 00000000..eefe5425 --- /dev/null +++ b/OpenAuth.WebApi/Template/MultiTable/BuildVue3.html @@ -0,0 +1,473 @@ + + + diff --git a/OpenAuth.WebApi/Template/MultiTable/BuildVue3WithDynamicHeader.html b/OpenAuth.WebApi/Template/MultiTable/BuildVue3WithDynamicHeader.html new file mode 100644 index 00000000..f9a11159 --- /dev/null +++ b/OpenAuth.WebApi/Template/MultiTable/BuildVue3WithDynamicHeader.html @@ -0,0 +1,478 @@ + + + diff --git a/OpenAuth.WebApi/Template/SingleTable/BuildVue3.html b/OpenAuth.WebApi/Template/SingleTable/BuildVue3.html new file mode 100644 index 00000000..a5a50835 --- /dev/null +++ b/OpenAuth.WebApi/Template/SingleTable/BuildVue3.html @@ -0,0 +1,257 @@ + + + diff --git a/OpenAuth.WebApi/Template/SingleTable/BuildVue3WithDynamicHeader.html b/OpenAuth.WebApi/Template/SingleTable/BuildVue3WithDynamicHeader.html new file mode 100644 index 00000000..697d8bed --- /dev/null +++ b/OpenAuth.WebApi/Template/SingleTable/BuildVue3WithDynamicHeader.html @@ -0,0 +1,260 @@ + + +