/// <summary> /// 表单方案 /// </summary> /// <returns></returns> public string BindFrms_Init() { //注册这个枚举,防止第一次运行出错. BP.Sys.SysEnums ses = new SysEnums("FrmEnableRole"); string text = ""; BP.WF.Node nd = new BP.WF.Node(this.FK_Node); //FrmNodeExt fns = new FrmNodeExt(this.FK_Flow, this.FK_Node); FrmNodes fns = new FrmNodes(this.FK_Flow, this.FK_Node); #region 如果没有ndFrm 就增加上. bool isHaveNDFrm = false; foreach (FrmNode fn in fns) { if (fn.FK_Frm == "ND" + this.FK_Node) { isHaveNDFrm = true; break; } } if (isHaveNDFrm == false) { FrmNode fn = new FrmNode(); fn.FK_Flow = this.FK_Flow; fn.FK_Frm = "ND" + this.FK_Node; fn.FK_Node = this.FK_Node; fn.FrmEnableRole = FrmEnableRole.Disable; //就是默认不启用. fn.FrmSln = 0; // fn.IsEdit = true; fn.IsEnableLoadData = true; fn.Insert(); fns.AddEntity(fn); } #endregion 如果没有ndFrm 就增加上. //组合这个实体才有外键信息. FrmNodeExts fnes = new FrmNodeExts(); foreach (FrmNode fn in fns) { MapData md = new MapData(); md.No = fn.FK_Frm; if (md.IsExits == false) { fn.Delete(); //说明该表单不存在了,就需要把这个删除掉. continue; } FrmNodeExt myen = new FrmNodeExt(fn.MyPK); fnes.AddEntity(myen); } //把json数据返回过去. return(fnes.ToJson()); }
public void BindList() { string text = ""; BP.WF.Node nd = new BP.WF.Node(this.FK_Node); FrmNodes fns = new FrmNodes(this.FK_Flow, this.FK_Node); #region 如果没有ndFrm 就增加上. bool isHaveNDFrm = false; foreach (FrmNode fn in fns) { if (fn.FK_Frm == "ND" + this.FK_Node) { isHaveNDFrm = true; break; } } if (isHaveNDFrm == false) { FrmNode fn = new FrmNode(); fn.FK_Flow = this.FK_Flow; fn.FK_Frm = "ND" + this.FK_Node; fn.FK_Node = this.FK_Node; fn.FrmEnableRole = FrmEnableRole.Disable; //就是默认不启用. fn.FrmSln = 0; // fn.IsEdit = true; fn.IsEnableLoadData = true; fn.Insert(); fns.AddEntity(fn); } #endregion 如果没有ndFrm 就增加上. string tfModel = SystemConfig.AppSettings["TreeFrmModel"]; this.Pub1.AddTable("width=100%"); this.Pub1.AddCaption("设置节点:(" + nd.Name + ")绑定表单"); this.Pub1.AddTR(); this.Pub1.AddTDTitle("Idx"); this.Pub1.AddTDTitle("表单编号"); this.Pub1.AddTDTitle("名称"); if (tfModel == "1") { this.Pub1.AddTDTitle("关键字段"); } this.Pub1.AddTDTitle("启用规则"); // this.Pub1.AddTDTitle("可编辑否?"); this.Pub1.AddTDTitle("可打印否?"); this.Pub1.AddTDTitle("是否启用<br>装载填充事件"); this.Pub1.AddTDTitle("权限控制<br>方案"); this.Pub1.AddTDTitle("表单元素<br>自定义设置"); this.Pub1.AddTDTitle("谁是主键?"); this.Pub1.AddTDTitle("文件模版"); if (nd.HisRunModel == RunModel.FL || nd.HisRunModel == RunModel.FHL) { this.Pub1.AddTDTitle("是否1变N"); //add by zhoupeng 2016.03.25 for hainan. } if (nd.HisRunModel == RunModel.SubThread) { this.Pub1.AddTDTitle("数据汇总"); //add by zhoupeng 2016.03.25 for hainan. } this.Pub1.AddTDTitle("顺序"); this.Pub1.AddTDTitle(""); this.Pub1.AddTDTitle(""); this.Pub1.AddTREnd(); int idx = 1; foreach (FrmNode fn in fns) { MapData md = new MapData(); md.No = fn.FK_Frm; if (md.RetrieveFromDBSources() == 0) { fn.Delete(); //说明该表单不存在了,就需要把这个删除掉. continue; } this.Pub1.AddTR(); this.Pub1.AddTDIdx(idx++); this.Pub1.AddTD(fn.FK_Frm); if (fn.FK_Frm == "ND" + this.FK_Node) { this.Pub1.AddTDB("<a href=\"javascript:WinOpen('../MapDef/CCForm/Frm.aspx?FK_MapData=" + md.No + "&FK_Flow=" + this.FK_Flow + "');\" >" + md.Name + "</a>"); } else { this.Pub1.AddTD("<a href=\"javascript:WinOpen('../MapDef/CCForm/Frm.aspx?FK_MapData=" + md.No + "&FK_Flow=" + this.FK_Flow + "');\" >" + md.Name + "</a>"); } DDL ddl = new DDL(); //获取当前独立表单中的所有字段 add by 海南 zqp if (tfModel == "1") { //获取它的字段集合 MapAttrs attrs = new MapAttrs(); attrs.Retrieve(MapAttrAttr.FK_MapData, md.No); MapAttrs attrNs = new MapAttrs(); //去掉一些基础字段 foreach (MapAttr attr in attrs) { switch (attr.KeyOfEn) { case "Title": case "FK_Emp": case "MyNum": case "FK_NY": case WorkAttr.Emps: case WorkAttr.OID: case StartWorkAttr.Rec: case StartWorkAttr.FID: continue; default: break; } attrNs.AddEntity(attr); } //添加到页面中 DDL myddl = new DDL(); myddl.ID = "DDL_Attr_" + md.No; myddl.BindEntities(attrNs, MapAttrAttr.KeyOfEn, MapAttrAttr.Name); myddl.SetSelectItem(fn.GuanJianZiDuan); this.Pub1.AddTD(myddl); } //为了扩充的需要,把下拉框的模式去掉了. //ddl = new DDL(); //ddl.ID = "DDL_FrmEnableRole_" + md.No; //ddl.Items.Add(new ListItem("始终启用", "0")); //ddl.Items.Add(new ListItem("有数据时启用", "1")); //ddl.Items.Add(new ListItem("有参数时启用", "2")); //ddl.Items.Add(new ListItem("按表单字段条件", "3")); //ddl.Items.Add(new ListItem("按SQL表达式", "4")); //ddl.SetSelectItem(fn.FrmEnableRoleInt); //设置权限控制方案. //this.Pub1.AddTD(ddl); this.Pub1.AddTD("<a href=\"javascript:WinOpen('./FlowFrm/FrmEnableRole.aspx?FK_Node=" + fn.FK_Node + "&FK_MapData=" + fn.FK_Frm + "')\">设置(" + fn.FrmEnableRoleText + ")</a>"); CheckBox cb = new CheckBox(); //cb.ID = "CB_IsEdit_" + md.No; //cb.Text = "可编辑否?"; //cb.Checked = fn.IsEdit; //this.Pub1.AddTD(cb); cb = new CheckBox(); cb.ID = "CB_IsPrint_" + md.No; cb.Text = "打印否?"; cb.Checked = fn.IsPrint; this.Pub1.AddTD(cb); cb = new CheckBox(); cb.ID = "CB_IsEnableLoadData_" + md.No; cb.Text = "启用否?"; cb.Checked = fn.IsEnableLoadData; this.Pub1.AddTD(cb); ddl = new DDL(); ddl.ID = "DDL_Sln_" + md.No; ddl.Items.Add(new ListItem("默认方案", "0")); ddl.Items.Add(new ListItem("自定义", this.FK_Node.ToString())); ddl.Items.Add(new ListItem("不可编辑", "1")); //让其不可编辑. ddl.SetSelectItem(fn.FrmSln); //设置权限控制方案. this.Pub1.AddTD(ddl); this.Pub1.AddTDBegin(); this.Pub1.Add("<a href=\"javascript:WinField('" + md.No + "','" + this.FK_Node + "','" + this.FK_Flow + "')\" >字段</a>"); this.Pub1.Add("-<a href=\"javascript:WinFJ('" + md.No + "','" + this.FK_Node + "','" + this.FK_Flow + "')\" >附件</a>"); this.Pub1.Add("-<a href=\"javascript:WinDtl('" + md.No + "','" + this.FK_Node + "','" + this.FK_Flow + "')\" >从表</a>"); if (md.HisFrmType == FrmType.ExcelFrm) { this.Pub1.Add("-<a href=\"javascript:ToolbarExcel('" + md.No + "','" + this.FK_Node + "','" + this.FK_Flow + "')\" >ToolbarExcel</a>"); } if (md.HisFrmType == FrmType.WordFrm) { this.Pub1.Add("-<a href=\"javascript:ToolbarWord('" + md.No + "','" + this.FK_Node + "','" + this.FK_Flow + "')\" >ToolbarWord</a>"); } this.Pub1.AddTDEnd(); ddl = new DDL(); ddl.ID = "DDL_WhoIsPK_" + md.No; ddl.BindSysEnum("WhoIsPK"); ddl.SetSelectItem((int)fn.WhoIsPK); //谁是主键?. this.Pub1.AddTD(ddl); if (md.HisFrmType == FrmType.ExcelFrm || md.HisFrmType == FrmType.WordFrm) { ddl = new DDL(); ddl.ID = "DDL_File_" + md.No; string[] files = System.IO.Directory.GetFiles(BP.Sys.SystemConfig.PathOfDataUser + "\\FrmOfficeTemplate\\", md.No + "*.xls"); foreach (string str in files) { //System.IO.FileInfo info=new System.IO.FileInfo( ddl.Items.Add(new ListItem(str.Substring(str.LastIndexOf(md.No)), str)); } this.Pub1.AddTD(ddl); } else { this.Pub1.AddTD("无效"); } if (nd.HisRunModel == RunModel.FL || nd.HisRunModel == RunModel.FHL) { cb = new CheckBox(); cb.ID = "CB_Is1ToN_" + md.No; cb.Text = "是否1变N?"; cb.Checked = fn.Is1ToN; this.Pub1.AddTD(cb);//add by zhoupeng 2016.03.25 for hainan. } if (nd.HisRunModel == RunModel.SubThread) { ddl = new DDL(); ddl.ID = "DDL_HuiZong_" + md.No; ddl.Items.Add(new ListItem("不汇总数据", "0")); BP.WF.Template.FrmNodes myfns = new FrmNodes(); myfns.Retrieve(FrmNodeAttr.FK_Flow, nd.FK_Flow); //组合这个字符串. string strs = ";" + fn.FK_Frm + ";"; foreach (BP.WF.Template.FrmNode myfrn in myfns) { if (strs.Contains(";" + myfrn.FK_Frm + ";") == true) { continue; } strs += ";" + myfrn.FK_Frm + ";"; //检查该frm 是否有dtl. MapDtls dtls = new MapDtls(myfrn.FK_Frm); if (dtls.Count == 0) { continue; } foreach (MapDtl dtl in dtls) { ddl.Items.Add(new ListItem("汇总到:" + myfrn.HisFrm.Name + "-" + dtl.Name, myfrn.HisFrm.No + "@" + dtl.No)); } } ddl.SetSelectItem(fn.HuiZong); //设置汇总.. this.Pub1.AddTD(ddl); } TextBox tb = new TextBox(); tb.ID = "TB_Idx_" + md.No; tb.Text = fn.Idx.ToString(); tb.Columns = 5; this.Pub1.AddTD(tb); this.Pub1.AddTDA("BindFrms.aspx?ShowType=EditPowerOrder&FK_Node=" + this.FK_Node + "&FK_Flow=" + this.FK_Flow + "&MyPK=" + fn.MyPK + "&DoType=Up", "上移"); this.Pub1.AddTDA("BindFrms.aspx?ShowType=EditPowerOrder&FK_Node=" + this.FK_Node + "&FK_Flow=" + this.FK_Flow + "&MyPK=" + fn.MyPK + "&DoType=Down", "下移"); this.Pub1.AddTREnd(); } this.Pub1.AddTableEnd(); text = "<input type=button onclick=\"javascript:BindFrms('" + this.FK_Node + "','" + this.FK_Flow + "');\" value='修改表单绑定' class=Btn />"; this.Pub1.Add(text); Button btn = new Button(); btn.ID = "Save"; btn.Text = "保存"; btn.CssClass = "Btn"; btn.Click += new EventHandler(btn_SavePowerOrders_Click); this.Pub1.Add(btn); text = "<input type=button onclick=\"javascript:window.close();\" value='关闭' class=Btn />"; this.Pub1.Add(text); }