通过“是否”字段来判断调用不同的类型的文章
最近项目,首页增加一个执法曝光栏目,新建模型,添加扩展字段,
文章为两种状态,未整改和已整改,通过“是否整改”字段来判断调用不同的类型。
前台效果:
扩展字段:
前台ajax调用
@Power.AjaxArticleList("执法曝光列表-表格式", new { Count = 40, Node = "zfpgzl", TitleLength = 80,Sort="Priority,PublishTime" ,ExtendField = true , Rectification=false,Type="已整改" }, new AjaxOptions { HttpMethod = "Post", UpdateTargetId = "wzgtable", InsertionMode = InsertionMode.InsertAfter })
执法曝光列表-表格式 标签
@inject NodeService NodeService @inject ContentServiceHelper ContentServiceHelper @inject ContentRouteUrlHelperExtend ContentRouteUrlHelperExtend @inject ArticleService ArticleService @inject ContentServiceHelper ContentServiceHelper @Power.VisualizationPartialView(new { Description = "用于显示文章标题链接的列表", Parameters = new { TitleLength = new { DisplayName = "标题长度", Type = "Int32", DefaultValue = 50, ToolTip = "汉字计算为两个字符长度", ControlType = "Integer" }, ShowNumber = new { DisplayName = "是否显示序号", Type = "Boolean", DefaultValue = false, ControlType = "Boolean" }, NumberFormat = new { DisplayName = "序号的数字格式", Type = "String", DefaultValue = "00", ControlType = "Text", ToolTip = "为避免00被程序认为是整型0,请在格式中加入字符串标识,例如00" }, ShowNode = new { DisplayName = "是否显示所属节点", Type = "Boolean", DefaultValue = false, ControlType = "Boolean" }, NodePrefix = new { DisplayName = "所属节点前插入字符", Type = "String", DefaultValue = "[", ControlType = "ComboBox", ListItems = "{'[':'[',']':']'}" }, NodeSuffix = new { DisplayName = "所属节点后插入字符", Type = "String", DefaultValue = "]", ControlType = "ComboBox", ListItems = "{'[':'[',']':']'}" }, ShowDate = new { DisplayName = "是否显示发布时间", Type = "Boolean", DefaultValue = true, ControlType = "Boolean" }, ShowRelation = new { DisplayName = "是否显示相关内容", Type = "Boolean", DefaultValue = false, ControlType = "Boolean" }, DateFormat = new { DisplayName = "发布时间日期格式", Type = "String", DefaultValue = "yyyy-MM-dd", ControlType = "ComboBox", ListItems = "{'yyyy-MM-dd HH:mm':'yyyy-MM-dd HH:mm(年-月-日 时:分)','yyyy-MM-dd HH:mm:ss':'yyyy-MM-dd HH:mm:ss(年-月-日 时:分:秒)'}" }, DateFollowTitle = new { DisplayName = "发布时间是否显示在标题后面", Type = "Boolean", DefaultValue = false, ControlType = "Boolean" }, ShowHits = new { DisplayName = "是否显示点击数", Type = "Boolean", DefaultValue = false, ControlType = "Boolean" }, HitsSuffix = new { DisplayName = "点击数后插入字符", Type = "String", DefaultValue = "", ToolTip = "点击数后缀", ControlType = "ComboBox", ListItems = "{'次':'次'}" }, ShowLinkTip = new { DisplayName = "是否显示链接提示", Type = "Boolean", DefaultValue = true, ControlType = "Boolean" }, HighlightDays = new { DisplayName = "多少天内的内容高亮显示", Type = "Int32", DefaultValue = 0, ControlType = "Integer" }, RelationTagName = new { DisplayName = "相关内容标题", Type = "String", ControlType = "Text", DefaultValue = "相关内容" }, NodeId = new { DisplayName = "节点Id", Type = "Int32", ControlType = "Integer" }, Type = new { DisplayName = "已整改或未整改", Type = "String", ControlType = "Text", DefaultValue = "已整改" } } }) @model Article @{ string keyword = Param.keyword?.ToString(); string type = Param.Type?.ToString(); var target = Param.LinkBlankTarget == true ? "_blank" : null; // 处理多少天内的内容高亮显示。 int highlightDays = Param.HighlightDays ?? 0; int highlightMinutes = Param.HighlightMinutes ?? 0; string highlightDaysCss = null; if (highlightDays > 0) { highlightDays = highlightDays - 1; var highlightDeadline = DateTime.Now.AddDays(-highlightDays); if (Model.PublishTime.Date <= DateTime.Now.Date && Model.PublishTime.Date >= highlightDeadline.Date) { highlightDaysCss = "highlight"; } } if (highlightMinutes > 0) { var highlightDeadline = DateTime.Now.AddMinutes(-highlightMinutes); if (Model.PublishTime > highlightDeadline) { highlightDaysCss = "highlight"; } } var nodeService = NodeService; Node node = nodeService.GetNodeByObj(Param.Node); var IsOpenChildNode = nodeService.IsOpenChildNode(node); var relationTagName = Param.RelationTagName ?? "相关内容"; if (node == null) { if (Param.NodeId != null) { node = nodeService.GetEntity(Param.NodeId); } else if (Model.NodeId != null) { node = nodeService.GetEntity(Model.NodeId.Value); } } } @if (Row.Index == 0) { if (node == null) { <tr class="noData"><td colspan="6">暂无资料</td></tr> return; } if (node.NodeStatus == NodeStatus.Open && !IsOpenChildNode) { <tr class="noData"><td colspan="6">找不到指定节点</td></tr> return; } if (node.NodeStatus == NodeStatus.Open) { <tr class="noData"><td colspan="6">暂无资料</td></tr> return; } <tr class="noData"><td colspan="6">调用的节点已关闭</td></tr> return; } @if(Model.ExtendObject.sfzg && type=="已整改") { <tr class="@Row.PositionLiteral @Row.IntervalLiteral @Row.HighRankLiteral @highlightDaysCss"> <td>@Model.Title</td> <td>@Model.ExtendObject.badwjmj</td> <td class="zcwt">@Model.ExtendObject.czwt</td> <td>@Model.ExtendObject.kf</td> <td>@Model.ExtendObject.xqzgrq.ToString("yyyy-MM-dd")</td> <td class="sfzg">已整改</td> </tr> } @if(!Model.ExtendObject.sfzg && type=="未整改") { <tr class="@Row.PositionLiteral @Row.IntervalLiteral @Row.HighRankLiteral @highlightDaysCss"> <td>@Model.Title</td> <td>@Model.ExtendObject.badwjmj</td> <td class="zcwt">@Model.ExtendObject.czwt</td> <td>@Model.ExtendObject.kf</td> <td>@Model.ExtendObject.xqzgrq.ToString("yyyy-MM-dd")</td> <td class="sfzg">未整改</td> </tr> }
用户登录
还没有账号?
立即注册