DevApp/Gs.DevApp/DevFrm/Work/Frm_Work01.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
DevApp/Gs.DevApp/UserControl/UcDictionarySelect.Designer.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
DevApp/Gs.DevApp/UserControl/UcDictionarySelect.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
DevApp/Gs.DevApp/DevFrm/Work/Frm_Work01.cs
@@ -121,6 +121,7 @@ var dr = gvMx1.GetFocusedDataRow(); if (dr == null || string.IsNullOrEmpty(dr["guid"].ToString())) { } else { @@ -138,12 +139,12 @@ if (txt_gx.Text.Trim() == fGxTouRu) _type = "工序G001:投入不良描述"; if (txt_gx.Text.Trim() == fGxDianJian) _type = "工序G002:电检不良描述"; _type = "工序G002:电检不良描述"; if (txt_gx.Text.Trim() == fGxShouJian) _type = "工序G003:水检不良描述"; if (txt_gx.Text.Trim() == fGxZhongJian) _type = "工序G004:终检不良描述"; UcDictionarySelect frm = new UcDictionarySelect(_type, " a.s_type='"+ _type + "' and pid<>'00000000-0000-0000-0000-000000000000'", _msg); UcDictionarySelect frm = new UcDictionarySelect(_type, " a.s_type='" + _type + "' and pid<>'00000000-0000-0000-0000-000000000000'", _msg); frm.UpdateParent += (ss, ee) => { System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); DevApp/Gs.DevApp/UserControl/UcDictionarySelect.Designer.cs
@@ -32,6 +32,7 @@ this.tlcMenuName = new DevExpress.XtraTreeList.Columns.TreeListColumn(); this.tlcActions = new DevExpress.XtraTreeList.Columns.TreeListColumn(); this.panel1 = new System.Windows.Forms.Panel(); this.btnOpen = new DevExpress.XtraEditors.SimpleButton(); this.lbMsg = new DevExpress.XtraEditors.LabelControl(); this.btnIn = new DevExpress.XtraEditors.SimpleButton(); ((System.ComponentModel.ISupportInitialize)(this.tlMenu)).BeginInit(); @@ -54,7 +55,7 @@ this.tlMenu.OptionsView.CheckBoxStyle = DevExpress.XtraTreeList.DefaultNodeCheckBoxStyle.Check; this.tlMenu.OptionsView.RootCheckBoxStyle = DevExpress.XtraTreeList.NodeCheckBoxStyle.Check; this.tlMenu.OptionsView.TreeLineStyle = DevExpress.XtraTreeList.LineStyle.Solid; this.tlMenu.Size = new System.Drawing.Size(776, 475); this.tlMenu.Size = new System.Drawing.Size(1043, 623); this.tlMenu.TabIndex = 5; this.tlMenu.TreeLevelWidth = 21; // @@ -81,13 +82,27 @@ // // panel1 // this.panel1.Controls.Add(this.btnOpen); this.panel1.Controls.Add(this.lbMsg); this.panel1.Controls.Add(this.btnIn); this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom; this.panel1.Location = new System.Drawing.Point(0, 475); this.panel1.Location = new System.Drawing.Point(0, 623); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(776, 56); this.panel1.Size = new System.Drawing.Size(1043, 56); this.panel1.TabIndex = 6; // // btnOpen // this.btnOpen.Appearance.BackColor = DevExpress.LookAndFeel.DXSkinColors.FillColors.Success; this.btnOpen.Appearance.Font = new System.Drawing.Font("Tahoma", 20F); this.btnOpen.Appearance.Options.UseBackColor = true; this.btnOpen.Appearance.Options.UseFont = true; this.btnOpen.Dock = System.Windows.Forms.DockStyle.Right; this.btnOpen.Location = new System.Drawing.Point(729, 0); this.btnOpen.Name = "btnOpen"; this.btnOpen.Size = new System.Drawing.Size(157, 56); this.btnOpen.TabIndex = 7; this.btnOpen.Text = "全部展开"; // // lbMsg // @@ -105,12 +120,14 @@ // btnIn // this.btnIn.Appearance.BackColor = DevExpress.LookAndFeel.DXSkinColors.FillColors.Primary; this.btnIn.Appearance.Font = new System.Drawing.Font("Tahoma", 20F); this.btnIn.Appearance.Options.UseBackColor = true; this.btnIn.Appearance.Options.UseFont = true; this.btnIn.Dock = System.Windows.Forms.DockStyle.Right; this.btnIn.ImageOptions.Image = global::Gs.DevApp.Properties.Resources.zoom100_16x16; this.btnIn.Location = new System.Drawing.Point(682, 0); this.btnIn.Location = new System.Drawing.Point(886, 0); this.btnIn.Name = "btnIn"; this.btnIn.Size = new System.Drawing.Size(94, 56); this.btnIn.Size = new System.Drawing.Size(157, 56); this.btnIn.TabIndex = 5; this.btnIn.Text = "确定选择"; // @@ -118,7 +135,7 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 18F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(776, 531); this.ClientSize = new System.Drawing.Size(1043, 679); this.Controls.Add(this.tlMenu); this.Controls.Add(this.panel1); this.IconOptions.Image = global::Gs.DevApp.Properties.Resources.logo_png_black; @@ -142,5 +159,6 @@ private System.Windows.Forms.Panel panel1; private DevExpress.XtraEditors.SimpleButton btnIn; private DevExpress.XtraEditors.LabelControl lbMsg; private DevExpress.XtraEditors.SimpleButton btnOpen; } } DevApp/Gs.DevApp/UserControl/UcDictionarySelect.cs
@@ -7,6 +7,7 @@ using System.Collections.Generic; using System.Data; using System.Drawing; using System.Threading.Tasks; using System.Windows.Forms; @@ -20,11 +21,20 @@ public UcDictionarySelect(string _strTitle, string _strWhere, string _strMsg = "") { InitializeComponent(); lbMsg.Text = _strMsg; this.strTitle = _strTitle; this.strWhere = _strWhere; this.Text = _strTitle; tlMenu.IndicatorWidth = 50; tlMenu.CustomDrawNodeIndicator += (s, ee) => { if (ee.IsNodeIndicator) { var index = ee.Node.TreeList.GetVisibleIndexByNode(ee.Node); ee.Info.DisplayText = (index + 1).ToString(); } }; getTreeAsync(); tlMenu.MouseDown += (s, e) => { TreeListHitInfo hitInfo = tlMenu.CalcHitInfo(new Point(e.X, e.Y)); @@ -36,16 +46,20 @@ if (node.HasChildren) // 只有当节点有子节点时才考虑展开或折叠 { if (node.Expanded) { node.Collapse(); btnOpen.Text = "全部展开"; } else { node.Expand(); btnOpen.Text = "全部收拢"; } } } } }; getTree(); tlMenu.CustomDrawNodeCheckBox += TreeList1_CustomDrawNodeCheckBox; tlMenu.OptionsSelection.EnableAppearanceFocusedCell = false; btnIn.Click += (s, e) => { findOrigin(tlMenu); @@ -62,13 +76,20 @@ UpdateParent?.Invoke(this, new UpdateParentEventArgs { DynamicList = list }); Close(); }; tlMenu.IndicatorWidth = 50; tlMenu.CustomDrawNodeIndicator += (s, ee) => { if (ee.IsNodeIndicator) btnOpen.Click += (s, e) => { if (btnOpen.Text == "全部展开") { var index = ee.Node.TreeList.GetVisibleIndexByNode(ee.Node); ee.Info.DisplayText = (index + 1).ToString(); tlMenu.ExpandAll(); btnOpen.Text = "全部收拢"; return; } if (btnOpen.Text == "全部收拢") { tlMenu.CollapseAll(); btnOpen.Text = "全部展开"; return; } }; } @@ -90,17 +111,10 @@ e.Handled = true; } } // 可选:处理节点展开事件,确保动态加载的子节点生效 private void treeList1_BeforeExpand(object sender, BeforeExpandEventArgs e) { // 若子节点是动态加载的,在此处加载数据 // LoadChildNodes(e.Node); } /// <summary> /// 读取列表 /// </summary> private void getTree() private async Task getTreeAsync() { string _where = " and 1=1 and a.type1=1 and " + this.strWhere; var pgq = new PageQueryModel(1, 999999, "a.defect_name", "asc", "", _where); @@ -116,18 +130,17 @@ tlMenu.ParentFieldName = "pid"; tlMenu.Tag = "defectName"; tlMenu.EndUpdate(); // tlMenu.OptionsBehavior.Editable = true; tlMenu.OptionsBehavior.AllowRecursiveNodeChecking = false; tlMenu.BestFitColumns(); tlMenu.ExpandAll(); tlMenu.CollapseAll(); } catch (Exception ex) { MsgHelper.Warning("提示:" + ex.Message); } await Task.Delay(500); // 等待1000毫秒(1秒) tlMenu.CollapseAll(); } #region MyRegion @@ -190,5 +203,7 @@ } } #endregion } }