/// <summary> /// 保存节点绑定部门信息 /// </summary> /// <returns></returns> public string Dot2DotTreeDeptModel_SaveNodeDepts() { JsonResultInnerData jr = new JsonResultInnerData(); string nodeid = this.GetRequestVal("nodeid"); string data = this.GetRequestVal("data"); string partno = this.GetRequestVal("partno"); bool lastpart = false; int partidx = 0; int partcount = 0; int nid = 0; if (string.IsNullOrWhiteSpace(nodeid) || int.TryParse(nodeid, out nid) == false) { throw new Exception("参数nodeid不正确"); } if (string.IsNullOrWhiteSpace(data)) { data = ""; } BP.WF.Template.NodeDepts ndepts = new BP.WF.Template.NodeDepts(); string[] deptNos = data.Split("|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); //提交内容过长时,采用分段式提交 if (string.IsNullOrWhiteSpace(partno)) { ndepts.Delete(BP.WF.Template.NodeDeptAttr.FK_Node, nid); } else { string[] parts = partno.Split("/".ToCharArray()); if (parts.Length != 2) { throw new Exception("参数partno不正确"); } partidx = int.Parse(parts[0]); partcount = int.Parse(parts[1]); deptNos = data.Split("|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); if (partidx == 1) { ndepts.Delete(BP.WF.Template.NodeDeptAttr.FK_Node, nid); } lastpart = partidx == partcount; } DataTable dtDepts = DBAccess.RunSQLReturnTable("SELECT No FROM Port_Dept"); BP.WF.Template.NodeDept nemp = null; foreach (string deptNo in deptNos) { if (dtDepts.Select(string.Format("No='{0}'", deptNo)).Length + dtDepts.Select(string.Format("NO='{0}'", deptNo)).Length == 0) { continue; } nemp = new BP.WF.Template.NodeDept(); nemp.FK_Node = nid; nemp.FK_Dept = deptNo; nemp.Insert(); } if (string.IsNullOrWhiteSpace(partno)) { jr.Msg = "保存成功"; } else { jr.InnerData = new { lastpart, partidx, partcount }; if (lastpart) { jr.Msg = "保存成功"; } else { jr.Msg = string.Format("第{0}/{1}段保存成功", partidx, partcount); } } return(Newtonsoft.Json.JsonConvert.SerializeObject(jr)); }
/// <summary> /// 初始化节点属性列表. /// </summary> /// <returns></returns> public string NodeAttrs_Init() { var strFlowId = GetRequestVal("FK_Flow"); if (DataType.IsNullOrEmpty(strFlowId)) { return("err@参数错误!"); } Nodes nodes = new Nodes(); nodes.Retrieve("FK_Flow", strFlowId); //因直接使用nodes.ToJson()无法获取某些字段(e.g.HisFormTypeText,原因:Node没有自己的Attr类) //故此处手动创建前台所需的DataTable DataTable dt = new DataTable(); dt.Columns.Add("NodeID"); //节点ID dt.Columns.Add("Name"); //节点名称 dt.Columns.Add("HisFormType"); //表单方案 dt.Columns.Add("HisFormTypeText"); dt.Columns.Add("HisRunModel"); //节点类型 dt.Columns.Add("HisRunModelT"); dt.Columns.Add("HisDeliveryWay"); //接收方类型 dt.Columns.Add("HisDeliveryWayText"); dt.Columns.Add("HisDeliveryWayJsFnPara"); dt.Columns.Add("HisDeliveryWayCountLabel"); dt.Columns.Add("HisDeliveryWayCount"); //接收方Count dt.Columns.Add("HisCCRole"); //抄送人 dt.Columns.Add("HisCCRoleText"); dt.Columns.Add("HisFrmEventsCount"); //消息&事件Count dt.Columns.Add("HisFinishCondsCount"); //流程完成条件Count DataRow dr; foreach (Node node in nodes) { dr = dt.NewRow(); dr["NodeID"] = node.NodeID; dr["Name"] = node.Name; dr["HisFormType"] = node.HisFormType; dr["HisFormTypeText"] = node.HisFormTypeText; dr["HisRunModel"] = node.HisRunModel; dr["HisRunModelT"] = node.HisRunModelT; dr["HisDeliveryWay"] = node.HisDeliveryWay; dr["HisDeliveryWayText"] = node.HisDeliveryWayText; //接收方数量 var intHisDeliveryWayCount = 0; if (node.HisDeliveryWay == BP.WF.DeliveryWay.ByStation) { dr["HisDeliveryWayJsFnPara"] = "ByStation"; dr["HisDeliveryWayCountLabel"] = "岗位"; BP.WF.Template.NodeStations nss = new BP.WF.Template.NodeStations(); intHisDeliveryWayCount = nss.Retrieve(BP.WF.Template.NodeStationAttr.FK_Node, node.NodeID); } else if (node.HisDeliveryWay == BP.WF.DeliveryWay.ByDept) { dr["HisDeliveryWayJsFnPara"] = "ByDept"; dr["HisDeliveryWayCountLabel"] = "部门"; BP.WF.Template.NodeDepts nss = new BP.WF.Template.NodeDepts(); intHisDeliveryWayCount = nss.Retrieve(BP.WF.Template.NodeDeptAttr.FK_Node, node.NodeID); } else if (node.HisDeliveryWay == BP.WF.DeliveryWay.ByBindEmp) { dr["HisDeliveryWayJsFnPara"] = "ByDept"; dr["HisDeliveryWayCountLabel"] = "人员"; BP.WF.Template.NodeEmps nes = new BP.WF.Template.NodeEmps(); intHisDeliveryWayCount = nes.Retrieve(BP.WF.Template.NodeStationAttr.FK_Node, node.NodeID); } dr["HisDeliveryWayCount"] = intHisDeliveryWayCount; //抄送 dr["HisCCRole"] = node.HisCCRole; dr["HisCCRoleText"] = node.HisCCRoleText; //消息&事件Count BP.Sys.FrmEvents fes = new BP.Sys.FrmEvents(); dr["HisFrmEventsCount"] = fes.Retrieve(BP.Sys.FrmEventAttr.FK_MapData, "ND" + node.NodeID); //流程完成条件Count BP.WF.Template.Conds conds = new BP.WF.Template.Conds(BP.WF.Template.CondType.Flow, node.NodeID); dr["HisFinishCondsCount"] = conds.Count; dt.Rows.Add(dr); } return(BP.Tools.Json.ToJson(dt)); }
/// <summary> /// 获取指定部门下一级子部门列表 /// </summary> /// <returns></returns> public string Dot2DotTreeDeptModel_GetSubDepts() { string parentid = this.GetRequestVal("parentid"); string nid = this.GetRequestVal("nodeid"); if (string.IsNullOrWhiteSpace(parentid)) { throw new Exception("参数parentid不能为空"); } if (string.IsNullOrWhiteSpace(nid)) { throw new Exception("参数nodeid不能为空"); } EasyuiTreeNode node = null; List <EasyuiTreeNode> d = new List <EasyuiTreeNode>(); BP.WF.Template.NodeDepts sdepts = new BP.WF.Template.NodeDepts(); sdepts.Retrieve(BP.WF.Template.NodeDeptAttr.FK_Node, int.Parse(nid)); if (BP.WF.Glo.OSModel == OSModel.OneOne) { BP.Port.Dept parentDept = new BP.Port.Dept(parentid); BP.Port.Depts depts = new BP.Port.Depts(); depts.Retrieve(BP.Port.DeptAttr.ParentNo, parentid); //增加部门 foreach (BP.Port.Dept dept in depts) { node = new EasyuiTreeNode(); node.id = "DEPT_" + dept.No; node.text = dept.Name; node.iconCls = "icon-department"; node.@checked = sdepts.GetEntityByKey(BP.WF.Template.NodeDeptAttr.FK_Dept, dept.No) != null; node.attributes = new EasyuiTreeNodeAttributes(); node.attributes.No = dept.No; node.attributes.Name = dept.Name; node.attributes.ParentNo = parentDept.No; node.attributes.ParentName = parentDept.Name; node.attributes.TType = "DEPT"; node.attributes.Code = BP.Tools.chs2py.ConvertStr2Code(dept.Name); node.state = "closed"; node.children = new List <EasyuiTreeNode>(); node.children.Add(new EasyuiTreeNode()); node.children[0].text = "loading..."; d.Add(node); } } else { BP.GPM.Dept parentDept = new BP.GPM.Dept(parentid); BP.GPM.Depts depts = new BP.GPM.Depts(); depts.Retrieve(BP.GPM.DeptAttr.ParentNo, parentid, BP.GPM.DeptAttr.Idx); //增加部门 foreach (BP.GPM.Dept dept in depts) { node = new EasyuiTreeNode(); node.id = "DEPT_" + dept.No; node.text = dept.Name; node.iconCls = "icon-department"; node.@checked = sdepts.GetEntityByKey(BP.WF.Template.NodeDeptAttr.FK_Dept, dept.No) != null; node.attributes = new EasyuiTreeNodeAttributes(); node.attributes.No = dept.No; node.attributes.Name = dept.Name; node.attributes.ParentNo = parentDept.No; node.attributes.ParentName = parentDept.Name; node.attributes.TType = "DEPT"; node.attributes.Code = BP.Tools.chs2py.ConvertStr2Code(dept.Name); node.state = "closed"; node.children = new List <EasyuiTreeNode>(); node.children.Add(new EasyuiTreeNode()); node.children[0].text = "loading..."; d.Add(node); } } return(Newtonsoft.Json.JsonConvert.SerializeObject(d)); }