接害类型配置加筛选复选框,筛选有项目的接害类型

dhzzyy
luoxingjian 5 months ago
parent 6a3f4a3d23
commit 33cc4a3325
  1. 1
      PEIS/Model/ReportModel.cs
  2. 5
      PEIS/Model/Setting/HazardTypeModel.cs
  3. 55
      PEIS/View/Setting/HazardTypeForm.Designer.cs
  4. 77
      PEIS/View/Setting/HazardTypeForm.cs
  5. 3
      PEIS/View/Setting/HazardTypeForm.resx

@ -60,6 +60,7 @@ namespace PEIS.Model
a.Contactor1,
a.Contactor2,
a.Address1,
a.JobStatus,
a.Tel1,
a.CardNo,
COALESCE(a.OrgName, a.Company) AS OrgName,

@ -17,6 +17,11 @@ namespace PEIS.Model.Setting
{
return DAOHelp.GetDataBySQL<FeeItem>("Select * From vi_FeeItem");
}
public List<DictHazardType> GetAlredlyHFItem()
{
var result = DAOHelp.GetDataBySQL<DictHazardType>($@"SELECT HID AS ID FROM Dict_HTypeFItem group by HID");
return result == null ? new List<DictHazardType>() : result;
}
public List<HTypeFItemInfo> GetHTypeFItem(Int64 hId)
{
return DAOHelp.GetDataBySQL<HTypeFItemInfo>($@"SELECT

@ -37,6 +37,8 @@
this.trSort = new DevExpress.XtraTreeList.Columns.TreeListColumn();
this.trStandard = new DevExpress.XtraTreeList.Columns.TreeListColumn();
this.trDescribe = new DevExpress.XtraTreeList.Columns.TreeListColumn();
this.panel5 = new System.Windows.Forms.Panel();
this.chBoxHaveItem = new System.Windows.Forms.CheckBox();
this.panel2 = new System.Windows.Forms.Panel();
this.opMenuHdType = new PEIS.View.UControl.OpMenu();
this.label2 = new System.Windows.Forms.Label();
@ -82,6 +84,7 @@
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.treeList1)).BeginInit();
this.panel5.SuspendLayout();
this.panel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.gCHFeelItem)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.gVHFeelItem)).BeginInit();
@ -103,6 +106,7 @@
//
this.splitContainer1.Panel1.AutoScroll = true;
this.splitContainer1.Panel1.Controls.Add(this.treeList1);
this.splitContainer1.Panel1.Controls.Add(this.panel5);
this.splitContainer1.Panel1.Controls.Add(this.panel2);
//
// splitContainer1.Panel2
@ -124,11 +128,11 @@
this.trStandard,
this.trDescribe});
this.treeList1.Dock = System.Windows.Forms.DockStyle.Fill;
this.treeList1.Location = new System.Drawing.Point(0, 46);
this.treeList1.Location = new System.Drawing.Point(0, 72);
this.treeList1.Name = "treeList1";
this.treeList1.OptionsMenu.EnableColumnMenu = false;
this.treeList1.OptionsView.AutoWidth = false;
this.treeList1.Size = new System.Drawing.Size(266, 697);
this.treeList1.Size = new System.Drawing.Size(266, 671);
this.treeList1.TabIndex = 1;
//
// trID
@ -225,6 +229,30 @@
this.trDescribe.VisibleIndex = 3;
this.trDescribe.Width = 200;
//
// panel5
//
this.panel5.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel5.Controls.Add(this.chBoxHaveItem);
this.panel5.Dock = System.Windows.Forms.DockStyle.Top;
this.panel5.Location = new System.Drawing.Point(0, 46);
this.panel5.Name = "panel5";
this.panel5.Size = new System.Drawing.Size(266, 26);
this.panel5.TabIndex = 2;
//
// chBoxHaveItem
//
this.chBoxHaveItem.AutoSize = true;
this.chBoxHaveItem.Dock = System.Windows.Forms.DockStyle.Left;
this.chBoxHaveItem.Location = new System.Drawing.Point(0, 0);
this.chBoxHaveItem.Margin = new System.Windows.Forms.Padding(0);
this.chBoxHaveItem.Name = "chBoxHaveItem";
this.chBoxHaveItem.Padding = new System.Windows.Forms.Padding(15, 0, 0, 0);
this.chBoxHaveItem.Size = new System.Drawing.Size(138, 24);
this.chBoxHaveItem.TabIndex = 0;
this.chBoxHaveItem.Text = "仅显示配置有项目";
this.chBoxHaveItem.UseVisualStyleBackColor = true;
this.chBoxHaveItem.CheckedChanged += new System.EventHandler(this.chBoxHaveItem_CheckedChanged);
//
// panel2
//
this.panel2.Controls.Add(this.opMenuHdType);
@ -289,10 +317,12 @@
this.gVHFeelItem.GridControl = this.gCHFeelItem;
this.gVHFeelItem.Name = "gVHFeelItem";
this.gVHFeelItem.OptionsMenu.EnableColumnMenu = false;
this.gVHFeelItem.OptionsView.ColumnAutoWidth = false;
this.gVHFeelItem.OptionsView.ShowGroupPanel = false;
this.gVHFeelItem.OptionsView.ShowPreviewRowLines = DevExpress.Utils.DefaultBoolean.False;
this.gVHFeelItem.OptionsView.ShowVerticalLines = DevExpress.Utils.DefaultBoolean.False;
this.gVHFeelItem.ViewCaption = "关联项目";
this.gVHFeelItem.OptionsView.ShowViewCaption = true;
this.gVHFeelItem.ViewCaption = "项目";
//
// gridColumn1
//
@ -351,7 +381,7 @@
this.FeeItemName2.OptionsFilter.AllowFilter = false;
this.FeeItemName2.Visible = true;
this.FeeItemName2.VisibleIndex = 0;
this.FeeItemName2.Width = 174;
this.FeeItemName2.Width = 150;
//
// FeeItemCode2
//
@ -365,6 +395,7 @@
this.FeeItemCode2.OptionsFilter.AllowFilter = false;
this.FeeItemCode2.Visible = true;
this.FeeItemCode2.VisibleIndex = 1;
this.FeeItemCode2.Width = 64;
//
// ItemClass2
//
@ -378,7 +409,7 @@
this.ItemClass2.OptionsFilter.AllowFilter = false;
this.ItemClass2.Visible = true;
this.ItemClass2.VisibleIndex = 2;
this.ItemClass2.Width = 46;
this.ItemClass2.Width = 60;
//
// SettlePrice2
//
@ -392,7 +423,7 @@
this.SettlePrice2.OptionsFilter.AllowFilter = false;
this.SettlePrice2.Visible = true;
this.SettlePrice2.VisibleIndex = 3;
this.SettlePrice2.Width = 46;
this.SettlePrice2.Width = 56;
//
// Price2
//
@ -406,7 +437,7 @@
this.Price2.OptionsFilter.AllowFilter = false;
this.Price2.Visible = true;
this.Price2.VisibleIndex = 4;
this.Price2.Width = 46;
this.Price2.Width = 40;
//
// Unit2
//
@ -420,7 +451,7 @@
this.Unit2.OptionsFilter.AllowFilter = false;
this.Unit2.Visible = true;
this.Unit2.VisibleIndex = 5;
this.Unit2.Width = 46;
this.Unit2.Width = 40;
//
// UnitName2
//
@ -434,7 +465,7 @@
this.UnitName2.OptionsFilter.AllowFilter = false;
this.UnitName2.Visible = true;
this.UnitName2.VisibleIndex = 6;
this.UnitName2.Width = 46;
this.UnitName2.Width = 40;
//
// DeptName2
//
@ -448,7 +479,7 @@
this.DeptName2.OptionsFilter.AllowFilter = false;
this.DeptName2.Visible = true;
this.DeptName2.VisibleIndex = 7;
this.DeptName2.Width = 63;
this.DeptName2.Width = 400;
//
// panel3
//
@ -754,6 +785,8 @@
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.treeList1)).EndInit();
this.panel5.ResumeLayout(false);
this.panel5.PerformLayout();
this.panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.gCHFeelItem)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.gVHFeelItem)).EndInit();
@ -818,5 +851,7 @@
private DevExpress.XtraTreeList.Columns.TreeListColumn trStandard;
private DevExpress.XtraTreeList.Columns.TreeListColumn trDescribe;
private FastReport.DevComponents.DotNetBar.ContextMenuBar contextMenuBar1;
private System.Windows.Forms.Panel panel5;
private System.Windows.Forms.CheckBox chBoxHaveItem;
}
}

