diff --git a/PEIS/Entity/DictHazardTypecs.cs b/PEIS/Entity/DictHazardTypecs.cs index 12892c1..615aa71 100644 --- a/PEIS/Entity/DictHazardTypecs.cs +++ b/PEIS/Entity/DictHazardTypecs.cs @@ -13,6 +13,10 @@ namespace PEIS.Entity { public override string TableName => "Dict_HazardType"; /// + /// ParentID + /// + public Int64 ParentID { get; set; } + /// /// 名字 /// public String Name { get; set; } @@ -24,6 +28,10 @@ namespace PEIS.Entity /// 排序 /// public int Sort { get; set; } + /// + /// 国标 + /// + public string Standard { get; set; } } } diff --git a/PEIS/View/Setting/HazardTypeForm.Designer.cs b/PEIS/View/Setting/HazardTypeForm.Designer.cs index cacd1a8..1090401 100644 --- a/PEIS/View/Setting/HazardTypeForm.Designer.cs +++ b/PEIS/View/Setting/HazardTypeForm.Designer.cs @@ -29,23 +29,24 @@ private void InitializeComponent() { this.splitContainer1 = new System.Windows.Forms.SplitContainer(); - this.gCHazardType = new DevExpress.XtraGrid.GridControl(); - this.gVHazardType = new DevExpress.XtraGrid.Views.Grid.GridView(); - this.ID = new DevExpress.XtraGrid.Columns.GridColumn(); - this.gcName = new DevExpress.XtraGrid.Columns.GridColumn(); - this.gcCode = new DevExpress.XtraGrid.Columns.GridColumn(); - this.gcSort = new DevExpress.XtraGrid.Columns.GridColumn(); + this.treeList1 = new DevExpress.XtraTreeList.TreeList(); + this.trID = new DevExpress.XtraTreeList.Columns.TreeListColumn(); + this.trParentID = new DevExpress.XtraTreeList.Columns.TreeListColumn(); + this.trName = new DevExpress.XtraTreeList.Columns.TreeListColumn(); + this.trCode = new DevExpress.XtraTreeList.Columns.TreeListColumn(); + this.trSort = new DevExpress.XtraTreeList.Columns.TreeListColumn(); + this.trStandard = new DevExpress.XtraTreeList.Columns.TreeListColumn(); this.panel2 = new System.Windows.Forms.Panel(); this.opMenuHdType = new PEIS.View.UControl.OpMenu(); this.label2 = new System.Windows.Forms.Label(); this.gCHFeelItem = new DevExpress.XtraGrid.GridControl(); this.gVHFeelItem = new DevExpress.XtraGrid.Views.Grid.GridView(); this.gridColumn1 = new DevExpress.XtraGrid.Columns.GridColumn(); - this.FeeItemCode2 = new DevExpress.XtraGrid.Columns.GridColumn(); this.Sort = new DevExpress.XtraGrid.Columns.GridColumn(); this.HID = new DevExpress.XtraGrid.Columns.GridColumn(); this.FID = new DevExpress.XtraGrid.Columns.GridColumn(); this.FeeItemName2 = new DevExpress.XtraGrid.Columns.GridColumn(); + this.FeeItemCode2 = new DevExpress.XtraGrid.Columns.GridColumn(); this.ItemClass2 = new DevExpress.XtraGrid.Columns.GridColumn(); this.SettlePrice2 = new DevExpress.XtraGrid.Columns.GridColumn(); this.Price2 = new DevExpress.XtraGrid.Columns.GridColumn(); @@ -62,6 +63,7 @@ this.KeyNo = new DevExpress.XtraGrid.Columns.GridColumn(); this.FeeItemCode = new DevExpress.XtraGrid.Columns.GridColumn(); this.FeeItemName = new DevExpress.XtraGrid.Columns.GridColumn(); + this.FeeItemCode22 = new DevExpress.XtraGrid.Columns.GridColumn(); this.ItemClass = new DevExpress.XtraGrid.Columns.GridColumn(); this.SettlePrice = new DevExpress.XtraGrid.Columns.GridColumn(); this.Price = new DevExpress.XtraGrid.Columns.GridColumn(); @@ -73,13 +75,11 @@ this.panel4 = new System.Windows.Forms.Panel(); this.opMenuItem = new PEIS.View.UControl.OpMenu(); this.label3 = new System.Windows.Forms.Label(); - this.FeeItemCode22 = new DevExpress.XtraGrid.Columns.GridColumn(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.gCHazardType)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.gVHazardType)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.treeList1)).BeginInit(); this.panel2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.gCHFeelItem)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.gVHFeelItem)).BeginInit(); @@ -99,7 +99,7 @@ // splitContainer1.Panel1 // this.splitContainer1.Panel1.AutoScroll = true; - this.splitContainer1.Panel1.Controls.Add(this.gCHazardType); + this.splitContainer1.Panel1.Controls.Add(this.treeList1); this.splitContainer1.Panel1.Controls.Add(this.panel2); // // splitContainer1.Panel2 @@ -110,84 +110,101 @@ this.splitContainer1.SplitterDistance = 266; this.splitContainer1.TabIndex = 0; // - // gCHazardType - // - this.gCHazardType.Dock = System.Windows.Forms.DockStyle.Fill; - this.gCHazardType.Location = new System.Drawing.Point(0, 46); - this.gCHazardType.MainView = this.gVHazardType; - this.gCHazardType.Name = "gCHazardType"; - this.gCHazardType.Size = new System.Drawing.Size(266, 697); - this.gCHazardType.TabIndex = 1; - this.gCHazardType.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] { - this.gVHazardType}); - // - // gVHazardType - // - this.gVHazardType.Appearance.ViewCaption.Options.UseTextOptions = true; - this.gVHazardType.Appearance.ViewCaption.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Near; - this.gVHazardType.Appearance.ViewCaption.TextOptions.VAlignment = DevExpress.Utils.VertAlignment.Center; - this.gVHazardType.Columns.AddRange(new DevExpress.XtraGrid.Columns.GridColumn[] { - this.ID, - this.gcName, - this.gcCode, - this.gcSort}); - this.gVHazardType.GridControl = this.gCHazardType; - this.gVHazardType.Name = "gVHazardType"; - this.gVHazardType.OptionsView.ShowGroupPanel = false; - this.gVHazardType.OptionsView.ShowPreviewRowLines = DevExpress.Utils.DefaultBoolean.False; - this.gVHazardType.OptionsView.ShowVerticalLines = DevExpress.Utils.DefaultBoolean.False; - this.gVHazardType.ViewCaption = "接害类型"; - // - // ID - // - this.ID.Caption = "主键"; - this.ID.FieldName = "ID"; - this.ID.Name = "ID"; - this.ID.OptionsColumn.AllowEdit = false; - this.ID.OptionsColumn.AllowSort = DevExpress.Utils.DefaultBoolean.False; - this.ID.OptionsFilter.AllowAutoFilter = false; - this.ID.OptionsFilter.AllowFilter = false; - // - // gcName - // - this.gcName.Caption = "名字"; - this.gcName.FieldName = "Name"; - this.gcName.Name = "gcName"; - this.gcName.OptionsColumn.AllowEdit = false; - this.gcName.OptionsColumn.AllowFocus = false; - this.gcName.OptionsColumn.AllowGroup = DevExpress.Utils.DefaultBoolean.True; - this.gcName.OptionsColumn.AllowSort = DevExpress.Utils.DefaultBoolean.False; - this.gcName.OptionsFilter.AllowAutoFilter = false; - this.gcName.OptionsFilter.AllowFilter = false; - this.gcName.Visible = true; - this.gcName.VisibleIndex = 0; - this.gcName.Width = 188; - // - // gcCode - // - this.gcCode.Caption = "编码"; - this.gcCode.FieldName = "Code"; - this.gcCode.Name = "gcCode"; - this.gcCode.OptionsColumn.AllowEdit = false; - this.gcCode.OptionsColumn.AllowFocus = false; - this.gcCode.OptionsColumn.AllowGroup = DevExpress.Utils.DefaultBoolean.False; - this.gcCode.OptionsColumn.AllowSort = DevExpress.Utils.DefaultBoolean.False; - this.gcCode.OptionsFilter.AllowAutoFilter = false; - this.gcCode.OptionsFilter.AllowFilter = false; - this.gcCode.Visible = true; - this.gcCode.VisibleIndex = 1; - this.gcCode.Width = 60; - // - // gcSort - // - this.gcSort.Caption = "排序"; - this.gcSort.FieldName = "Sort"; - this.gcSort.Name = "gcSort"; - this.gcSort.OptionsColumn.AllowEdit = false; - this.gcSort.OptionsColumn.AllowGroup = DevExpress.Utils.DefaultBoolean.False; - this.gcSort.OptionsColumn.AllowSort = DevExpress.Utils.DefaultBoolean.False; - this.gcSort.OptionsFilter.AllowAutoFilter = false; - this.gcSort.OptionsFilter.AllowFilter = false; + // treeList1 + // + this.treeList1.Columns.AddRange(new DevExpress.XtraTreeList.Columns.TreeListColumn[] { + this.trID, + this.trParentID, + this.trName, + this.trCode, + this.trSort, + this.trStandard}); + this.treeList1.Dock = System.Windows.Forms.DockStyle.Fill; + this.treeList1.Location = new System.Drawing.Point(0, 46); + this.treeList1.Name = "treeList1"; + this.treeList1.OptionsView.AutoWidth = false; + this.treeList1.Size = new System.Drawing.Size(266, 697); + this.treeList1.TabIndex = 1; + // + // trID + // + this.trID.Caption = "trID"; + this.trID.FieldName = "ID"; + this.trID.Name = "trID"; + this.trID.OptionsColumn.AllowEdit = false; + this.trID.OptionsColumn.AllowFocus = false; + this.trID.OptionsColumn.AllowSort = false; + this.trID.OptionsFilter.AllowAutoFilter = false; + this.trID.OptionsFilter.AllowFilter = false; + // + // trParentID + // + this.trParentID.Caption = "ParentID"; + this.trParentID.FieldName = "ParentID"; + this.trParentID.Name = "trParentID"; + this.trParentID.OptionsColumn.AllowEdit = false; + this.trParentID.OptionsColumn.AllowFocus = false; + this.trParentID.OptionsColumn.AllowSize = false; + this.trParentID.OptionsColumn.AllowSort = false; + this.trParentID.OptionsFilter.AllowAutoFilter = false; + this.trParentID.OptionsFilter.AllowFilter = false; + // + // trName + // + this.trName.Caption = "名称"; + this.trName.FieldName = "Name"; + this.trName.Name = "trName"; + this.trName.OptionsColumn.AllowEdit = false; + this.trName.OptionsColumn.AllowFocus = false; + this.trName.OptionsColumn.AllowSize = false; + this.trName.OptionsColumn.AllowSort = false; + this.trName.OptionsFilter.AllowAutoFilter = false; + this.trName.OptionsFilter.AllowFilter = false; + this.trName.Visible = true; + this.trName.VisibleIndex = 0; + this.trName.Width = 250; + // + // trCode + // + this.trCode.Caption = "编码"; + this.trCode.FieldName = "Code"; + this.trCode.Name = "trCode"; + this.trCode.OptionsColumn.AllowEdit = false; + this.trCode.OptionsColumn.AllowFocus = false; + this.trCode.OptionsColumn.AllowSize = false; + this.trCode.OptionsColumn.AllowSort = false; + this.trCode.OptionsFilter.AllowAutoFilter = false; + this.trCode.OptionsFilter.AllowFilter = false; + this.trCode.Visible = true; + this.trCode.VisibleIndex = 1; + this.trCode.Width = 100; + // + // trSort + // + this.trSort.Caption = "排序"; + this.trSort.FieldName = "Sort"; + this.trSort.Name = "trSort"; + this.trSort.OptionsColumn.AllowEdit = false; + this.trSort.OptionsColumn.AllowFocus = false; + this.trSort.OptionsColumn.AllowSize = false; + this.trSort.OptionsColumn.AllowSort = false; + this.trSort.OptionsFilter.AllowAutoFilter = false; + this.trSort.OptionsFilter.AllowFilter = false; + // + // trStandard + // + this.trStandard.Caption = "国标"; + this.trStandard.FieldName = "Standard"; + this.trStandard.Name = "trStandard"; + this.trStandard.OptionsColumn.AllowEdit = false; + this.trStandard.OptionsColumn.AllowFocus = false; + this.trStandard.OptionsColumn.AllowSize = false; + this.trStandard.OptionsColumn.AllowSort = false; + this.trStandard.OptionsFilter.AllowAutoFilter = false; + this.trStandard.OptionsFilter.AllowFilter = false; + this.trStandard.Visible = true; + this.trStandard.VisibleIndex = 2; + this.trStandard.Width = 120; // // panel2 // @@ -268,19 +285,6 @@ this.gridColumn1.OptionsFilter.AllowAutoFilter = false; this.gridColumn1.OptionsFilter.AllowFilter = false; // - // FeeItemCode2 - // - this.FeeItemCode2.Caption = "项目编码"; - this.FeeItemCode2.FieldName = "FeeItemCode"; - this.FeeItemCode2.Name = "FeeItemCode2"; - this.FeeItemCode2.OptionsColumn.AllowEdit = false; - this.FeeItemCode2.OptionsColumn.AllowFocus = false; - this.FeeItemCode2.OptionsColumn.AllowSort = DevExpress.Utils.DefaultBoolean.False; - this.FeeItemCode2.OptionsFilter.AllowAutoFilter = false; - this.FeeItemCode2.OptionsFilter.AllowFilter = false; - this.FeeItemCode2.Visible = true; - this.FeeItemCode2.VisibleIndex = 1; - // // Sort // this.Sort.Caption = "顺序"; @@ -329,6 +333,19 @@ this.FeeItemName2.VisibleIndex = 0; this.FeeItemName2.Width = 174; // + // FeeItemCode2 + // + this.FeeItemCode2.Caption = "项目编码"; + this.FeeItemCode2.FieldName = "FeeItemCode"; + this.FeeItemCode2.Name = "FeeItemCode2"; + this.FeeItemCode2.OptionsColumn.AllowEdit = false; + this.FeeItemCode2.OptionsColumn.AllowFocus = false; + this.FeeItemCode2.OptionsColumn.AllowSort = DevExpress.Utils.DefaultBoolean.False; + this.FeeItemCode2.OptionsFilter.AllowAutoFilter = false; + this.FeeItemCode2.OptionsFilter.AllowFilter = false; + this.FeeItemCode2.Visible = true; + this.FeeItemCode2.VisibleIndex = 1; + // // ItemClass2 // this.ItemClass2.Caption = "项目类别"; @@ -539,6 +556,18 @@ this.FeeItemName.VisibleIndex = 0; this.FeeItemName.Width = 170; // + // FeeItemCode22 + // + this.FeeItemCode22.Caption = "项目编码"; + this.FeeItemCode22.FieldName = "FeeItemCode"; + this.FeeItemCode22.Name = "FeeItemCode22"; + this.FeeItemCode22.OptionsColumn.AllowEdit = false; + this.FeeItemCode22.OptionsColumn.AllowFocus = false; + this.FeeItemCode22.OptionsFilter.AllowAutoFilter = false; + this.FeeItemCode22.OptionsFilter.AllowFilter = false; + this.FeeItemCode22.Visible = true; + this.FeeItemCode22.VisibleIndex = 1; + // // ItemClass // this.ItemClass.Caption = "项目类别"; @@ -678,18 +707,6 @@ this.label3.Text = "检查项目"; this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // - // FeeItemCode22 - // - this.FeeItemCode22.Caption = "项目编码"; - this.FeeItemCode22.FieldName = "FeeItemCode"; - this.FeeItemCode22.Name = "FeeItemCode22"; - this.FeeItemCode22.OptionsColumn.AllowEdit = false; - this.FeeItemCode22.OptionsColumn.AllowFocus = false; - this.FeeItemCode22.OptionsFilter.AllowAutoFilter = false; - this.FeeItemCode22.OptionsFilter.AllowFilter = false; - this.FeeItemCode22.Visible = true; - this.FeeItemCode22.VisibleIndex = 1; - // // HazardTypeForm // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); @@ -704,8 +721,7 @@ this.splitContainer1.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); this.splitContainer1.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.gCHazardType)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.gVHazardType)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.treeList1)).EndInit(); this.panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.gCHFeelItem)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.gVHFeelItem)).EndInit(); @@ -723,12 +739,6 @@ private System.Windows.Forms.SplitContainer splitContainer1; private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Panel panel2; - private DevExpress.XtraGrid.GridControl gCHazardType; - private DevExpress.XtraGrid.Views.Grid.GridView gVHazardType; - private DevExpress.XtraGrid.Columns.GridColumn ID; - private DevExpress.XtraGrid.Columns.GridColumn gcName; - private DevExpress.XtraGrid.Columns.GridColumn gcCode; - private DevExpress.XtraGrid.Columns.GridColumn gcSort; private DevExpress.XtraGrid.GridControl gCHFeelItem; private DevExpress.XtraGrid.Views.Grid.GridView gVHFeelItem; private System.Windows.Forms.Panel panel3; @@ -766,5 +776,12 @@ private DevExpress.XtraGrid.Columns.GridColumn UnitName2; private DevExpress.XtraGrid.Columns.GridColumn DeptName2; private DevExpress.XtraGrid.Columns.GridColumn FeeItemCode22; + private DevExpress.XtraTreeList.TreeList treeList1; + private DevExpress.XtraTreeList.Columns.TreeListColumn trID; + private DevExpress.XtraTreeList.Columns.TreeListColumn trParentID; + private DevExpress.XtraTreeList.Columns.TreeListColumn trName; + private DevExpress.XtraTreeList.Columns.TreeListColumn trCode; + private DevExpress.XtraTreeList.Columns.TreeListColumn trSort; + private DevExpress.XtraTreeList.Columns.TreeListColumn trStandard; } } \ No newline at end of file diff --git a/PEIS/View/Setting/HazardTypeForm.cs b/PEIS/View/Setting/HazardTypeForm.cs index 173ff27..3396e4e 100644 --- a/PEIS/View/Setting/HazardTypeForm.cs +++ b/PEIS/View/Setting/HazardTypeForm.cs @@ -1,4 +1,5 @@ -using PEIS.Base; +using DevExpress.XtraTreeList.Nodes; +using PEIS.Base; using PEIS.Entity; using PEIS.Event; using PEIS.Presenter; @@ -29,7 +30,8 @@ namespace PEIS.View.Setting opMenuHdType.TstbKey.TextChanged += TstbKey_TextChanged; opMenuHdType.TsmiRefresh.Click += TsmiRefresh_Click; - gVHazardType.FocusedRowChanged += GVHazardType_FocusedRowChanged; + treeList1.FocusedNodeChanged += TreeList1_FocusedNodeChanged; + //gVHazardType.FocusedRowChanged += GVHazardType_FocusedRowChanged; //关联菜单 opMenuRelation.TsmiRefresh.Visible = true; opMenuRelation.TsmiAdd.Visible = false; @@ -54,6 +56,7 @@ namespace PEIS.View.Setting Shown += HazardTypeForm_Shown; } + private void HazardTypeForm_Shown(object sender, EventArgs e) { ThreadPool.QueueUserWorkItem(s => @@ -70,25 +73,25 @@ namespace PEIS.View.Setting public event EventHandler> GetHazardTypeItem; public void ShowHazardTypeItem(List hazardTypes) { - Invoke(new Action(() => { gCHazardType.DataSource = null; gCHazardType.DataSource = hazardTypes;})); + Invoke(new Action(() => { treeList1.DataSource = null; treeList1.DataSource = hazardTypes;})); } private void TstbKey_TextChanged(object sender, EventArgs e) { var textValue = (sender as ToolStripTextBox).Text; if (!string.IsNullOrEmpty(textValue)&&!textValue.Equals("输入条件查询")) { - gVHazardType.ApplyFindFilter(textValue); + treeList1.ApplyFindFilter(textValue); } else { - gVHazardType.ApplyFindFilter(""); + treeList1.ApplyFindFilter(""); } } private void TsmiRefresh_Click(object sender, EventArgs e) { LoadHazardType(); } - private void GVHazardType_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) + private void TreeList1_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e) { LoadHTypeFItem(); } @@ -112,13 +115,21 @@ namespace PEIS.View.Setting { int feeItemIndex = gVFeelItem.FocusedRowHandle; var feeItemRow = gVFeelItem.GetRow(feeItemIndex) as FeeItem; - int hazardTypeIndex=gVHazardType.FocusedRowHandle; - var hazardTypeRow = gVHazardType.GetRow(hazardTypeIndex) as DictHazardType; + //int hazardTypeIndex= treeList1.FocusedRowHandle; + //var hazardTypeRow = treeList1.GetRow(hazardTypeIndex) as DictHazardType; + var hazardTypeRow = treeList1.GetFocusedRow() as DictHazardType; if (hazardTypeRow == null) { Global.Msg("info", "没有接害类型"); return; } + TreeListNode selectedNode = treeList1.FocusedNode; + bool hasChildren = selectedNode.HasChildren; + if (hasChildren) + { + Global.Msg("info", "分类上不能添加项目"); + return; + } var HFeelItem= gCHFeelItem.DataSource as List; var alradlyData=HFeelItem?.Where(p => p.FID == feeItemRow.ID).FirstOrDefault(); if (alradlyData!=null) @@ -148,8 +159,7 @@ namespace PEIS.View.Setting } public void LoadHTypeFItem() { - int hazardTypeIndex = gVHazardType.FocusedRowHandle; - var hazardTypeRow = gVHazardType.GetRow(hazardTypeIndex) as DictHazardType; + var hazardTypeRow = treeList1.GetFocusedRow() as DictHazardType; if (hazardTypeRow!=null) { GetHTypeFItem?.Invoke(this, new Args() { Eid = hazardTypeRow.ID });