diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_NewWorkFlow/Controllers/NWFProcessController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_NewWorkFlow/Controllers/NWFProcessController.cs index 3a981bd27..4d2563731 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_NewWorkFlow/Controllers/NWFProcessController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_NewWorkFlow/Controllers/NWFProcessController.cs @@ -3,6 +3,7 @@ using Learun.Util; using System.Collections.Generic; using System.Web.Mvc; using Learun.Application.Organization; +using Learun.Application.Base.AuthorizeModule; namespace Learun.Application.Web.Areas.LR_NewWorkFlow.Controllers { @@ -20,6 +21,7 @@ namespace Learun.Application.Web.Areas.LR_NewWorkFlow.Controllers private NWFSchemeIBLL nWFSchemeIBLL = new NWFSchemeBLL(); private NWFTaskIBLL nWFTaskIBLL = new NWFTaskBLL(); private UserIBLL userIbll = new UserBLL(); + private UserRelationIBLL userRelationIBLL = new UserRelationBLL(); #region 视图功能 /// @@ -187,6 +189,15 @@ namespace Learun.Application.Web.Areas.LR_NewWorkFlow.Controllers return View(); } /// + /// 添加审核节点 + /// + /// + [HttpGet] + public ActionResult AddTaskForm() + { + return View(); + } + /// /// 批量审核页面 /// /// @@ -476,9 +487,29 @@ namespace Learun.Application.Web.Areas.LR_NewWorkFlow.Controllers /// [HttpPost] [AjaxOnly] - public ActionResult SaveDraft(string processId, string schemeCode) + public ActionResult SaveDraft(string processId, string schemeCode, string createUserId) { UserInfo userInfo = LoginUserInfo.Get(); + if (!string.IsNullOrEmpty(createUserId) && userInfo.userId != createUserId) + { + var userEntity = userIbll.GetEntityByUserId(createUserId); + userInfo.userId = userEntity.F_UserId; + userInfo.enCode = userEntity.F_EnCode; + userInfo.realName = userEntity.F_RealName; + userInfo.nickName = userEntity.F_NickName; + userInfo.headIcon = userEntity.F_HeadIcon; + userInfo.gender = userEntity.F_Gender; + userInfo.mobile = userEntity.F_Mobile; + userInfo.telephone = userEntity.F_Telephone; + userInfo.email = userEntity.F_Email; + userInfo.oICQ = userEntity.F_OICQ; + userInfo.weChat = userEntity.F_WeChat; + userInfo.companyId = userEntity.F_CompanyId; + userInfo.departmentId = userEntity.F_DepartmentId; + userInfo.openId = userEntity.F_OpenId; + userInfo.isSystem = userEntity.F_SecurityLevel == 1 ? true : false; + } + nWFProcessIBLL.SaveDraft(processId, schemeCode, userInfo); return Success("流程草稿保存成功"); } @@ -505,14 +536,51 @@ namespace Learun.Application.Web.Areas.LR_NewWorkFlow.Controllers /// 流程进程自定义标题 /// 流程进程等级 /// 下一节点审核人 + /// 流程创建人 /// [HttpPost] [AjaxOnly] - public ActionResult CreateFlow(string schemeCode, string processId, string title, int level, string auditors) + public ActionResult CreateFlow(string schemeCode, string processId, string title, int level, string auditors, string createUserId) { UserInfo userInfo = LoginUserInfo.Get(); - nWFProcessIBLL.CreateFlow(schemeCode, processId, title, level, auditors, userInfo); - return Success("流程创建成功"); + if (!string.IsNullOrEmpty(createUserId) && userInfo.userId != createUserId) + { + if (title == null) + { + title = ""; + } + title += "【" + userInfo.realName + "代发】"; + var userEntity = userIbll.GetEntityByUserId(createUserId); + userInfo.userId = userEntity.F_UserId; + userInfo.enCode = userEntity.F_EnCode; + userInfo.realName = userEntity.F_RealName; + userInfo.nickName = userEntity.F_NickName; + userInfo.headIcon = userEntity.F_HeadIcon; + userInfo.gender = userEntity.F_Gender; + userInfo.mobile = userEntity.F_Mobile; + userInfo.telephone = userEntity.F_Telephone; + userInfo.email = userEntity.F_Email; + userInfo.oICQ = userEntity.F_OICQ; + userInfo.weChat = userEntity.F_WeChat; + userInfo.companyId = userEntity.F_CompanyId; + userInfo.departmentId = userEntity.F_DepartmentId; + userInfo.openId = userEntity.F_OpenId; + userInfo.isSystem = userEntity.F_SecurityLevel == 1 ? true : false; + + userInfo.roleIds = userRelationIBLL.GetObjectIds(userEntity.F_UserId, 1); + userInfo.postIds = userRelationIBLL.GetObjectIds(userEntity.F_UserId, 2); + } + try + { + nWFProcessIBLL.CreateFlow(schemeCode, processId, title, level, auditors, userInfo); + return Success("流程创建成功"); + } + catch (System.Exception ex) + { + nWFProcessIBLL.SaveDraft(processId, schemeCode, userInfo); + return Fail(ex.Message); + } + } /// @@ -541,9 +609,18 @@ namespace Learun.Application.Web.Areas.LR_NewWorkFlow.Controllers [AjaxOnly] public ActionResult AgainCreateFlow(string processId) { - UserInfo userInfo = LoginUserInfo.Get(); - nWFProcessIBLL.AgainCreateFlow(processId, userInfo); - return Success("流程重新创建成功"); + try + { + UserInfo userInfo = LoginUserInfo.Get(); + nWFProcessIBLL.AgainCreateFlow(processId, userInfo); + return Success("流程重新创建成功"); + } + catch (System.Exception ex) + { + + return Fail(ex.Message); + } + } /// /// 审批流程 @@ -726,6 +803,22 @@ namespace Learun.Application.Web.Areas.LR_NewWorkFlow.Controllers } } + + /// + /// 添加任务 + /// + /// + /// + /// + /// + [HttpPost] + [AjaxOnly] + public ActionResult AddTask(string processId, string bNodeId, string eNodeId) + { + UserInfo userInfo = LoginUserInfo.Get(); + nWFProcessIBLL.AddTask(processId, bNodeId, eNodeId, userInfo); + return Success("添加成功"); + } #endregion } } \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_NewWorkFlow/Views/NWFProcess/AddTaskForm.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_NewWorkFlow/Views/NWFProcess/AddTaskForm.cshtml new file mode 100644 index 000000000..9a7e2a6a5 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_NewWorkFlow/Views/NWFProcess/AddTaskForm.cshtml @@ -0,0 +1,78 @@ +@{ + ViewBag.Title = "任务添加"; + Layout = "~/Views/Shared/_WorkFlowNewForm.cshtml"; +} + + + +
+
+
+ 开始节点 +
+
+
+
+
+ 审核节点 +
+
+
+
+
+
+ +
+
+
+ +
+
+
+
+
+
+
正在处理
+
已处理
+
未处理
+
+
+
+
+
+
+ +@Html.AppendJsFile("/Areas/LR_NewWorkFlow/Views/NWFProcess/AddTaskForm.js") \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_NewWorkFlow/Views/NWFProcess/AddTaskForm.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_NewWorkFlow/Views/NWFProcess/AddTaskForm.js new file mode 100644 index 000000000..feb210dfc --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_NewWorkFlow/Views/NWFProcess/AddTaskForm.js @@ -0,0 +1,235 @@ +var processId = request('processId'); // 流程实例主键 +var acceptClick; + +var bootstrap = function ($, learun) { + "use strict"; + console.log('test') + + var schemeObj; + var history; + var currentIds; + var page = { + nodeMap: {}, + init: function () { + $('#lr_form_tabs').lrFormTab(); + $('#wf_shcemeinfo').lrworkflow({ + isPreview: true, + openNode: function (node) { + top.wflookNode = node; + if (node.history) { + learun.layerForm({ + id: 'LookNodeForm', + title: '审批记录查看【' + node.name + '】', + url: top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/LookNodeForm', + width: 600, + height: 400, + btn: null + }); + } + } + }); + + + $('#bNodeId').lrselect({ + title: 'name', + text: 'name', + value: 'id', + allowSearch: true + }); + + $('#eNodeId').lrselect({ + title: 'name', + text: 'name', + value: 'id', + allowSearch: true + }); + + learun.httpAsync('GET', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/GetProcessDetails', { processId: processId }, function (data) { + console.log(data) + if (data) { + console.log(data) + + var info = data.info; + page.taskInfo = data.task; + + schemeObj = JSON.parse(info.Scheme); + history = info.TaskLogList; + currentIds = info.CurrentNodeIds; + + page.loadFlowInfo(); + page.loadTimeLine(); + + + $('#bNodeId').lrselectRefresh({ data: schemeObj.nodes }) + $('#eNodeId').lrselectRefresh({ data: schemeObj.nodes }) + } + }); + } + ,loadFlowInfo: function () { + learun.clientdata.getAllAsync('department', { + callback: function (departmentMap) { + learun.clientdata.getAllAsync('user', { + callback: function (userMap) { + var nodeInfoes = {}; + // 当前节点处理人信息 + $.each(page.taskInfo, function (_index, _item) { + var nameList = []; + $.each(_item.nWFUserInfoList, function (_jindex, _jitem) { + if (userMap[_jitem.Id]) { + var name = userMap[_jitem.Id].name; + var _department = departmentMap[userMap[_jitem.Id].departmentId]; + if (_department) { + name = '【' + _department.name + '】' + name; + } + + nameList.push(name); + } + }); + var point = { + namelist: String(nameList) + } + nodeInfoes[_item.F_NodeId] = nodeInfoes[_item.F_NodeId] || []; + nodeInfoes[_item.F_NodeId].push(point); + }); + // 初始化工作流节点历史处理信息 + $.each(history, function (id, item) { + nodeInfoes[item.F_NodeId] = nodeInfoes[item.F_NodeId] || []; + nodeInfoes[item.F_NodeId].push(item); + }); + + var strcurrentIds = String(currentIds); + $.each(schemeObj.nodes, function (_index, _item) {//0正在处理 1 已处理同意 2 已处理不同意 3 未处理 + _item.state = '3'; + if (nodeInfoes[_item.id]) { + _item.history = nodeInfoes[_item.id]; + _item.state = '1'; + } + if (strcurrentIds.indexOf(_item.id) > -1) { + _item.state = '0'; + } + if (_item.isAllAuditor == "2") { + _item.name += '
【多人审核:'; + + if (_item.auditorType == "1") { + _item.name += '并行】'; + } + else { + _item.name += '串行】'; + } + } + page.nodeMap[_item.id] = _item; + }); + + $('#wf_shcemeinfo').lrworkflowSet('set', { data: schemeObj }); + } + }); + } + }); + }, + loadTimeLine: function () { + var nodelist = []; + learun.clientdata.getAllAsync('department', { + callback: function (departmentMap) { + learun.clientdata.getAllAsync('user', { + callback: function (userMap) { + for (var i = 0, l = history.length; i < l; i++) { + var item = history[i]; + + + var name = (item.F_CreateUserName || '系统处理') + ':'; + if (item.F_CreateUserId && userMap[item.F_CreateUserId]) { + var _department = departmentMap[userMap[item.F_CreateUserId].departmentId]; + if (_department) { + name = '【' + _department.name + '】' + name; + } + } + + + //F_TaskType //0创建1审批2传阅3加签审核4子流程5重新创建6.超时流转7会签审核8加签9催办10超时提醒 + var content = item.F_OperationName; + if (item.F_Des) { + content += '【审批意见】' + item.F_Des; + } + var nodeName = ''; + if (item.F_NodeId && page.nodeMap[item.F_NodeId]) { + nodeName = page.nodeMap[item.F_NodeId].name; + } + var point = { + title: item.F_NodeName || nodeName, + people: name, + content: content, + time: item.F_CreateDate + }; + + if (item.F_TaskType == 0 || item.F_TaskType == 1 || item.F_TaskType == 3 || item.F_TaskType == 5 || item.F_TaskType == 6 || item.F_TaskType == 8) { + // 查看表单 + point.content = content + '  查看表单'; + point.nodeId = item.F_NodeId; + point.processId = item.F_ProcessId; + point.callback = function (data) { + top['lrwfschemeObj'] = schemeObj; + + + learun.layerForm({ + id: 'MonitorForm', + title: '表单查看-' + data.title, + url: top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/MonitorForm?nodeId=' + data.nodeId + '&processId=' + data.processId, + width: 800, + height: 700, + maxmin: true, + btn: null + }); + } + } + else if (item.F_OperationCode == 'createChild' || item.F_OperationCode == 'againCreateChild') { + point.content = content + '  查看子流程'; + point.nodeId = item.F_NodeId; + point.processId = item.F_ProcessId; + point.callback = function (data) { + learun.layerForm({ + id: 'MonitorDetailsIndex', + title: '子流程查看', + url: top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/MonitorDetailsIndex?processId=' + data.processId + "&nodeId=" + data.nodeId, + width: 1000, + height: 900, + maxmin: true, + btn: null + }); + } + } + + + + nodelist.push(point); + } + $('#wf_timeline').lrtimeline(nodelist); + } + }); + } + }); + + + + + } + }; + // 保存数据 + acceptClick = function (callBack) { + + if (!$('#form1').lrValidform()) { + return false; + } + var formData = $('#form1').lrGetFormData(); + if (formData.bNodeId == formData.eNodeId) { + learun.alert.error("开始和审核节点不能一样!"); + } + formData.processId = processId; + $.lrSaveForm(top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/AddTask', formData, function (res) { + // 保存成功后才回调 + callBack && callBack(); + }); + console.log(formData) + + }; + page.init(); +} \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_NewWorkFlow/Views/NWFProcess/MonitorIndex.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_NewWorkFlow/Views/NWFProcess/MonitorIndex.cshtml index a7d1d1256..4fbaf412a 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_NewWorkFlow/Views/NWFProcess/MonitorIndex.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_NewWorkFlow/Views/NWFProcess/MonitorIndex.cshtml @@ -34,6 +34,7 @@ diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_NewWorkFlow/Views/NWFProcess/MonitorIndex.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_NewWorkFlow/Views/NWFProcess/MonitorIndex.js index 7d5c124d5..c811244ff 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_NewWorkFlow/Views/NWFProcess/MonitorIndex.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_NewWorkFlow/Views/NWFProcess/MonitorIndex.js @@ -91,6 +91,24 @@ var bootstrap = function ($, learun) { }); } }); + // 添加审核节点 + $('#lr_add').on('click', function () { + var processId = $('#gridtable').jfGridValue('F_Id') || ''; + if (learun.checkrow(processId)) { + learun.layerForm({ + id: 'AppointForm', + title: '添加审核节点', + url: top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/AddTaskForm?processId=' + processId, + height: 500, + width: 800, + callBack: function (id) { + return top[id].acceptClick(function () { + $('#gridtable').jfGridSet('reload'); + }); + } + }); + } + }); }, initleft: function () { $('#lr_left_list li').on('click', function () { diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_NewWorkFlow/Views/NWFProcess/NWFContainerForm.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_NewWorkFlow/Views/NWFProcess/NWFContainerForm.cshtml index dd82ba36c..b4498a4ff 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_NewWorkFlow/Views/NWFProcess/NWFContainerForm.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_NewWorkFlow/Views/NWFProcess/NWFContainerForm.cshtml @@ -7,38 +7,85 @@ } @Html.AppendCssFile("/Areas/LR_NewWorkFlow/Views/NWFProcess/NWFContainerForm.css")
-