@ -4,6 +4,7 @@ using DevExpress.XtraTreeList.Nodes;
using PEIS.Base;
using PEIS.Entity;
using PEIS.Event;
using PEIS.Model.Setting;
using PEIS.Presenter;
using PEIS.Utils;
using System;
@ -71,6 +72,7 @@ namespace PEIS.View.Setting
});
}
#region 接害类型
public bool haveItem_CheckBox = false;
private void TreeList1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
@ -120,8 +122,6 @@ namespace PEIS.View.Setting
LoadHazardType();
}
}
public void LoadHazardType()
{
GetHazardTypeItem?.Invoke(this,new Args<DictHazardType>());
@ -129,7 +129,70 @@ namespace PEIS.View.Setting
public event EventHandler<Args<DictHazardType>> GetHazardTypeItem;
public void ShowHazardTypeItem(List<DictHazardType> hazardTypes)
{
Invoke(new Action(() => { treeList1.DataSource = null; treeList1.DataSource = hazardTypes;}));
if (haveItem_CheckBox)
{
var alredlyHFItem = new HazardTypeModel().GetAlredlyHFItem();
if (alredlyHFItem.Count > 0 && hazardTypes != null && hazardTypes.Count > 0)
{
var pHazardType = new List<DictHazardType>();//父
GethazardTypeParent(hazardTypes, null, ref pHazardType);
var alredlyIds = alredlyHFItem.Select(p => p.ID).ToList();
var alredlyItems = hazardTypes.Where(p => alredlyIds.Contains(p.ID)).ToList();
var alredlyPid = hazardTypes.Select(p => p.ParentID).ToList();
var sHazardType = new List<DictHazardType>();
GethazardTypeParent2(pHazardType, alredlyItems, ref sHazardType);
sHazardType.AddRange(alredlyItems);
Invoke(new Action(() => { treeList1.DataSource = null; treeList1.DataSource = sHazardType; }));
}
else {
Invoke(new Action(() => { treeList1.DataSource = null;}));
}
}
else {
Invoke(new Action(() => { treeList1.DataSource = null; treeList1.DataSource = hazardTypes;}));
}
}
public void GethazardTypeParent2(List<DictHazardType> source, List<DictHazardType> dicts, ref List<DictHazardType> pList)
{
foreach (var item in dicts)
{
var p= source.Where(o => o.ID == item.ParentID).ToList();
if (p != null && p.Count > 0)
{
var one = p.FirstOrDefault();
if (pList.Where(s => s.ID == one.ID).FirstOrDefault() == null)
{
pList.Add(one);
}
GethazardTypeParent2(source, p, ref pList);
}
}
}
public void GethazardTypeParent(List<DictHazardType> source, Int64? id,ref List<DictHazardType> pList)
{
var nodes=source.Where(p => p.ParentID == id).ToList();
if (nodes.Count>0)
{
if (id == null)
{
pList.AddRange(nodes);
}
else {
var parent = source.Where(p => p.ID == id).FirstOrDefault();
if (pList.Where(p=>p.ID== parent.ID).FirstOrDefault()==null)
{
pList.Add(parent);
}
}
foreach (var item in nodes)
{
GethazardTypeParent(source, item.ID,ref pList);
}
}
}
private void TstbKey_TextChanged(object sender, EventArgs e)
{
@ -151,6 +214,12 @@ namespace PEIS.View.Setting
{
LoadHTypeFItem();
}
private void chBoxHaveItem_CheckedChanged(object sender, EventArgs e)
{
var checkBox = sender as CheckBox;
haveItem_CheckBox = checkBox.Checked;
LoadHazardType();
}
#endregion
#region 检查项目
//FeeItemModel
@ -266,5 +335,7 @@ namespace PEIS.View.Setting
{
return new HazardTypePresenter(this);
}
}
}

@ -117,7 +117,4 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="contextMenuBar1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>
Loading…
Cancel
Save