using Learun.Application.WorkFlow;
using Learun.Util;
using System.Collections.Generic;
using System.Web.Mvc;
namespace Learun.Application.Web.Areas.LR_WorkFlowModule.Controllers
{
///
/// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
/// Copyright (c) 2013-2018 北京泉江科技有限公司
/// 创建人:陈彬彬
/// 日 期:2017.04.17
/// 描 述:工作流模板处理
///
public class WfSchemeController : MvcControllerBase
{
private WfSchemeIBLL wfSchemeIBLL = new WfSchemeBLL();
#region 视图功能
///
/// 流程模板管理
///
///
[HttpGet]
public ActionResult Index()
{
return View();
}
///
/// 流程模板设计
///
///
[HttpGet]
public ActionResult Form()
{
return View();
}
///
/// 流程模板设计历史记录
///
///
[HttpGet]
public ActionResult HistoryForm()
{
return View();
}
///
/// 预览流程模板
///
///
[HttpGet]
public ActionResult PreviewForm()
{
return View();
}
///
/// 节点信息设置
///
///
[HttpGet]
public ActionResult NodeForm()
{
return View();
}
#region 审核人员添加
///
/// 添加岗位
///
///
[HttpGet]
public ActionResult PostForm()
{
return View();
}
///
/// 添加角色
///
///
[HttpGet]
public ActionResult RoleForm()
{
return View();
}
///
/// 添加用户
///
///
[HttpGet]
public ActionResult UserForm()
{
return View();
}
#endregion
#region 表单添加
///
/// 表单添加
///
///
[HttpGet]
public ActionResult WorkformForm()
{
return View();
}
#endregion
#region 表单权限设置
///
/// 权限添加
///
///
[HttpGet]
public ActionResult AuthorizeForm()
{
return View();
}
#endregion
#region 条件字段
///
/// 条件字段添加
///
///
[HttpGet]
public ActionResult ConditionFieldForm()
{
return View();
}
///
/// 字段选择
///
///
[HttpGet]
public ActionResult FieldSelectForm()
{
return View();
}
#endregion
///
/// 线段信息设置
///
///
[HttpGet]
public ActionResult LineForm()
{
return View();
}
#endregion
#region 获取数据
///
/// 获取分页数据
///
/// 分页参数
/// 关键字
///
[HttpGet]
[AjaxOnly]
public ActionResult GetSchemeInfoPageList(string pagination, string keyword, string category)
{
Pagination paginationobj = pagination.ToObject();
var data = wfSchemeIBLL.GetSchemeInfoPageList(paginationobj, keyword, category);
var jsonData = new
{
rows = data,
total = paginationobj.total,
page = paginationobj.page,
records = paginationobj.records,
};
return JsonResult(jsonData);
}
///
/// 获取自定义流程列表
///
///
[HttpGet]
[AjaxOnly]
public ActionResult GetCustmerSchemeInfoList()
{
UserInfo userInfo = LoginUserInfo.Get();
var data = wfSchemeIBLL.GetCustmerSchemeInfoList(userInfo);
return JsonResult(data);
}
///
/// 获取设计表单数据
///
/// 主键
///
[HttpGet]
[AjaxOnly]
public ActionResult GetFormData(string schemeCode)
{
WfSchemeInfoEntity schemeInfoEntity = wfSchemeIBLL.GetWfSchemeInfoEntityByCode(schemeCode);
if (schemeInfoEntity == null) {
return JsonResult(new { });
}
WfSchemeEntity schemeEntity = wfSchemeIBLL.GetWfSchemeEntity(schemeInfoEntity.F_SchemeId);
var wfSchemeAuthorizeList = wfSchemeIBLL.GetWfSchemeAuthorizeList(schemeInfoEntity.F_Id);
var jsonData = new
{
schemeInfoEntity = schemeInfoEntity,
schemeEntity = schemeEntity,
wfSchemeAuthorizeList = wfSchemeAuthorizeList
};
return JsonResult(jsonData);
}
///
/// 获取模板分页数据
///
/// 分页参数
///
///
[HttpGet]
[AjaxOnly]
public ActionResult GetSchemePageList(string pagination, string schemeInfoId)
{
Pagination paginationobj = pagination.ToObject();
var data = wfSchemeIBLL.GetSchemePageList(paginationobj, schemeInfoId);
var jsonData = new
{
rows = data,
total = paginationobj.total,
page = paginationobj.page,
records = paginationobj.records,
};
return JsonResult(jsonData);
}
///
/// 获取流程模板数据
///
/// 模板主键
///
[HttpGet]
[AjaxOnly]
public ActionResult GetScheme(string schemeId)
{
var data = wfSchemeIBLL.GetWfSchemeEntity(schemeId);
return JsonResult(data);
}
#endregion
#region 提交数据
///
/// 保存流程模板
///
/// 主键
/// 表单设计模板信息
/// 模板权限信息
/// 模板内容
/// 类型1.正式2.草稿
///
[HttpPost]
[ValidateAntiForgeryToken]
[AjaxOnly]
public ActionResult SaveForm(string keyValue, string schemeInfo, string shcemeAuthorize, string scheme, int type)
{
WfSchemeInfoEntity schemeInfoEntity = schemeInfo.ToObject();
List wfSchemeAuthorizeList = shcemeAuthorize.ToObject>();
WfSchemeEntity schemeEntity = new WfSchemeEntity();
schemeEntity.F_Scheme = scheme;
schemeEntity.F_Type = type;
wfSchemeIBLL.SaveEntity(keyValue, schemeInfoEntity, schemeEntity, wfSchemeAuthorizeList);
return Success("保存成功!");
}
///
/// 删除模板数据
///
/// 主键
///
[HttpPost]
[AjaxOnly]
public ActionResult DeleteForm(string keyValue)
{
wfSchemeIBLL.VirtualDelete(keyValue);
return Success("删除成功!");
}
///
/// 启用/停用表单
///
/// 主键
/// 状态1启用0禁用
///
[HttpPost]
[AjaxOnly]
public ActionResult UpDateSate(string keyValue, int state)
{
wfSchemeIBLL.UpdateState(keyValue, state);
return Success((state == 1 ? "启用" : "禁用") + "成功!");
}
///
/// 更新表单模板版本
///
/// 主键
/// 状态1启用0禁用
///
[HttpPost]
[AjaxOnly]
public ActionResult UpdateScheme(string schemeInfoId, string schemeId)
{
wfSchemeIBLL.UpdateScheme(schemeInfoId, schemeId);
return Success("更新成功!");
}
#endregion
}
}