mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-09-19 01:58:01 +08:00
routine update
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using Infrastructure;
|
||||
using OpenAuth.App;
|
||||
using OpenAuth.App.SSO;
|
||||
using OpenAuth.Domain;
|
||||
using OpenAuth.Mvc.Controllers;
|
||||
using OpenAuth.Mvc.WebCtrls.Tree;
|
||||
|
||||
namespace OpenAuth.Mvc.Areas.FlowManage.Controllers
|
||||
{
|
||||
@@ -53,35 +52,6 @@ namespace OpenAuth.Mvc.Areas.FlowManage.Controllers
|
||||
return JsonHelper.Instance.Serialize(WfFrmMainBll.Load(pageCurrent, pageSize));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回表单列表树
|
||||
/// </summary>
|
||||
/// <param name="keyword">关键字</param>
|
||||
/// <returns>返回树形Json</returns>
|
||||
[HttpGet]
|
||||
public ActionResult GetTreeJson()
|
||||
{
|
||||
var data = WfFrmMainBll.GetAllList();
|
||||
var treeList = new List<TreeEntity>();
|
||||
foreach (var item in data)
|
||||
{
|
||||
TreeEntity tree = new TreeEntity
|
||||
{
|
||||
id = item.Id.ToString(),
|
||||
text = item.FrmName,
|
||||
value = item.Id.ToString(),
|
||||
isexpand = true,
|
||||
complete = true,
|
||||
hasChildren = false,
|
||||
parentId = "0",
|
||||
Attribute = "Sort",
|
||||
AttributeValue = "Frm"
|
||||
};
|
||||
|
||||
treeList.Add(tree);
|
||||
}
|
||||
return Content(treeList.TreeToJson());
|
||||
}
|
||||
/// <summary>
|
||||
/// 设置表单
|
||||
/// </summary>
|
||||
@@ -102,7 +72,20 @@ namespace OpenAuth.Mvc.Areas.FlowManage.Controllers
|
||||
public ActionResult GetAllListJson()
|
||||
{
|
||||
var data = WfFrmMainBll.GetAllList();
|
||||
return Content(data.ToJson());
|
||||
|
||||
var result = data.Select(u => new
|
||||
{
|
||||
id = u.Id.ToString(),
|
||||
text = u.FrmName,
|
||||
value = u.Id.ToString(),
|
||||
isexpand = true,
|
||||
complete = true,
|
||||
hasChildren = false,
|
||||
parentId = "0",
|
||||
Attribute = "Sort",
|
||||
AttributeValue = "Frm"
|
||||
});
|
||||
return Content(result.ToJson());
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
@@ -115,7 +115,7 @@
|
||||
//加载左边的树
|
||||
var item = {
|
||||
height: $(window).height() - 87,
|
||||
url: "../../FlowManage/FormDesign/GetTreeJson",
|
||||
url: "../../FlowManage/FormDesign/GetAllListJson",
|
||||
onnodeclick: function (item) {
|
||||
|
||||
frmData.FrmId = item.id;
|
||||
|
@@ -167,8 +167,6 @@
|
||||
</Compile>
|
||||
<Compile Include="Models\AuthenticateAttribute.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="WebCtrls\Tree\TreeEntity.cs" />
|
||||
<Compile Include="WebCtrls\Tree\TreeJson.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="BllScripts\assignModule.js" />
|
||||
|
@@ -1,52 +0,0 @@
|
||||
namespace OpenAuth.Mvc.WebCtrls.Tree
|
||||
{
|
||||
/// <summary>
|
||||
/// wdTree实体
|
||||
/// </summary>
|
||||
public class TreeEntity
|
||||
{
|
||||
public string parentId { get; set; }
|
||||
public string id { get; set; }
|
||||
public string text { get; set; }
|
||||
public string value { get; set; }
|
||||
public int? checkstate { get; set; }
|
||||
public bool showcheck { get; set; }
|
||||
public bool complete { get; set; }
|
||||
/// <summary>
|
||||
/// 是否展开
|
||||
/// </summary>
|
||||
public bool isexpand { get; set; }
|
||||
/// <summary>
|
||||
/// 是否有子节点
|
||||
/// </summary>
|
||||
public bool hasChildren { get; set; }
|
||||
/// <summary>
|
||||
/// 图片
|
||||
/// </summary>
|
||||
public string img { get; set; }
|
||||
/// <summary>
|
||||
/// title
|
||||
/// </summary>
|
||||
public string title { get; set; }
|
||||
/// <summary>
|
||||
/// 级
|
||||
/// </summary>
|
||||
public int? Level { get; set; }
|
||||
/// <summary>
|
||||
/// 自定义属性
|
||||
/// </summary>
|
||||
public string Attribute { get; set; }
|
||||
/// <summary>
|
||||
/// 自定义属性值
|
||||
/// </summary>
|
||||
public string AttributeValue { get; set; }
|
||||
/// <summary>
|
||||
/// 自定义属性A
|
||||
/// </summary>
|
||||
public string AttributeA { get; set; }
|
||||
/// <summary>
|
||||
/// 自定义属性值A
|
||||
/// </summary>
|
||||
public string AttributeValueA { get; set; }
|
||||
}
|
||||
}
|
@@ -1,78 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenAuth.Mvc.WebCtrls.Tree
|
||||
{
|
||||
/// <summary>
|
||||
/// 构造树形Json
|
||||
/// </summary>
|
||||
public static class TreeJson
|
||||
{
|
||||
/// <summary>
|
||||
/// 转换树Json
|
||||
/// </summary>
|
||||
/// <param name="list">数据源</param>
|
||||
/// <param name="ParentId">父节点</param>
|
||||
/// <returns></returns>
|
||||
public static string TreeToJson(this List<TreeEntity> list, string ParentId = "0")
|
||||
{
|
||||
StringBuilder strJson = new StringBuilder();
|
||||
List<TreeEntity> item = list.FindAll(t => t.parentId == ParentId);
|
||||
strJson.Append("[");
|
||||
if (item.Count > 0)
|
||||
{
|
||||
foreach (TreeEntity entity in item)
|
||||
{
|
||||
strJson.Append("{");
|
||||
strJson.Append("\"id\":\"" + entity.id + "\",");
|
||||
if (entity.text != null && !string.IsNullOrEmpty(entity.text))
|
||||
{
|
||||
strJson.Append("\"text\":\"" + entity.text.Replace(" ", "") + "\",");
|
||||
}
|
||||
|
||||
strJson.Append("\"value\":\"" + entity.value + "\",");
|
||||
if (entity.Attribute != null && !string.IsNullOrEmpty(entity.Attribute))
|
||||
{
|
||||
strJson.Append("\"" + entity.Attribute + "\":\"" + entity.AttributeValue + "\",");
|
||||
}
|
||||
if (entity.AttributeA != null && !string.IsNullOrEmpty(entity.AttributeA))
|
||||
{
|
||||
strJson.Append("\"" + entity.AttributeA + "\":\"" + entity.AttributeValueA + "\",");
|
||||
}
|
||||
if (entity.title != null && !string.IsNullOrEmpty(entity.title.Replace(" ", "")))
|
||||
{
|
||||
strJson.Append("\"title\":\"" + entity.title.Replace(" ", "") + "\",");
|
||||
}
|
||||
if (entity.img != null && !string.IsNullOrEmpty(entity.img.Replace(" ", "")))
|
||||
{
|
||||
strJson.Append("\"img\":\"" + entity.img.Replace(" ", "") + "\",");
|
||||
}
|
||||
if (entity.checkstate != null)
|
||||
{
|
||||
strJson.Append("\"checkstate\":" + entity.checkstate + ",");
|
||||
}
|
||||
if (entity.parentId != null)
|
||||
{
|
||||
strJson.Append("\"parentnodes\":\"" + entity.parentId + "\",");
|
||||
}
|
||||
if (entity.Level != null)
|
||||
{
|
||||
strJson.Append("\"Level\":" + entity.Level + ",");
|
||||
}
|
||||
strJson.Append("\"showcheck\":" + entity.showcheck.ToString().ToLower() + ",");
|
||||
strJson.Append("\"isexpand\":" + entity.isexpand.ToString().ToLower() + ",");
|
||||
if (entity.complete == true)
|
||||
{
|
||||
strJson.Append("\"complete\":" + entity.complete.ToString().ToLower() + ",");
|
||||
}
|
||||
strJson.Append("\"hasChildren\":" + entity.hasChildren.ToString().ToLower() + ",");
|
||||
strJson.Append("\"ChildNodes\":" + TreeToJson(list, entity.id) + "");
|
||||
strJson.Append("},");
|
||||
}
|
||||
strJson = strJson.Remove(strJson.Length - 1, 1);
|
||||
}
|
||||
strJson.Append("]");
|
||||
return strJson.ToString();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user