lg
2024-09-22 c78ffe15080b3218671f03c7d85a5e8edd484b62
仓库管理
已添加6个文件
1823 ■■■■■ 文件已修改
DevApp/Gs.DevApp/DevFrm/Sys/Organization.Designer.cs 384 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/DevFrm/Sys/Organization.cs 262 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/DevFrm/Sys/Organization.resx 120 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/DevFrm/Sys/SysMenu.Designer.cs 594 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/DevFrm/Sys/SysMenu.cs 343 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/DevFrm/Sys/SysMenu.resx 120 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/DevFrm/Sys/Organization.Designer.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,384 @@

namespace Gs.DevApp.DevFrm.User
{
    partial class Organization
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }
        #region Windows Form Designer generated code
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.toolBarMenu1 = new Gs.DevApp.UserControl.ToolBarMenu();
            this.xtraTabControl1 = new DevExpress.XtraTab.XtraTabControl();
            this.xtraTabPage1 = new DevExpress.XtraTab.XtraTabPage();
            this.tlMenu = new System.Windows.Forms.TreeView();
            this.xtraTabPage2 = new DevExpress.XtraTab.XtraTabPage();
            this.panel1 = new System.Windows.Forms.Panel();
            this.txt_factory = new DevExpress.XtraEditors.TextEdit();
            this.labelControl9 = new DevExpress.XtraEditors.LabelControl();
            this.labelControl11 = new DevExpress.XtraEditors.LabelControl();
            this.label1 = new System.Windows.Forms.Label();
            this.labelControl8 = new DevExpress.XtraEditors.LabelControl();
            this.txt_upGuid = new System.Windows.Forms.ComboBox();
            this.labelControl6 = new DevExpress.XtraEditors.LabelControl();
            this.labelControl7 = new DevExpress.XtraEditors.LabelControl();
            this.txt_isStatus = new DevExpress.XtraEditors.ComboBoxEdit();
            this.lbGuid = new System.Windows.Forms.Label();
            this.labelControl5 = new DevExpress.XtraEditors.LabelControl();
            this.labelControl1 = new DevExpress.XtraEditors.LabelControl();
            this.labelControl12 = new DevExpress.XtraEditors.LabelControl();
            this.txt_conTel = new DevExpress.XtraEditors.TextEdit();
            this.labelControl4 = new DevExpress.XtraEditors.LabelControl();
            this.txt_conPeople = new DevExpress.XtraEditors.TextEdit();
            this.labelControl3 = new DevExpress.XtraEditors.LabelControl();
            this.txt_name = new DevExpress.XtraEditors.TextEdit();
            this.labelControl2 = new DevExpress.XtraEditors.LabelControl();
            ((System.ComponentModel.ISupportInitialize)(this.xtraTabControl1)).BeginInit();
            this.xtraTabControl1.SuspendLayout();
            this.xtraTabPage1.SuspendLayout();
            this.xtraTabPage2.SuspendLayout();
            this.panel1.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.txt_factory.Properties)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.txt_isStatus.Properties)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.txt_conTel.Properties)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.txt_conPeople.Properties)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.txt_name.Properties)).BeginInit();
            this.SuspendLayout();
            //
            // toolBarMenu1
            //
            this.toolBarMenu1.Dock = System.Windows.Forms.DockStyle.Top;
            this.toolBarMenu1.isSetBtn = false;
            this.toolBarMenu1.Location = new System.Drawing.Point(0, 0);
            this.toolBarMenu1.Name = "toolBarMenu1";
            this.toolBarMenu1.Size = new System.Drawing.Size(917, 80);
            this.toolBarMenu1.TabIndex = 0;
            //
            // xtraTabControl1
            //
            this.xtraTabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.xtraTabControl1.Location = new System.Drawing.Point(0, 80);
            this.xtraTabControl1.Name = "xtraTabControl1";
            this.xtraTabControl1.SelectedTabPage = this.xtraTabPage1;
            this.xtraTabControl1.Size = new System.Drawing.Size(917, 564);
            this.xtraTabControl1.TabIndex = 3;
            this.xtraTabControl1.TabPages.AddRange(new DevExpress.XtraTab.XtraTabPage[] {
            this.xtraTabPage1,
            this.xtraTabPage2});
            //
            // xtraTabPage1
            //
            this.xtraTabPage1.Controls.Add(this.tlMenu);
            this.xtraTabPage1.Name = "xtraTabPage1";
            this.xtraTabPage1.Size = new System.Drawing.Size(915, 532);
            this.xtraTabPage1.Text = "数据查询";
            //
            // tlMenu
            //
            this.tlMenu.Dock = System.Windows.Forms.DockStyle.Left;
            this.tlMenu.Font = new System.Drawing.Font("Tahoma", 10F);
            this.tlMenu.Location = new System.Drawing.Point(0, 0);
            this.tlMenu.Name = "tlMenu";
            this.tlMenu.Size = new System.Drawing.Size(207, 532);
            this.tlMenu.TabIndex = 2;
            //
            // xtraTabPage2
            //
            this.xtraTabPage2.Controls.Add(this.panel1);
            this.xtraTabPage2.Name = "xtraTabPage2";
            this.xtraTabPage2.PageEnabled = false;
            this.xtraTabPage2.Size = new System.Drawing.Size(915, 532);
            this.xtraTabPage2.Text = "数据编辑";
            //
            // panel1
            //
            this.panel1.BackColor = System.Drawing.Color.White;
            this.panel1.Controls.Add(this.txt_factory);
            this.panel1.Controls.Add(this.labelControl9);
            this.panel1.Controls.Add(this.labelControl11);
            this.panel1.Controls.Add(this.label1);
            this.panel1.Controls.Add(this.labelControl8);
            this.panel1.Controls.Add(this.txt_upGuid);
            this.panel1.Controls.Add(this.labelControl6);
            this.panel1.Controls.Add(this.labelControl7);
            this.panel1.Controls.Add(this.txt_isStatus);
            this.panel1.Controls.Add(this.lbGuid);
            this.panel1.Controls.Add(this.labelControl5);
            this.panel1.Controls.Add(this.labelControl1);
            this.panel1.Controls.Add(this.labelControl12);
            this.panel1.Controls.Add(this.txt_conTel);
            this.panel1.Controls.Add(this.labelControl4);
            this.panel1.Controls.Add(this.txt_conPeople);
            this.panel1.Controls.Add(this.labelControl3);
            this.panel1.Controls.Add(this.txt_name);
            this.panel1.Controls.Add(this.labelControl2);
            this.panel1.Font = new System.Drawing.Font("Tahoma", 10F);
            this.panel1.Location = new System.Drawing.Point(21, 17);
            this.panel1.Name = "panel1";
            this.panel1.Size = new System.Drawing.Size(554, 413);
            this.panel1.TabIndex = 1;
            //
            // txt_factory
            //
            this.txt_factory.Location = new System.Drawing.Point(138, 76);
            this.txt_factory.Name = "txt_factory";
            this.txt_factory.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 10F);
            this.txt_factory.Properties.Appearance.Options.UseFont = true;
            this.txt_factory.Size = new System.Drawing.Size(156, 28);
            this.txt_factory.TabIndex = 135;
            //
            // labelControl9
            //
            this.labelControl9.Appearance.Font = new System.Drawing.Font("Tahoma", 10F);
            this.labelControl9.Appearance.Options.UseFont = true;
            this.labelControl9.Location = new System.Drawing.Point(41, 80);
            this.labelControl9.Name = "labelControl9";
            this.labelControl9.Size = new System.Drawing.Size(85, 21);
            this.labelControl9.TabIndex = 134;
            this.labelControl9.Text = "组织编号:";
            //
            // labelControl11
            //
            this.labelControl11.Location = new System.Drawing.Point(81, 290);
            this.labelControl11.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
            this.labelControl11.Name = "labelControl11";
            this.labelControl11.Size = new System.Drawing.Size(45, 18);
            this.labelControl11.TabIndex = 133;
            this.labelControl11.Text = "主键:";
            //
            // label1
            //
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(119, 285);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(0, 21);
            this.label1.TabIndex = 132;
            //
            // labelControl8
            //
            this.labelControl8.Appearance.Font = new System.Drawing.Font("Tahoma", 10F);
            this.labelControl8.Appearance.Options.UseFont = true;
            this.labelControl8.Location = new System.Drawing.Point(300, 35);
            this.labelControl8.Name = "labelControl8";
            this.labelControl8.Size = new System.Drawing.Size(136, 21);
            this.labelControl8.TabIndex = 120;
            this.labelControl8.Text = "(空将为根组织)";
            //
            // txt_upGuid
            //
            this.txt_upGuid.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.txt_upGuid.FormattingEnabled = true;
            this.txt_upGuid.Location = new System.Drawing.Point(138, 34);
            this.txt_upGuid.Name = "txt_upGuid";
            this.txt_upGuid.Size = new System.Drawing.Size(156, 29);
            this.txt_upGuid.TabIndex = 119;
            //
            // labelControl6
            //
            this.labelControl6.Appearance.Font = new System.Drawing.Font("Tahoma", 10F);
            this.labelControl6.Appearance.Options.UseFont = true;
            this.labelControl6.Location = new System.Drawing.Point(41, 38);
            this.labelControl6.Name = "labelControl6";
            this.labelControl6.Size = new System.Drawing.Size(85, 21);
            this.labelControl6.TabIndex = 118;
            this.labelControl6.Text = "上级组织:";
            //
            // labelControl7
            //
            this.labelControl7.Appearance.Font = new System.Drawing.Font("Tahoma", 10F);
            this.labelControl7.Appearance.Options.UseFont = true;
            this.labelControl7.Location = new System.Drawing.Point(41, 248);
            this.labelControl7.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
            this.labelControl7.Name = "labelControl7";
            this.labelControl7.Size = new System.Drawing.Size(85, 21);
            this.labelControl7.TabIndex = 117;
            this.labelControl7.Text = "组织状态:";
            //
            // txt_isStatus
            //
            this.txt_isStatus.Location = new System.Drawing.Point(138, 244);
            this.txt_isStatus.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
            this.txt_isStatus.Name = "txt_isStatus";
            this.txt_isStatus.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 10F);
            this.txt_isStatus.Properties.Appearance.Options.UseFont = true;
            this.txt_isStatus.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
            this.txt_isStatus.Properties.Items.AddRange(new object[] {
            "-请选择-",
            "正常",
            "禁用"});
            this.txt_isStatus.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
            this.txt_isStatus.Size = new System.Drawing.Size(156, 28);
            this.txt_isStatus.TabIndex = 116;
            //
            // lbGuid
            //
            this.lbGuid.AutoSize = true;
            this.lbGuid.Location = new System.Drawing.Point(138, 295);
            this.lbGuid.Name = "lbGuid";
            this.lbGuid.Size = new System.Drawing.Size(0, 21);
            this.lbGuid.TabIndex = 111;
            //
            // labelControl5
            //
            this.labelControl5.Appearance.ForeColor = System.Drawing.Color.Red;
            this.labelControl5.Appearance.Options.UseForeColor = true;
            this.labelControl5.Location = new System.Drawing.Point(303, 209);
            this.labelControl5.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
            this.labelControl5.Name = "labelControl5";
            this.labelControl5.Size = new System.Drawing.Size(8, 18);
            this.labelControl5.TabIndex = 110;
            this.labelControl5.Text = "*";
            //
            // labelControl1
            //
            this.labelControl1.Appearance.ForeColor = System.Drawing.Color.Red;
            this.labelControl1.Appearance.Options.UseForeColor = true;
            this.labelControl1.Location = new System.Drawing.Point(303, 166);
            this.labelControl1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
            this.labelControl1.Name = "labelControl1";
            this.labelControl1.Size = new System.Drawing.Size(8, 18);
            this.labelControl1.TabIndex = 109;
            this.labelControl1.Text = "*";
            //
            // labelControl12
            //
            this.labelControl12.Appearance.ForeColor = System.Drawing.Color.Red;
            this.labelControl12.Appearance.Options.UseForeColor = true;
            this.labelControl12.Location = new System.Drawing.Point(303, 123);
            this.labelControl12.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
            this.labelControl12.Name = "labelControl12";
            this.labelControl12.Size = new System.Drawing.Size(8, 18);
            this.labelControl12.TabIndex = 108;
            this.labelControl12.Text = "*";
            //
            // txt_conTel
            //
            this.txt_conTel.Location = new System.Drawing.Point(138, 202);
            this.txt_conTel.Name = "txt_conTel";
            this.txt_conTel.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 10F);
            this.txt_conTel.Properties.Appearance.Options.UseFont = true;
            this.txt_conTel.Size = new System.Drawing.Size(156, 28);
            this.txt_conTel.TabIndex = 7;
            //
            // labelControl4
            //
            this.labelControl4.Appearance.Font = new System.Drawing.Font("Tahoma", 10F);
            this.labelControl4.Appearance.Options.UseFont = true;
            this.labelControl4.Location = new System.Drawing.Point(24, 206);
            this.labelControl4.Name = "labelControl4";
            this.labelControl4.Size = new System.Drawing.Size(102, 21);
            this.labelControl4.TabIndex = 6;
            this.labelControl4.Text = "负责人电话:";
            //
            // txt_conPeople
            //
            this.txt_conPeople.Location = new System.Drawing.Point(138, 160);
            this.txt_conPeople.Name = "txt_conPeople";
            this.txt_conPeople.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 10F);
            this.txt_conPeople.Properties.Appearance.Options.UseFont = true;
            this.txt_conPeople.Size = new System.Drawing.Size(156, 28);
            this.txt_conPeople.TabIndex = 5;
            //
            // labelControl3
            //
            this.labelControl3.Appearance.Font = new System.Drawing.Font("Tahoma", 10F);
            this.labelControl3.Appearance.Options.UseFont = true;
            this.labelControl3.Location = new System.Drawing.Point(24, 164);
            this.labelControl3.Name = "labelControl3";
            this.labelControl3.Size = new System.Drawing.Size(102, 21);
            this.labelControl3.TabIndex = 4;
            this.labelControl3.Text = "组织负责人:";
            //
            // txt_name
            //
            this.txt_name.Location = new System.Drawing.Point(138, 118);
            this.txt_name.Name = "txt_name";
            this.txt_name.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 10F);
            this.txt_name.Properties.Appearance.Options.UseFont = true;
            this.txt_name.Size = new System.Drawing.Size(156, 28);
            this.txt_name.TabIndex = 3;
            //
            // labelControl2
            //
            this.labelControl2.Appearance.Font = new System.Drawing.Font("Tahoma", 10F);
            this.labelControl2.Appearance.Options.UseFont = true;
            this.labelControl2.Location = new System.Drawing.Point(41, 122);
            this.labelControl2.Name = "labelControl2";
            this.labelControl2.Size = new System.Drawing.Size(85, 21);
            this.labelControl2.TabIndex = 2;
            this.labelControl2.Text = "组织名称:";
            //
            // Organization
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 18F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(917, 644);
            this.Controls.Add(this.xtraTabControl1);
            this.Controls.Add(this.toolBarMenu1);
            this.Name = "Organization";
            this.Text = "Organization";
            ((System.ComponentModel.ISupportInitialize)(this.xtraTabControl1)).EndInit();
            this.xtraTabControl1.ResumeLayout(false);
            this.xtraTabPage1.ResumeLayout(false);
            this.xtraTabPage2.ResumeLayout(false);
            this.panel1.ResumeLayout(false);
            this.panel1.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)(this.txt_factory.Properties)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.txt_isStatus.Properties)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.txt_conTel.Properties)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.txt_conPeople.Properties)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.txt_name.Properties)).EndInit();
            this.ResumeLayout(false);
        }
        #endregion
        private UserControl.ToolBarMenu toolBarMenu1;
        private DevExpress.XtraTab.XtraTabControl xtraTabControl1;
        private DevExpress.XtraTab.XtraTabPage xtraTabPage1;
        private System.Windows.Forms.TreeView tlMenu;
        private DevExpress.XtraTab.XtraTabPage xtraTabPage2;
        private System.Windows.Forms.Panel panel1;
        private DevExpress.XtraEditors.LabelControl labelControl8;
        private System.Windows.Forms.ComboBox txt_upGuid;
        private DevExpress.XtraEditors.LabelControl labelControl6;
        private DevExpress.XtraEditors.LabelControl labelControl7;
        private DevExpress.XtraEditors.ComboBoxEdit txt_isStatus;
        private System.Windows.Forms.Label lbGuid;
        private DevExpress.XtraEditors.LabelControl labelControl5;
        private DevExpress.XtraEditors.LabelControl labelControl1;
        private DevExpress.XtraEditors.LabelControl labelControl12;
        private DevExpress.XtraEditors.TextEdit txt_conTel;
        private DevExpress.XtraEditors.LabelControl labelControl4;
        private DevExpress.XtraEditors.TextEdit txt_conPeople;
        private DevExpress.XtraEditors.LabelControl labelControl3;
        private DevExpress.XtraEditors.TextEdit txt_name;
        private DevExpress.XtraEditors.LabelControl labelControl2;
        private DevExpress.XtraEditors.LabelControl labelControl11;
        private System.Windows.Forms.Label label1;
        private DevExpress.XtraEditors.TextEdit txt_factory;
        private DevExpress.XtraEditors.LabelControl labelControl9;
    }
}
DevApp/Gs.DevApp/DevFrm/Sys/Organization.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,262 @@
using Gs.DevApp.Entity;
using Gs.DevApp.ToolBox;
using Newtonsoft.Json;
using System;
using System.Data;
using System.Windows.Forms;
namespace Gs.DevApp.DevFrm.User
{
    public partial class Organization : DevExpress.XtraEditors.XtraForm
    {
        public Organization()
        {
            InitializeComponent();
            this.toolBarMenu1.btnAddClick += ToolBarMenu1_btnAddClick;
            this.toolBarMenu1.btnEdtClick += ToolBarMenu1_btnEdtClick;
            this.toolBarMenu1.btnSaveClick += ToolBarMenu1_btnSaveClick;
            this.toolBarMenu1.btnLoadClick += ToolBarMenu1_btnLoadClick;
            this.toolBarMenu1.btnDelClick += ToolBarMenu1_btnDelClick1;
            this.toolBarMenu1.btnEscClick += ToolBarMenu1_btnEscClick;
            tlMenu.DoubleClick += TlMenu_DoubleClick;
            getTree();
        }
        private void TlMenu_DoubleClick(object sender, EventArgs e)
        {
            TreeNode clickedNode = tlMenu.SelectedNode;
            if (clickedNode.FirstNode == null)
            {
                string rowGuid = clickedNode.Name.ToString();
                getModel(rowGuid, false, 999);
            }
        }
        /// <summary>
        /// å–消事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ToolBarMenu1_btnEscClick(object sender, EventArgs e)
        {
            UtilityHelper.JumpToTab(xtraTabControl1, 0);
        }
        /// <summary>
        /// åˆ é™¤äº‹ä»¶
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ToolBarMenu1_btnDelClick1(object sender, EventArgs e)
        {
            string rowGuid, rowName;
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_name, tlMenu);
            if (string.IsNullOrEmpty(rowGuid))
            {
                ToolBox.MsgHelper.Warning("请先选择你要删除的行!");
                return;
            }
            if (!MsgHelper.AskQuestion("你选择了【" + rowName + "】,确定删除吗?"))
            {
                return;
            }
            var _obj = new
            {
                guid = rowGuid,//主建
            };
            try
            {
                string strJson = UtilityHelper.HttpPost("", "Organization/DeleteModel", JsonConvert.SerializeObject(_obj));
                ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
                if (_rtn.rtnCode > 0) { getTree(); }
                ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg);
            }
            catch (Exception ex)
            {
                ToolBox.MsgHelper.Warning("提示:" + ex.Message);
            }
        }
        /// <summary>
        /// åˆ·æ–°äº‹ä»¶
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ToolBarMenu1_btnLoadClick(object sender, EventArgs e)
        {
            UtilityHelper.JumpToTab(xtraTabControl1, 0);
            getTree();
        }
        /// <summary>
        /// ä¿®æ”¹äº‹ä»¶
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ToolBarMenu1_btnEdtClick(object sender, EventArgs e)
        {
            string rowGuid, rowName;
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_name, tlMenu);
            if (string.IsNullOrEmpty(rowGuid))
            {
                ToolBox.MsgHelper.Warning("请先选择你要操作的行!");
                return;
            }
            getModel(rowGuid, true, 1);
        }
        /// <summary>
        /// æ–°å¢žäº‹ä»¶
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ToolBarMenu1_btnAddClick(object sender, EventArgs e)
        {
            UtilityHelper.JumpToTab(xtraTabControl1, 1);
            lbGuid.Text = "";
            UtilityHelper.CleanValueByControl(this.panel1.Controls, true);
        }
        /// <summary>
        /// ä¿å­˜äº‹ä»¶
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ToolBarMenu1_btnSaveClick(object sender, EventArgs e)
        {
            toolBarMenu1.isSetBtn = false;
            if (string.IsNullOrEmpty(txt_factory.Text.Trim()))
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("名称不能为空!");
                txt_factory.Focus();
                return;
            }
            if (string.IsNullOrEmpty(txt_name.Text.Trim()))
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("名称不能为空!");
                txt_name.Focus();
                return;
            }
            if (string.IsNullOrEmpty(txt_conPeople.Text.Trim()))
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("联系人不能为空!");
                txt_conPeople.Focus();
                return;
            }
            if (string.IsNullOrEmpty(txt_conTel.Text.Trim()))
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("联系电话不能为空!");
                txt_conTel.Focus();
                return;
            }
            if (txt_isStatus.SelectedIndex <= 0)
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("状态不能为空!");
                txt_isStatus.Focus();
                return;
            }
            string _upGuid = txt_upGuid.Text.Trim().Length > 0 ? txt_upGuid.SelectedValue.ToString() : "";
            var _obj = new
            {
                guid = lbGuid.Text.Trim(),//主建
                upGuid = _upGuid,//上级的主建
                name = txt_name.Text.Trim(),//名称
                conPeople = txt_conPeople.Text,//联系人
                conTel = txt_conPeople.Text,//联系电话
                isStatus = txt_isStatus.SelectedIndex,//状态
                factory = txt_factory.Text,//组织编号
            };
            try
            {
                string strJson = UtilityHelper.HttpPost("", "Organization/EditModel", JsonConvert.SerializeObject(_obj));
                ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
                ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg);
                if (_rtn.rtnCode > 0)
                {
                    lbGuid.Text = _rtn.rtnData;
                    toolBarMenu1.isSetBtn = true;
                    UtilityHelper.ChangeEnableByControl(this.panel1.Controls, false);
                }
            }
            catch (Exception ex)
            {
                ToolBox.MsgHelper.Warning("提示:" + ex.Message);
            }
        }
        private void getTree()
        {
            tlMenu.Nodes.Clear();
            ImageList imageList = new ImageList();
            imageList.Images.Add("icon1", Properties.Resources.publicfix_32x32);
            imageList.Images.Add("icon2", Properties.Resources.user_16x16);
            tlMenu.ImageList = imageList;
            PageQueryModel pgq = new PageQueryModel(1, 999999, "factory", "asc", "", "");
            string json = JsonConvert.SerializeObject(pgq);
            try
            {
                string strReturn = UtilityHelper.HttpPost("", "Organization/GetListPage", json);
                ReturnModel<PageListModel> dd = UtilityHelper.ReturnToTablePage(strReturn);
                DataTable dt = dd.rtnData.list;
                DataRow[] drGrp = dt.Select("upGuid='' or upguid is null");
                DataTable dtComList = new DataTable();
                dtComList.Columns.Add("guid", typeof(string));
                dtComList.Columns.Add("name", typeof(string));
                foreach (DataRow _dy in drGrp)
                {
                    dtComList.Rows.Add(_dy["guid"].ToString(), _dy["name"].ToString());
                    TreeNode node = new TreeNode();//定义结点
                    node.Text = _dy["name"].ToString();//为结点赋值
                    node.Name = _dy["guid"].ToString();
                    node.ImageIndex = 0;
                    DataRow[] drItem = dt.Select("upGuid='" + _dy["guid"].ToString() + "'");
                    foreach (DataRow _dy2 in drItem)
                    {
                        TreeNode node22 = new TreeNode();//定义结点
                        node22.Text = _dy2["name"].ToString();//为结点赋值
                        node22.Name = _dy2["guid"].ToString();
                        node22.ImageIndex = 1;
                        node.Nodes.Add(node22);
                    }
                    node.ExpandAll();
                    tlMenu.Nodes.Add(node);
                }
                txt_upGuid.DataSource = dtComList;
                txt_upGuid.DisplayMember = "name";
                txt_upGuid.ValueMember = "guid";
            }
            catch (Exception ex)
            {
                ToolBox.MsgHelper.Warning("提示:" + ex.Message);
            }
        }
        private void getModel(string strGuid, bool isEdit, int tabIdx)
        {
            if (string.IsNullOrEmpty(strGuid))
            {
                ToolBox.MsgHelper.Warning("请先选择你要操作的行!");
                return;
            }
            UtilityHelper.JumpToTab(xtraTabControl1, tabIdx);
            var _obj = new
            {
                guid = strGuid,//主建
            };
            try
            {
                string strJson = UtilityHelper.HttpPost("", "Organization/GetModel", JsonConvert.SerializeObject(_obj));
                ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
                if (_rtn.rtnCode > 0)
                {
                    dynamic dy = _rtn.rtnData;
                    lbGuid.Text = strGuid;
                    UtilityHelper.SetValueByObj(this.panel1.Controls, dy, isEdit);
                }
                else
                    ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg);
            }
            catch (Exception ex)
            {
                ToolBox.MsgHelper.Warning("提示:" + ex.Message);
            }
        }
    }
}
DevApp/Gs.DevApp/DevFrm/Sys/Organization.resx
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
  <!--
    Microsoft ResX Schema
    Version 2.0
    The primary goals of this format is to allow a simple XML format
    that is mostly human readable. The generation and parsing of the
    various data types are done through the TypeConverter classes
    associated with the data types.
    Example:
    ... ado.net/XML headers & schema ...
    <resheader name="resmimetype">text/microsoft-resx</resheader>
    <resheader name="version">2.0</resheader>
    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
        <value>[base64 mime encoded serialized .NET Framework object]</value>
    </data>
    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
        <comment>This is a comment</comment>
    </data>
    There are any number of "resheader" rows that contain simple
    name/value pairs.
    Each data row contains a name, and value. The row also contains a
    type or mimetype. Type corresponds to a .NET class that support
    text/value conversion through the TypeConverter architecture.
    Classes that don't support this are serialized and stored with the
    mimetype set.
    The mimetype is used for serialized objects, and tells the
    ResXResourceReader how to depersist the object. This is currently not
    extensible. For a given mimetype the value must be set accordingly:
    Note - application/x-microsoft.net.object.binary.base64 is the format
    that the ResXResourceWriter will generate, however the reader can
    read any of the formats listed below.
    mimetype: application/x-microsoft.net.object.binary.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
            : and then encoded with base64 encoding.
    mimetype: application/x-microsoft.net.object.soap.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
            : and then encoded with base64 encoding.
    mimetype: application/x-microsoft.net.object.bytearray.base64
    value   : The object must be serialized into a byte array
            : using a System.ComponentModel.TypeConverter
            : and then encoded with base64 encoding.
    -->
  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
    <xsd:element name="root" msdata:IsDataSet="true">
      <xsd:complexType>
        <xsd:choice maxOccurs="unbounded">
          <xsd:element name="metadata">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" />
              </xsd:sequence>
              <xsd:attribute name="name" use="required" type="xsd:string" />
              <xsd:attribute name="type" type="xsd:string" />
              <xsd:attribute name="mimetype" type="xsd:string" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="assembly">
            <xsd:complexType>
              <xsd:attribute name="alias" type="xsd:string" />
              <xsd:attribute name="name" type="xsd:string" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="data">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="resheader">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" />
            </xsd:complexType>
          </xsd:element>
        </xsd:choice>
      </xsd:complexType>
    </xsd:element>
  </xsd:schema>
  <resheader name="resmimetype">
    <value>text/microsoft-resx</value>
  </resheader>
  <resheader name="version">
    <value>2.0</value>
  </resheader>
  <resheader name="reader">
    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <resheader name="writer">
    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
