//用来存 col id , 中文, 控件type public AppPbEditFormParser(PbBillInfo billInfo) { FieldSets = GetFieldSetInfo(billInfo); GridPanels = GetGridPanel(); LayoutForm = GetFormInfo(); Expressions = GetExpressions(billInfo); TB = GetEditToolbar(billInfo); tabinfos = GetTabInfos(billInfo); }
// 计算span public TableLayoutForm CalColSpan(TableLayoutForm form, Dictionary <int, SortedList <int, PbBaseControlInfo> > dic) { var sortSet = new SortedSet <int>(); var checkSet = new SortedSet <int>(); //为多选框服务的 //对列宽进行排序 foreach (var pbColumn in form.Items) { if (pbColumn is PbCheckboxInfo) { continue; } sortSet.Add(pbColumn.Width); } foreach (var pbColumn in form.Items) { if (pbColumn is PbCheckboxInfo) { continue; } pbColumn.Span = Convert.ToInt32(Math.Ceiling((double)pbColumn.Width / ((double)1.5 * sortSet.Min))); } foreach (var pbColumn in form.Items) { if (pbColumn is PbCheckboxInfo) { pbColumn.Span = checkSet.Min; } } //计算每行最多的列 colspan int maxSpan = 0; foreach (var items in dic) { int tempSpan = 0; foreach (var item in items.Value) { if (item.Value.Name == "ocode" || item.Value.Name == "code") { continue; } tempSpan += item.Value.Span; } if (tempSpan > maxSpan) { maxSpan = tempSpan; } } form.ColumnsPerRow = maxSpan; return(form); }
//表头普通的 public TableLayoutForm GetFormInfo() { Dictionary <int, SortedList <int, PbBaseControlInfo> > dic = new Dictionary <int, SortedList <int, PbBaseControlInfo> >(); layoutForm.Items = this.Sort(layoutForm.Items, ref dic); //计算该fieldset 每行最多的colspan layoutForm = CalColSpan(layoutForm, dic); //转类型 foreach (var item in layoutForm.Items) { layoutForm.FieldsApp.Add(AppControlConverter.ConvertToExtControl(item)); } CommonParser.Log("TableLayoutForm转换成功."); return(layoutForm); }
public StringBuilder NotAbsForm(TableLayoutForm form, StringBuilder sb) { sb.Append("{" + "xtype: 'fieldset'," + string.Format(@" columnsPerRow: {0}, title: '{1}', collapsible: {2}, collapsed: {3}, border: {4}, ", form.ColumnsPerRow, "", "false", "false", "false")); sb.Append(@" fieldDefaults: { margin: '0 10 8 0', anchor: '100%', msgTarget: 'side' }, fieldRows: ["); return(sb); }
public PbEditFormParser(PbBillInfo billInfo) { FieldSets = GetFieldSetInfo(billInfo); GridPanels = GetGridPanel(); LayoutForm = GetFormInfo(billInfo); Expressions = GetExpressions(billInfo); TB = GetEditToolbar(billInfo); tabinfos = GetTabInfos(billInfo); FieldSetBlobdoc = GetBlobdoc(billInfo); GetPictureBoxs(billInfo); GetAsrGrid(billInfo); GetWfGrid(billInfo); //汇总form和fieldset上所有列名 foreach (var item in LayoutForm.AllFields) { if (!LayoutForm.ColumnNames.Contains(item.Name)) { LayoutForm.ColumnNames.Add(item.Name); } } foreach (var fieldset in FieldSets) { foreach (var item in fieldset.AllFields) { if (!LayoutForm.ColumnNames.Contains(item.Name)) { LayoutForm.ColumnNames.Add(item.Name); } } } //计算表体游离panel数量,包括grid,tab,金格,进度控件等 int tempCount = 0; for (int i = 0; i < GridPanels.Count; i++) { if (!GridPanels[i].IsInTab) { tempCount++; } } if (tabinfos.Count == 1) { tempCount++; } if (billInfo.HasBlobdoc == "1") { tempCount++; } if (billInfo.HasEppocx == "1") { tempCount++; } if (billInfo.AsrGridInfo.Visible) { tempCount++; } if (billInfo.WfGridInfo.Visible) { tempCount++; } billInfo.BodyCmpCount = tempCount; //设置grid和tab的布局region SortedList <int, string> sortlist = new SortedList <int, string>(); //游离panel排序 if (tabinfos.Count > 0) //有tab情况下,金格等控件在tab中 { sortlist.Add(tabinfos[0].YPos, "tabPanel0"); } for (int i = 0; i < GridPanels.Count; i++) { if (!GridPanels[i].IsInTab) { sortlist.Add(GridPanels[i].Y, GridPanels[i].TableName); } } if (sortlist.Count > 0) { int maxY = Convert.ToInt32(sortlist.Last().Key); if (tabinfos.Count > 0) //有tab情况下,金格等控件在tab中 { //根据组件y坐标来设置region if (tabinfos[0].YPos == maxY) { tabinfos[0].Region = "center"; } else { tabinfos[0].Region = "north"; } } for (int i = 0; i < GridPanels.Count; i++) { if (!GridPanels[i].IsInTab) { if (GridPanels[i].Y == maxY && billInfo.HasBlobdoc != "1" && billInfo.HasEppocx != "1") { GridPanels[i].Region = "center"; } else { GridPanels[i].Region = "north"; } } } } }
//获取二维数组的字段信息 private List <List <ExtControlBase> > GetFieldsRows(Dictionary <int, SortedList <int, PbBaseControlInfo> > dic, FieldSet fset, TableLayoutForm lForm) { List <List <ExtControlBase> > fieldRows = new List <List <ExtControlBase> >(); ExtControlBase extControl = null; foreach (var item in dic) { List <ExtControlBase> list = new List <ExtControlBase>(); foreach (var control in item.Value) { extControl = ControlConverter.ConvertToExtControl(control.Value); list.Add(extControl); if (fset != null) { fset.AllFields.Add(extControl); } if (lForm != null) { lForm.AllFields.Add(extControl); } } if (list.Count > 0) { fieldRows.Add(list); } } return(fieldRows); }