diff --git a/SGGL/FineUIPro.Web/Controls/ProjectWBSControl.ascx b/SGGL/FineUIPro.Web/Controls/ProjectWBSControl.ascx new file mode 100644 index 00000000..3abb5460 --- /dev/null +++ b/SGGL/FineUIPro.Web/Controls/ProjectWBSControl.ascx @@ -0,0 +1,24 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ProjectWBSControl.ascx.cs" Inherits="FineUIPro.Web.Controls.ProjectWBSControl" %> + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/Controls/ProjectWBSControl.ascx.cs b/SGGL/FineUIPro.Web/Controls/ProjectWBSControl.ascx.cs new file mode 100644 index 00000000..811c7fa3 --- /dev/null +++ b/SGGL/FineUIPro.Web/Controls/ProjectWBSControl.ascx.cs @@ -0,0 +1,212 @@ +using BLL; +using System; +using System.Data; +using System.Linq; + +namespace FineUIPro.Web.Controls +{ + public partial class ProjectWBSControl : System.Web.UI.UserControl + { + #region 自定义项 + /// + /// 主键 + /// + public string WorkPackageId + { + get + { + return (string)ViewState["WorkPackageId"]; + } + set + { + ViewState["WorkPackageId"] = value; + } + } + + /// + /// 项目ID + /// + public string ProjectId + { + get + { + return (string)ViewState["ProjectId"]; + } + set + { + ViewState["ProjectId"] = value; + } + } + #endregion + + #region 加载页面 + /// + /// 加载页面 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + ////加载树 + SetSubUnitProjectTree(this.trWBS); + } + } + #endregion + + /// + /// + /// + /// + /// + protected void trWBS_NodeCommand(object sender, TreeCommandEventArgs e) + { + if (this.trWBS != null && !string.IsNullOrEmpty(this.trWBS.SelectedNodeID)) + { + this.WorkPackageId = this.trWBS.SelectedNodeID; + if (this.change != null) + { + this.change(this, e); + } + } + } + + public delegate void userEvent(object sender, EventArgs arg); + + public event userEvent change; + + + #region 绑定分公司 单位-项目树 + /// + /// 绑定分公司 单位-项目树 + /// + /// + /// + public void SetSubUnitProjectTree(FineUIPro.Tree trWBS) + { + this.trWBS.Nodes.Clear(); + this.trWBS.ShowBorder = false; + this.trWBS.ShowHeader = false; + this.trWBS.EnableIcons = true; + this.trWBS.AutoScroll = true; + this.trWBS.EnableSingleClickExpand = true; + + TreeNode rootNode1 = new TreeNode(); + rootNode1.Text = "建筑工程"; + rootNode1.NodeID = "1"; + rootNode1.CommandName = "ProjectType"; + rootNode1.EnableExpandEvent = true; + rootNode1.EnableClickEvent = true; + this.trWBS.Nodes.Add(rootNode1); + TreeNode emptyNode = new TreeNode(); + emptyNode.Text = ""; + emptyNode.NodeID = ""; + rootNode1.Nodes.Add(emptyNode); + //this.GetNodes(rootNode1.Nodes, rootNode1.NodeID); + + TreeNode rootNode2 = new TreeNode(); + rootNode2.Text = "安装工程"; + rootNode2.NodeID = "2"; + rootNode2.CommandName = "ProjectType"; + rootNode2.EnableExpandEvent = true; + rootNode2.EnableClickEvent = true; + this.trWBS.Nodes.Add(rootNode2); + rootNode2.Nodes.Add(emptyNode); + } + #endregion + + #region 展开树 + /// + /// 展开树 + /// + /// + /// + protected void trWBS_NodeExpand(object sender, TreeNodeEventArgs e) + { + + e.Node.Nodes.Clear(); + if (e.Node.CommandName == "ProjectType") //展开工程类型 + { + var trUnitWork = from x in Funs.DB.WBS_UnitWork + where x.ProjectId == this.ProjectId && x.SuperUnitWork == null && x.ProjectType == e.Node.NodeID + select x; + trUnitWork = trUnitWork.OrderBy(x => x.UnitWorkCode); + if (trUnitWork.Count() > 0) + { + foreach (var trUnitWorkItem in trUnitWork) + { + TreeNode newNode = new TreeNode(); + newNode.Text = trUnitWorkItem.UnitWorkCode + "-" + trUnitWorkItem.UnitWorkName; + newNode.NodeID = trUnitWorkItem.UnitWorkId; + newNode.CommandName = "UnitWork"; + newNode.EnableExpandEvent = true; + newNode.EnableClickEvent = true; + e.Node.Nodes.Add(newNode); + if (BLL.WorkPackageService.GetWorkPackages1ByUnitWorkId(trUnitWorkItem.UnitWorkId.ToString()) != null) + { + TreeNode temp = new TreeNode(); + temp.Text = "temp"; + temp.NodeID = "temp"; + newNode.Nodes.Add(temp); + } + } + } + } + else if (e.Node.CommandName == "UnitWork") //展开单位工程节点 + { + var workPackages = from x in Funs.DB.WBS_WorkPackage where x.UnitWorkId == e.NodeID && x.SuperWorkPack == null && x.IsApprove == true orderby x.WorkPackageCode select x; + foreach (var workPackage in workPackages) + { + TreeNode newNode = new TreeNode(); + newNode.Text = workPackage.PackageContent; + newNode.NodeID = workPackage.WorkPackageId; + newNode.CommandName = "WorkPackage"; + newNode.EnableExpandEvent = true; + newNode.EnableClickEvent = true; + e.Node.Nodes.Add(newNode); + var childWorkPackages = from x in Funs.DB.WBS_WorkPackage where x.SuperWorkPackageId == workPackage.WorkPackageId && x.IsApprove == true select x; + if (childWorkPackages.Count() > 0) + { + TreeNode emptyNode = new TreeNode(); + emptyNode.Text = ""; + emptyNode.NodeID = ""; + newNode.Nodes.Add(emptyNode); + } + } + } + else if (e.Node.CommandName == "WorkPackage") //展开工作包节点 + { + var workPackages = from x in Funs.DB.WBS_WorkPackage where x.SuperWorkPackageId == e.Node.NodeID && x.IsApprove == true orderby x.WorkPackageCode select x; + if (workPackages.Count() > 0) //存在子单位工程 + { + foreach (var workPackage in workPackages) + { + TreeNode newNode = new TreeNode(); + newNode.Text = workPackage.PackageContent; + newNode.NodeID = workPackage.WorkPackageId; + newNode.CommandName = "WorkPackage"; + newNode.EnableExpandEvent = true; + newNode.EnableClickEvent = true; + e.Node.Nodes.Add(newNode); + var childWorkPackages = from x in Funs.DB.WBS_WorkPackage where x.SuperWorkPackageId == workPackage.WorkPackageId && x.IsApprove == true select x; + if (childWorkPackages.Count() > 0) + { + TreeNode emptyNode = new TreeNode(); + emptyNode.Text = ""; + emptyNode.NodeID = ""; + newNode.Nodes.Add(emptyNode); + } + } + } + } + } + #endregion + + protected void ckState_SelectedIndexChanged(object sender, EventArgs e) + { + ////加载树 + SetSubUnitProjectTree(this.trWBS); + } + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Controls/ProjectWBSControl.ascx.designer.cs b/SGGL/FineUIPro.Web/Controls/ProjectWBSControl.ascx.designer.cs new file mode 100644 index 00000000..a1fe0dab --- /dev/null +++ b/SGGL/FineUIPro.Web/Controls/ProjectWBSControl.ascx.designer.cs @@ -0,0 +1,53 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.Controls +{ + + + public partial class ProjectWBSControl + { + + /// + /// Panel2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel Panel2; + + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar1; + + /// + /// ckState 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.RadioButtonList ckState; + + /// + /// trWBS 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Tree trWBS; + } +} diff --git a/SGGL/FineUIPro.Web/DigData/ProjectWBSDW.aspx b/SGGL/FineUIPro.Web/DigData/ProjectWBSDW.aspx index c91856ad..f1ea5a14 100644 --- a/SGGL/FineUIPro.Web/DigData/ProjectWBSDW.aspx +++ b/SGGL/FineUIPro.Web/DigData/ProjectWBSDW.aspx @@ -1,6 +1,6 @@ <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ProjectWBSDW.aspx.cs" Inherits="FineUIPro.Web.DigData.ProjectWBSDW" %> -<%@ Register Src="~/Controls/WBSControl.ascx" TagName="WBSControl" TagPrefix="uc1" %> +<%@ Register Src="~/Controls/ProjectWBSControl.ascx" TagName="ProjectWBSControl" TagPrefix="uc1" %> @@ -19,7 +19,7 @@ - + diff --git a/SGGL/FineUIPro.Web/DigData/ProjectWBSDW.aspx.cs b/SGGL/FineUIPro.Web/DigData/ProjectWBSDW.aspx.cs index 1b81e1cb..582efea3 100644 --- a/SGGL/FineUIPro.Web/DigData/ProjectWBSDW.aspx.cs +++ b/SGGL/FineUIPro.Web/DigData/ProjectWBSDW.aspx.cs @@ -10,15 +10,15 @@ namespace FineUIPro.Web.DigData /// /// 主键 /// - public string WorkPackageCode + public string WorkPackageId { get { - return (string)ViewState["WorkPackageCode"]; + return (string)ViewState["WorkPackageId"]; } set { - ViewState["WorkPackageCode"] = value; + ViewState["WorkPackageId"] = value; } } @@ -46,15 +46,16 @@ namespace FineUIPro.Web.DigData { if (!IsPostBack) { + this.ProjectId = this.CurrUser.LoginProjectId; ////权限按钮方法 - this.ucTree.WorkPackageCode = this.WorkPackageCode; + // this.ucTree.WorkPackageCode = this.WorkPackageCode; + this.ucTree.ProjectId = this.ProjectId; } } protected void changeTree(object sender, EventArgs e) { - this.WorkPackageCode = this.ucTree.WorkPackageCode; - + this.WorkPackageId = this.ucTree.WorkPackageId; initControlItem(); } @@ -96,7 +97,7 @@ namespace FineUIPro.Web.DigData /// protected void initControlItem() { - var getControlItem = from x in Funs.DB.WBS_ControlItemInit where x.WorkPackageCode == this.WorkPackageCode select x; + var getControlItem = from x in Funs.DB.WBS_ControlItemAndCycle where x.WorkPackageId == this.WorkPackageId select x; cblControlItem.DataValueField = "ControlItemCode"; cblControlItem.DataTextField = "ControlItemContent"; cblControlItem.DataSource = getControlItem; diff --git a/SGGL/FineUIPro.Web/DigData/ProjectWBSDW.aspx.designer.cs b/SGGL/FineUIPro.Web/DigData/ProjectWBSDW.aspx.designer.cs index 4ced22b3..47fc58f7 100644 --- a/SGGL/FineUIPro.Web/DigData/ProjectWBSDW.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/DigData/ProjectWBSDW.aspx.designer.cs @@ -66,7 +66,7 @@ namespace FineUIPro.Web.DigData /// 自动生成的字段。 /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// - protected global::FineUIPro.Web.Controls.WBSControl ucTree; + protected global::FineUIPro.Web.Controls.ProjectWBSControl ucTree; /// /// panelCenterRegion 控件。 diff --git a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj index e271a9f8..a5cc182a 100644 --- a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj +++ b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj @@ -350,6 +350,7 @@ + @@ -6383,6 +6384,13 @@ ShowQRImage.aspx + + ProjectWBSControl.ascx + ASPXCodeBehind + + + ProjectWBSControl.ascx + WBSControl.ascx ASPXCodeBehind