|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458 |
- using Learun.Application.Base.SystemModule;
- using Learun.Application.WorkFlow;
- using Learun.Util;
- using System;
- using System.Collections.Generic;
- using System.Web.Mvc;
-
- namespace Learun.Application.Web.Areas.LR_NewWorkFlow.Controllers
- {
- /// <summary>
- /// 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架
- /// Copyright (c) 2013-2018 上海力软信息技术有限公司
- /// 创建人:力软-框架开发组
- /// 日 期:2018.12.06
- /// 描 述:工作流模板(新)
- /// </summary>
- public class NWFSchemeController : MvcControllerBase
- {
- private NWFSchemeIBLL nWFSchemeIBLL = new NWFSchemeBLL();
- private AnnexesFileIBLL annexesFileIBLL = new AnnexesFileBLL();
-
-
- #region 视图功能
- /// <summary>
- /// 主页面
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult Index()
- {
- return View();
- }
- /// <summary>
- /// 表单页面
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult Form()
- {
- return View();
- }
- /// <summary>
- /// 流程模板设计历史记录
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult HistoryForm()
- {
- return View();
- }
- /// <summary>
- /// 预览流程模板
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult PreviewForm()
- {
- return View();
- }
-
-
- /// <summary>
- /// 节点信息设置
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult NodeForm()
- {
- return View();
- }
- #region 审核人员添加
- /// <summary>
- /// 添加岗位
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult PostForm()
- {
- return View();
- }
- /// <summary>
- /// 添加角色
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult RoleForm()
- {
- return View();
- }
- /// <summary>
- /// 添加用户
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult UserForm()
- {
- return View();
- }
- /// <summary>
- /// 添加上下级
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult LevelForm()
- {
- return View();
- }
- /// <summary>
- /// 添加某节点执行人
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult AuditorNodeForm()
- {
- return View();
- }
- /// <summary>
- /// 添加表单字段
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult AuditorFieldForm()
- {
- return View();
- }
- #endregion
-
- #region 表单添加
- /// <summary>
- /// 表单添加
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult WorkformForm()
- {
- return View();
- }
- #endregion
-
- #region 条件字段
- /// <summary>
- /// 条件字段添加
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult ConditionFieldForm()
- {
- return View();
- }
- #endregion
-
- #region 按钮设置
- /// <summary>
- /// 表单添加
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult ButtonForm()
- {
- return View();
- }
- #endregion
-
-
- /// <summary>
- /// 线段信息设置
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult LineForm()
- {
- return View();
- }
-
-
- /// <summary>
- /// 导入页面
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult ImportForm()
- {
- return View();
- }
- #endregion
-
- #region 获取数据
- /// <summary>
- /// 获取分页数据
- /// </summary>
- /// <param name="pagination">分页参数</param>
- /// <param name="queryJson">查询条件</param>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetInfoPageList(string pagination, string queryJson)
- {
- Pagination paginationobj = pagination.ToObject<Pagination>();
- var data = nWFSchemeIBLL.GetInfoPageList(paginationobj, queryJson);
- var jsonData = new
- {
- rows = data,
- total = paginationobj.total,
- page = paginationobj.page,
- records = paginationobj.records,
- };
- return Success(jsonData);
- }
- /// <summary>
- /// 获取流程列表
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetList()
- {
- var data = nWFSchemeIBLL.GetInfoList();
- return Success(data);
- }
-
- /// <summary>
- /// 获取自定义流程列表
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetMyInfoList()
- {
- UserInfo userInfo = LoginUserInfo.Get();
- var data = nWFSchemeIBLL.GetInfoList(userInfo);
- return Success(data);
- }
- /// <summary>
- /// 获取自定义流程列表
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetMyInfoListHasImg()
- {
- UserInfo userInfo = LoginUserInfo.Get();
- var data = nWFSchemeIBLL.GetInfoList(userInfo);
- foreach (var item in data)
- {
- var annexes = annexesFileIBLL.GetEntityByFolderId(item.imgUrl);
- if (null != annexes)
- {
- item.imgUrl = "\\"+ annexes.F_FilePath.Substring(annexes.F_FilePath.IndexOf("Resource"));
- }
- else
- {
- item.imgUrl = null;
- }
- }
- return Success(data);
- }
- /// <summary>
- /// 获取流程模板数据
- /// </summary>
- /// <param name="code">流程编码</param>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetFormData(string code)
- {
- NWFSchemeInfoEntity schemeInfoEntity = nWFSchemeIBLL.GetInfoEntityByCode(code);
- if (schemeInfoEntity == null)
- {
- return Success(new { });
- }
-
- NWFSchemeEntity schemeEntity = nWFSchemeIBLL.GetSchemeEntity(schemeInfoEntity.F_SchemeId);
- var nWFSchemeAuthList = nWFSchemeIBLL.GetAuthList(schemeInfoEntity.F_Id);
- var jsonData = new
- {
- info = schemeInfoEntity,
- scheme = schemeEntity,
- authList = nWFSchemeAuthList
- };
- return Success(jsonData);
- }
-
- /// <summary>
- /// 获取模板分页数据
- /// </summary>
- /// <param name="pagination">分页参数</param>
- /// <param name="schemeInfoId"></param>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetSchemePageList(string pagination, string schemeInfoId)
- {
- Pagination paginationobj = pagination.ToObject<Pagination>();
- var data = nWFSchemeIBLL.GetSchemePageList(paginationobj, schemeInfoId);
- var jsonData = new
- {
- rows = data,
- total = paginationobj.total,
- page = paginationobj.page,
- records = paginationobj.records,
- };
- return Success(jsonData);
- }
- /// <summary>
- /// 获取流程模板数据
- /// </summary>
- /// <param name="schemeId">模板主键</param>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetScheme(string schemeId)
- {
- var data = nWFSchemeIBLL.GetSchemeEntity(schemeId);
- return Success(data);
- }
-
- /// <summary>
- /// 获取流程模板数据
- /// </summary>
- /// <param name="code">流程编码</param>
- /// <returns></returns>
- [HttpPost, ValidateInput(false)]
- public void ExportScheme(string code)
- {
- NWFSchemeInfoEntity schemeInfoEntity = nWFSchemeIBLL.GetInfoEntityByCode(code);
- if (schemeInfoEntity != null)
- {
- NWFSchemeEntity schemeEntity = nWFSchemeIBLL.GetSchemeEntity(schemeInfoEntity.F_SchemeId);
- var nWFSchemeAuthList = nWFSchemeIBLL.GetAuthList(schemeInfoEntity.F_Id);
- var jsonData = new
- {
- info = schemeInfoEntity,
- scheme = schemeEntity,
- authList = nWFSchemeAuthList
- };
-
- string data = jsonData.ToJson();
-
- FileDownHelper.DownLoadString(data, schemeInfoEntity.F_Name + ".lrscheme");
- }
- }
-
- /// <summary>
- /// excel文件导入(通用)
- /// </summary>
- /// <param name="templateId">模板Id</param>
- /// <param name="fileId">文件主键</param>
- /// <param name="chunks">分片数</param>
- /// <param name="ext">文件扩展名</param>
- /// <returns></returns>
- [HttpPost]
- [ValidateAntiForgeryToken]
- public ActionResult ExecuteImportScheme(string templateId, string fileId, int chunks, string ext)
- {
- UserInfo userInfo = LoginUserInfo.Get();
- string path = annexesFileIBLL.SaveAnnexes(fileId, fileId + "." + ext, chunks, userInfo);
- if (!string.IsNullOrEmpty(path))
- {
- // 读取导入文件
- string data = DirFileHelper.ReadText(path);
- // 删除临时文件
- DirFileHelper.DeleteFile2(path);
- if (!string.IsNullOrEmpty(data))
- {
- NWFSchemeModel nWFSchemeModel = data.ToObject<NWFSchemeModel>();
- // 验证流程编码是否重复
- NWFSchemeInfoEntity schemeInfoEntityTmp = nWFSchemeIBLL.GetInfoEntityByCode(nWFSchemeModel.info.F_Code);
- if (schemeInfoEntityTmp != null)
- {
- nWFSchemeModel.info.F_Code = Guid.NewGuid().ToString();
- }
- nWFSchemeIBLL.SaveEntity("", nWFSchemeModel.info, nWFSchemeModel.scheme, nWFSchemeModel.authList);
-
- }
- return Success("导入成功");
- }
- else
- {
- return Fail("导入模板失败!");
- }
- }
- #endregion
-
- #region 提交数据
- /// <summary>
- /// 保存流程模板
- /// </summary>
- /// <param name="keyValue">主键</param>
- /// <param name="schemeInfo">表单设计模板信息</param>
- /// <param name="shcemeAuth">模板权限信息</param>
- /// <param name="scheme">模板内容</param>
- /// <param name="type">类型1.正式2.草稿</param>
- /// <returns></returns>
- [HttpPost]
- [ValidateAntiForgeryToken]
- [AjaxOnly]
- public ActionResult SaveForm(string keyValue, string schemeInfo, string shcemeAuth, string scheme, int type)
- {
- NWFSchemeInfoEntity schemeInfoEntity = schemeInfo.ToObject<NWFSchemeInfoEntity>();
- List<NWFSchemeAuthEntity> nWFSchemeAuthList = shcemeAuth.ToObject<List<NWFSchemeAuthEntity>>();
- NWFSchemeEntity schemeEntity = new NWFSchemeEntity();
- schemeEntity.F_Content = scheme;
- schemeEntity.F_Type = type;
-
- // 验证流程编码是否重复
- NWFSchemeInfoEntity schemeInfoEntityTmp = nWFSchemeIBLL.GetInfoEntityByCode(schemeInfoEntity.F_Code);
- if (schemeInfoEntityTmp != null && schemeInfoEntityTmp.F_Id != keyValue)
- {
- return Fail("流程编码重复");
- }
-
- nWFSchemeIBLL.SaveEntity(keyValue, schemeInfoEntity, schemeEntity, nWFSchemeAuthList);
- return Success("保存成功!");
- }
- /// <summary>
- /// 删除模板数据
- /// </summary>
- /// <param name="keyValue">主键</param>
- /// <returns></returns>
- [HttpPost]
- [AjaxOnly]
- public ActionResult DeleteForm(string keyValue)
- {
- nWFSchemeIBLL.DeleteEntity(keyValue);
- return Success("删除成功!");
- }
-
- /// <summary>
- /// 启用/停用表单
- /// </summary>
- /// <param name="keyValue">主键</param>
- /// <param name="state">状态1启用0禁用</param>
- /// <returns></returns>
- [HttpPost]
- [AjaxOnly]
- public ActionResult UpDateSate(string keyValue, int state)
- {
- nWFSchemeIBLL.UpdateState(keyValue, state);
- return Success((state == 1 ? "启用" : "禁用") + "成功!");
- }
- /// <summary>
- /// 更新表单模板版本
- /// </summary>
- /// <param name="keyValue">主键</param>
- /// <param name="state">状态1启用0禁用</param>
- /// <returns></returns>
- [HttpPost]
- [AjaxOnly]
- public ActionResult UpdateScheme(string schemeInfoId, string schemeId)
- {
- nWFSchemeIBLL.UpdateScheme(schemeInfoId, schemeId);
- return Success("更新成功!");
- }
- #endregion
-
-
- }
- }
|