public IControl GetDataGrid(bool needBorrowColumn = false, bool needStateColumn = false, int stateColumnwidth = 80) { var dataGrid = new MiniDataGrid(); var listCofig = this.S_DOC_Space.S_DOC_ListConfig.FirstOrDefault(d => d.RelationID == this.ID); var detailList = listCofig.S_DOC_ListConfigDetail.Where(d => d.Dispaly == "True").OrderBy(d => d.DetailSort).ToList(); if (needStateColumn) { MiniGridColumn column = new MiniGridColumn(); column.Field = "State"; column.HeaderText = "状态"; column.align = "center"; column.Allowsort = false; column.Width = stateColumnwidth; dataGrid.AddControl(column); } if (needBorrowColumn && this.CanBorrow == "True") { MiniGridColumn column = new MiniGridColumn(); column.Field = "BorrowState"; column.HeaderText = "是否借出"; column.align = "center"; column.Allowsort = false; column.Width = 80; dataGrid.AddControl(column); MiniGridColumn column2 = new MiniGridColumn(); column2.Field = "BorrowDetail"; column2.HeaderText = "借阅记录"; column2.align = "center"; column2.Allowsort = false; column2.Width = 80; dataGrid.AddControl(column2); } foreach (var item in detailList) { MiniGridColumn column = new MiniGridColumn(); var nodeAttr = this.S_DOC_FileAttr.FirstOrDefault(d => d.FileAttrField == item.AttrField); if (nodeAttr == null) { continue; } column.Field = item.AttrField; column.HeaderText = item.AttrName; column.align = item.Align; if (item.AllowSort == TrueOrFalse.False.ToString()) { column.Allowsort = false; } column.Width = Convert.ToInt32(item.Width); if (nodeAttr.DataType == AttrDataType.DateTime.ToString()) { column.SetAttribute("dateformat", "yyyy-MM-dd"); } dataGrid.AddControl(column); } return(dataGrid); }
//档案空间的项目列表展示 public JsonResult GetDataGridHtml() { string nodeConfigID = this.Request["ConfigID"]; string spaceID = this.Request["SpaceID"]; var space = DocConfigHelper.CreateConfigSpaceByID(spaceID); if (space == null) { throw new Formula.Exceptions.BusinessException("未能找到ID为【" + spaceID + "】的档案空间配置对象"); } var node = space.S_DOC_Node.FirstOrDefault(d => d.ID == nodeConfigID); if (node == null) { throw new Formula.Exceptions.BusinessException("未能找到ID为【" + nodeConfigID + "】的节点定义对象"); } MiniDataGrid grid = node.GetDataGrid(true) as MiniDataGrid; MiniGridColumn column = new MiniGridColumn(); column.Field = "img"; column.HeaderText = "打开树形图"; column.align = "center"; column.Allowsort = false; column.Width = 100; grid.AddControl(column, 0); grid.Url = "/DocSystem/View/NodeView/GetList?SpaceID=" + spaceID + "&ConfigID=" + nodeConfigID; //借阅状态显示红绿状态 grid.SetAttribute("ondrawcell", "onDrawCell"); if (node.CanBorrow == "True") { MiniGridColumn columnBorrow = new MiniGridColumn(); columnBorrow.Field = "Borrow"; columnBorrow.HeaderText = "操作"; columnBorrow.align = "center"; columnBorrow.Allowsort = false; columnBorrow.Width = 100; grid.AddControl(columnBorrow, 1); } //var listconfig = node.ListConfig().ID; var list = node.ListConfig().S_DOC_QueryParam.Where(a => a.InKey == "True").ToList(); var quickQueryField = String.Join(",", list.Select(a => a.InnerField)); var quickQueryText = String.Join(",", list.Select(a => a.AttrName)); return(Json(new { QuickQuery = new { field = quickQueryField, text = quickQueryText }, GridHtml = grid.Render(node.IsShowIndex == "True") })); }
public ActionResult List() { string QueryKey = ""; string btnTemplate = "<a class=\"mini-button\" iconcls=\"{1}\" onclick=\"{2}\" plain=\"true\" id=\"{3}\">{0}</a>"; string nodeConfigID = this.Request["ConfigID"]; string spaceID = this.Request["SpaceID"]; var space = DocConfigHelper.CreateConfigSpaceByID(spaceID); if (space == null) { throw new Formula.Exceptions.BusinessException("未能找到ID为【" + spaceID + "】的档案空间配置对象"); } var node = space.S_DOC_Node.FirstOrDefault(d => d.ID == nodeConfigID); if (node == null) { throw new Formula.Exceptions.BusinessException("未能找到ID为【" + nodeConfigID + "】的节点定义对象"); } var grid = node.GetDataGrid(true, true, 40) as MiniDataGrid; grid.Url = "GetList"; grid.Multiselect = true; if (node.CanBorrow == "True") { var column = new MiniGridColumn(); column.Field = "BorrowUserName"; column.HeaderText = "借阅人"; column.align = "center"; column.Allowsort = true; column.Width = 80; grid.AddControl(column); } MiniGridColumn columnLif = new MiniGridColumn(); columnLif.Field = "ArchivesLifeCycle"; columnLif.HeaderText = "操作记录"; columnLif.align = "center"; columnLif.Allowsort = false; columnLif.Width = 100; grid.AddControl(columnLif); ViewBag.DataGridHtml = grid.Render(node.IsShowIndex == "True"); var queryForm = node.GetQueryForm(); var table = queryForm.Controls.FirstOrDefault() as Table; int height = table.Rows.Count * 30 + 60; ViewBag.QueryFormHtml = queryForm.Render(); QueryKey = space.S_DOC_ListConfig.FirstOrDefault(d => d.RelationID == nodeConfigID).QueryKeyText; if (GetQueryString("$IsSelect") == "true") { ViewBag.BtnHTML += " <a id='returnSelectList' class='mini-button' onclick='returnSelectList()' iconcls='icon-refer' plain='true'>选择</a>"; } if (node.Structs.Exists(d => d.Parent.NodeID == "Root")) { ViewBag.BtnHTML += String.Format(btnTemplate, "添加", "icon-add", "add({width: '70%', height: '70%'})", "btnAdd"); } if (GetQueryString("$IsSelect") != "true") { ViewBag.BtnHTML += String.Format(btnTemplate, "修改", "icon-edit", "edit({width: '70%', height: '70%'})", "btnEdit"); ViewBag.BtnHTML += String.Format(btnTemplate, "批量修改", "icon-edit", "multiEdit('/DocSystem/Manager/NodeManager/Edit')", "btnMultiEdit"); ViewBag.BtnHTML += String.Format(btnTemplate, "删除", "icon-remove", "del()", "btnDel"); ViewBag.BtnHTML += String.Format(btnTemplate, "打开树形图", "icon-goto", "opentree()", "btnOpenTree"); //if (node.CanBorrow == "True") // ViewBag.BtnHTML += String.Format(btnTemplate, "归还", "icon-copy", "borrowreturn()", "btnBorrowReturn"); if (node.S_DOC_FileNodeRelation.Count > 0) { ViewBag.BtnHTML += String.Format(btnTemplate, "查看文件", "icon-extensions", "openfile()", "btnOpenFile"); } ViewBag.BtnHTML += String.Format(btnTemplate, "发布", "icon-downgrade", "publish()", "btnPublish"); ViewBag.BtnHTML += String.Format(btnTemplate, "禁用", "icon-cancel", "forbidden()", "btnForbid"); ViewBag.BtnHTML += String.Format(btnTemplate, "解封", "icon-unlock", "RelieveSeal()", "btnForbid"); } var enumsList = node.S_DOC_NodeAttr.Where(d => d.IsEnum == "True").ToList().Select(d => d.EnumKey).Distinct().ToList(); ViewBag.Enums = enumsList; foreach (var item in node.S_DOC_NodeAttr.Where(d => d.IsEnum == "True").ToList()) { if (String.IsNullOrEmpty(item.EnumKey)) { continue; } var enumKey = item.EnumKey; if (enumKey.Split('.').Length > 1) { enumKey = enumKey.Split('.')[1]; } ViewBag.Script += "addGridEnum(\"dataGrid\", \"" + item.AttrField + "\", \"" + enumKey + "\");"; } return(View()); }
public ActionResult List() { string QueryKey = ""; string btnTemplate = "<a class=\"mini-button\" iconcls=\"{1}\" onclick=\"{2}\" plain=\"true\" id=\"{3}\">{0}</a>"; string configID = this.Request["ConfigID"]; string spaceID = this.Request["SpaceID"]; string nodeID = this.Request["NodeID"]; var space = DocConfigHelper.CreateConfigSpaceByID(spaceID); if (space == null) { throw new Formula.Exceptions.BusinessException("未能找到ID为【" + spaceID + "】的档案空间配置对象"); } var fileConfig = space.S_DOC_File.FirstOrDefault(d => d.ID == configID); if (fileConfig == null) { throw new Formula.Exceptions.BusinessException("未能找到ID为【" + configID + "】的节点定义对象"); } var grid = fileConfig.GetDataGrid(true, true, 40) as MiniDataGrid; grid.Url = "GetList"; grid.Multiselect = true; //var column = new MiniGridColumn(); //column.Field = "BorrowUserName"; //column.HeaderText = "借阅人"; //column.align = "center"; column.Allowsort = true; column.Width = 80; //grid.AddControl(column); MiniGridColumn column = new MiniGridColumn(); column.Field = "ArchivesLifeCycle"; column.HeaderText = "操作记录"; column.align = "center"; column.Allowsort = false; column.Width = 100; grid.AddControl(column); ViewBag.DatagridHtml = grid.Render(fileConfig.IsShowIndex == "True"); var queryForm = fileConfig.GetQueryForm(); var table = queryForm.Controls.FirstOrDefault() as Table; int height = table.Rows.Count * 30 + 60; ViewBag.QueryFormHtml = queryForm.Render(); QueryKey = space.S_DOC_ListConfig.FirstOrDefault(d => d.RelationID == configID).QueryKeyText; if (GetQueryString("$IsSelect") == "true") { ViewBag.BtnHTML += " <a id='returnSelectList' class='mini-button' onclick='returnSelectList()' iconcls='icon-refer' plain='true'>选择</a>"; } else { if (!String.IsNullOrEmpty(nodeID)) { ViewBag.BtnHTML += String.Format(btnTemplate, "添加", "icon-add", "add({width: 800, height: 500})", "btnAdd"); } ViewBag.BtnHTML += String.Format(btnTemplate, "修改", "icon-edit", "edit({width: 800, height: 500})", "btnEdit"); ViewBag.BtnHTML += String.Format(btnTemplate, "批量修改", "icon-edit", "multiEdit('/DocSystem/Manager/FileManager/Edit')", "btnMultiEdit"); ViewBag.BtnHTML += String.Format(btnTemplate, "删除", "icon-remove", "del()", "btnDel"); if (String.IsNullOrEmpty(nodeID)) { ViewBag.BtnHTML += String.Format(btnTemplate, "打开树形图", "icon-goto", "opentree()", "btnOpenTree"); } if (fileConfig.CanDownload == "True") { ViewBag.BtnHTML += String.Format(btnTemplate, "下载", "icon-download", "download()", "btnDownload"); } //if (fileConfig.CanBorrow == "True") // ViewBag.BtnHTML += String.Format(btnTemplate, "归还", "icon-copy", "borrowreturn()", "btnBorrowReturn"); ViewBag.BtnHTML += String.Format(btnTemplate, "浏览", "icon-zoomin", "browse()", "btnBrowse"); ViewBag.BtnHTML += String.Format(btnTemplate, "发布", "icon-downgrade", "publish()", "btnPublish"); ViewBag.BtnHTML += String.Format(btnTemplate, "禁用", "icon-cancel", "forbidden()", "btnForbid"); ViewBag.BtnHTML += String.Format(btnTemplate, "移动", "icon-goto", "movefile()", "btnMove"); //ViewBag.BtnHTML += String.Format(btnTemplate, "升版", "icon-upload", "upVersion()", "btnUpVersion"); //ViewBag.BtnHTML += String.Format(btnTemplate, "查看版本", "icon-search", "viewVersion()", "btnViewVersion"); } if (fileConfig.FileCategory == FileCategory.Atlas.ToString()) { ViewBag.IsAtlas = "True"; } else { ViewBag.IsAtlas = "False"; } var enumsList = fileConfig.S_DOC_FileAttr.Where(d => d.IsEnum == "True").ToList().Select(d => d.EnumKey).Distinct().ToList(); ViewBag.Enums = enumsList; foreach (var item in fileConfig.S_DOC_FileAttr.Where(d => d.IsEnum == "True").ToList()) { if (String.IsNullOrEmpty(item.EnumKey)) { continue; } var enumKey = item.EnumKey; if (enumKey.Split('.').Length > 1) { enumKey = enumKey.Split('.')[1]; } ViewBag.Script += "addGridEnum(\"dataGrid\", \"" + item.FileAttrField + "\", \"" + enumKey + "\");"; } var ArchiveType = System.Configuration.ConfigurationManager.AppSettings["ArchiveType"]; ViewBag.ArchiveType = string.IsNullOrEmpty(ArchiveType) ? "PdfFile" : ArchiveType; return(View()); }