222
schangxiang@126.com
2025-05-06 129a0c82833a11f5305855ae6d6ce401756d49be
222
已添加4个文件
已修改6个文件
259 ■■■■ 文件已修改
Weben_CMS专用代码生成器/Code/Generate/Web/Index_Generate.cs 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Weben_CMS专用代码生成器/Code/Generate/Web/enum_Generate.cs 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Weben_CMS专用代码生成器/Code/GenerateCode_WeiBen_CMS.csproj 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Weben_CMS专用代码生成器/Code/MainForm.Designer.cs 116 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Weben_CMS专用代码生成器/Code/MainForm.cs 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Weben_CMS专用代码生成器/Code/Model/GenerateCodeParam.cs 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Weben_CMS专用代码生成器/Code/Templete/Web/enum模板.txt 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Weben_CMS专用代码生成器/Code/Templete/Web/index模板.txt 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Weben_CMS专用代码生成器/Code/Utility/CommonHelper.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Weben_CMS专用代码生成器/Code/常用.txt 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Weben_CMSרÓôúÂëÉú³ÉÆ÷/Code/Generate/Web/Index_Generate.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,27 @@

using GenerateCode_WeiBen_WMS.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace GenerateCode_GEBrilliantFactory
{
    /// <summary>
    /// ç”ŸæˆæŸ¥è¯¢å®žä½“ç±»
    /// </summary>
    public class Index_Generate : BaseGenerate
    {
        public static string CreateText(GenerateCodeParam param)
        {
            var str = TextHelper.ReadText(@"Templete\Web\index模板.txt");
            CommonReplace(ref str);
            CommonHelper.CommonReplaceStr(param, ref str);
            return str;
        }
    }
}
Weben_CMSרÓôúÂëÉú³ÉÆ÷/Code/Generate/Web/enum_Generate.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,27 @@

using GenerateCode_WeiBen_WMS.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace GenerateCode_GEBrilliantFactory
{
    /// <summary>
    /// ç”ŸæˆæŸ¥è¯¢å®žä½“ç±»
    /// </summary>
    public class enum_Generate : BaseGenerate
    {
        public static string CreateText(GenerateCodeParam param)
        {
            var str = TextHelper.ReadText(@"Templete\Web\enum模板.txt");
            CommonReplace(ref str);
            CommonHelper.CommonReplaceStr(param, ref str);
            return str;
        }
    }
}
Weben_CMSרÓôúÂëÉú³ÉÆ÷/Code/GenerateCode_WeiBen_CMS.csproj
@@ -128,6 +128,8 @@
    <Compile Include="Generate\BLL_Generate.cs" />
    <Compile Include="Generate\DAL_Generate.cs" />
    <Compile Include="Generate\Procedure_Generate.cs" />
    <Compile Include="Generate\Web\enum_Generate.cs" />
    <Compile Include="Generate\Web\Index_Generate.cs" />
    <Compile Include="Model\GenerateCodeParam.cs" />
    <Compile Include="Model\Enum\DataBaseEnum.cs" />
    <Compile Include="Model\Enum\DataTypeEnum.cs" />
@@ -278,6 +280,12 @@
    <Content Include="Templete\InitSQL模板.txt">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>
    <Content Include="Templete\Web\enum模板.txt">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>
    <Content Include="Templete\Web\index模板.txt">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>
    <Content Include="常用.txt" />
  </ItemGroup>
  <ItemGroup />
Weben_CMSרÓôúÂëÉú³ÉÆ÷/Code/MainForm.Designer.cs
@@ -64,6 +64,9 @@
            this.lbl_DataSource = new System.Windows.Forms.Label();
            this.cmb_DataSource = new System.Windows.Forms.ComboBox();
            this.groupBox2 = new System.Windows.Forms.GroupBox();
            this.label19 = new System.Windows.Forms.Label();
            this.label18 = new System.Windows.Forms.Label();
            this.tb_EnumList = new System.Windows.Forms.TextBox();
            this.tb_GroupName = new System.Windows.Forms.TextBox();
            this.label16 = new System.Windows.Forms.Label();
            this.label15 = new System.Windows.Forms.Label();
@@ -74,9 +77,10 @@
            this.label12 = new System.Windows.Forms.Label();
            this.tb_templeteFileDownName = new System.Windows.Forms.TextBox();
            this.label14 = new System.Windows.Forms.Label();
            this.tb_EnumList = new System.Windows.Forms.TextBox();
            this.label18 = new System.Windows.Forms.Label();
            this.label19 = new System.Windows.Forms.Label();
            this.label20 = new System.Windows.Forms.Label();
            this.tb_MenuName = new System.Windows.Forms.TextBox();
            this.label21 = new System.Windows.Forms.Label();
            this.tb_PageMenuInstanceName = new System.Windows.Forms.TextBox();
            this.groupBox1.SuspendLayout();
            this.groupBox2.SuspendLayout();
            this.groupBox3.SuspendLayout();