</root>
DevApp/Gs.DevApp/DevFrm/Sys/SysMenu.Designer.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,594 @@

namespace Gs.DevApp.DevFrm.User
{
    partial class SysMenu
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }
        #region Windows Form Designer generated code
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.toolBarMenu1 = new Gs.DevApp.UserControl.ToolBarMenu();
            this.xtraTabControl1 = new DevExpress.XtraTab.XtraTabControl();
            this.xtraTabPage1 = new DevExpress.XtraTab.XtraTabPage();
            this.tlMenu = new DevExpress.XtraTreeList.TreeList();
            this.tlcModuleID = new DevExpress.XtraTreeList.Columns.TreeListColumn();
            this.tlcMenuName = new DevExpress.XtraTreeList.Columns.TreeListColumn();
            this.tlcMenuCaption = new DevExpress.XtraTreeList.Columns.TreeListColumn();
            this.tlcActions = new DevExpress.XtraTreeList.Columns.TreeListColumn();
            this.treeListColumn1 = new DevExpress.XtraTreeList.Columns.TreeListColumn();
            this.tlcParentMenuName = new DevExpress.XtraTreeList.Columns.TreeListColumn();
            this.tlcMenuType = new DevExpress.XtraTreeList.Columns.TreeListColumn();
            this.xtraTabPage2 = new DevExpress.XtraTab.XtraTabPage();
            this.panel1 = new System.Windows.Forms.Panel();
            this.label2 = new System.Windows.Forms.Label();
            this.txt_formPath = new DevExpress.XtraEditors.ComboBoxEdit();
            this.label3 = new System.Windows.Forms.Label();
            this.txt_name = new DevExpress.XtraEditors.ComboBoxEdit();
            this.labelControl11 = new DevExpress.XtraEditors.LabelControl();
            this.lbGuid = new System.Windows.Forms.Label();
            this.label1 = new System.Windows.Forms.Label();
            this.labelControl8 = new DevExpress.XtraEditors.LabelControl();
            this.txt_upGuid = new DevExpress.XtraEditors.TreeListLookUpEdit();
            this.treeListLookUpEdit1TreeList = new DevExpress.XtraTreeList.TreeList();
            this.treeListColumn2 = new DevExpress.XtraTreeList.Columns.TreeListColumn();
            this.labelControl7 = new DevExpress.XtraEditors.LabelControl();
            this.txt_isStatus = new DevExpress.XtraEditors.ComboBoxEdit();
            this.txt_idx = new System.Windows.Forms.NumericUpDown();
            this.labelControl1 = new DevExpress.XtraEditors.LabelControl();
            this.labelControl12 = new DevExpress.XtraEditors.LabelControl();
            this.labelControl9 = new DevExpress.XtraEditors.LabelControl();
            this.labelControl6 = new DevExpress.XtraEditors.LabelControl();
            this.labelControl5 = new DevExpress.XtraEditors.LabelControl();
            this.txt_category = new DevExpress.XtraEditors.ComboBoxEdit();
            this.txt_icon = new DevExpress.XtraEditors.TextEdit();
            this.labelControl4 = new DevExpress.XtraEditors.LabelControl();
            this.labelControl3 = new DevExpress.XtraEditors.LabelControl();
            this.labelControl2 = new DevExpress.XtraEditors.LabelControl();
            this.treeListColumn3 = new DevExpress.XtraTreeList.Columns.TreeListColumn();
            ((System.ComponentModel.ISupportInitialize)(this.xtraTabControl1)).BeginInit();
            this.xtraTabControl1.SuspendLayout();
            this.xtraTabPage1.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.tlMenu)).BeginInit();
            this.xtraTabPage2.SuspendLayout();
            this.panel1.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.txt_formPath.Properties)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.txt_name.Properties)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.txt_upGuid.Properties)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.treeListLookUpEdit1TreeList)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.txt_isStatus.Properties)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.txt_idx)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.txt_category.Properties)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.txt_icon.Properties)).BeginInit();
            this.SuspendLayout();
            //
            // toolBarMenu1
            //
            this.toolBarMenu1.Dock = System.Windows.Forms.DockStyle.Top;
            this.toolBarMenu1.isSetBtn = false;
            this.toolBarMenu1.Location = new System.Drawing.Point(0, 0);
            this.toolBarMenu1.Name = "toolBarMenu1";
            this.toolBarMenu1.Size = new System.Drawing.Size(1107, 80);
            this.toolBarMenu1.TabIndex = 0;
            //
            // xtraTabControl1
            //
            this.xtraTabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.xtraTabControl1.Location = new System.Drawing.Point(0, 80);
            this.xtraTabControl1.Name = "xtraTabControl1";
            this.xtraTabControl1.SelectedTabPage = this.xtraTabPage1;
            this.xtraTabControl1.Size = new System.Drawing.Size(1107, 507);
            this.xtraTabControl1.TabIndex = 4;
            this.xtraTabControl1.TabPages.AddRange(new DevExpress.XtraTab.XtraTabPage[] {
            this.xtraTabPage1,
            this.xtraTabPage2});
            //
            // xtraTabPage1
            //
            this.xtraTabPage1.Controls.Add(this.tlMenu);
            this.xtraTabPage1.Name = "xtraTabPage1";
            this.xtraTabPage1.Size = new System.Drawing.Size(1105, 475);
            this.xtraTabPage1.Text = "数据查询";
            //
            // tlMenu
            //
            this.tlMenu.Appearance.Row.Font = new System.Drawing.Font("Tahoma", 10F);
            this.tlMenu.Appearance.Row.Options.UseFont = true;
            this.tlMenu.Columns.AddRange(new DevExpress.XtraTreeList.Columns.TreeListColumn[] {
            this.tlcModuleID,
            this.tlcMenuName,
            this.tlcMenuCaption,
            this.tlcActions,
            this.treeListColumn1,
            this.tlcParentMenuName,
            this.tlcMenuType});
            this.tlMenu.Cursor = System.Windows.Forms.Cursors.Default;
            this.tlMenu.Dock = System.Windows.Forms.DockStyle.Fill;
            this.tlMenu.Font = new System.Drawing.Font("Tahoma", 9F);
            this.tlMenu.Location = new System.Drawing.Point(0, 0);
            this.tlMenu.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
            this.tlMenu.MinWidth = 23;
            this.tlMenu.Name = "tlMenu";
            this.tlMenu.OptionsBehavior.Editable = false;
            this.tlMenu.OptionsView.TreeLineStyle = DevExpress.XtraTreeList.LineStyle.Solid;
            this.tlMenu.Size = new System.Drawing.Size(1105, 475);
            this.tlMenu.TabIndex = 3;
            this.tlMenu.TreeLevelWidth = 21;
            //
            // tlcModuleID
            //
            this.tlcModuleID.Caption = "guid";
            this.tlcModuleID.FieldName = "guid";
            this.tlcModuleID.MinWidth = 23;
            this.tlcModuleID.Name = "tlcModuleID";
            this.tlcModuleID.Visible = true;
            this.tlcModuleID.VisibleIndex = 5;
            this.tlcModuleID.Width = 103;
            //
            // tlcMenuName
            //
            this.tlcMenuName.Caption = "菜单名称";
            this.tlcMenuName.FieldName = "name";
            this.tlcMenuName.MinWidth = 38;
            this.tlcMenuName.Name = "tlcMenuName";
            this.tlcMenuName.Visible = true;
            this.tlcMenuName.VisibleIndex = 0;
            this.tlcMenuName.Width = 215;
            //
            // tlcMenuCaption
            //
            this.tlcMenuCaption.Caption = "窗体路径";
            this.tlcMenuCaption.FieldName = "formPath";
            this.tlcMenuCaption.MinWidth = 23;
            this.tlcMenuCaption.Name = "tlcMenuCaption";
            this.tlcMenuCaption.Visible = true;
            this.tlcMenuCaption.VisibleIndex = 3;
            this.tlcMenuCaption.Width = 139;
            //
            // tlcActions
            //
            this.tlcActions.Caption = "窗体类型";
            this.tlcActions.FieldName = "categoryTxt";
            this.tlcActions.MinWidth = 23;
            this.tlcActions.Name = "tlcActions";
            this.tlcActions.Visible = true;
            this.tlcActions.VisibleIndex = 6;
            this.tlcActions.Width = 50;
            //
            // treeListColumn1
            //
            this.treeListColumn1.Caption = "窗体图标";
            this.treeListColumn1.FieldName = "icon";
            this.treeListColumn1.Name = "treeListColumn1";
            this.treeListColumn1.Visible = true;
            this.treeListColumn1.VisibleIndex = 4;
            this.treeListColumn1.Width = 104;
            //
            // tlcParentMenuName
            //
            this.tlcParentMenuName.Caption = "状态";
            this.tlcParentMenuName.FieldName = "isStatusTxt";
            this.tlcParentMenuName.MinWidth = 23;
            this.tlcParentMenuName.Name = "tlcParentMenuName";
            this.tlcParentMenuName.Visible = true;
            this.tlcParentMenuName.VisibleIndex = 2;
            this.tlcParentMenuName.Width = 64;
            //
            // tlcMenuType
            //
            this.tlcMenuType.Caption = "排序号";
            this.tlcMenuType.FieldName = "idx";
            this.tlcMenuType.MinWidth = 23;
            this.tlcMenuType.Name = "tlcMenuType";
            this.tlcMenuType.Visible = true;
            this.tlcMenuType.VisibleIndex = 1;
            this.tlcMenuType.Width = 50;
            //
            // xtraTabPage2
            //
            this.xtraTabPage2.Controls.Add(this.panel1);
            this.xtraTabPage2.Name = "xtraTabPage2";
            this.xtraTabPage2.PageEnabled = false;
            this.xtraTabPage2.Size = new System.Drawing.Size(1105, 475);
            this.xtraTabPage2.Text = "数据编辑";
            //
            // panel1
            //
            this.panel1.BackColor = System.Drawing.Color.White;
            this.panel1.Controls.Add(this.label2);
            this.panel1.Controls.Add(this.txt_formPath);
            this.panel1.Controls.Add(this.label3);
            this.panel1.Controls.Add(this.txt_name);
            this.panel1.Controls.Add(this.labelControl11);
            this.panel1.Controls.Add(this.lbGuid);
            this.panel1.Controls.Add(this.label1);
            this.panel1.Controls.Add(this.labelControl8);
            this.panel1.Controls.Add(this.txt_upGuid);
            this.panel1.Controls.Add(this.labelControl7);
            this.panel1.Controls.Add(this.txt_isStatus);
            this.panel1.Controls.Add(this.txt_idx);
            this.panel1.Controls.Add(this.labelControl1);
            this.panel1.Controls.Add(this.labelControl12);
            this.panel1.Controls.Add(this.labelControl9);
            this.panel1.Controls.Add(this.labelControl6);
            this.panel1.Controls.Add(this.labelControl5);
            this.panel1.Controls.Add(this.txt_category);
            this.panel1.Controls.Add(this.txt_icon);
            this.panel1.Controls.Add(this.labelControl4);
            this.panel1.Controls.Add(this.labelControl3);
            this.panel1.Controls.Add(this.labelControl2);
            this.panel1.Font = new System.Drawing.Font("Tahoma", 10F);
            this.panel1.Location = new System.Drawing.Point(29, 34);
            this.panel1.Name = "panel1";
            this.panel1.Size = new System.Drawing.Size(679, 411);
            this.panel1.TabIndex = 2;
            //
            // label2
            //
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(429, 163);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(197, 21);
            this.label2.TabIndex = 135;
            this.label2.Text = "(建议从下拉框中选择)";
            //
            // txt_formPath
            //
            this.txt_formPath.Location = new System.Drawing.Point(111, 160);
            this.txt_formPath.Name = "txt_formPath";
            this.txt_formPath.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 10F);
            this.txt_formPath.Properties.Appearance.Options.UseFont = true;
            this.txt_formPath.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
            this.txt_formPath.Properties.DropDownRows = 20;
            this.txt_formPath.Size = new System.Drawing.Size(297, 28);
            this.txt_formPath.TabIndex = 134;
            //
            // label3
            //
            this.label3.AutoSize = true;
            this.label3.Location = new System.Drawing.Point(429, 87);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(248, 21);
            this.label3.TabIndex = 132;
            this.label3.Text = "(按钮类型请从下拉框中选择)";
            //
            // txt_name
            //
            this.txt_name.Location = new System.Drawing.Point(111, 83);
            this.txt_name.Name = "txt_name";
            this.txt_name.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 10F);
            this.txt_name.Properties.Appearance.Options.UseFont = true;
            this.txt_name.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
            this.txt_name.Properties.DropDownRows = 30;
            this.txt_name.Size = new System.Drawing.Size(297, 28);
            this.txt_name.TabIndex = 3;
            //
            // labelControl11
            //
            this.labelControl11.Location = new System.Drawing.Point(13, 319);
            this.labelControl11.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
            this.labelControl11.Name = "labelControl11";
            this.labelControl11.Size = new System.Drawing.Size(45, 18);
            this.labelControl11.TabIndex = 131;
            this.labelControl11.Text = "主键:";
            //
            // lbGuid
            //
            this.lbGuid.AutoSize = true;
            this.lbGuid.Location = new System.Drawing.Point(111, 319);
            this.lbGuid.Name = "lbGuid";
            this.lbGuid.Size = new System.Drawing.Size(0, 21);
            this.lbGuid.TabIndex = 1;
            //
            // label1
            //
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(412, 15);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(163, 21);
            this.label1.TabIndex = 118;
            this.label1.Text = "(空将为一级菜单)";
            //
            // labelControl8
            //
            this.labelControl8.Appearance.ForeColor = System.Drawing.Color.Red;
            this.labelControl8.Appearance.Options.UseForeColor = true;
            this.labelControl8.Location = new System.Drawing.Point(418, 211);
            this.labelControl8.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
            this.labelControl8.Name = "labelControl8";
            this.labelControl8.Size = new System.Drawing.Size(8, 18);
            this.labelControl8.TabIndex = 117;
            this.labelControl8.Text = "*";
            //
            // txt_upGuid
            //
            this.txt_upGuid.EditValue = "";
            this.txt_upGuid.Location = new System.Drawing.Point(111, 11);
            this.txt_upGuid.Name = "txt_upGuid";
            this.txt_upGuid.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 10F);
            this.txt_upGuid.Properties.Appearance.Options.UseFont = true;
            this.txt_upGuid.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
            this.txt_upGuid.Properties.TreeList = this.treeListLookUpEdit1TreeList;
            this.txt_upGuid.Size = new System.Drawing.Size(297, 28);
            this.txt_upGuid.TabIndex = 116;
            //
            // treeListLookUpEdit1TreeList
            //
            this.treeListLookUpEdit1TreeList.Columns.AddRange(new DevExpress.XtraTreeList.Columns.TreeListColumn[] {
            this.treeListColumn2});
            this.treeListLookUpEdit1TreeList.Dock = System.Windows.Forms.DockStyle.Fill;
            this.treeListLookUpEdit1TreeList.KeyFieldName = "";
            this.treeListLookUpEdit1TreeList.Location = new System.Drawing.Point(99, 73);
            this.treeListLookUpEdit1TreeList.Name = "treeListLookUpEdit1TreeList";
            this.treeListLookUpEdit1TreeList.OptionsBehavior.Editable = false;
            this.treeListLookUpEdit1TreeList.OptionsView.ShowIndentAsRowStyle = true;
            this.treeListLookUpEdit1TreeList.ParentFieldName = "";
            this.treeListLookUpEdit1TreeList.Size = new System.Drawing.Size(400, 200);
            this.treeListLookUpEdit1TreeList.TabIndex = 0;
            //
            // treeListColumn2
            //
            this.treeListColumn2.Caption = "菜单名";
            this.treeListColumn2.FieldName = "name";
            this.treeListColumn2.Name = "treeListColumn2";
            this.treeListColumn2.Visible = true;
            this.treeListColumn2.VisibleIndex = 0;
            //
            // labelControl7
            //
            this.labelControl7.Appearance.Font = new System.Drawing.Font("Tahoma", 10F);
            this.labelControl7.Appearance.Options.UseFont = true;
            this.labelControl7.Location = new System.Drawing.Point(13, 209);
            this.labelControl7.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
            this.labelControl7.Name = "labelControl7";
            this.labelControl7.Size = new System.Drawing.Size(85, 21);
            this.labelControl7.TabIndex = 115;
            this.labelControl7.Text = "菜单状态:";
            //
            // txt_isStatus
            //
            this.txt_isStatus.Location = new System.Drawing.Point(111, 208);
            this.txt_isStatus.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
            this.txt_isStatus.Name = "txt_isStatus";
            this.txt_isStatus.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 10F);
            this.txt_isStatus.Properties.Appearance.Options.UseFont = true;
            this.txt_isStatus.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
            this.txt_isStatus.Properties.Items.AddRange(new object[] {
            "-请选择-",
            "正常",
            "禁用"});
            this.txt_isStatus.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
            this.txt_isStatus.Size = new System.Drawing.Size(297, 28);
            this.txt_isStatus.TabIndex = 114;
            //
            // txt_idx
            //
            this.txt_idx.Location = new System.Drawing.Point(111, 244);
            this.txt_idx.Name = "txt_idx";
            this.txt_idx.Size = new System.Drawing.Size(297, 28);
            this.txt_idx.TabIndex = 113;
            this.txt_idx.Value = new decimal(new int[] {
            2,
            0,
            0,
            0});
            //
            // labelControl1
            //
            this.labelControl1.Appearance.Font = new System.Drawing.Font("Tahoma", 10F);
            this.labelControl1.Appearance.Options.UseFont = true;
            this.labelControl1.Location = new System.Drawing.Point(13, 252);
            this.labelControl1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
            this.labelControl1.Name = "labelControl1";
            this.labelControl1.Size = new System.Drawing.Size(85, 21);
            this.labelControl1.TabIndex = 112;
            this.labelControl1.Text = "菜单排序:";
            //
            // labelControl12
            //
            this.labelControl12.Appearance.ForeColor = System.Drawing.Color.Red;
            this.labelControl12.Appearance.Options.UseForeColor = true;
            this.labelControl12.Location = new System.Drawing.Point(418, 52);
            this.labelControl12.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
            this.labelControl12.Name = "labelControl12";
            this.labelControl12.Size = new System.Drawing.Size(8, 18);
            this.labelControl12.TabIndex = 107;
            this.labelControl12.Text = "*";
            //
            // labelControl9
            //
            this.labelControl9.Appearance.ForeColor = System.Drawing.Color.Red;
            this.labelControl9.Appearance.Options.UseForeColor = true;
            this.labelControl9.Location = new System.Drawing.Point(418, 88);
            this.labelControl9.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
            this.labelControl9.Name = "labelControl9";
            this.labelControl9.Size = new System.Drawing.Size(8, 18);
            this.labelControl9.TabIndex = 108;
            this.labelControl9.Text = "*";
            //
            // labelControl6
            //
            this.labelControl6.Appearance.Font = new System.Drawing.Font("Tahoma", 10F);
            this.labelControl6.Appearance.Options.UseFont = true;
            this.labelControl6.Location = new System.Drawing.Point(13, 161);
            this.labelControl6.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
            this.labelControl6.Name = "labelControl6";
            this.labelControl6.Size = new System.Drawing.Size(85, 21);
            this.labelControl6.TabIndex = 103;
            this.labelControl6.Text = "窗体类名:";
            //
            // labelControl5
            //
            this.labelControl5.Appearance.Font = new System.Drawing.Font("Tahoma", 10F);
            this.labelControl5.Appearance.Options.UseFont = true;
            this.labelControl5.Location = new System.Drawing.Point(13, 49);
            this.labelControl5.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
            this.labelControl5.Name = "labelControl5";
            this.labelControl5.Size = new System.Drawing.Size(85, 21);
            this.labelControl5.TabIndex = 101;
            this.labelControl5.Text = "菜单类型:";
            //
            // txt_category
            //
            this.txt_category.EditValue = "-请选择-";
            this.txt_category.Location = new System.Drawing.Point(111, 47);
            this.txt_category.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
            this.txt_category.Name = "txt_category";
            this.txt_category.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 10F);
            this.txt_category.Properties.Appearance.Options.UseFont = true;
            this.txt_category.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
            this.txt_category.Properties.Items.AddRange(new object[] {
            "-请选择-",
            "窗体类型",
            "按钮类型"});
            this.txt_category.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
            this.txt_category.Size = new System.Drawing.Size(297, 28);
            this.txt_category.TabIndex = 100;
            //
            // txt_icon
            //
            this.txt_icon.Location = new System.Drawing.Point(111, 119);
            this.txt_icon.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
            this.txt_icon.Name = "txt_icon";
            this.txt_icon.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 10F);
            this.txt_icon.Properties.Appearance.Options.UseFont = true;
            this.txt_icon.Size = new System.Drawing.Size(297, 28);
            this.txt_icon.TabIndex = 99;
            //
            // labelControl4
            //
            this.labelControl4.Appearance.Font = new System.Drawing.Font("Tahoma", 10F);
            this.labelControl4.Appearance.Options.UseFont = true;
            this.labelControl4.Location = new System.Drawing.Point(13, 119);
            this.labelControl4.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
            this.labelControl4.Name = "labelControl4";
            this.labelControl4.Size = new System.Drawing.Size(85, 21);
            this.labelControl4.TabIndex = 98;
            this.labelControl4.Text = "菜单图标:";
            //
            // labelControl3
            //
            this.labelControl3.Appearance.Font = new System.Drawing.Font("Tahoma", 10F);
            this.labelControl3.Appearance.Options.UseFont = true;
            this.labelControl3.Location = new System.Drawing.Point(13, 17);
            this.labelControl3.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
            this.labelControl3.Name = "labelControl3";
            this.labelControl3.Size = new System.Drawing.Size(85, 21);
            this.labelControl3.TabIndex = 97;
            this.labelControl3.Text = "父级菜单:";
            //
            // labelControl2
            //
            this.labelControl2.Appearance.Font = new System.Drawing.Font("Tahoma", 10F);
            this.labelControl2.Appearance.Options.UseFont = true;
            this.labelControl2.Location = new System.Drawing.Point(13, 84);
            this.labelControl2.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
            this.labelControl2.Name = "labelControl2";
            this.labelControl2.Size = new System.Drawing.Size(85, 21);
            this.labelControl2.TabIndex = 94;
            this.labelControl2.Text = "菜单名称:";
            //
            // treeListColumn3
            //
            this.treeListColumn3.Caption = "菜单名";
            this.treeListColumn3.FieldName = "name";
            this.treeListColumn3.Name = "treeListColumn3";
            this.treeListColumn3.Visible = true;
            this.treeListColumn3.VisibleIndex = 0;
            //
            // SysMenu
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 18F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(1107, 587);
            this.Controls.Add(this.xtraTabControl1);
            this.Controls.Add(this.toolBarMenu1);
            this.Name = "SysMenu";
            this.Text = "SysMenu";
            ((System.ComponentModel.ISupportInitialize)(this.xtraTabControl1)).EndInit();
            this.xtraTabControl1.ResumeLayout(false);
            this.xtraTabPage1.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.tlMenu)).EndInit();
            this.xtraTabPage2.ResumeLayout(false);
            this.panel1.ResumeLayout(false);
            this.panel1.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)(this.txt_formPath.Properties)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.txt_name.Properties)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.txt_upGuid.Properties)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.treeListLookUpEdit1TreeList)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.txt_isStatus.Properties)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.txt_idx)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.txt_category.Properties)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.txt_icon.Properties)).EndInit();
            this.ResumeLayout(false);
        }
        #endregion
        private UserControl.ToolBarMenu toolBarMenu1;
        private DevExpress.XtraTab.XtraTabControl xtraTabControl1;
        private DevExpress.XtraTab.XtraTabPage xtraTabPage1;
        private DevExpress.XtraTab.XtraTabPage xtraTabPage2;
        private System.Windows.Forms.Panel panel1;
        private DevExpress.XtraEditors.LabelControl labelControl11;
        private System.Windows.Forms.Label lbGuid;
        private System.Windows.Forms.Label label1;
        private DevExpress.XtraEditors.LabelControl labelControl8;
        private DevExpress.XtraEditors.TreeListLookUpEdit txt_upGuid;
        private DevExpress.XtraTreeList.TreeList treeListLookUpEdit1TreeList;
        private DevExpress.XtraTreeList.Columns.TreeListColumn treeListColumn2;
        private DevExpress.XtraEditors.LabelControl labelControl7;
        private DevExpress.XtraEditors.ComboBoxEdit txt_isStatus;
        private System.Windows.Forms.NumericUpDown txt_idx;
        private DevExpress.XtraEditors.LabelControl labelControl1;
        private DevExpress.XtraEditors.LabelControl labelControl12;
        private DevExpress.XtraEditors.LabelControl labelControl9;
        private DevExpress.XtraEditors.LabelControl labelControl6;
        private DevExpress.XtraEditors.LabelControl labelControl5;
        private DevExpress.XtraEditors.ComboBoxEdit txt_category;
        private DevExpress.XtraEditors.TextEdit txt_icon;
        private DevExpress.XtraEditors.LabelControl labelControl4;
        private DevExpress.XtraEditors.LabelControl labelControl3;
        private DevExpress.XtraEditors.LabelControl labelControl2;
        private DevExpress.XtraEditors.ComboBoxEdit txt_name;
        private System.Windows.Forms.Label label3;
        private DevExpress.XtraEditors.ComboBoxEdit txt_formPath;
        private System.Windows.Forms.Label label2;
        private DevExpress.XtraTreeList.Columns.TreeListColumn treeListColumn3;
        private DevExpress.XtraTreeList.TreeList tlMenu;
        private DevExpress.XtraTreeList.Columns.TreeListColumn tlcModuleID;
        private DevExpress.XtraTreeList.Columns.TreeListColumn tlcMenuName;
        private DevExpress.XtraTreeList.Columns.TreeListColumn tlcMenuCaption;
        private DevExpress.XtraTreeList.Columns.TreeListColumn tlcActions;
        private DevExpress.XtraTreeList.Columns.TreeListColumn treeListColumn1;
        private DevExpress.XtraTreeList.Columns.TreeListColumn tlcParentMenuName;
        private DevExpress.XtraTreeList.Columns.TreeListColumn tlcMenuType;
    }
}
DevApp/Gs.DevApp/DevFrm/Sys/SysMenu.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,343 @@
using DevExpress.XtraEditors.Controls;
using DevExpress.XtraTreeList;
using DevExpress.XtraTreeList.Nodes;
using Gs.DevApp.Entity;
using Gs.DevApp.ToolBox;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Data;
using System.Reflection;
using System.Windows.Forms;
namespace Gs.DevApp.DevFrm.User
{
    public partial class SysMenu : DevExpress.XtraEditors.XtraForm
    {
        public SysMenu()
        {
            InitializeComponent();
            txt_upGuid.Properties.PopupFormSize = new System.Drawing.Size(txt_upGuid.Width, 300);
            //txt_upGuid.Properties.ImmediatePopup = true;
            txt_upGuid.Properties.TextEditStyle = TextEditStyles.DisableTextEditor;
            this.toolBarMenu1.btnAddClick += ToolBarMenu1_btnAddClick;
            this.toolBarMenu1.btnEdtClick += ToolBarMenu1_btnEdtClick;
            this.toolBarMenu1.btnSaveClick += ToolBarMenu1_btnSaveClick;
            this.toolBarMenu1.btnLoadClick += ToolBarMenu1_btnLoadClick;
            this.toolBarMenu1.btnDelClick += ToolBarMenu1_btnDelClick1;
            this.toolBarMenu1.btnEscClick += ToolBarMenu1_btnEscClick;
            txt_category.TextChanged += Txt_category_TextChanged;
            tlMenu.MouseDoubleClick += TlMenu_MouseDoubleClick;
            txt_upGuid.Properties.TreeList.IndicatorWidth = 50;
            txt_upGuid.Properties.TreeList.CustomDrawNodeIndicator += (s, ee) =>
            {
                if (ee.IsNodeIndicator)
                {
                    var index = ee.Node.TreeList.GetVisibleIndexByNode(ee.Node);
                    ee.Info.DisplayText = (index + 1).ToString();
                }
            };
            tlMenu.IndicatorWidth = 50;
            tlMenu.CustomDrawNodeIndicator += (s, ee) =>
            {
                if (ee.IsNodeIndicator)
                {
                    var index = ee.Node.TreeList.GetVisibleIndexByNode(ee.Node);
                    ee.Info.DisplayText = (index + 1).ToString();
                }
            };
            getTree();
            getDownList();
            getActionList();
        }
        /// <summary>
        /// èœå•类型改变事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Txt_category_TextChanged(object sender, EventArgs e)
        {
            if (txt_category.SelectedIndex == 1)
            {
                this.txt_formPath.Enabled = true;
                this.txt_icon.Enabled = true;
            }
            else
            {
                this.txt_formPath.Enabled = false;
                this.txt_icon.Enabled = false;
                this.txt_formPath.Text = "";
                this.txt_icon.Text = "";
            }
        }
        /// <summary>
        /// åŒå‡»è¡Œäº‹ä»¶
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TlMenu_MouseDoubleClick(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            TreeListHitInfo info = tlMenu.CalcHitInfo(e.Location);
            if (info.Node != null)
            {
                TreeListNode clickedNode = this.tlMenu.FocusedNode;
                if (clickedNode.FirstNode == null)
                {
                    string rowGuid = clickedNode.GetValue("guid").ToString();
                    getModel(rowGuid, false, 999);
                }
            }
        }
        /// <summary>
        /// å–消事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ToolBarMenu1_btnEscClick(object sender, EventArgs e)
        {
            UtilityHelper.JumpToTab(xtraTabControl1, 0);
        }
        /// <summary>
        /// åˆ é™¤äº‹ä»¶
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ToolBarMenu1_btnDelClick1(object sender, EventArgs e)
        {
            string rowGuid, rowName;
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_name, tlMenu);
            if (string.IsNullOrEmpty(rowGuid))
            {
                ToolBox.MsgHelper.Warning("请先选择你要操作的行!");
                return;
            }
            if (!MsgHelper.AskQuestion("你选择了【" + rowName + "】,确定删除吗?"))
            {
                return;
            }
            var _obj = new
            {
                guid = rowGuid,//主建
            };
            try
            {
                string strJson = UtilityHelper.HttpPost("", "MenuAction/DeleteModel", JsonConvert.SerializeObject(_obj));
                ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
                if (_rtn.rtnCode > 0) { getTree(); }
                ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg);
            }
            catch (Exception ex)
            {
                ToolBox.MsgHelper.Warning("提示:" + ex.Message);
            }
        }
        /// <summary>
        /// åˆ·æ–°äº‹ä»¶
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ToolBarMenu1_btnLoadClick(object sender, EventArgs e)
        {
            UtilityHelper.JumpToTab(xtraTabControl1, 0);
            getTree();
        }
        /// <summary>
        /// ä¿®æ”¹äº‹ä»¶
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ToolBarMenu1_btnEdtClick(object sender, EventArgs e)
        {
            string rowGuid, rowName;
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_name, tlMenu);
            if (string.IsNullOrEmpty(rowGuid))
            {
                ToolBox.MsgHelper.Warning("请先选择你要操作的行!");
                return;
            }
            getModel(rowGuid, true, 1);
            if (txt_category.SelectedIndex == 1)
            {
                this.txt_formPath.Enabled = true;
                this.txt_icon.Enabled = true;
            }
            else
            {
                this.txt_formPath.Enabled = false;
                this.txt_icon.Enabled = false;
            }
        }
        /// <summary>
        /// æ–°å¢žäº‹ä»¶
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ToolBarMenu1_btnAddClick(object sender, EventArgs e)
        {
            UtilityHelper.JumpToTab(xtraTabControl1, 1);
            lbGuid.Text = "";
            UtilityHelper.CleanValueByControl(this.panel1.Controls, true);
        }
        /// <summary>
        /// ä¿å­˜äº‹ä»¶
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ToolBarMenu1_btnSaveClick(object sender, EventArgs e)
        {
            toolBarMenu1.isSetBtn = false;
            if (string.IsNullOrEmpty(txt_category.Text.Trim()) || txt_category.SelectedIndex == 0)
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("菜单类型不能为空!");
                txt_category.Focus();
                return;
            }
            if (string.IsNullOrEmpty(txt_name.Text.Trim()))
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("菜单名称不能为空!");
                txt_name.Focus();
                return;
            }
            if (string.IsNullOrEmpty(txt_isStatus.Text.Trim()) || txt_isStatus.SelectedIndex == 0)
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("菜单状态不能为空!");
                txt_isStatus.Focus();
                return;
            }
            string _upGuid = txt_upGuid.EditValue.ToString();
            if (txt_category.SelectedIndex == 2 && string.IsNullOrEmpty(_upGuid))
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("按钮类型必须选择父级菜单!");
                txt_isStatus.Focus();
                return;
            }
            var _obj = new
            {
                guid = lbGuid.Text.Trim(),//主建
                upGuid = _upGuid,//上级的主建
                name = txt_name.Text.Trim(),//名称
                icon = txt_icon.Text,//菜单图标
                isStatus = txt_isStatus.SelectedIndex,//状态
                formPath = txt_formPath.Text.Trim(),//窗体路径
                idx = int.Parse(txt_idx.Value.ToString()),//排序
                category = txt_category.SelectedIndex,//类型
            };
            try
            {
                string strJson = UtilityHelper.HttpPost("", "MenuAction/EditModel", JsonConvert.SerializeObject(_obj));
                ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
                ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg);
                if (_rtn.rtnCode > 0)
                {
                    lbGuid.Text = _rtn.rtnData;
                    toolBarMenu1.isSetBtn = true;
                    UtilityHelper.ChangeEnableByControl(this.panel1.Controls, false);
                }
            }
            catch (Exception ex)
            {
                ToolBox.MsgHelper.Warning("提示:" + ex.Message);
            }
        }
        /// <summary>
        /// è¯»å–列表
        /// </summary>
        private void getTree()
        {
            PageQueryModel pgq = new PageQueryModel(1, 999999, "idx", "asc", "", "");
            string json = JsonConvert.SerializeObject(pgq);
            try
            {
                string strReturn = UtilityHelper.HttpPost("", "MenuAction/GetListPage", json);
                ReturnModel<PageListModel> dd = UtilityHelper.ReturnToTablePage(strReturn);
                DataTable dt = dd.rtnData.list;
                this.tlMenu.DataSource = dt;
                this.tlMenu.KeyFieldName = "guid";
                this.tlMenu.ParentFieldName = "upGuid";
                this.tlMenu.Tag = "name";
                this.tlMenu.EndUpdate();
                this.tlMenu.ExpandAll();
                tlMenu.OptionsView.CheckBoxStyle = DevExpress.XtraTreeList.DefaultNodeCheckBoxStyle.Default;
            }
            catch (Exception ex)
            {
                ToolBox.MsgHelper.Warning("提示:" + ex.Message);
            }
        }
        private void getModel(string strGuid, bool isEdit, int tabIdx)
        {
            if (string.IsNullOrEmpty(strGuid))
            {
                ToolBox.MsgHelper.Warning("请先选择你要操作的行!");
                return;
            }
            UtilityHelper.JumpToTab(xtraTabControl1, tabIdx);
            var _obj = new
            {
                guid = strGuid,//主建
            };
            try
            {
                string strJson = UtilityHelper.HttpPost("", "MenuAction/GetModel", JsonConvert.SerializeObject(_obj));
                ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
                if (_rtn.rtnCode > 0)
                {
                    dynamic dy = _rtn.rtnData;
                    lbGuid.Text = strGuid;
                    UtilityHelper.SetValueByObj(this.panel1.Controls, dy, isEdit);
                    txt_upGuid.EditValue = dy.upGuid.ToString();
                }
                else
                    ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg);
            }
            catch (Exception ex)
            {
                ToolBox.MsgHelper.Warning("提示:" + ex.Message);
            }
        }
        /// <summary>
        /// è¯»å–上级树
        /// </summary>
        private void getDownList()
        {
            PageQueryModel pgq = new PageQueryModel(1, 999999, "idx", "asc", "", " and category=1");
            string json = JsonConvert.SerializeObject(pgq);
            try
            {
                string strReturn = UtilityHelper.HttpPost("", "MenuAction/GetListPage", json);
                ReturnModel<PageListModel> dd = UtilityHelper.ReturnToTablePage(strReturn);
                DataTable dt = dd.rtnData.list;
                txt_upGuid.Properties.TreeList.KeyFieldName = "guid";
                txt_upGuid.Properties.TreeList.ParentFieldName = "upGuid";
                txt_upGuid.Properties.ValueMember = "guid";
                txt_upGuid.Properties.DisplayMember = "name";
                txt_upGuid.Properties.DataSource = dt;
            }
            catch (Exception ex)
            {
                ToolBox.MsgHelper.Warning("提示:" + ex.Message);
            }
        }
        private void getActionList()
        {
            List<string> lst = new List<string>();
            lst = toolBarMenu1.actions;
            txt_name.Properties.Items.AddRange(toolBarMenu1.actions);
            Assembly assembly = Assembly.GetExecutingAssembly();
            Type[] types = assembly.GetTypes();
            foreach (Type type in types)
            {
                if (type.IsSubclassOf(typeof(Form)))
                {
                    txt_formPath.Properties.Items.Add(type.FullName);
                }
            }
        }
    }
}
DevApp/Gs.DevApp/DevFrm/Sys/SysMenu.resx
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
  <!--
    Microsoft ResX Schema
    Version 2.0
    The primary goals of this format is to allow a simple XML format
    that is mostly human readable. The generation and parsing of the
    various data types are done through the TypeConverter classes
    associated with the data types.
    Example:
    ... ado.net/XML headers & schema ...
    <resheader name="resmimetype">text/microsoft-resx</resheader>
    <resheader name="version">2.0</resheader>
    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
        <value>[base64 mime encoded serialized .NET Framework object]</value>
    </data>
    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
        <comment>This is a comment</comment>
    </data>
    There are any number of "resheader" rows that contain simple
    name/value pairs.
    Each data row contains a name, and value. The row also contains a
    type or mimetype. Type corresponds to a .NET class that support
    text/value conversion through the TypeConverter architecture.
    Classes that don't support this are serialized and stored with the
    mimetype set.
    The mimetype is used for serialized objects, and tells the
    ResXResourceReader how to depersist the object. This is currently not
    extensible. For a given mimetype the value must be set accordingly:
    Note - application/x-microsoft.net.object.binary.base64 is the format
    that the ResXResourceWriter will generate, however the reader can
    read any of the formats listed below.
    mimetype: application/x-microsoft.net.object.binary.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
            : and then encoded with base64 encoding.
    mimetype: application/x-microsoft.net.object.soap.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
            : and then encoded with base64 encoding.
    mimetype: application/x-microsoft.net.object.bytearray.base64
    value   : The object must be serialized into a byte array
            : using a System.ComponentModel.TypeConverter
            : and then encoded with base64 encoding.
    -->
  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
    <xsd:element name="root" msdata:IsDataSet="true">
      <xsd:complexType>
        <xsd:choice maxOccurs="unbounded">
          <xsd:element name="metadata">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" />
              </xsd:sequence>
              <xsd:attribute name="name" use="required" type="xsd:string" />
              <xsd:attribute name="type" type="xsd:string" />
              <xsd:attribute name="mimetype" type="xsd:string" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="assembly">
            <xsd:complexType>
              <xsd:attribute name="alias" type="xsd:string" />
              <xsd:attribute name="name" type="xsd:string" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="data">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="resheader">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" />
            </xsd:complexType>
          </xsd:element>
        </xsd:choice>
      </xsd:complexType>
    </xsd:element>
  </xsd:schema>
  <resheader name="resmimetype">
    <value>text/microsoft-resx</value>
  </resheader>
  <resheader name="version">
    <value>2.0</value>
  </resheader>
  <resheader name="reader">
    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <resheader name="writer">
    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
</root>