You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
117 lines
3.6 KiB
117 lines
3.6 KiB
using NFine.Application.SystemManage;
|
|
using NFine.Code;
|
|
using NFine.Domain.Entity.SystemManage;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Web.Mvc;
|
|
|
|
namespace NFine.Web.Areas.SystemManage.Controllers
|
|
{
|
|
public class ModuleController : ControllerBase
|
|
{
|
|
private ModuleApp moduleApp = new ModuleApp();
|
|
|
|
[HttpGet]
|
|
[HandlerAjaxOnly]
|
|
public ActionResult GetTreeSelectJson()
|
|
{
|
|
var data = moduleApp.GetList();
|
|
var treeList = new List<TreeSelectModel>();
|
|
foreach (ModuleEntity item in data)
|
|
{
|
|
TreeSelectModel treeModel = new TreeSelectModel();
|
|
treeModel.id = item.F_Id;
|
|
treeModel.text = item.F_FullName;
|
|
treeModel.parentId = item.F_ParentId;
|
|
treeList.Add(treeModel);
|
|
}
|
|
return Content(treeList.TreeSelectJson());
|
|
}
|
|
|
|
[HttpGet]
|
|
[HandlerAjaxOnly]
|
|
public ActionResult GetTreeGridJson(string keyword)
|
|
{
|
|
var data = moduleApp.GetList();
|
|
if (!string.IsNullOrEmpty(keyword))
|
|
{
|
|
data = data.TreeWhere(t => t.F_FullName.Contains(keyword));
|
|
}
|
|
var treeList = new List<TreeGridModel>();
|
|
foreach (ModuleEntity item in data)
|
|
{
|
|
TreeGridModel treeModel = new TreeGridModel();
|
|
bool hasChildren = data.Count(t => t.F_ParentId == item.F_Id) == 0 ? false : true;
|
|
treeModel.id = item.F_Id;
|
|
treeModel.isLeaf = hasChildren;
|
|
treeModel.parentId = item.F_ParentId;
|
|
treeModel.expanded = hasChildren;
|
|
treeModel.entityJson = item.ToJson();
|
|
treeList.Add(treeModel);
|
|
}
|
|
return Content(treeList.TreeGridJson());
|
|
}
|
|
|
|
[HttpGet]
|
|
[HandlerAjaxOnly]
|
|
public ActionResult GetFormJson(string keyValue)
|
|
{
|
|
var data = moduleApp.GetForm(keyValue);
|
|
return Content(data.ToJson());
|
|
}
|
|
|
|
[HttpPost]
|
|
[HandlerAjaxOnly]
|
|
[ValidateAntiForgeryToken]
|
|
public ActionResult SubmitForm(ModuleEntity moduleEntity, string keyValue)
|
|
{
|
|
moduleApp.SubmitForm(moduleEntity, keyValue);
|
|
return Success("操作成功。");
|
|
}
|
|
|
|
[HttpPost]
|
|
[HandlerAjaxOnly]
|
|
[HandlerAuthorize]
|
|
[ValidateAntiForgeryToken]
|
|
public ActionResult DeleteForm(string keyValue)
|
|
{
|
|
moduleApp.DeleteForm(keyValue);
|
|
return Success("删除成功。");
|
|
}
|
|
|
|
//获取数据权限详情
|
|
[HttpGet]
|
|
[HandlerAjaxOnly]
|
|
public ActionResult GetCondition(Pagination pagination, string SourceID)
|
|
{
|
|
|
|
DataTable data = moduleApp.GetCondition(SourceID);
|
|
var JsonData = new
|
|
{
|
|
total = pagination.total,
|
|
page = pagination.page,
|
|
records = pagination.records,
|
|
rows = data
|
|
};
|
|
return Content(JsonData.ToJson());
|
|
}
|
|
//保存数据权限
|
|
[HttpPost]
|
|
[HandlerAjaxOnly]
|
|
public ActionResult SetDataAction(string SourceID, string List_Condition)
|
|
{
|
|
try
|
|
{
|
|
moduleApp.SetDataAction(SourceID, List_Condition);
|
|
return Content("操作成功。");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return Content(ex.ToString());
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|