@@ -163,7 +167,7 @@
            // 
            // tb_WCF_NameSpacePath
            // 
            this.tb_WCF_NameSpacePath.Location = new System.Drawing.Point(751, 309);
            this.tb_WCF_NameSpacePath.Location = new System.Drawing.Point(983, 358);
            this.tb_WCF_NameSpacePath.Margin = new System.Windows.Forms.Padding(4);
            this.tb_WCF_NameSpacePath.Name = "tb_WCF_NameSpacePath";
            this.tb_WCF_NameSpacePath.Size = new System.Drawing.Size(261, 25);
@@ -172,7 +176,7 @@
            // label2
            // 
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(607, 311);
            this.label2.Location = new System.Drawing.Point(862, 368);
            this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(105, 15);
@@ -273,7 +277,7 @@
            // label9
            // 
            this.label9.AutoSize = true;
            this.label9.Location = new System.Drawing.Point(617, 262);
            this.label9.Location = new System.Drawing.Point(682, 47);
            this.label9.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
            this.label9.Name = "label9";
            this.label9.Size = new System.Drawing.Size(45, 15);
@@ -282,7 +286,7 @@
            // 
            // tb_OrderBy
            // 
            this.tb_OrderBy.Location = new System.Drawing.Point(671, 259);
            this.tb_OrderBy.Location = new System.Drawing.Point(736, 44);
            this.tb_OrderBy.Margin = new System.Windows.Forms.Padding(4);
            this.tb_OrderBy.Name = "tb_OrderBy";
            this.tb_OrderBy.Size = new System.Drawing.Size(192, 25);
@@ -291,7 +295,7 @@
            // label10
            // 
            this.label10.AutoSize = true;
            this.label10.Location = new System.Drawing.Point(891, 262);
            this.label10.Location = new System.Drawing.Point(956, 47);
            this.label10.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
            this.label10.Name = "label10";
            this.label10.Size = new System.Drawing.Size(83, 15);
@@ -348,7 +352,7 @@
            // 
            // tb_RoutePrefix
            // 
            this.tb_RoutePrefix.Location = new System.Drawing.Point(717, 345);
            this.tb_RoutePrefix.Location = new System.Drawing.Point(983, 395);
            this.tb_RoutePrefix.Margin = new System.Windows.Forms.Padding(4);
            this.tb_RoutePrefix.Name = "tb_RoutePrefix";
            this.tb_RoutePrefix.Size = new System.Drawing.Size(192, 25);
@@ -358,7 +362,7 @@
            // label13
            // 
            this.label13.AutoSize = true;
            this.label13.Location = new System.Drawing.Point(617, 352);
            this.label13.Location = new System.Drawing.Point(862, 398);
            this.label13.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
            this.label13.Name = "label13";
            this.label13.Size = new System.Drawing.Size(99, 15);
@@ -423,6 +427,10 @@
            // 
            // groupBox2
            // 
            this.groupBox2.Controls.Add(this.tb_PageMenuInstanceName);
            this.groupBox2.Controls.Add(this.label21);
            this.groupBox2.Controls.Add(this.tb_MenuName);
            this.groupBox2.Controls.Add(this.label20);
            this.groupBox2.Controls.Add(this.label19);
            this.groupBox2.Controls.Add(this.label18);
            this.groupBox2.Controls.Add(this.tb_EnumList);
@@ -464,6 +472,36 @@
            this.groupBox2.TabIndex = 46;
            this.groupBox2.TabStop = false;
            this.groupBox2.Text = "自定义配置";
            //
            // label19
            //
            this.label19.AutoSize = true;
            this.label19.Location = new System.Drawing.Point(424, 432);
            this.label19.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
            this.label19.Name = "label19";
            this.label19.Size = new System.Drawing.Size(751, 15);
            this.label19.TabIndex = 53;
            this.label19.Text = "PurchaseType|PurchaseTypeEnum|PurchaseTypeDesc,MaterialType|MaterialTypeEnum|Mate" +
    "rialTypeDesc";
            //
            // label18
            //
            this.label18.AutoSize = true;
            this.label18.Location = new System.Drawing.Point(424, 488);
            this.label18.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
            this.label18.Name = "label18";
            this.label18.Size = new System.Drawing.Size(135, 15);
            this.label18.TabIndex = 52;
            this.label18.Text = "枚举类型字段集合:";
            //
            // tb_EnumList
            //
            this.tb_EnumList.Location = new System.Drawing.Point(557, 451);
            this.tb_EnumList.Margin = new System.Windows.Forms.Padding(4);
            this.tb_EnumList.Multiline = true;
            this.tb_EnumList.Name = "tb_EnumList";
            this.tb_EnumList.Size = new System.Drawing.Size(491, 129);
            this.tb_EnumList.TabIndex = 51;
            // 
            // tb_GroupName
            // 
