OpenAuth.Net/OpenAuth.Mvc/Areas/FlowManage/Controllers/FormDesignController.cs

147 lines
4.0 KiB
C#
Raw Normal View History

2017-01-13 19:26:36 +08:00
using System;
using System.Collections.Generic;
using System.Web.Mvc;
using Infrastructure;
2017-02-06 00:12:11 +08:00
using OpenAuth.App;
2017-02-06 23:17:51 +08:00
using OpenAuth.App.SSO;
using OpenAuth.Domain;
using OpenAuth.Mvc.Controllers;
2017-05-07 20:26:00 +08:00
using OpenAuth.Mvc.WebCtrls.Tree;
2017-01-13 19:26:36 +08:00
namespace OpenAuth.Mvc.Areas.FlowManage.Controllers
{
public class FormDesignController : BaseController
2017-01-13 19:26:36 +08:00
{
public WFFormService WfFrmMainBll { get; set; }
2017-01-13 19:26:36 +08:00
#region
/// <summary>
/// 管理
/// </summary>
/// <returns></returns>
[HttpGet]
public ActionResult Index()
{
return View();
}
2017-02-07 11:36:26 +08:00
2017-01-13 19:26:36 +08:00
/// <summary>
/// 预览表单
/// </summary>
/// <returns></returns>
[HttpGet]
public ActionResult FormPreview()
{
return View();
}
/// <summary>
/// 创建表单
/// </summary>
/// <returns></returns>
[HttpGet]
public ActionResult FrmBuider()
{
return View();
2017-02-06 00:12:11 +08:00
}
2017-01-13 19:26:36 +08:00
#endregion
2017-02-06 00:12:11 +08:00
2017-01-13 19:26:36 +08:00
#region
2017-02-06 00:12:11 +08:00
public string Load(int pageCurrent = 1, int pageSize = 30)
{
return JsonHelper.Instance.Serialize(WfFrmMainBll.Load(pageCurrent, pageSize));
2017-02-06 00:12:11 +08:00
}
2017-01-13 19:26:36 +08:00
/// <summary>
2017-03-22 00:09:03 +08:00
/// 返回表单列表树
2017-01-13 19:26:36 +08:00
/// </summary>
/// <param name="keyword">关键字</param>
/// <returns>返回树形Json</returns>
[HttpGet]
public ActionResult GetTreeJson()
{
var data = WfFrmMainBll.GetAllList();
2017-01-13 19:26:36 +08:00
var treeList = new List<TreeEntity>();
foreach (var item in data)
{
2017-03-22 00:09:03 +08:00
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"
};
2017-01-13 19:26:36 +08:00
treeList.Add(tree);
}
return Content(treeList.TreeToJson());
}
/// <summary>
/// 设置表单
/// </summary>
/// <param name="keyValue">主键</param>
/// <returns></returns>
[HttpGet]
public ActionResult GetFormJson(Guid keyValue)
{
var data = WfFrmMainBll.GetForm(keyValue);
2017-01-13 19:26:36 +08:00
return Content(data.ToJson());
}
2017-01-23 18:25:24 +08:00
/// <summary>
/// 获取表单数据all
/// </summary>
/// <returns></returns>
[HttpGet]
public ActionResult GetAllListJson()
{
var data = WfFrmMainBll.GetAllList();
2017-01-23 18:25:24 +08:00
return Content(data.ToJson());
}
2017-01-13 19:26:36 +08:00
#endregion
#region
/// <summary>
/// 删除表单模板
/// </summary>
/// <param name="ids">主键值</param>
2017-01-13 19:26:36 +08:00
/// <returns></returns>
[HttpPost]
2017-02-07 11:36:26 +08:00
public string RemoveForm(Guid[] ids)
2017-01-13 19:26:36 +08:00
{
WfFrmMainBll.RemoveForm(ids);
2017-02-07 11:36:26 +08:00
return Result.ToJson();
2017-01-13 19:26:36 +08:00
}
///// <summary>
///// 保存用户表单(新增、修改)
///// </summary>
///// <param name="keyValue">主键值</param>
///// <param name="userEntity">用户实体</param>
///// <returns></returns>
2017-02-06 23:17:51 +08:00
[HttpPost]
public string SaveForm(string keyValue, WFFrmMain userEntity)
{
try
{
var user = AuthUtil.GetCurrentUser();
userEntity.ModifyUserId = user.User.Account;
userEntity.ModifyUserName = user.User.Name;
WfFrmMainBll.SaveForm(keyValue, userEntity);
2017-02-06 23:17:51 +08:00
}
catch (Exception e)
{
Result.Status = false;
Result.Message = e.Message;
}
return Result.ToJson();
}
2017-01-13 19:26:36 +08:00
#endregion
}
}