/// <summary> /// 得到纬度的实体集合,通过属性。 /// </summary> /// <param name="attrOfD">纬度属性</param> /// <returns>EntitiesNoName</returns> protected EntitiesNoName GetEntitiesNoNameByAttrKey(string attrOfD) { Attr attr = this.HisEns.GetNewEntity.EnMap.GetAttrByKey(attrOfD); EntitiesNoName ens = (EntitiesNoName)attr.HisFKEns; ens.RetrieveAll(); return(ens); }
public Entities SetDGData(int pageIdx, bool isSearch) { // this.BPToolBar1.SaveSearchState(this.EnsName, this.Key); this.ToolBar1.SaveSearchState(this.EnsName, this.Key); Entities ens = this.HisEns; Entity en = ens.GetNewEntity; QueryObject qo = new QueryObject(ens); qo = this.ToolBar1.GetnQueryObject(ens, en); string url = this.Request.RawUrl; if (url.IndexOf("PageIdx") != -1) { url = url.Substring(0, url.IndexOf("PageIdx") - 1); } this.UCSys2.Clear(); int maxPageNum = 0; try { maxPageNum = this.UCSys2.BindPageIdx(qo.GetCount(), SystemConfig.PageSize, pageIdx, "Batch.aspx?EnsName=" + this.EnsName); } catch (Exception ex) { en.CheckPhysicsTable(); throw ex; } if (isSearch) { return(null); } if (maxPageNum > 1) { this.UCSys2.Add("翻页键:← → PageUp PageDown"); } qo.DoQuery(en.PK, SystemConfig.PageSize, pageIdx); this.UCSys1.DataPanelDtlCheckBox(ens); //if (this.IsS == false) // this.UCSys3.Add("[<a href='Batch.aspx?EnsName=" + this.EnsName + "&PageIdx=" + this.PageIdx + "&IsS=1'>选择全部</a>] "); //else // this.UCSys3.Add("[<a href='Batch.aspx?EnsName=" + this.EnsName + "&PageIdx=" + this.PageIdx + "&IsS=0'>全不选</a>] "); RefMethods rms = en.EnMap.HisRefMethods; foreach (RefMethod rm in rms) { if (rm.IsCanBatch == false) { continue; } Button btn = new Button(); btn.ID = "Btn_" + rm.Index; btn.Text = rm.Title; btn.CssClass = "Btn"; if (rm.Warning == null) { btn.Attributes["onclick"] = " return confirm('您确定要执行吗?');"; } else { btn.Attributes["onclick"] = " return confirm('" + rm.Warning + "');"; } this.UCSys3.Add(btn); btn.Click += new EventHandler(btn_Click); } UAC uac = en.HisUAC; if (uac.IsDelete) { Button btn = new Button(); btn.ID = "Btn_Del"; btn.CssClass = "Btn"; btn.Text = "删除"; btn.Attributes["onclick"] = " return confirm('您确认吗?');"; btn.Attributes["class"] = "Button"; this.UCSys3.Add(btn); btn.Click += new EventHandler(btn_Click); } MoveToShowWay showWay = (MoveToShowWay)ens.GetEnsAppCfgByKeyInt("MoveToShowWay"); // 执行移动. if (showWay != MoveToShowWay.None) { string MoveTo = en.GetCfgValStr("MoveTo"); if (en.EnMap.Attrs.Contains(MoveTo) == false) { this.Alert("Moveto 字段设置错误,实体不包含字段:" + MoveTo); return(null); } Attr attr = en.EnMap.GetAttrByKey(MoveTo); if (showWay == MoveToShowWay.DDL) { Button btnM = new Button(); btnM.ID = "Btn_Move"; btnM.CssClass = "Btn"; btnM.Text = "移动到"; btnM.Attributes["onclick"] = "return confirm('您确实要移动吗?');"; this.UCSys3.Add(" "); this.UCSys3.Add(btnM); btnM.Click += new EventHandler(btn_Move_Click); DDL ddl = new DDL(); ddl.ID = "DDL_MoveTo1"; if (attr.IsEnum) { ddl.BindSysEnum(attr.Key); ddl.Items.Insert(0, new ListItem("选择" + "=>" + attr.Desc, "all")); } else { EntitiesNoName ens1 = attr.HisFKEns as EntitiesNoName; ens1.RetrieveAll(); ddl.BindEntities(ens1); ddl.Items.Insert(0, new ListItem("选择" + "=>" + attr.Desc, "all")); } this.UCSys3.Add(ddl); } if (showWay == MoveToShowWay.Panel) { if (attr.IsEnum) { SysEnums ses = new SysEnums(attr.Key); foreach (SysEnum se in ses) { Button btn = new Button(); btn.CssClass = "Btn"; btn.ID = "Btn_Move_" + se.IntKey; btn.Text = "设置" + ":" + se.Lab; btn.Attributes["onclick"] = "return confirm('您确实要执行设置[" + se.Lab + "]吗?');"; btn.Click += new EventHandler(btn_Move_Click); this.UCSys3.Add(btn); this.UCSys3.Add(" "); } } else { EntitiesNoName ens1 = attr.HisFKEns as EntitiesNoName; ens1.RetrieveAll(); foreach (EntityNoName en1 in ens1) { Button btn = new Button(); btn.CssClass = "Btn"; btn.ID = "Btn_Move_" + en1.No; btn.Text = "设置:" + en1.Name; btn.Attributes["onclick"] = "return confirm('您确实要设置[" + en1.Name + "]吗?');"; btn.Click += new EventHandler(btn_Move_Click); this.UCSys3.Add(btn); this.UCSys3.Add(" "); } } } } int ToPageIdx = this.PageIdx + 1; int PPageIdx = this.PageIdx - 1; this.UCSys3.Add("<SCRIPT language=javascript>"); this.UCSys3.Add("\t\n document.onkeydown = chang_page;"); this.UCSys3.Add("\t\n function chang_page() {"); // this.UCSys3.Add("\t\n alert(event.keyCode); "); if (this.PageIdx == 1) { this.UCSys3.Add("\t\n if (event.keyCode == 37 || event.keyCode == 33) alert('已经是第一页');"); } else { this.UCSys3.Add("\t\n if (event.keyCode == 37 || event.keyCode == 38 || event.keyCode == 33) "); this.UCSys3.Add("\t\n location='Batch.aspx?EnsName=" + this.EnsName + "&PageIdx=" + PPageIdx + "';"); } if (this.PageIdx == maxPageNum) { this.UCSys3.Add("\t\n if (event.keyCode == 39 || event.keyCode == 40 || event.keyCode == 34) alert('已经是最后一页');"); } else { this.UCSys3.Add("\t\n if (event.keyCode == 39 || event.keyCode == 40 || event.keyCode == 34) "); this.UCSys3.Add("\t\n location='Batch.aspx?EnsName=" + this.EnsName + "&PageIdx=" + ToPageIdx + "';"); } this.UCSys3.Add("\t\n } "); this.UCSys3.Add("</SCRIPT>"); return(ens); }
protected void Page_Load(object sender, EventArgs e) { this.Title = "从表设计"; MapData.IsEditDtlModel = true; MapData md = new MapData(this.FK_MapData); MapDtl dtl = new MapDtl(this.FK_MapDtl); if (dtl.IsView == false) { return; } MapAttrs attrs = new MapAttrs(this.MyPK); MapAttrs attrs2 = new MapAttrs(); MapExts mes = new MapExts(this.MyPK); string LinkFields = ","; if (mes.Count != 0) { foreach (MapExt me in mes) { switch (me.ExtType) { case MapExtXmlList.Link: LinkFields += me.AttrOfOper + ","; break; default: break; } } this.Page.RegisterClientScriptBlock("s8", "<script language='JavaScript' src='../Scripts/jquery-1.4.1.min.js' ></script>"); this.Page.RegisterClientScriptBlock("b8", "<script language='JavaScript' src='../CCForm/MapExt.js' ></script>"); this.Page.RegisterClientScriptBlock("dCd", "<script language='JavaScript' src='/DataUser/JSLibData/" + this.FK_MapDtl + ".js' ></script>"); this.Pub1.Add("<div id='divinfo' style='width: 155px; position: absolute; color: Lime; display: none;cursor: pointer;align:left'></div>"); } string t = DateTime.Now.ToString("MM-dd-hh:mm:ss"); if (attrs.Count == 0) { dtl.IntMapAttrs(); } this.Title = md.Name + " - 设计明细"; this.Pub1.AddTable("class='Table' border='0' ID='Tab' cellspacing='0' cellpadding='0' "); // this.Pub1.AddCaptionLeftTX("<a href='MapDef.aspx?MyPK=" + md.No + "' ><img src='../Img/Btn/Back.gif' border=0/>" + this.ToE("Back","返回") + ":" + md.Name + "</a> - <img src='../Img/Btn/Table.gif' border=0/>" + dtl.Name + " - <a href=\"javascript:AddF('" + this.MyPK + "');\" ><img src='../Img/Btn/New.gif' border=0/>" + "新建字段" + "</a> "); this.Pub1.Add(dtl.MTR); #region 输出标题. this.Pub1.AddTR(); if (dtl.IsShowIdx) { this.Pub1.AddTDTitle(""); } foreach (MapAttr attr in attrs) { if (attr.UIVisible == false) { continue; } this.Pub1.Add("<TH style='width:" + attr.UIWidthInt + "px'>"); this.Pub1.Add("<a href=\"javascript:Up('" + this.MyPK + "','" + attr.MyPK + "','" + t + "');\" ><img src='../Img/Btn/Left.gif' class=Arrow alt='向左移动' border=0/></a>"); if (attr.HisEditType == EditType.UnDel || attr.HisEditType == EditType.Edit) { switch (attr.LGType) { case FieldTypeS.Normal: this.Pub1.Add("<a href=\"javascript:Edit('" + this.MyPK + "','" + attr.MyPK + "','" + attr.MyDataType + "');\" alt='" + attr.KeyOfEn + "'>" + attr.Name + "</a>"); break; case FieldTypeS.Enum: this.Pub1.Add("<a href=\"javascript:EditEnum('" + this.MyPK + "','" + attr.MyPK + "');\" alt='" + attr.KeyOfEn + "' >" + attr.Name + "</a>"); break; case FieldTypeS.FK: this.Pub1.Add("<a href=\"javascript:EditTable('" + this.MyPK + "','" + attr.MyPK + "','" + attr.MyDataTypeS + "');\" alt='" + attr.KeyOfEn + "'>" + attr.Name + "</a>"); break; default: break; } } else { this.Pub1.Add(attr.Name); } // this.Pub1.Add("[<a href=\"javascript:Insert('" + this.MyPK + "','" + attr.Idx + "');\" ><img src='../Img/Btn/Insert.gif' border=0/>插入</a>]"); this.Pub1.Add("<a href=\"javascript:Down('" + this.MyPK + "','" + attr.MyPK + "','" + t + "');\" ><img src='../Img/Btn/Right.gif' class=Arrow alt='向右移动' border=0/></a>"); this.Pub1.Add("</TH>"); } if (dtl.IsEnableAthM) { this.Pub1.AddTDTitle("<a href=\"javascript:Attachment('" + dtl.No + "');\"><img src='./../Img/set.gif' border=0 width='16px' /></a>"); } if (dtl.IsEnableM2M) { this.Pub1.AddTDTitle("<a href=\"javascript:MapM2M('" + dtl.No + "');\"><img src='./../Img/set.gif' border=0 width='16px' /></a>"); } if (dtl.IsEnableM2MM) { this.Pub1.AddTDTitle("<a href=\"javascript:window.showModalDialog('MapM2MM.aspx?NoOfObj=M2MM&FK_MapData=" + this.FK_MapDtl + "','m2m','dialogHeight: 500px; dialogWidth: 600px;center: yes; help: no')\"><img src='./../Img/set.gif' border=0 width='16px' /></a>"); } if (dtl.IsEnableLink) { this.Pub1.AddTDTitle(dtl.LinkLabel); } //Pub1.AddTDTitle(" "); this.Pub1.AddTREnd(); #endregion 输出标题. #region 输出行. for (int i = 1; i <= dtl.RowsOfList; i++) { this.Pub1.AddTR(); if (dtl.IsShowIdx) { this.Pub1.AddTDIdx(i); } foreach (MapAttr attr in attrs) { if (attr.UIVisible == false) { continue; } #region 是否输出超连接. if (attr.UIIsEnable == false && LinkFields.Contains("," + attr.KeyOfEn + ",")) { MapExt meLink = mes.GetEntityByKey(MapExtAttr.ExtType, MapExtXmlList.Link) as MapExt; string url = meLink.Tag; if (url.Contains("?") == false) { url = url + "?a3=2"; } url = url + "&WebUserNo=" + WebUser.No + "&SID=" + WebUser.SID + "&EnName=" + this.FK_MapDtl; if (url.Contains("@AppPath")) { url = url.Replace("@AppPath", "http://" + this.Request.Url.Host + this.Request.ApplicationPath); } if (url.Contains("@")) { if (attrs2.Count == 0) { attrs2 = new MapAttrs(this.FK_MapDtl); } foreach (MapAttr item in attrs2) { url = url.Replace("@" + item.KeyOfEn, item.DefVal); if (url.Contains("@") == false) { break; } } } this.Pub1.AddTD("<a href='" + url + "' target='" + meLink.Tag1 + "' >" + attr.DefVal + "</a>"); continue; } #endregion 是否输出超连接. #region 输出字段. switch (attr.LGType) { case FieldTypeS.Normal: if (attr.MyDataType == BP.DA.DataType.AppBoolean) { CheckBox cb = new CheckBox(); cb.Checked = attr.DefValOfBool; cb.Enabled = attr.UIIsEnable; cb.Text = attr.Name; this.Pub1.AddTD(cb); break; } TextBox tb = new TextBox(); tb.ID = "TB_" + attr.KeyOfEn + "_" + i; tb.Text = attr.DefVal; tb.ReadOnly = !attr.UIIsEnable; this.Pub1.AddTD(tb); switch (attr.MyDataType) { case BP.DA.DataType.AppString: tb.Attributes["style"] = "width:" + attr.UIWidth + "px;border: none;"; if (attr.UIHeight > 25) { tb.TextMode = TextBoxMode.MultiLine; tb.Attributes["Height"] = attr.UIHeight + "px"; tb.Rows = attr.UIHeightInt / 25; } break; case BP.DA.DataType.AppDateTime: tb.Attributes["style"] = "width:" + attr.UIWidth + "px;border: none;"; if (attr.UIIsEnable) { tb.Attributes["onfocus"] = "WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'});"; //tb.Attributes["class"] = "TBcalendar"; } break; case BP.DA.DataType.AppDate: tb.Attributes["style"] = "width:" + attr.UIWidth + "px;border: none;"; if (attr.UIIsEnable) { tb.Attributes["onfocus"] = "WdatePicker();"; // tb.Attributes["class"] = "TBcalendar"; } break; default: tb.Attributes["style"] = "width:" + attr.UIWidth + "px;border: none;"; if (tb.ReadOnly == false) { // OnKeyPress="javascript:return VirtyNum(this);" //tb.Attributes["OnKeyDown"] = "javascript:return VirtyNum(this);"; if (attr.MyDataType == DataType.AppInt) { tb.Attributes["OnKeyDown"] = "javascript:return VirtyInt(this);"; } else { tb.Attributes["OnKeyDown"] = "javascript:return VirtyNum(this);"; } tb.Attributes["onkeyup"] += "javascript:C" + i + "();C" + attr.KeyOfEn + "();"; tb.Attributes["class"] = "TBNum"; } else { // tb.Attributes["onpropertychange"] += "C" + attr.KeyOfEn + "();"; tb.Attributes["class"] = "TBNumReadonly"; } break; } break; case FieldTypeS.Enum: DDL ddl = new DDL(); ddl.ID = "DDL_" + attr.KeyOfEn + "_" + i; try { ddl.BindSysEnum(attr.KeyOfEn); ddl.SetSelectItem(attr.DefVal); } catch (Exception ex) { BP.Sys.PubClass.Alert(ex.Message); } ddl.Enabled = attr.UIIsEnable; this.Pub1.AddTDCenter(ddl); break; case FieldTypeS.FK: DDL ddl1 = new DDL(); ddl1.ID = "DDL_" + attr.KeyOfEn + "_" + i; try { EntitiesNoName ens = attr.HisEntitiesNoName; ens.RetrieveAll(); ddl1.BindEntities(ens); if (ddl1.SetSelectItem(attr.DefVal) == false) { ddl1.Items.Insert(0, new ListItem("请选择", attr.DefVal)); ddl1.SelectedIndex = 0; } } catch { } ddl1.Enabled = attr.UIIsEnable; this.Pub1.AddTDCenter(ddl1); break; default: break; } #endregion s输出字段. } #region 输出附件,m2m if (dtl.IsEnableAthM) { this.Pub1.AddTD("<a href=\"javascript:EnableAthM('" + this.FK_MapDtl + "');\" ><img src='../Img/AttachmentM.png' border=0 width='16px' /></a>"); } if (dtl.IsEnableM2M) { this.Pub1.AddTD("<a href=\"javascript:window.showModalDialog('../CCForm/M2M.aspx?NoOfObj=M2M&IsTest=1&OID=0&FK_MapData=" + this.FK_MapDtl + "','m2m','dialogHeight: 500px; dialogWidth: 600px;center: yes; help: no')\"><img src='./../Img/M2M.png' border=0 width='16px' /></a>"); } if (dtl.IsEnableM2MM) { this.Pub1.AddTD("<a href=\"javascript:window.showModalDialog('../CCForm/M2MM.aspx?NoOfObj=M2MM&IsTest=1&OID=0&FK_MapData=" + this.FK_MapDtl + "','m2m','dialogHeight: 500px; dialogWidth: 600px;center: yes; help: no')\"><img src='./../Img/M2MM.png' border=0 width='16px' /></a>"); } if (dtl.IsEnableLink) { this.Pub1.AddTD("<a href='" + dtl.LinkUrl + "' target='" + dtl.LinkTarget + "' >" + dtl.LinkLabel + "</a>"); } #endregion 输出附件,m2m //Pub1.AddTD(" "); this.Pub1.AddTREnd(); } #endregion 输出行. #region 合计. if (dtl.IsShowSum) { this.Pub1.AddTRSum(); if (dtl.IsShowIdx) { this.Pub1.AddTD("合计"); } foreach (MapAttr attr in attrs) { if (attr.UIVisible == false) { continue; } if (attr.IsNum && attr.LGType == FieldTypeS.Normal) { TB tb = new TB(); tb.ID = "TB_" + attr.KeyOfEn; tb.Text = attr.DefVal; tb.ShowType = attr.HisTBType; tb.ReadOnly = true; tb.Font.Bold = true; tb.BackColor = System.Drawing.Color.FromName("#FFFFFF"); tb.Attributes["class"] = "TBNumReadonly"; this.Pub1.AddTD(tb); } else { this.Pub1.AddTD(); } } if (dtl.IsEnableAthM) { this.Pub1.AddTD(); } if (dtl.IsEnableM2M) { this.Pub1.AddTD(); } if (dtl.IsEnableM2MM) { this.Pub1.AddTD(); } if (dtl.IsEnableLink) { this.Pub1.AddTD(); } // Pub1.AddTD(" "); this.Pub1.AddTREnd(); } this.Pub1.AddTableEnd(); #endregion 合计. #region 处理设计时自动填充从表. if (this.Key != null) { MapExt me = new MapExt(this.FK_MapExt); string[] strs = me.Tag1.Split('$'); foreach (string str in strs) { if (str.Contains(this.FK_MapDtl) == false) { continue; } string[] ss = str.Split(':'); string sql = ss[1]; sql = sql.Replace("@Key", this.Key); sql = sql.Replace("@key", this.Key); sql = sql.Replace("@val", this.Key); sql = sql.Replace("@Val", this.Key); DataTable dt = DBAccess.RunSQLReturnTable(sql); int idx = 0; foreach (DataRow dr in dt.Rows) { idx++; foreach (DataColumn dc in dt.Columns) { string val = dr[dc.ColumnName].ToString(); try { this.Pub1.GetTextBoxByID("TB_" + dc.ColumnName + "_" + idx).Text = val; } catch { } try { this.Pub1.GetDDLByID("DDL_" + dc.ColumnName + "_" + idx).SetSelectItem(val); } catch { } } } } } #endregion 处理设计时自动填充从表. #region 处理拓展属性. for (int i = 1; i <= dtl.RowsOfList; i++) { foreach (MapExt me in mes) { switch (me.ExtType) { case MapExtXmlList.DDLFullCtrl: // 自动填充. DDL ddlOper = this.Pub1.GetDDLByID("DDL_" + me.AttrOfOper); if (ddlOper == null) { continue; } ddlOper.Attributes["onchange"] = "DDLFullCtrl(this.value,\'" + ddlOper.ClientID + "\', \'" + me.MyPK + "\')"; break; case MapExtXmlList.ActiveDDL: DDL ddlPerant = this.Pub1.GetDDLByID("DDL_" + me.AttrOfOper + "_" + i); if (ddlPerant == null) { me.Delete(); continue; } DDL ddlChild = this.Pub1.GetDDLByID("DDL_" + me.AttrsOfActive + "_" + i); if (ddlChild == null) { me.Delete(); continue; } ddlPerant.Attributes["onchange"] = "DDLAnsc(this.value,\'" + ddlChild.ClientID + "\', \'" + me.MyPK + "\')"; if (ddlPerant.Items.Count == 0) { continue; } string val = ddlPerant.SelectedItemStringVal; string valC1 = ddlChild.SelectedItemStringVal; DataTable dt = DBAccess.RunSQLReturnTable(me.Doc.Replace("@Key", val)); ddlChild.Items.Clear(); foreach (DataRow dr in dt.Rows) { ddlChild.Items.Add(new ListItem(dr[1].ToString(), dr[0].ToString())); } ddlChild.SetSelectItem(valC1); break; case MapExtXmlList.AutoFullDLL: //自动填充下拉框的范围. DDL ddlFull = this.Pub1.GetDDLByID("DDL_" + me.AttrOfOper + "_" + i); if (ddlFull == null) { me.Delete(); continue; } string valOld = ddlFull.SelectedItemStringVal; ddlFull.Items.Clear(); string fullSQL = me.Doc.Replace("@WebUser.No", WebUser.No); fullSQL = fullSQL.Replace("@WebUser.FK_Dept", WebUser.FK_Dept); fullSQL = fullSQL.Replace("@WebUser.Name", WebUser.Name); if (fullSQL.Contains("@")) { //Attrs attrsFull = mydtl.EnMap.Attrs; //foreach (Attr attr in attrsFull) //{ // if (fullSQL.Contains("@") == false) // break; // fullSQL = fullSQL.Replace("@" + attr.Key, mydtl.GetValStrByKey(attr.Key)); //} } ddlFull.Bind(DBAccess.RunSQLReturnTable(fullSQL), "No", "Name"); ddlFull.SetSelectItem(valOld); break; case MapExtXmlList.TBFullCtrl: // 自动填充. TextBox tbAuto = this.Pub1.GetTextBoxByID("TB_" + me.AttrOfOper + "_" + i); if (tbAuto == null) { me.Delete(); continue; } tbAuto.Attributes["onkeyup"] = "DoAnscToFillDiv(this,this.value,\'" + tbAuto.ClientID + "\', \'" + me.MyPK + "\');"; tbAuto.Attributes["AUTOCOMPLETE"] = "OFF"; if (me.Tag != "") { /* 处理下拉框的选择范围的问题 */ string[] strs = me.Tag.Split('$'); foreach (string str in strs) { string[] myCtl = str.Split(':'); string ctlID = myCtl[0]; DDL ddlC = this.Pub1.GetDDLByID("DDL_" + ctlID + "_" + i); if (ddlC == null) { continue; } string sql = myCtl[1].Replace("~", "'"); sql = sql.Replace("@WebUser.No", WebUser.No); sql = sql.Replace("@WebUser.Name", WebUser.Name); sql = sql.Replace("@WebUser.FK_Dept", WebUser.FK_Dept); sql = sql.Replace("@Key", tbAuto.Text.Trim()); dt = DBAccess.RunSQLReturnTable(sql); string valC = ddlC.SelectedItemStringVal; ddlC.Items.Clear(); foreach (DataRow dr in dt.Rows) { ddlC.Items.Add(new ListItem(dr[1].ToString(), dr[0].ToString())); } ddlC.SetSelectItem(valC); } } // tbAuto.Attributes["onkeyup"] = "DoAnscToFillDiv(this,this.value);"; // tbAuto.Attributes["onkeyup"] = "DoAnscToFillDiv(this,this.value,\'" + tbAuto.ClientID + "\', \'" + me.MyPK + "\');"; break; case MapExtXmlList.InputCheck: TextBox tbCheck = this.Pub1.GetTextBoxByID("TB_" + me.AttrOfOper + "_" + i); if (tbCheck != null) { tbCheck.Attributes[me.Tag2] += " rowPK=" + i + ";" + me.Tag1 + "(this);"; } else { me.Delete(); } break; case MapExtXmlList.PopVal: //弹出窗. TextBox tb = this.Pub1.GetTextBoxByID("TB_" + me.AttrOfOper + "_" + i); if (tb == null) { continue; } //tb.Attributes["ondblclick"] = "return ReturnValCCFormPopVal(this,'" + me.MyPK + "','33');"; tb.Attributes["ondblclick"] = "ReturnValCCFormPopVal(this,'" + me.MyPK + "','33');"; // throw new Exception("ssssrrrss"); break; default: break; } } } #endregion 处理拓展属性. #region 输出自动计算公式 this.Pub1.Add("\n <script language='JavaScript'>"); MapExts exts = new MapExts(dtl.No); foreach (MapExt ext in exts) { if (ext.ExtType != MapExtXmlList.AutoFull) { continue; } for (int i = 1; i <= dtl.RowsOfList; i++) { string top = "\n function C" + i + "() { \n "; string script = ""; foreach (MapAttr attr in attrs) { if (attr.UIVisible == false) { continue; } if (attr.IsNum == false) { continue; } if (attr.LGType != FieldTypeS.Normal) { continue; } if (ext.Tag == "1" && ext.Doc != "") { script += this.GenerAutoFull(i.ToString(), attrs, ext); } } string end = " \n } "; this.Pub1.Add(top + script + end); } } this.Pub1.Add("\n</script>"); // 输出合计算计公式 foreach (MapAttr attr in attrs) { if (attr.UIVisible == false) { continue; } if (attr.LGType != FieldTypeS.Normal) { continue; } if (attr.IsNum == false) { continue; } if (attr.MyDataType == DataType.AppBoolean) { continue; } string top = "\n<script language='JavaScript'> function C" + attr.KeyOfEn + "() { \n "; string end = "\n } </script>"; this.Pub1.Add(top + this.GenerSum(attr, dtl) + " ; \t\n" + end); } #endregion 输出自动计算公式 }
protected void Page_Load(object sender, EventArgs e) { if (this.Request.QueryString["FK_Node"] == null) { // 如果没有接收到节点ID参数,就绑定当前人员可以执行批量审核的待办工作. int num = this.BindNodeList(); return; } BP.WF.Node nd = new BP.WF.Node(this.FK_Node); Flow fl = nd.HisFlow; string sql = ""; if (nd.HisRunModel == RunModel.SubThread) { sql = "SELECT a.*, b.Starter,b.ADT,b.WorkID FROM " + fl.PTable + " a , WF_EmpWorks b WHERE a.OID=B.FID AND b.WFState Not IN (7) AND b.FK_Node=" + nd.NodeID + " AND b.FK_Emp='" + WebUser.No + "'"; } else { sql = "SELECT a.*, b.Starter,b.ADT,b.WorkID FROM " + fl.PTable + " a , WF_EmpWorks b WHERE a.OID=B.WorkID AND b.WFState Not IN (7) AND b.FK_Node=" + nd.NodeID + " AND b.FK_Emp='" + WebUser.No + "'"; } // string sql = "SELECT Title,RDT,ADT,SDT,FID,WorkID,Starter FROM WF_EmpWorks WHERE FK_Emp='" + WebUser.No + "'"; DataTable dt = BP.DA.DBAccess.RunSQLReturnTable(sql); if (nd.HisBatchRole == BatchRole.None) { this.Pub1.AddFieldSetRed("错误", "节点(" + nd.Name + ")不能执行批量处理操作."); return; } string inSQL = "SELECT WorkID FROM WF_EmpWorks WHERE FK_Emp='" + WebUser.No + "' AND WFState!=7 AND FK_Node=" + this.FK_Node; Works wks = nd.HisWorks; wks.RetrieveInSQL(inSQL); BtnLab btnLab = new BtnLab(this.FK_Node); this.Pub1.AddTable("width='100%'"); //移动按钮位置 if (nd.HisBatchRole == BatchRole.Group) { this.Pub1.AddCaptionMsgLong("<a href='Batch.aspx'>返回</a> <input ID=\"btnGroup\" type=\"button\" value=\"合卷批复\" CssClass=\"Btn\" onclick=\"BatchGroup()\" />"); } else { this.Pub1.AddCaptionMsgLong(nd.FlowName + " - <a href='Batch.aspx'>返回</a>"); } #region 生成标题. this.Pub1.AddTR(); this.Pub1.AddTDTitle("序号"); string str1 = "<INPUT id='checkedAll' onclick='SelectAll()' text='选择' value='选择' type='checkbox' name='checkedAll'>"; this.Pub1.AddTDTitle("align='left'", str1 + "选择"); this.Pub1.AddTDTitle("标题"); this.Pub1.AddTDTitle("发起人"); this.Pub1.AddTDTitle("接受日期"); // 显示出来字段. BatchParas 的规则为 @字段中文名=fieldName@字段中文名1=fieldName1 MapAttrs attrs = new MapAttrs(this.FK_MapData); string[] strs = nd.BatchParas.Split(','); foreach (string str in strs) { if (string.IsNullOrEmpty(str) || str.Contains("@PFlowNo") == true) { continue; } foreach (MapAttr attr in attrs) { if (str != attr.KeyOfEn) { continue; } this.Pub1.AddTDTitle(attr.Name); } } this.Pub1.AddTREnd(); #endregion 生成标题. GERpt rpt = nd.HisFlow.HisGERpt; bool is1 = false; int idx = 0; foreach (Work wk in wks) { idx++; if (idx == nd.BatchListCount) { break; } #region 显示必要的列. is1 = this.Pub1.AddTR(is1); this.Pub1.AddTDIdx(idx); CheckBox cb = new CheckBox(); cb.ID = "CB_" + wk.OID.ToString(); foreach (DataRow dr in dt.Rows) { if (dr["WorkID"].ToString() != wk.OID.ToString()) { continue; } cb.Text = "选择"; this.Pub1.AddTD(cb); //this.Pub1.AddTD("<a href=\"javascript:WinOpen('MyFlow.aspx?WorkID=" + wk.OID + "&FK_Node=" + this.FK_Node + "&FK_Flow="+nd.FK_Flow+"','s')\" >" + dr["Title"].ToString() + "</a>"); this.Pub1.AddTD("<a href=\"javascript:WinOpen('FlowFormTree/Default.aspx?WorkID=" + wk.OID + "&FK_Node=" + this.FK_Node + "&IsSend=0&FK_Flow=" + nd.FK_Flow + "','s')\" >" + dr["Title"].ToString() + "</a>"); this.Pub1.AddTD(dr["Starter"].ToString()); this.Pub1.AddTD(dr["ADT"].ToString()); break; } #endregion 显示必要的列. #region 显示出来自定义的字段数据.. foreach (string str in strs) { if (string.IsNullOrEmpty(str) || str.Contains("@PFlowNo") == true) { continue; } foreach (MapAttr attr in attrs) { if (str != attr.KeyOfEn) { continue; } TB tb = new TB(); tb.ID = "TB_" + attr.KeyOfEn + "_" + wk.OID; switch (attr.LGType) { case FieldTypeS.Normal: switch (attr.MyDataType) { case BP.DA.DataType.AppString: if (attr.UIRows == 1) { tb.Text = wk.GetValStringByKey(attr.KeyOfEn); tb.Attributes["style"] = "width: " + attr.UIWidth + "px; text-align: left; height: 15px;padding: 0px;margin: 0px;"; if (attr.UIIsEnable) { tb.CssClass = "TB"; } else { tb.CssClass = "TBReadonly"; } this.Pub1.AddTD(tb); } else { tb.TextMode = TextBoxMode.MultiLine; tb.Text = wk.GetValStringByKey(attr.KeyOfEn); tb.Attributes["style"] = "width: " + attr.UIWidth + "px; text-align: left;padding: 0px;margin: 0px;"; tb.Attributes["maxlength"] = attr.MaxLen.ToString(); tb.Rows = attr.UIRows; if (attr.UIIsEnable) { tb.CssClass = "TBDoc"; } else { tb.CssClass = "TBReadonly"; } this.Pub1.AddTD(tb); } break; case BP.DA.DataType.AppDate: tb.ShowType = TBType.Date; tb.Text = wk.GetValStrByKey(attr.KeyOfEn); if (attr.UIIsEnable) { tb.Attributes["onfocus"] = "WdatePicker();"; } if (attr.UIIsEnable) { tb.Attributes["class"] = "TB"; } else { tb.Attributes["class"] = "TBReadonly"; } tb.Attributes["style"] = "width: " + attr.UIWidth + "px; text-align: left; height: 19px;"; this.Pub1.AddTD(tb); break; case BP.DA.DataType.AppDateTime: tb.ShowType = TBType.DateTime; tb.Text = wk.GetValStrByKey(attr.KeyOfEn); // en.GetValStrByKey(attr.KeyOfEn); if (attr.UIIsEnable) { tb.Attributes["class"] = "TBcalendar"; } else { tb.Attributes["class"] = "TBReadonly"; } if (attr.UIIsEnable) { tb.Attributes["onfocus"] = "WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'});"; } tb.Attributes["style"] = "width: " + attr.UIWidth + "px; text-align: left; height: 19px;"; this.Pub1.AddTD(tb); break; case BP.DA.DataType.AppBoolean: cb = new CheckBox(); //cb.Width = 350; cb.Text = attr.Name; cb.ID = "CB_" + attr.KeyOfEn + "_" + wk.OID; cb.Checked = attr.DefValOfBool; cb.Enabled = attr.UIIsEnable; cb.Checked = wk.GetValBooleanByKey(attr.KeyOfEn); if (cb.Enabled == false) { cb.Enabled = false; } else { //add by dgq 2013-4-9,添加内容修改后的事件 // cb.Attributes["onmousedown"] = "Change('" + attr.FK_MapData + "')"; cb.Enabled = true; } this.Pub1.AddTD(cb); break; case BP.DA.DataType.AppDouble: case BP.DA.DataType.AppFloat: tb.Attributes["style"] = "width: " + attr.GetValStrByKey("UIWidth") + "px; text-align: right; height: 19px;word-break: keep-all;"; tb.Text = attr.DefVal; if (attr.UIIsEnable) { //增加验证 tb.Attributes.Add("onkeyup", @"Change('" + attr.FK_MapData + "');"); tb.Attributes.Add("onblur", @"value=value.replace(/[^-?\d+\.*\d*$]/g,'');TB_ClickNum(this,0);"); tb.Attributes.Add("onClick", "TB_ClickNum(this)"); tb.Attributes["OnKeyPress"] += @"javascript:return VirtyNum(this,'float');"; tb.Attributes["class"] = "TBNum"; } else { tb.Attributes["class"] = "TBReadonly"; } this.Pub1.AddTD(tb); break; case BP.DA.DataType.AppInt: tb.Attributes["style"] = "width: " + attr.GetValStrByKey("UIWidth") + "px; text-align: right; height: 19px;word-break: keep-all;"; tb.Text = attr.DefVal; if (attr.UIIsEnable) { //增加验证 tb.Attributes.Add("onkeyup", @"Change('" + attr.FK_MapData + "');"); tb.Attributes.Add("onblur", @"value=value.replace(/[^-?\d]/g,'');TB_ClickNum(this,0);"); tb.Attributes.Add("onClick", "TB_ClickNum(this)"); tb.Attributes["OnKeyPress"] += @"javascript:return VirtyNum(this,'int');"; tb.Attributes["class"] = "TBNum"; } else { tb.Attributes["class"] = "TBReadonly"; } this.Pub1.AddTD(tb); break; case BP.DA.DataType.AppMoney: if (attr.UIIsEnable) { //增加验证 tb.Attributes.Add("onkeyup", @"Change('" + attr.FK_MapData + "');"); tb.Attributes.Add("onblur", @"value=value.replace(/[^-?\d+\.*\d*$]/g,'');TB_ClickNum(this,'0.00');"); tb.Attributes.Add("onClick", "TB_ClickNum(this)"); tb.Attributes["OnKeyPress"] += @"javascript:return VirtyNum(this,'float');"; tb.Attributes["class"] = "TBNum"; } else { tb.Attributes["class"] = "TBReadonly"; } // tb.ShowType = TBType.Moneny; tb.Text = wk.GetValIntByKey(attr.KeyOfEn).ToString("0.00"); tb.Attributes["style"] = "width: " + attr.GetValStrByKey("UIWidth") + "px; text-align: right; height: 19px;"; this.Pub1.AddTD(tb); break; case BP.DA.DataType.AppRate: if (attr.UIIsEnable) { tb.Attributes["class"] = "TBNum"; } else { tb.Attributes["class"] = "TBReadonly"; } tb.ShowType = TBType.Moneny; tb.Text = wk.GetValMoneyByKey(attr.KeyOfEn).ToString("0.00"); tb.Attributes["style"] = "width: " + attr.GetValStrByKey("UIWidth") + "px; text-align: right; height: 19px;"; this.Pub1.AddTD(tb); break; default: break; } break; case FieldTypeS.Enum: if (attr.UIContralType == UIContralType.DDL) { DDL ddle = new DDL(); ddle.ID = "DDL_" + attr.KeyOfEn + "_" + wk.OID; ddle.BindSysEnum(attr.UIBindKey); ddle.SetSelectItem(wk.GetValIntByKey(attr.KeyOfEn)); ddle.Enabled = attr.UIIsEnable; ddle.Attributes["tabindex"] = attr.Idx.ToString(); if (attr.UIIsEnable) { //add by dgq 2013-4-9,添加内容修改后的事件 ddle.Attributes["onchange"] = "Change('" + attr.FK_MapData + "')"; } // ddle.Enabled = false; this.Pub1.AddTD(ddle); } else { } break; case FieldTypeS.FK: DDL ddl1 = new DDL(); ddl1.ID = "DDL_" + attr.KeyOfEn + "_" + wk.OID; ddl1.Attributes["tabindex"] = attr.Idx.ToString(); if (ddl1.Enabled) { EntitiesNoName ens = attr.HisEntitiesNoName; ens.RetrieveAll(); ddl1.BindEntities(ens); ddl1.SetSelectItem(wk.GetValStrByKey(attr.KeyOfEn)); } else { ddl1.Attributes["style"] = "width: " + attr.UIWidth + "px;height: 19px;"; if (ddl1.Enabled == true) { ddl1.Enabled = false; } ddl1.Attributes["Width"] = attr.UIWidth.ToString(); ddl1.Items.Add(new ListItem(wk.GetValRefTextByKey(attr.KeyOfEn), wk.GetValStrByKey(attr.KeyOfEn))); } ddl1.Enabled = attr.UIIsEnable; this.Pub1.AddTD(ddl1); break; default: break; } } } #endregion 显示出来自定义的字段数据.. this.Pub1.AddTREnd(); } this.Pub1.AddTableEndWithHR(); MapExts mes = new MapExts(this.FK_MapData); #region 处理扩展属性. if (mes.Count != 0) { this.Page.RegisterClientScriptBlock("s81", "<script language='JavaScript' src='/WF/Scripts/jquery-1.4.1.min.js' ></script>"); this.Page.RegisterClientScriptBlock("b81", "<script language='JavaScript' src='/WF/CCForm/MapExt.js' defer='defer' type='text/javascript' ></script>"); this.Pub1.Add("<div id='divinfo' style='width: 155px; position: absolute; color: Lime; display: none;cursor: pointer;align:left'></div>"); this.Page.RegisterClientScriptBlock("dCd", "<script language='JavaScript' src='/DataUser/JSLibData/" + this.FK_MapData + ".js' ></script>"); foreach (Work wk in wks) { foreach (MapExt me in mes) { switch (me.ExtType) { case MapExtXmlList.DDLFullCtrl: // 自动填充. DDL ddlOper = this.Pub1.GetDDLByID("DDL_" + me.AttrOfOper + "_" + wk.OID); if (ddlOper == null) { continue; } ddlOper.Attributes["onchange"] = "DDLFullCtrl(this.value,\'" + ddlOper.ClientID + "\', \'" + me.MyPK + "\')"; break; case MapExtXmlList.ActiveDDL: DDL ddlPerant = this.Pub1.GetDDLByID("DDL_" + me.AttrOfOper + "_" + wk.OID); string val, valC; if (ddlPerant == null || wk.OID < 100) { continue; } #warning 此处需要优化 string ddlC = "ContentPlaceHolder1_Batch1_DDL_" + me.AttrsOfActive + "_" + wk.OID; // ddlPerant.Attributes["onchange"] = " isChange=true; DDLAnsc(this.value, \'" + ddlC + "\', \'" + me.MyPK + "\')"; ddlPerant.Attributes["onchange"] = "DDLAnsc(this.value, \'" + ddlC + "\', \'" + me.MyPK + "\')"; DDL ddlChild = this.Pub1.GetDDLByID("DDL_" + me.AttrsOfActive + "_" + wk.OID); val = ddlPerant.SelectedItemStringVal; if (ddlChild.Items.Count == 0) { valC = wk.GetValStrByKey(me.AttrsOfActive); } else { valC = ddlChild.SelectedItemStringVal; } string mysql = me.Doc.Replace("@Key", val); if (mysql.Contains("@")) { mysql = BP.WF.Glo.DealExp(mysql, wk, null); } ddlChild.Bind(DBAccess.RunSQLReturnTable(mysql), "No", "Name"); if (ddlChild.SetSelectItem(valC) == false) { ddlChild.Items.Insert(0, new ListItem("请选择" + valC, valC)); ddlChild.SelectedIndex = 0; } break; case MapExtXmlList.AutoFullDLL: //自动填充下拉框的范围. DDL ddlFull = this.Pub1.GetDDLByID("DDL_" + me.AttrOfOper + "_" + wk.OID); if (ddlFull == null) { continue; } string valOld = wk.GetValStrByKey(me.AttrOfOper); string fullSQL = me.Doc.Replace("@WebUser.No", WebUser.No); fullSQL = fullSQL.Replace("@WebUser.Name", WebUser.Name); fullSQL = fullSQL.Replace("@WebUser.FK_Dept", WebUser.FK_Dept); fullSQL = fullSQL.Replace("@WebUser.FK_DeptName", WebUser.FK_DeptName); fullSQL = fullSQL.Replace("@Key", this.Request.QueryString["Key"]); if (fullSQL.Contains("@")) { Attrs attrsFull = wk.EnMap.Attrs; foreach (Attr attr in attrsFull) { if (fullSQL.Contains("@") == false) { break; } fullSQL = fullSQL.Replace("@" + attr.Key, wk.GetValStrByKey(attr.Key)); } } ddlFull.Items.Clear(); ddlFull.Bind(DBAccess.RunSQLReturnTable(fullSQL), "No", "Name"); if (ddlFull.SetSelectItem(valOld) == false) { ddlFull.Items.Insert(0, new ListItem("请选择" + valOld, valOld)); ddlFull.SelectedIndex = 0; } // ddlFull.Attributes["onchange"] = " isChange=true;"; break; case MapExtXmlList.TBFullCtrl: // 自动填充. TextBox tbAuto = this.Pub1.GetTextBoxByID("TB_" + me.AttrOfOper + "_" + wk.OID); if (tbAuto == null) { continue; } // tbAuto.Attributes["onkeyup"] = " isChange=true; DoAnscToFillDiv(this,this.value,\'" + tbAuto.ClientID + "\', \'" + me.MyPK + "\');"; tbAuto.Attributes["onkeyup"] = " DoAnscToFillDiv(this,this.value,\'" + tbAuto.ClientID + "\', \'" + me.MyPK + "\');"; tbAuto.Attributes["AUTOCOMPLETE"] = "OFF"; if (me.Tag != "") { /* 处理下拉框的选择范围的问题 */ string[] strsTmp = me.Tag.Split('$'); foreach (string str in strsTmp) { string[] myCtl = str.Split(':'); string ctlID = myCtl[0]; DDL ddlC1 = this.Pub1.GetDDLByID("DDL_" + ctlID + "_" + wk.OID); if (ddlC1 == null) { //me.Tag = ""; // me.Update(); continue; } sql = myCtl[1].Replace("~", "'"); sql = sql.Replace("@WebUser.No", WebUser.No); sql = sql.Replace("@WebUser.Name", WebUser.Name); sql = sql.Replace("@WebUser.FK_Dept", WebUser.FK_Dept); sql = sql.Replace("@Key", tbAuto.Text.Trim()); dt = DBAccess.RunSQLReturnTable(sql); string valC1 = ddlC1.SelectedItemStringVal; ddlC1.Items.Clear(); foreach (DataRow dr in dt.Rows) { ddlC1.Items.Add(new ListItem(dr[1].ToString(), dr[0].ToString())); } ddlC1.SetSelectItem(valC1); } } break; case MapExtXmlList.InputCheck: TextBox tbCheck = this.Pub1.GetTextBoxByID("TB_" + me.AttrOfOper + "_" + wk.OID); if (tbCheck != null) { tbCheck.Attributes[me.Tag2] += " rowPK=" + wk.OID + "; " + me.Tag1 + "(this);"; } break; case MapExtXmlList.PopVal: //弹出窗. TB tb = this.Pub1.GetTBByID("TB_" + me.AttrOfOper + "_" + wk.OID); // tb.Attributes["ondblclick"] = " isChange=true; ReturnVal(this,'" + me.Doc + "','sd');"; tb.Attributes["ondblclick"] = " ReturnVal(this,'" + me.Doc + "','sd');"; break; case MapExtXmlList.Link: // 超链接. //TB tb = this.Pub1.GetTBByID("TB_" + me.AttrOfOper + "_" + mydtl.OID); //tb.Attributes["ondblclick"] = " isChange=true; ReturnVal(this,'" + me.Doc + "','sd');"; break; case MapExtXmlList.RegularExpression: //正则表达式,对数据控件处理 TextBox tbExp = this.Pub1.GetTextBoxByID("TB_" + me.AttrOfOper + "_" + wk.OID); if (tbExp == null || me.Tag == "onsubmit") { continue; } //验证输入的正则格式 string regFilter = me.Doc; if (regFilter.LastIndexOf("/g") < 0 && regFilter.LastIndexOf('/') < 0) { regFilter = "'" + regFilter + "'"; } //处理事件 tbExp.Attributes.Add("" + me.Tag + "", "return txtTest_Onkeyup(this," + regFilter + ",'" + me.Tag1 + "')"); //[me.Tag] += "this.value=this.value.replace(" + regFilter + ",'')"; break; default: break; } } } } #endregion 拓展属性 Button btn = new Button(); if (nd.HisBatchRole == BatchRole.Ordinary) { /*如果普通的批处理.*/ btn.CssClass = "Btn"; btn.ID = "Btn_Send"; if (nd.BatchParas_IsSelfUrl == true) { btn.Text = "选择要批量处理的工作"; } else { btn.Text = "批量处理:" + btnLab.SendLab; } btn.Click += new EventHandler(btn_Send_Click); btn.Attributes["onclick"] = " return confirm('您确定要执行吗?');"; this.Pub1.Add(btn); if (btnLab.ReturnEnable == false) { btn = new Button(); btn.CssClass = "Btn"; btn.ID = "Btn_Return"; btn.Text = "批量处理:" + btnLab.ReturnEnable; btn.Click += new EventHandler(btnDelete_Return_Click); btn.Attributes["onclick"] = " return confirm('您确定要执行吗?');"; this.Pub1.Add(btn); } } if (nd.HisBatchRole == BatchRole.Group) { /*如果分组审核?*/ btn = new Button(); btn.CssClass = "Btn"; btn.ID = "Btn_Group"; //btn.Text = btnLab.SendLab; btn.Text = "合卷批复"; btn.Click += new EventHandler(btn_Group_Click); btn.Attributes["onclick"] = " return confirm('您确定要执行吗?');"; this.Pub1.Add(btn); } if (btnLab.ReturnEnable == false) { btn = new Button(); btn.CssClass = "Btn"; btn.ID = "Btn_Return"; btn.Text = "批量处理:" + btnLab.ReturnEnable; btn.Click += new EventHandler(btnDelete_Return_Click); btn.Attributes["onclick"] = " return confirm('您确定要执行吗?');"; this.Pub1.Add(btn); } if (btnLab.DeleteEnable != 0) { btn = new Button(); btn.CssClass = "Btn"; btn.ID = "Btn_Del"; btn.Text = "批量处理:" + btnLab.DeleteLab; btn.Click += new EventHandler(btnDelete_Click); btn.Attributes["onclick"] = " return confirm('您确定要执行吗?');"; this.Pub1.Add(btn); } }
protected void Page_Load(object sender, EventArgs e) { this.Title = "流程报表定义"; switch (this.DoType) { case "Reset": BP.WF.Flow fl = new BP.WF.Flow(this.FK_Flow); fl.CheckRptOfReset(); this.Response.Redirect("WFRpt.aspx?FK_MapData=" + this.FK_MapData, true); return; default: break; } Cash.Map_Cash.Remove(this.FK_MapData); MapData md = new MapData(this.FK_MapData); MapAttrs mattrs = new MapAttrs(md.No); int count = mattrs.Count; if (mattrs.Count == 0) { BP.WF.Flow f = new BP.WF.Flow(this.FK_Flow); f.CheckRpt(); this.Response.Redirect(this.Request.RawUrl, true); return; } if (gfs.Count == 1) { GroupField mygf = (GroupField)gfs[0]; if (mygf.Lab != md.Name) { mygf.Lab = md.Name; mygf.Update(); } } this.Pub1.AddB(this.Title + " <a href=\"javascript:GroupFieldNew('" + md.No + "')\">字段分组</a>"); // this.Pub1.AddB("-<a href=\"javascript:WinOpen('/WF/Comm/Search.aspx?EnsName=" + this.MyPK + "')\">查询预览</a>"); // this.Pub1.AddB("-<a href=\"javascript:WinOpen('/WF/Comm/Group.aspx?EnsName=" + this.MyPK + "')\">分析预览</a>"); if (this.FK_MapData.Contains("RptDtl") == false) { this.Pub1.AddB("-<a href=\"javascript:DoReset('" + this.FK_Flow + "','" + this.FK_MapData + "')\">重设字段</a>"); /* 说明是主表:判断它是否有从表。*/ string sql = "SELECT COUNT(No) FROM Sys_MapDtl WHERE No LIKE 'ND" + int.Parse(this.FK_Flow) + "%'"; if (BP.DA.DBAccess.RunSQLReturnValInt(sql) >= 1) { // this.Pub1.AddB("-<a href=\"javascript:AddDtl('" + md.No + "')\">插入从表</a>"); //sql = "SELECT No FROM Sys_MapData WHERE No LIKE '" + this.MyPK + "Dtl%'"; //DataTable dt = BP.DA.DBAccess.RunSQLReturnTable(sql); //switch (dt.Rows.Count) //{ // case 0: // break; // case 1: // this.Pub1.AddB("-<a href='WFRpt.aspx?MyPK=" + dt.Rows[0][0].ToString() + "'>明细报表设计</a>"); // break; // default: // this.Pub1.AddB("-<a href='WFRpt.aspx?DoType=DeDtl&MyPK=" + this.MyPK + "'>明细报表设计</a>"); // break; //} } } else { this.Pub1.AddB("-<a href=\"WFRpt.aspx?MyPK=ND" + int.Parse(this.FK_Flow) + "Rpt\">" + "返回" + "</a>"); } this.Pub1.AddHR(); this.Pub1.AddTable("width='100%'"); /* * 根据 GroupField 循环出现菜单。 */ foreach (GroupField gf in gfs) { string gfAttr = " onmouseover=GFOnMouseOver('" + gf.OID + "','" + rowIdx + "') onmouseout=GFOnMouseOut()"; currGF = gf; this.Pub1.AddTR(gfAttr); if (gfs.Count == 1) { this.Pub1.AddTD("colspan=4 class=GroupField valign='top' align:left style='height: 24px;align:left' ", "<div style='text-align:left; float:left'> <a href=\"javascript:GroupField('" + this.FK_MapData + "','" + gf.OID + "')\" >" + gf.Lab + "</a></div><div style='text-align:right; float:right'></div>"); } else { this.Pub1.AddTD("colspan=4 class=GroupField valign='top' align:left style='height: 24px;align:left' onclick=\"GroupBarClick('" + gf.Idx + "')\" ", "<div style='text-align:left; float:left'><img src='../Style/Min.gif' alert='Min' id='Img" + gf.Idx + "' border=0 /> <a href=\"javascript:GroupField('" + this.FK_MapData + "','" + gf.OID + "')\" >" + gf.Lab + "</a></div><div style='text-align:right; float:right'> <a href=\"javascript:GFDoUp('" + gf.OID + "')\" ><img src='./WF/Img/Btn/Up.gif' class='Arrow' border=0/></a> <a href=\"javascript:GFDoDown('" + gf.OID + "')\" ><img src='./WF/Img/Btn/Down.gif' class='Arrow' border=0/></a></div>"); } this.Pub1.AddTREnd(); int i = -1; int idx = -1; isLeftNext = true; rowIdx = 0; foreach (MapAttr attr in mattrs) { gfAttr = " onmouseover=GFOnMouseOver('" + gf.OID + "','" + rowIdx + "') onmouseout=GFOnMouseOut()"; if (attr.GroupID == 0) { attr.GroupID = gf.OID; attr.Update(); } if (attr.GroupID != gf.OID) { if (gf.Idx == 0 && attr.GroupID == 0) { } else { continue; } } if (attr.HisAttr.IsRefAttr || attr.UIVisible == false) { continue; } if (isLeftNext) { if (gfs.Count == 0) { this.InsertObjects(false); } else { this.InsertObjects(true); } } // 显示的顺序号. idx++; if (attr.IsBigDoc && attr.UIIsLine) { if (isLeftNext == false) { this.Pub1.AddTD(); this.Pub1.AddTD(); this.Pub1.AddTREnd(); } rowIdx++; this.Pub1.AddTR(" ID='" + currGF.Idx + "_" + rowIdx + "' " + gfAttr); this.Pub1.Add("<TD class=FDesc colspan=4 width='100%' >"); this.Pub1.Add(this.GenerLab(attr, idx, 0, count)); TextBox mytbLine = new TextBox(); mytbLine.ID = "TB_" + attr.KeyOfEn; mytbLine.TextMode = TextBoxMode.MultiLine; mytbLine.Rows = 8; mytbLine.Attributes["style"] = "width:100%;padding: 0px;margin: 0px;"; mytbLine.Enabled = attr.UIIsEnable; if (mytbLine.Enabled == false) { mytbLine.Attributes["class"] = "TBReadonly"; } this.Pub1.Add(mytbLine); this.Pub1.AddTDEnd(); this.Pub1.AddTREnd(); isLeftNext = true; continue; } if (attr.IsBigDoc) { if (isLeftNext) { rowIdx++; this.Pub1.AddTR(" ID='" + currGF.Idx + "_" + rowIdx + "' " + gfAttr); } this.Pub1.Add("<TD class=FDesc colspan=2 width='50%' >"); this.Pub1.Add(this.GenerLab(attr, idx, 0, count)); TextBox mytbLine = new TextBox(); mytbLine.TextMode = TextBoxMode.MultiLine; mytbLine.Rows = 8; mytbLine.Attributes["style"] = "width:100%;padding: 0px;margin: 0px;"; mytbLine.ID = "TB_" + attr.KeyOfEn; mytbLine.Enabled = attr.UIIsEnable; if (mytbLine.Enabled == false) { mytbLine.Attributes["class"] = "TBReadonly"; } this.Pub1.Add(mytbLine); this.Pub1.AddTDEnd(); if (isLeftNext == false) { this.Pub1.AddTREnd(); } isLeftNext = !isLeftNext; continue; } //计算 colspanOfCtl . int colspanOfCtl = 1; if (attr.UIIsLine) { colspanOfCtl = 3; } if (attr.UIIsLine) { if (isLeftNext == false) { this.Pub1.AddTD(); this.Pub1.AddTD(); this.Pub1.AddTREnd(); } isLeftNext = true; } if (isLeftNext) { rowIdx++; this.Pub1.AddTR(" ID='" + currGF.Idx + "_" + rowIdx + "' " + gfAttr); } TB tb = new TB(); tb.Attributes["width"] = "100%"; tb.Columns = 60; tb.ID = "TB_" + attr.KeyOfEn; #region add contrals. switch (attr.LGType) { case FieldTypeS.Normal: tb.Enabled = attr.UIIsEnable; switch (attr.MyDataType) { case BP.DA.DataType.AppString: this.Pub1.AddTDDesc(this.GenerLab(attr, idx, i, count)); tb.ShowType = TBType.TB; tb.Text = attr.DefVal; if (colspanOfCtl == 3) { this.Pub1.AddTD(" width=80% colspan=" + colspanOfCtl, tb); } else { if (attr.IsSigan) { this.Pub1.AddTD("colspan=" + colspanOfCtl, "<img src='/DataUser/Siganture/" + WebUser.No + ".jpg' border=0 onerror=\"this.src='/DataUser/Siganture/UnName.jpg'\"/>"); } else { this.Pub1.AddTD("width='40%' colspan=" + colspanOfCtl, tb); } } break; case BP.DA.DataType.AppDate: this.Pub1.AddTDDesc(this.GenerLab(attr, idx, i, count)); tb.ShowType = TBType.Date; tb.Text = attr.DefVal; if (attr.UIIsEnable) { tb.Attributes["onfocus"] = "WdatePicker();"; } this.Pub1.AddTD("width='40%' colspan=" + colspanOfCtl, tb); break; case BP.DA.DataType.AppDateTime: this.Pub1.AddTDDesc(this.GenerLab(attr, idx, i, count)); tb.ShowType = TBType.DateTime; tb.Text = attr.DefVal; if (attr.UIIsEnable) { tb.Attributes["onfocus"] = "WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'});"; } this.Pub1.AddTD("width='40%' colspan=" + colspanOfCtl, tb); break; case BP.DA.DataType.AppBoolean: if (attr.UIIsLine) { this.Pub1.AddTDDesc(this.GenerLab(attr, idx, i, count)); } else { this.Pub1.AddTDDesc(this.GenerLab(attr, idx, i, count)); } CheckBox cb = new CheckBox(); cb.Text = attr.Name; cb.Checked = attr.DefValOfBool; cb.Enabled = attr.UIIsEnable; this.Pub1.AddTD("width='40%' colspan=" + colspanOfCtl, cb); break; case BP.DA.DataType.AppDouble: case BP.DA.DataType.AppFloat: case BP.DA.DataType.AppInt: this.Pub1.AddTDDesc(this.GenerLab(attr, idx, i, count)); tb.ShowType = TBType.Num; tb.Text = attr.DefVal; this.Pub1.AddTD("width='40%' colspan=" + colspanOfCtl, tb); break; case BP.DA.DataType.AppMoney: case BP.DA.DataType.AppRate: this.Pub1.AddTDDesc(this.GenerLab(attr, idx, i, count)); tb.ShowType = TBType.Moneny; tb.Text = attr.DefVal; this.Pub1.AddTD("width='40%' colspan=" + colspanOfCtl, tb); break; default: break; } tb.Attributes["width"] = "100%"; switch (attr.MyDataType) { case BP.DA.DataType.AppString: case BP.DA.DataType.AppDateTime: case BP.DA.DataType.AppDate: if (tb.Enabled) { tb.Attributes["class"] = "TB"; } else { tb.Attributes["class"] = "TBReadonly"; } break; default: if (tb.Enabled) { tb.Attributes["class"] = "TBNum"; } else { tb.Attributes["class"] = "TBNumReadonly"; } break; } break; case FieldTypeS.Enum: this.Pub1.AddTDDesc(this.GenerLab(attr, idx, i, count)); DDL ddle = new DDL(); ddle.ID = "DDL_" + attr.KeyOfEn; ddle.BindSysEnum(attr.KeyOfEn); ddle.SetSelectItem(attr.DefVal); ddle.Enabled = attr.UIIsEnable; this.Pub1.AddTD("colspan=" + colspanOfCtl, ddle); break; case FieldTypeS.FK: this.Pub1.AddTDDesc(this.GenerLab(attr, idx, i, count)); DDL ddl1 = new DDL(); ddl1.ID = "DDL_" + attr.KeyOfEn; try { EntitiesNoName ens = attr.HisEntitiesNoName; ens.RetrieveAll(); ddl1.BindEntities(ens); ddl1.SetSelectItem(attr.DefVal); } catch { } ddl1.Enabled = attr.UIIsEnable; this.Pub1.AddTD("colspan=" + colspanOfCtl, ddl1); break; default: break; } #endregion add contrals. if (colspanOfCtl == 3) { isLeftNext = true; this.Pub1.AddTREnd(); continue; } if (isLeftNext == false) { isLeftNext = true; this.Pub1.AddTREnd(); continue; } isLeftNext = false; } // 最后处理补充上它。 if (isLeftNext == false) { this.Pub1.AddTD(); this.Pub1.AddTD(); this.Pub1.AddTREnd(); } this.InsertObjects(false); } this.Pub1.AddTableEnd(); #region 处理异常情况。 foreach (MapDtl dtl in dtls) { if (dtl.IsUse == false) { dtl.RowIdx = 0; dtl.GroupID = 0; dtl.Update(); // this.Response.Redirect(this.Request.RawUrl, true); } } #endregion 处理异常情况。 #region 处理iFrom 的自适应的问题。 string js = "\t\n<script type='text/javascript' >"; foreach (MapDtl dtl in dtls) { js += "\t\n window.setInterval(\"ReinitIframe('F" + dtl.No + "','TD" + dtl.No + "')\", 200);"; } js += "\t\n</script>"; this.Pub1.Add(js); #endregion 处理iFrom 的自适应的问题。 #region 处理隐藏字段。 string msg = ""; // +++++++ 编辑隐藏字段 +++++++++ <br>"; foreach (MapAttr attr in mattrs) { if (attr.UIVisible) { continue; } switch (attr.KeyOfEn) { case "OID": case "FID": case "FK_NY": case "Emps": case "FK_Dept": case "WFState": case "RDT": case "MyNum": case "Rec": case "CDT": continue; default: break; } msg += "<a href=\"javascript:Edit('" + this.FK_MapData + "','" + attr.MyPK + "','" + attr.MyDataType + "');\">" + attr.Name + "</a> "; } if (msg.Length > 10) { this.Pub1.AddFieldSet("编辑隐藏字段"); this.Pub1.Add(msg); this.Pub1.Add("<br>说明:隐藏字段是不显示在表单里面,多用于属性的计算、方向条件的设置,报表的体现。"); this.Pub1.AddFieldSetEnd(); } #endregion 处理隐藏字段。 #region 查询条件定义 this.Pub1.AddFieldSet("查询条件定义" + " - <a href=\"javascript:WinOpen('../Rpt/Search.aspx?FK_Flow=" + this.FK_Flow + "')\">查询预览</a>-<a href=\"javascript:WinOpen('/WF/Comm/Group.aspx?EnsName=" + this.MyPK + "')\">分析预览</a>"); foreach (MapAttr mattr in mattrs) { if (mattr.UIContralType != UIContralType.DDL) { continue; } CheckBox cb = new CheckBox(); cb.ID = "CB_F_" + mattr.KeyOfEn; if (md.RptSearchKeys.Contains("@" + mattr.KeyOfEn)) { cb.Checked = true; } cb.Text = mattr.Name; this.Pub1.Add(cb); } this.Pub1.AddHR(); Button btn = new Button(); btn.CssClass = "Btn"; btn.Text = "保存"; btn.ID = "Btn_Save"; btn.Click += new EventHandler(btn_Click); this.Pub1.Add(btn); this.Pub1.AddFieldSetEnd(); #endregion }
protected void Page_Load(object sender, EventArgs e) { if (BP.WF.Dev2Interface.Flow_IsCanStartThisFlow(this.FK_Flow, WebUser.No) == false) { } Flow fl = new Flow(this.FK_Flow); this.Page.Title = fl.Name; MapAttrs attrs = new MapAttrs(this.FK_MapData); if (fl.BatchStartFields.Length == 0) { this.Pub1.AddFieldSet("流程属性设置错误"); this.Pub1.Add("您需要在流程属性里设置批量发起需要填写的字段。"); this.Pub1.AddFieldSetEnd(); } MapExts mes = new MapExts(this.FK_MapData); BP.WF.Node nd = new BP.WF.Node(int.Parse(this.FK_Flow + "01")); Work wk = nd.HisWork; wk.ResetDefaultVal(); this.Pub1.AddTable(); this.Pub1.AddCaptionMsg("批量发起:" + fl.Name); #region 输出标题. this.Pub1.AddTR(); this.Pub1.AddTDTitle("序"); string str1 = "<INPUT id='checkedAll' onclick=\"SelectAllBS(this);\" value='选择' type='checkbox' name='checkedAll' >全部选择"; this.Pub1.AddTDTitle("align='left'", str1); //this.Pub1.AddTDTitle("align='left'", ""); string[] strs = fl.BatchStartFields.Split(','); foreach (string str in strs) { if (string.IsNullOrEmpty(str)) { continue; } foreach (MapAttr attr in attrs) { if (str != attr.KeyOfEn) { continue; } this.Pub1.AddTDTitle(attr.Name); } } this.Pub1.AddTREnd(); #endregion 输出标题. #region 输出标题. for (int i = 1; i <= this.RowNum; i++) { this.Pub1.AddTR(); this.Pub1.AddTDIdx(i); CheckBox cbIdx = new CheckBox(); cbIdx.Checked = false; cbIdx.Text = "发起否?"; cbIdx.ID = "CB_IDX_" + i; this.Pub1.AddTD(cbIdx); foreach (string str in strs) { if (string.IsNullOrEmpty(str)) { continue; } foreach (MapAttr attr in attrs) { if (str != attr.KeyOfEn) { continue; } TB tb = new TB(); tb.ID = "TB_" + attr.KeyOfEn + "_" + i; switch (attr.LGType) { case FieldTypeS.Normal: switch (attr.MyDataType) { case BP.DA.DataType.AppString: if (attr.UIRows == 1) { tb.Text = attr.DefVal; tb.Attributes["style"] = "width: " + attr.UIWidth + "px; text-align: left; height: 15px;padding: 0px;margin: 0px;"; if (attr.UIIsEnable) { tb.CssClass = "TB"; } else { tb.CssClass = "TBReadonly"; } this.Pub1.AddTD(tb); } else { tb.TextMode = TextBoxMode.MultiLine; tb.Text = attr.DefVal; tb.Attributes["style"] = "width: " + attr.UIWidth + "px; text-align: left;padding: 0px;margin: 0px;"; tb.Attributes["maxlength"] = attr.MaxLen.ToString(); tb.Rows = attr.UIRows; if (attr.UIIsEnable) { tb.CssClass = "TBDoc"; } else { tb.CssClass = "TBReadonly"; } this.Pub1.AddTD(tb); } break; case BP.DA.DataType.AppDate: tb.ShowType = TBType.Date; tb.Text = attr.DefVal; if (attr.UIIsEnable) { tb.Attributes["onfocus"] = "WdatePicker();"; } if (attr.UIIsEnable) { tb.Attributes["class"] = "TB"; } else { tb.Attributes["class"] = "TBReadonly"; } tb.Attributes["style"] = "width: " + attr.UIWidth + "px; text-align: left; height: 19px;"; this.Pub1.AddTD(tb); break; case BP.DA.DataType.AppDateTime: tb.ShowType = TBType.DateTime; tb.Text = attr.DefVal; // en.GetValStrByKey(attr.KeyOfEn); if (attr.UIIsEnable) { tb.Attributes["class"] = "TBcalendar"; } else { tb.Attributes["class"] = "TBReadonly"; } if (attr.UIIsEnable) { tb.Attributes["onfocus"] = "WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'});"; } tb.Attributes["style"] = "width: " + attr.UIWidth + "px; text-align: left; height: 19px;"; this.Pub1.AddTD(tb); break; case BP.DA.DataType.AppBoolean: CheckBox cb = new CheckBox(); //cb.Width = 350; cb.Text = attr.Name; cb.ID = "CB_" + attr.KeyOfEn + "_" + i; cb.Checked = attr.DefValOfBool; cb.Enabled = attr.UIIsEnable; cb.Checked = attr.DefValOfBool; if (cb.Enabled == false) { cb.Enabled = false; } else { //add by dgq 2013-4-9,添加内容修改后的事件 // cb.Attributes["onmousedown"] = "Change('" + attr.FK_MapData + "')"; cb.Enabled = true; } this.Pub1.AddTD(cb); break; case BP.DA.DataType.AppDouble: case BP.DA.DataType.AppFloat: tb.Attributes["style"] = "width: " + attr.GetValStrByKey("UIWidth") + "px; text-align: right; height: 19px;word-break: keep-all;"; tb.Text = attr.DefVal; if (attr.UIIsEnable) { //增加验证 tb.Attributes.Add("onkeyup", @"Change('" + attr.FK_MapData + "');"); tb.Attributes.Add("onblur", @"value=value.replace(/[^-?\d+\.*\d*$]/g,'');TB_ClickNum(this,0);"); tb.Attributes.Add("onClick", "TB_ClickNum(this)"); tb.Attributes["OnKeyPress"] += @"javascript:return VirtyNum(this,'float');"; tb.Attributes["class"] = "TBNum"; } else { tb.Attributes["class"] = "TBReadonly"; } this.Pub1.AddTD(tb); break; case BP.DA.DataType.AppInt: tb.Attributes["style"] = "width: " + attr.GetValStrByKey("UIWidth") + "px; text-align: right; height: 19px;word-break: keep-all;"; tb.Text = attr.DefVal; if (attr.UIIsEnable) { //增加验证 tb.Attributes.Add("onkeyup", @"Change('" + attr.FK_MapData + "');"); tb.Attributes.Add("onblur", @"value=value.replace(/[^-?\d]/g,'');TB_ClickNum(this,0);"); tb.Attributes.Add("onClick", "TB_ClickNum(this)"); tb.Attributes["OnKeyPress"] += @"javascript:return VirtyNum(this,'int');"; tb.Attributes["class"] = "TBNum"; } else { tb.Attributes["class"] = "TBReadonly"; } this.Pub1.AddTD(tb); break; case BP.DA.DataType.AppMoney: if (attr.UIIsEnable) { //增加验证 tb.Attributes.Add("onkeyup", @"Change('" + attr.FK_MapData + "');"); tb.Attributes.Add("onblur", @"value=value.replace(/[^-?\d+\.*\d*$]/g,'');TB_ClickNum(this,'0.00');"); tb.Attributes.Add("onClick", "TB_ClickNum(this)"); tb.Attributes["OnKeyPress"] += @"javascript:return VirtyNum(this,'float');"; tb.Attributes["class"] = "TBNum"; } else { tb.Attributes["class"] = "TBReadonly"; } // tb.ShowType = TBType.Moneny; tb.Text = attr.DefVal; tb.Attributes["style"] = "width: " + attr.GetValStrByKey("UIWidth") + "px; text-align: right; height: 19px;"; this.Pub1.AddTD(tb); break; case BP.DA.DataType.AppRate: if (attr.UIIsEnable) { tb.Attributes["class"] = "TBNum"; } else { tb.Attributes["class"] = "TBReadonly"; } tb.ShowType = TBType.Moneny; tb.Text = attr.DefVal; tb.Attributes["style"] = "width: " + attr.GetValStrByKey("UIWidth") + "px; text-align: right; height: 19px;"; this.Pub1.AddTD(tb); break; default: break; } break; case FieldTypeS.Enum: if (attr.UIContralType == UIContralType.DDL) { DDL ddle = new DDL(); ddle.ID = "DDL_" + attr.KeyOfEn + "_" + i; ddle.BindSysEnum(attr.UIBindKey); ddle.SetSelectItem(attr.DefVal); ddle.Enabled = attr.UIIsEnable; ddle.Attributes["tabindex"] = attr.Idx.ToString(); if (attr.UIIsEnable) { //add by dgq 2013-4-9,添加内容修改后的事件 // ddle.Attributes["onchange"] = "Change('" + attr.FK_MapData + "')"; } // ddle.Enabled = false; this.Pub1.AddTD(ddle); } else { } break; case FieldTypeS.FK: DDL ddl1 = new DDL(); ddl1.ID = "DDL_" + attr.KeyOfEn + "_" + i; ddl1.Attributes["tabindex"] = attr.Idx.ToString(); if (ddl1.Enabled) { EntitiesNoName ens = attr.HisEntitiesNoName; ens.RetrieveAll(); ddl1.BindEntities(ens); ddl1.SetSelectItem(attr.DefVal); //add by dgq 2013-4-9,添加内容修改后的事件 // ddl1.Attributes["onchange"] = "Change('" + attr.FK_MapData + "')"; } else { ddl1.Attributes["style"] = "width: " + attr.UIWidth + "px;height: 19px;"; if (ddl1.Enabled == true) { ddl1.Enabled = false; } ddl1.Attributes["Width"] = attr.UIWidth.ToString(); ddl1.Items.Add(new ListItem(attr.DefVal, attr.DefVal)); } ddl1.Enabled = attr.UIIsEnable; this.Pub1.AddTD(ddl1); break; default: break; } } } this.Pub1.AddTREnd(); } #endregion 输出标题. this.Pub1.AddTableEnd(); #region 处理扩展属性. if (mes.Count != 0) { this.Page.RegisterClientScriptBlock("s81", "<script language='JavaScript' src='/WF/Scripts/jquery-1.4.1.min.js' ></script>"); this.Page.RegisterClientScriptBlock("b81", "<script language='JavaScript' src='/WF/CCForm/MapExt.js' defer='defer' type='text/javascript' ></script>"); this.Pub1.Add("<div id='divinfo' style='width: 155px; position: absolute; color: Lime; display: none;cursor: pointer;align:left'></div>"); this.Page.RegisterClientScriptBlock("dCd", "<script language='JavaScript' src='/DataUser/JSLibData/" + this.FK_MapData + ".js' ></script>"); for (int i = 1; i <= this.RowNum; i++) { foreach (MapExt me in mes) { switch (me.ExtType) { case MapExtXmlList.DDLFullCtrl: // 自动填充. DDL ddlOper = this.Pub1.GetDDLByID("DDL_" + me.AttrOfOper + "_" + i); if (ddlOper == null) { continue; } ddlOper.Attributes["onchange"] = "DDLFullCtrl(this.value,\'" + ddlOper.ClientID + "\', \'" + me.MyPK + "\')"; break; case MapExtXmlList.ActiveDDL: DDL ddlPerant = this.Pub1.GetDDLByID("DDL_" + me.AttrOfOper + "_" + i); string val, valC; DataTable dt; if (ddlPerant == null) { continue; } #warning 此处需要优化 string ddlC = "ContentPlaceHolder1_BatchStart1_DDL_" + me.AttrsOfActive + "_" + i; // ddlPerant.Attributes["onchange"] = " isChange=true; DDLAnsc(this.value, \'" + ddlC + "\', \'" + me.MyPK + "\')"; ddlPerant.Attributes["onchange"] = "DDLAnsc(this.value, \'" + ddlC + "\', \'" + me.MyPK + "\')"; DDL ddlChild = this.Pub1.GetDDLByID("DDL_" + me.AttrsOfActive + "_" + i); val = ddlPerant.SelectedItemStringVal; if (ddlChild.Items.Count == 0) { valC = wk.GetValStrByKey(me.AttrsOfActive); } else { valC = ddlChild.SelectedItemStringVal; } string mysql = me.Doc.Replace("@Key", val); if (mysql.Contains("@") && i >= 100) { mysql = BP.WF.Glo.DealExp(mysql, wk, null); } else { continue; } dt = DBAccess.RunSQLReturnTable(mysql); ddlChild.Bind(dt, "No", "Name"); if (ddlChild.SetSelectItem(valC) == false) { ddlChild.Items.Insert(0, new ListItem("请选择" + valC, valC)); ddlChild.SelectedIndex = 0; } // ddlChild.Attributes["onchange"] = " isChange=true;"; break; case MapExtXmlList.AutoFullDLL: //自动填充下拉框的范围. DDL ddlFull = this.Pub1.GetDDLByID("DDL_" + me.AttrOfOper + "_" + i); if (ddlFull == null) { continue; } string valOld = wk.GetValStrByKey(me.AttrOfOper); //string valOld =ddlFull.SelectedItemStringVal; string fullSQL = me.Doc.Replace("@WebUser.No", WebUser.No); fullSQL = fullSQL.Replace("@WebUser.Name", WebUser.Name); fullSQL = fullSQL.Replace("@WebUser.FK_Dept", WebUser.FK_Dept); fullSQL = fullSQL.Replace("@WebUser.FK_DeptName", WebUser.FK_DeptName); fullSQL = fullSQL.Replace("@Key", this.Request.QueryString["Key"]); if (fullSQL.Contains("@")) { Attrs attrsFull = wk.EnMap.Attrs; foreach (Attr attr in attrsFull) { if (fullSQL.Contains("@") == false) { break; } fullSQL = fullSQL.Replace("@" + attr.Key, wk.GetValStrByKey(attr.Key)); } } //if (fullSQL.Contains("@")) //{ // /*从主表中取数据*/ // Attrs attrsFull = this.MainEn.EnMap.Attrs; // foreach (Attr attr in attrsFull) // { // if (fullSQL.Contains("@") == false) // break; // if (fullSQL.Contains("@" + attr.Key) == false) // continue; // fullSQL = fullSQL.Replace("@" + attr.Key, this.MainEn.GetValStrByKey(attr.Key)); // } //} ddlFull.Items.Clear(); ddlFull.Bind(DBAccess.RunSQLReturnTable(fullSQL), "No", "Name"); if (ddlFull.SetSelectItem(valOld) == false) { ddlFull.Items.Insert(0, new ListItem("请选择" + valOld, valOld)); ddlFull.SelectedIndex = 0; } // ddlFull.Attributes["onchange"] = " isChange=true;"; break; case MapExtXmlList.TBFullCtrl: // 自动填充. TextBox tbAuto = this.Pub1.GetTextBoxByID("TB_" + me.AttrOfOper + "_" + i); if (tbAuto == null) { continue; } // tbAuto.Attributes["onkeyup"] = " isChange=true; DoAnscToFillDiv(this,this.value,\'" + tbAuto.ClientID + "\', \'" + me.MyPK + "\');"; tbAuto.Attributes["onkeyup"] = " DoAnscToFillDiv(this,this.value,\'" + tbAuto.ClientID + "\', \'" + me.MyPK + "\');"; tbAuto.Attributes["AUTOCOMPLETE"] = "OFF"; if (me.Tag != "") { /* 处理下拉框的选择范围的问题 */ string[] strsTmp = me.Tag.Split('$'); foreach (string str in strsTmp) { string[] myCtl = str.Split(':'); string ctlID = myCtl[0]; DDL ddlC1 = this.Pub1.GetDDLByID("DDL_" + ctlID + "_" + i); if (ddlC1 == null) { //me.Tag = ""; // me.Update(); continue; } string sql = myCtl[1].Replace("~", "'"); sql = sql.Replace("@WebUser.No", WebUser.No); sql = sql.Replace("@WebUser.Name", WebUser.Name); sql = sql.Replace("@WebUser.FK_Dept", WebUser.FK_Dept); sql = sql.Replace("@Key", tbAuto.Text.Trim()); dt = DBAccess.RunSQLReturnTable(sql); string valC1 = ddlC1.SelectedItemStringVal; ddlC1.Items.Clear(); foreach (DataRow dr in dt.Rows) { ddlC1.Items.Add(new ListItem(dr[1].ToString(), dr[0].ToString())); } ddlC1.SetSelectItem(valC1); } } break; case MapExtXmlList.InputCheck: TextBox tbCheck = this.Pub1.GetTextBoxByID("TB_" + me.AttrOfOper + "_" + i); if (tbCheck != null) { tbCheck.Attributes[me.Tag2] += " rowPK=" + i + "; " + me.Tag1 + "(this);"; } break; case MapExtXmlList.PopVal: //弹出窗. TB tb = this.Pub1.GetTBByID("TB_" + me.AttrOfOper + "_" + i); // tb.Attributes["ondblclick"] = " isChange=true; ReturnVal(this,'" + me.Doc + "','sd');"; tb.Attributes["ondblclick"] = " ReturnVal(this,'" + me.Doc + "','sd');"; break; case MapExtXmlList.Link: // 超链接. //TB tb = this.Pub1.GetTBByID("TB_" + me.AttrOfOper + "_" + mydtl.OID); //tb.Attributes["ondblclick"] = " isChange=true; ReturnVal(this,'" + me.Doc + "','sd');"; break; case MapExtXmlList.RegularExpression: //正则表达式,对数据控件处理 TextBox tbExp = this.Pub1.GetTextBoxByID("TB_" + me.AttrOfOper + "_" + i); if (tbExp == null || me.Tag == "onsubmit") { continue; } //验证输入的正则格式 string regFilter = me.Doc; if (regFilter.LastIndexOf("/g") < 0 && regFilter.LastIndexOf('/') < 0) { regFilter = "'" + regFilter + "'"; } //处理事件 tbExp.Attributes.Add("" + me.Tag + "", "return txtTest_Onkeyup(this," + regFilter + ",'" + me.Tag1 + "')"); //[me.Tag] += "this.value=this.value.replace(" + regFilter + ",'')"; break; default: break; } } } } #endregion 拓展属性 Button btn = new Button(); btn.Text = "执行发起"; btn.ID = "Btn_Start"; btn.Click += new EventHandler(btn_Send_Click); btn.OnClientClick = "return checkType()"; this.Pub1.Add(btn); #region 文件上传. this.Pub1.AddFieldSet("通过Excel导入方式发起:<a href='/DataUser/BatchStartFlowTemplete/" + this.FK_Flow + ".xls'><img src='/WF/Img/FileType/xls.gif' />下载Excel模版</a>"); this.Pub1.Add("文件名:"); FileUpload fu = new FileUpload(); fu.ID = "File1"; this.Pub1.Add(fu); btn = new Button(); btn.Text = "导入"; btn.ID = "Btn_Imp"; btn.Click += new EventHandler(btn_Upload_Click); this.Pub1.Add(btn); this.Pub1.AddFieldSetEnd(); #endregion 文件上传. }