@@ -566,35 +604,41 @@
            this.label14.TabIndex = 47;
            this.label14.Text = "文件下载名字:";
            // 
            // tb_EnumList
            // label20
            // 
            this.tb_EnumList.Location = new System.Drawing.Point(557, 451);
            this.tb_EnumList.Margin = new System.Windows.Forms.Padding(4);
            this.tb_EnumList.Multiline = true;
            this.tb_EnumList.Name = "tb_EnumList";
            this.tb_EnumList.Size = new System.Drawing.Size(491, 129);
            this.tb_EnumList.TabIndex = 51;
            this.label20.AutoSize = true;
            this.label20.Location = new System.Drawing.Point(600, 239);
            this.label20.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
            this.label20.Name = "label20";
            this.label20.Size = new System.Drawing.Size(90, 15);
            this.label20.TabIndex = 54;
            this.label20.Text = "页面菜单名:";
            // 
            // label18
            // tb_MenuName
            // 
            this.label18.AutoSize = true;
            this.label18.Location = new System.Drawing.Point(424, 488);
            this.label18.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
            this.label18.Name = "label18";
            this.label18.Size = new System.Drawing.Size(135, 15);
            this.label18.TabIndex = 52;
            this.label18.Text = "枚举类型字段集合:";
            this.tb_MenuName.Location = new System.Drawing.Point(700, 229);
            this.tb_MenuName.Margin = new System.Windows.Forms.Padding(4);
            this.tb_MenuName.Name = "tb_MenuName";
            this.tb_MenuName.Size = new System.Drawing.Size(261, 25);
            this.tb_MenuName.TabIndex = 55;
            // 
            // label19
            // label21
            // 
            this.label19.AutoSize = true;
            this.label19.Location = new System.Drawing.Point(424, 432);
            this.label19.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
            this.label19.Name = "label19";
            this.label19.Size = new System.Drawing.Size(751, 15);
            this.label19.TabIndex = 53;
            this.label19.Text = "PurchaseType|PurchaseTypeEnum|PurchaseTypeDesc,MaterialType|MaterialTypeEnum|Mate" +
    "rialTypeDesc";
            this.label21.AutoSize = true;
            this.label21.Location = new System.Drawing.Point(600, 275);
            this.label21.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
            this.label21.Name = "label21";
            this.label21.Size = new System.Drawing.Size(135, 15);
            this.label21.TabIndex = 56;
            this.label21.Text = "页面菜单对象缩写:";
            //
            // tb_PageMenuInstanceName
            //
            this.tb_PageMenuInstanceName.Location = new System.Drawing.Point(736, 265);
            this.tb_PageMenuInstanceName.Margin = new System.Windows.Forms.Padding(4);
            this.tb_PageMenuInstanceName.Name = "tb_PageMenuInstanceName";
            this.tb_PageMenuInstanceName.Size = new System.Drawing.Size(261, 25);
            this.tb_PageMenuInstanceName.TabIndex = 57;
            // 
            // MainForm
            // 
@@ -675,6 +719,10 @@
        private System.Windows.Forms.Label label18;
        private System.Windows.Forms.TextBox tb_EnumList;
        private System.Windows.Forms.Label label19;
        private System.Windows.Forms.Label label20;
        private System.Windows.Forms.TextBox tb_MenuName;
        private System.Windows.Forms.TextBox tb_PageMenuInstanceName;
        private System.Windows.Forms.Label label21;
    }
}
Weben_CMSרÓôúÂëÉú³ÉÆ÷/Code/MainForm.cs
@@ -31,6 +31,8 @@
            this.tb_WCF_NameSpacePath.Text = "HIAWms";//WCF项目命名空间 
            this.tb_FileName.Text = "Xiangzi";//文件前缀名
            this.tb_ChinaComment.Text = "物料基础信息表";//中文注释
            this.tb_MenuName.Text = "物料信息";//中文注释
            this.tb_PageMenuInstanceName.Text = "wmsMaterial";
            this.tb_CreatePerson.Text = "shaocx";//创建人
            this.tb_EntityName.Text = "WmsMaterial";//实体类名
            //this.tb_EntityProName.Text = "wmsMaterial";//实体类对象名
