@functions { public string getLinks(Link link) { StringBuilder linkBuilder = new StringBuilder(); linkBuilder.Append("<div class="node""); if (link.Parent != null) { linkBuilder.Append("style="display: none""); } linkBuilder.Append(">"); linkBuilder.Append(" <div class="item">"); linkBuilder.Append("<div class="item-info ">"); linkBuilder.Append("<span class="text-success">[" + link.Type.GetDisplayName() + "]</span>"); linkBuilder.Append(" " + link.Name + " "); linkBuilder.Append("<a href="" + Url.Action(nameof(NY.TBWebApp.Controllers.Admin.LinkController.CreateLink), new { ParentId = link.Id, fromUrl = Context.Request.GetRequestUrl() }) + "" class="btn btn-info btn-sm">添加下级</a> "); linkBuilder.Append(" <a href=" + Url.Action(nameof(NY.TBWebApp.Controllers.Admin.LinkController.EditLink), new { Id = link.Id, fromUrl = Context.Request.GetRequestUrl() }) + " class="btn btn-info btn-sm">编辑</a> "); linkBuilder.Append("<a href=" + Url.Action(nameof(NY.TBWebApp.Controllers.Admin.LinkController.DeleteLink), new { Id = link.Id, fromUrl = Context.Request.GetRequestUrl() }) + " class="btn btn-info btn-sm" onclick="return confirm('是否确认删除?'); ">删除</a>"); linkBuilder.Append(" </div> <div class="clearfix"></div></div>"); foreach (var childNode in link.Childs.OrderByDescending(m => m.SortNo).ThenBy(m => m.SortNo)) { linkBuilder.Append(getLinks(childNode)); } linkBuilder.Append(" </div>"); return linkBuilder.ToString(); } }