From 89ef0e0df783ebe160a1dd8c86e7641d67f0a3ca Mon Sep 17 00:00:00 2001 From: lu <99954486@qq.com> Date: 星期六, 02 十一月 2024 16:44:18 +0800 Subject: [PATCH] 1 --- DevApp/Gs.DevApp/DevFrm/User/RoleSelectAction.resx | 140 +++++++++++++++++ DevApp/Gs.DevApp/DevFrm/User/RoleSelectAction.cs | 174 +++++++++++++++++++++ DevApp/Gs.DevApp/Resources/bouser_16x162.png | 0 DevApp/Gs.DevApp/Resources/refresh_32x32.png | 0 DevApp/Gs.DevApp/DevFrm/User/RoleSelectAction.Designer.cs | 141 +++++++++++++++++ 5 files changed, 455 insertions(+), 0 deletions(-) diff --git a/DevApp/Gs.DevApp/DevFrm/User/RoleSelectAction.Designer.cs b/DevApp/Gs.DevApp/DevFrm/User/RoleSelectAction.Designer.cs new file mode 100644 index 0000000..d2c8f16 --- /dev/null +++ b/DevApp/Gs.DevApp/DevFrm/User/RoleSelectAction.Designer.cs @@ -0,0 +1,141 @@ +锘縩amespace Gs.DevApp.DevFrm.User +{ + partial class RoleSelectAction + { + /// <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() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RoleSelectAction)); + this.panel1 = new System.Windows.Forms.Panel(); + this.panel2 = new System.Windows.Forms.Panel(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.trv = new System.Windows.Forms.TreeView(); + this.btnCancel = new DevExpress.XtraEditors.SimpleButton(); + this.btnSave = new DevExpress.XtraEditors.SimpleButton(); + this.panel1.SuspendLayout(); + this.panel2.SuspendLayout(); + this.groupBox1.SuspendLayout(); + this.SuspendLayout(); + // + // panel1 + // + this.panel1.Controls.Add(this.groupBox1); + this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel1.Location = new System.Drawing.Point(0, 0); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(468, 643); + this.panel1.TabIndex = 0; + // + // panel2 + // + this.panel2.Controls.Add(this.btnCancel); + this.panel2.Controls.Add(this.btnSave); + this.panel2.Dock = System.Windows.Forms.DockStyle.Bottom; + this.panel2.Location = new System.Drawing.Point(0, 579); + this.panel2.Name = "panel2"; + this.panel2.Size = new System.Drawing.Size(468, 64); + this.panel2.TabIndex = 1; + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.trv); + this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill; + this.groupBox1.Location = new System.Drawing.Point(0, 0); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(468, 643); + this.groupBox1.TabIndex = 11; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "璇烽�夋嫨璇ヨ鑹茬殑鏉冮檺"; + // + // trv + // + this.trv.CheckBoxes = true; + this.trv.Dock = System.Windows.Forms.DockStyle.Fill; + this.trv.Font = new System.Drawing.Font("Tahoma", 10F); + this.trv.Location = new System.Drawing.Point(3, 22); + this.trv.Name = "trv"; + this.trv.Size = new System.Drawing.Size(462, 618); + this.trv.TabIndex = 2; + // + // btnCancel + // + this.btnCancel.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); + this.btnCancel.Appearance.Options.UseFont = true; + this.btnCancel.ButtonStyle = DevExpress.XtraEditors.Controls.BorderStyles.HotFlat; + this.btnCancel.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnCancel.ImageOptions.Image = ((System.Drawing.Image)(resources.GetObject("btnCancel.ImageOptions.Image"))); + this.btnCancel.Location = new System.Drawing.Point(214, 16); + this.btnCancel.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.btnCancel.Name = "btnCancel"; + this.btnCancel.Size = new System.Drawing.Size(87, 37); + this.btnCancel.TabIndex = 240; + this.btnCancel.Text = "鍙栨秷 (&C)"; + this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); + // + // btnSave + // + this.btnSave.Appearance.Font = new System.Drawing.Font("Tahoma", 10F); + this.btnSave.Appearance.Options.UseFont = true; + this.btnSave.ButtonStyle = DevExpress.XtraEditors.Controls.BorderStyles.HotFlat; + this.btnSave.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnSave.ImageOptions.Image = ((System.Drawing.Image)(resources.GetObject("btnSave.ImageOptions.Image"))); + this.btnSave.Location = new System.Drawing.Point(93, 16); + this.btnSave.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.btnSave.Name = "btnSave"; + this.btnSave.Size = new System.Drawing.Size(87, 37); + this.btnSave.TabIndex = 239; + this.btnSave.Text = "纭畾 (&L)"; + this.btnSave.Click += new System.EventHandler(this.btnSave_Click); + // + // RoleSelectAction + // + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(468, 643); + this.Controls.Add(this.panel2); + this.Controls.Add(this.panel1); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "RoleSelectAction"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "璁剧疆瑙掕壊鏉冮檺"; + this.panel1.ResumeLayout(false); + this.panel2.ResumeLayout(false); + this.groupBox1.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.TreeView trv; + private System.Windows.Forms.Panel panel2; + private DevExpress.XtraEditors.SimpleButton btnCancel; + private DevExpress.XtraEditors.SimpleButton btnSave; + } +} \ No newline at end of file diff --git a/DevApp/Gs.DevApp/DevFrm/User/RoleSelectAction.cs b/DevApp/Gs.DevApp/DevFrm/User/RoleSelectAction.cs new file mode 100644 index 0000000..a178965 --- /dev/null +++ b/DevApp/Gs.DevApp/DevFrm/User/RoleSelectAction.cs @@ -0,0 +1,174 @@ +锘縰sing DevExpress.Utils.DirectXPaint; +using DevExpress.XtraEditors; +using Gs.DevApp.Properties; +using Gs.DevApp.ToolBox; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Gs.DevApp.DevFrm.User +{ + public partial class RoleSelectAction : DevExpress.XtraEditors.XtraForm + { + private StringBuilder _actionLst = new StringBuilder(); + private readonly string _rightGuid; + public RoleSelectAction(string rightGuid) + { + InitializeComponent(); + trv.AfterCheck += Trv_AfterCheck; + _rightGuid = rightGuid; + getTree(_rightGuid); + } + + private void getTree(string roleGuid) + { + trv.Nodes.Clear(); + var imageList = new ImageList(); + imageList.Images.Add("icon0", Resources.publicfix_32x32); + imageList.Images.Add("icon1", Resources.addfooter_32x32); + imageList.Images.Add("icon2", Resources.listmultilevel_16x16); + imageList.Images.Add("icon3", Resources.addcalculatedfield_16x16); + trv.ImageList = imageList; + var _obj = new + { + roleGuid //涓诲缓 + }; + try + { + var strReturn = UtilityHelper.HttpPost("", "Role/GetListByRole", + JsonConvert.SerializeObject(_obj)); + var dd = UtilityHelper.ReturnToTablePage(strReturn); + var dt = dd.rtnData.list; + var drGrp = dt.Select("upGuid='' or upGuid is null"); + foreach (var _dy in drGrp) + { + var _orgGuid = _dy["guid"] + "&"; + var node = new TreeNode(); //瀹氫箟缁撶偣 + node.Text = _dy["name"].ToString(); //涓虹粨鐐硅祴鍊� + node.Name = _dy["guid"].ToString(); + node.ImageIndex = 0; + node.Checked = _dy["isCk"].ToString() == "1" ? true : false; + var drItem = dt.Select("upGuid='" + _dy["guid"] + + "' and orgGuid='" + _dy["guid"] + + "'"); + foreach (var _dy2 in drItem) + { + var node22 = new TreeNode(); //瀹氫箟缁撶偣 + node22.Text = _dy2["name"].ToString(); //涓虹粨鐐硅祴鍊� + node22.Name = _orgGuid + _dy2["guid"]; + node22.ImageIndex = 1; + node22.Checked = _dy2["isCk"].ToString() == "1" + ? true + : false; + var drItem33 = dt.Select("upGuid='" + _dy2["guid"] + + "' and orgGuid='" + + _dy["guid"] + "'"); + foreach (var _dy3 in drItem33) + { + var node33 = new TreeNode(); //瀹氫箟缁撶偣 + node33.Text = _dy3["name"].ToString(); //涓虹粨鐐硅祴鍊� + node33.Name = _orgGuid + _dy3["guid"]; + node33.ImageIndex = 2; + node33.Checked = _dy3["isCk"].ToString() == "1" + ? true + : false; + var drItem44 = dt.Select("upGuid='" + _dy3["guid"] + + "' and orgGuid='" + _dy["guid"] + "'"); + foreach (var _dy4 in drItem44) + { + var node44 = new TreeNode(); //瀹氫箟缁撶偣 + node44.Text = _dy4["name"].ToString(); //涓虹粨鐐硅祴鍊� + node44.Name = _orgGuid + _dy4["guid"]; + node44.ImageIndex = 3; + node44.Checked = _dy4["isCk"].ToString() == "1" + ? true + : false; + node33.Nodes.Add(node44); + } + + node22.Nodes.Add(node33); + } + + node22.Expand(); + node.Nodes.Add(node22); + } + + node.Expand(); + trv.Nodes.Add(node); + } + } + catch (Exception ex) + { + MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + } + } + + private void btnCancel_Click(object sender, EventArgs e) + { + Close(); + } + private void Trv_AfterCheck(object sender, TreeViewEventArgs e) + { + try + { + trv.AfterCheck -= Trv_AfterCheck; + UtilityHelper.TreeViewCheck(e); + trv.AfterCheck += Trv_AfterCheck; + } + catch (Exception ex) + { + MsgHelper.ShowError(ex.Message); + } + } + + // 閬嶅巻TreeView涓殑鎵�鏈夎妭鐐� + private void TraverseTreeViewNodes(TreeNodeCollection nodes) + { + foreach (TreeNode node in nodes) + { + if (node.Checked) + _actionLst.Append(node.Name + "~"); + // 閫掑綊閬嶅巻瀛愯妭鐐� + if (node.Nodes.Count > 0) TraverseTreeViewNodes(node.Nodes); + } + } + private void btnSave_Click(object sender, EventArgs e) + { + string rowGuid = _rightGuid; + if (string.IsNullOrEmpty(rowGuid)) + { + MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); + return; + } + + if (!MsgHelper.AskQuestion("纭畾璁剧疆鏉冮檺鍚楋紵")) + return; + _actionLst = new StringBuilder(); + TraverseTreeViewNodes(trv.Nodes); + var _obj = new + { + roleGuid = rowGuid, + actionLst = _actionLst.ToString() + }; + try + { + var strJson = UtilityHelper.HttpPost("", + "Role/SetRoleMenuAction", + JsonConvert.SerializeObject(_obj)); + var _rtn = UtilityHelper.ReturnToDynamic(strJson); + MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnData.outMsg); + } + catch (Exception ex) + { + MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + } + } + } +} \ No newline at end of file diff --git a/DevApp/Gs.DevApp/DevFrm/User/RoleSelectAction.resx b/DevApp/Gs.DevApp/DevFrm/User/RoleSelectAction.resx new file mode 100644 index 0000000..c0dfd5d --- /dev/null +++ b/DevApp/Gs.DevApp/DevFrm/User/RoleSelectAction.resx @@ -0,0 +1,140 @@ +锘�<?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> + <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> + <data name="btnCancel.ImageOptions.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value> + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAABF0RVh0VGl0 + bGUAQ2xvc2U7RXhpdDsFGf+FAAAArElEQVQ4T7XSOwoCQRCE4c0E8XEDQTMRA+/gTTykGBuYGm6olxBE + tP1LHGl1WoZVg2+DYrqYZrYys6/cPvVibk38teBUkkUFNcbYuGyFCXYuyxYcMYSyPlSi4fY9m+KMsECW + aEF5D2m4gzUeZ6MC8SXZYflU4K8taZ2nc1GBH+4i3eStJFdwwABpWNf268xwQVggW4zgd1aJnnbvsrBA + 9JyvWfGPVOx3Bc1ZdQWpA3U147gCvgAAAABJRU5ErkJggg== +</value> + </data> + <data name="btnSave.ImageOptions.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value> + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACB0RVh0VGl0 + bGUATmV3O05ld0VtcGxveWVlO05ld1BlcnNvbjveWVScAAAA3ElEQVQ4T5WOPQ5BQRSF3wYsgohCJXRq + PRWJJaktgFLUOjsQ0egURKEgaj/NOEfuyJl5E4/iy8y5c7+Tyc6LruI0O+cKUbEVnUkhxhd4ycOcDUdL + cgVjULKcK1AxyCbwJBPLuYKiH/iCm+VkgZf0VJlcKJNUgRZ9sshkRpkEBRr8AmiCJ/Ay75z9XED64GQM + bPZGnSDYAsUjqFgmZXAAPWZ1goDHBngAfnsDqqAGtjbjW12duGBui9+YqhMXnKPlFCd14oJ9tJxip05c + 0AFrcLdlhbMVaKsTFPyPy16LX4vunIH/egAAAABJRU5ErkJggg== +</value> + </data> +</root> \ No newline at end of file diff --git a/DevApp/Gs.DevApp/Resources/bouser_16x162.png b/DevApp/Gs.DevApp/Resources/bouser_16x162.png new file mode 100644 index 0000000..b9d5708 --- /dev/null +++ b/DevApp/Gs.DevApp/Resources/bouser_16x162.png Binary files differ diff --git a/DevApp/Gs.DevApp/Resources/refresh_32x32.png b/DevApp/Gs.DevApp/Resources/refresh_32x32.png new file mode 100644 index 0000000..c705765 --- /dev/null +++ b/DevApp/Gs.DevApp/Resources/refresh_32x32.png Binary files differ -- Gitblit v1.9.3