@@ -98,6 +100,26 @@
                string filePrefixName = this.tb_FileName.Text.Trim();//文件前缀名
                string modulelogo = this.tb_Modulelogo.Text.Trim();//模块简写
                string chinaComment = this.tb_ChinaComment.Text.Trim();//中文注释
                if (chinaComment == "")
                {
                    MessageBox.Show("请输入 è¡¨çš„中文注解!");
                    this.tb_ChinaComment.Focus();
                    return;
                }
                string menuName = this.tb_MenuName.Text.Trim();//中文注释
                if (menuName == "")
                {
                    MessageBox.Show("请输入 é¡µé¢èœå•名!");
                    this.tb_MenuName.Focus();
                    return;
                }
                string _tb_PageMenuInstanceName = this.tb_PageMenuInstanceName.Text.Trim();//中文注释
                if (_tb_PageMenuInstanceName == "")
                {
                    MessageBox.Show("请输入 é¡µé¢èœå•对象缩写!");
                    this.tb_PageMenuInstanceName.Focus();
                    return;
                }
                string createPerson = this.tb_CreatePerson.Text.Trim();//创建人
                string entityName = this.tb_EntityName.Text.Trim();//实体类名
                string tableAlias = this.tb_EntityProName.Text.Trim();//实体类对象名/表别名
@@ -160,6 +182,8 @@
                {
                    Modulelogo = modulelogo,
                    ChinaComment = chinaComment,
                    PageMenuName = menuName,
                    PageMenuInstanceName = _tb_PageMenuInstanceName,
                    NameSpacePath = wcf_NameSpacePath,
                    ColumnNameList = columnList,
                    EntityName = entityName,
@@ -265,6 +289,20 @@
                #endregion
                #region Web
                var webRootPath = tbPath.Text + @"\web\src\widgets\" + tb_EntityName.Text.Trim();
                //13、生成 Index æ–‡ä»¶
                str_generate = Index_Generate.CreateText(param);
                tf = TextHelper.Export2File_V2(webRootPath, $"index.ts", tableName, str_generate, FileType.InputModel, filePrefixName, entityName, modulelogo);
                //14、生成 enum æ–‡ä»¶
                str_generate = enum_Generate.CreateText(param);
                tf = TextHelper.Export2File_V2(webRootPath, $"enum.ts", tableName, str_generate, FileType.InputModel, filePrefixName, entityName, modulelogo);
                #endregion
                ////生成 OutputModel æ–‡ä»¶
Weben_CMSרÓôúÂëÉú³ÉÆ÷/Code/Model/GenerateCodeParam.cs
@@ -23,6 +23,16 @@
        public string ChinaComment { get; set; }
        /// <summary>
        /// é¡µé¢èœå•名
        /// </summary>
        public string PageMenuName { get; set; }
        /// <summary>
        /// é¡µé¢èœå•对象缩写
        /// </summary>
        public string PageMenuInstanceName { get; set; }
        /// <summary>
        /// åˆ—名列表
        /// </summary>
        public List<ColumnModel> ColumnNameList { get; set; } = new List<ColumnModel>();
Weben_CMSרÓôúÂëÉú³ÉÆ÷/Code/Templete/Web/enumÄ£°å.txt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,15 @@
export interface TabType {
  label: string
  name: string
  columns?: any[]
  data?: any[]
  isFooter: boolean
  [key: string]: any
}
export const permissionCodes = {
  '$PageMenuInstanceName$-list': '列表-列表',
  '$PageMenuInstanceName$-add': '列表-添加',
  '$PageMenuInstanceName$-import': '列表-导入',
  '$PageMenuInstanceName$-output': '列表-输出',
}
Weben_CMSרÓôúÂëÉú³ÉÆ÷/Code/Templete/Web/indexÄ£°å.txt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,14 @@
import $NameSpacePath$ from './Views/$NameSpacePath$'
import Setting from '@/components/Setting/Setting'
import { provider } from '@/provider/index'
import p from '../../assets/svg/p.svg'
export default {
  is: '$NameSpacePath$',
  name: '$PageMenuName$',
  category: 'run',
  icon: p,
  authorizationRequired: false,
  canvasView: provider($NameSpacePath$),
  settingsView: Setting,
}
Weben_CMSרÓôúÂëÉú³ÉÆ÷/Code/Utility/CommonHelper.cs
@@ -41,6 +41,8 @@
        {
            str = str.Replace("$NameSpacePath$", param.NameSpacePath);//命名空间
            str = str.Replace("$ChinaComment$", param.ChinaComment);//中文注释
            str = str.Replace("$PageMenuName$", param.PageMenuName);//中文注释
            str = str.Replace("$PageMenuInstanceName$", param.PageMenuInstanceName);//中文注释
            str = str.Replace("$EntityName$", param.EntityName);//实体类名
            str = str.Replace("$Modulelogo$", param.Modulelogo);//模块简写
            str = str.Replace("$EntityInstanceName$", param.EntityInstanceName);//实例名
Weben_CMSרÓôúÂëÉú³ÉÆ÷/Code/³£ÓÃ.txt
@@ -1,6 +1,8 @@

$ChinaComment$
$PageMenuName$
$EntityName$
$NameSpacePath$