diff --git a/OpenAuth.App/FlowInstanceApp.cs b/OpenAuth.App/FlowInstanceApp.cs index 1cfad14b..c5a4a86f 100644 --- a/OpenAuth.App/FlowInstanceApp.cs +++ b/OpenAuth.App/FlowInstanceApp.cs @@ -316,50 +316,43 @@ namespace OpenAuth.App /// private string GetMakerList(FlowRuntime wfruntime) { - try + string makerList = ""; + if (wfruntime.runtimeModel.nextNodeId == "-1") { - string makerList = ""; - if (wfruntime.runtimeModel.nextNodeId == "-1") + throw (new Exception("无法寻找到下一个节点")); + } + if (wfruntime.runtimeModel.nextNodeType == 0)//如果是会签节点 + { + List _nodelist = wfruntime.GetCountersigningNodeIdList(wfruntime.runtimeModel.nextNodeId); + string _makerList = ""; + foreach (string item in _nodelist) { - throw (new Exception("无法寻找到下一个节点")); - } - if (wfruntime.runtimeModel.nextNodeType == 0)//如果是会签节点 - { - List _nodelist = wfruntime.GetCountersigningNodeIdList(wfruntime.runtimeModel.nextNodeId); - string _makerList = ""; - foreach (string item in _nodelist) + _makerList = GetMakerList(wfruntime.runtimeModel.nodes[item], wfruntime.runtimeModel.flowInstanceId); + if (_makerList == "-1") { - _makerList = GetMakerList(wfruntime.runtimeModel.nodes[item], wfruntime.runtimeModel.flowInstanceId); - if (_makerList == "-1") - { - throw (new Exception("无法寻找到会签节点的审核者,请查看流程设计是否有问题!")); - } - if (_makerList == "1") - { - throw (new Exception("会签节点的审核者不能为所有人,请查看流程设计是否有问题!")); - } - if (makerList != "") - { - makerList += ","; - } - makerList += _makerList; + throw (new Exception("无法寻找到会签节点的审核者,请查看流程设计是否有问题!")); } - } - else - { - makerList = GetMakerList(wfruntime.runtimeModel.nextNode, wfruntime.runtimeModel.flowInstanceId); - if (makerList == "-1") + if (_makerList == "1") { - throw (new Exception("无法寻找到节点的审核者,请查看流程设计是否有问题!")); + throw (new Exception("会签节点的审核者不能为所有人,请查看流程设计是否有问题!")); } + if (makerList != "") + { + makerList += ","; + } + makerList += _makerList; } + } + else + { + makerList = GetMakerList(wfruntime.runtimeModel.nextNode, wfruntime.runtimeModel.flowInstanceId); + if (makerList == "-1") + { + throw (new Exception("无法寻找到节点的审核者,请查看流程设计是否有问题!")); + } + } - return makerList; - } - catch - { - throw; - } + return makerList; } /// /// 寻找该节点执行人 diff --git a/OpenAuth.App/FlowSchemeApp.cs b/OpenAuth.App/FlowSchemeApp.cs index 6fed7a30..ac2ce6df 100644 --- a/OpenAuth.App/FlowSchemeApp.cs +++ b/OpenAuth.App/FlowSchemeApp.cs @@ -28,7 +28,10 @@ namespace OpenAuth.App { UnitWork.Update(u => u.Id == flowScheme.Id, u => new FlowScheme { - //todo:瑕佷慨鏀圭殑 + SchemeContent = flowScheme.SchemeContent, + SchemeName = flowScheme.SchemeName, + ModifyDate = DateTime.Now, + FrmId = flowScheme.FrmId }); } diff --git a/OpenAuth.Mvc/Views/FlowInstances/Edit.cshtml b/OpenAuth.Mvc/Views/FlowInstances/Edit.cshtml index 660c7f98..f90baf3b 100644 --- a/OpenAuth.Mvc/Views/FlowInstances/Edit.cshtml +++ b/OpenAuth.Mvc/Views/FlowInstances/Edit.cshtml @@ -23,7 +23,7 @@
- +
@@ -42,16 +42,25 @@
-
    -
    -
    + +
    +
    +
      +
      +
      +
      +
      +
      +
      + +
      - - + + diff --git a/OpenAuth.Mvc/js/flowlayout.js b/OpenAuth.Mvc/js/flowlayout.js index 10d25d57..2321eb1c 100644 --- a/OpenAuth.Mvc/js/flowlayout.js +++ b/OpenAuth.Mvc/js/flowlayout.js @@ -1,9 +1,9 @@ -锘縧ayui.define(["jquery","layer","bootstrap"], - function(exports) { +锘縧ayui.define(["jquery", "layer", "bootstrap"], + function (exports) { var $ = layui.jquery; var layer = layui.layer; //鍒濆鍖栬璁℃祦绋嬪櫒 - $.fn.flowdesign = function(options) { + $.fn.flowdesign = function (options) { var $frmpreview = $(this); if (!$frmpreview.attr('id')) { return false; @@ -21,11 +21,11 @@ haveGroup: true, useOperStack: true }; - if (options != undefined ) { + if (options != undefined) { $.extend(defaultcnf, options); } - var flowPanel = $.createGooFlow($(this),defaultcnf); + var flowPanel = $.createGooFlow($(this), defaultcnf); flowPanel.setNodeRemarks({ cursor: "閫夋嫨鎸囬拡", direct: "杞崲杩炵嚎", @@ -48,10 +48,93 @@ flowPanel.loadData(options.flowcontent); } - flowPanel.SetNodeEx = function(id, data) { + //瀵煎嚭鏁版嵁鎵╁睍鏂规硶 + //鎵鏈夎妭鐐瑰繀椤绘湁杩涘嚭绾挎 + //蹇呴』鏈夊紑濮嬬粨鏉熻妭鐐癸紙涓斿彧鑳戒负涓涓級 + //鍒嗘祦鍚堟祦鑺傜偣蹇呴』鎴愬鍑虹幇 + //鍒嗘祦鍚堟祦鑺傜偣蹇呴』涓涓瀵瑰簲涓斾腑闂村繀椤绘湁涓斿彧鑳芥湁涓涓櫘閫氳妭鐐 + //鍒嗘祦鑺傜偣涓庡悎娴佽妭鐐逛箣鍓嶇殑瀹℃牳鑺傜偣蹇呴』鏈変笖鍙兘鏈変竴鏉″嚭鍘诲拰杩涙潵鑺傜偣 + flowPanel.exportDataEx = function () { + var data = flowPanel.exportData(); + var fromlines = {}, + tolines = {}, + nodes = {}, + fnodes = [], //浼氱鍒嗘祦鑺傜偣 + hnodes = [], //浼氱鍚堟祦鑺傜偣 + startroundFlag = 0, //寮濮嬭妭鐐规爣璇 + endroundFlag = 0; //缁撴潫鑺傜偣鏍囪瘑 + for (var i in data.lines) { + if (fromlines[data.lines[i].from] == undefined) { + fromlines[data.lines[i].from] = []; + } + fromlines[data.lines[i].from].push(data.lines[i].to); + + if (tolines[data.lines[i].to] == undefined) { + tolines[data.lines[i].to] = []; + } + tolines[data.lines[i].to].push(data.lines[i].from); + } + for (var j in data.nodes) { + var _node = data.nodes[j]; + var _flag = false; + switch (_node.type) { + case "start round mix": + startroundFlag++; + if (fromlines[_node.id] == undefined) { + layer.msg("寮濮嬭妭鐐规棤娉曟祦杞埌涓嬩竴涓妭鐐"); + return -1; + } + break; + case "end round": + endroundFlag++; + if (tolines[_node.id] == undefined) { + layer.msg("鏃犳硶娴佽浆鍒扮粨鏉熻妭鐐"); + return -1; + } + break; + case "node": + if (_node.setInfo == null) { + layer.msg("璇疯缃妭鐐广"+_node.name+"銆戞搷浣滀汉鍛"); + return -1; + } + _flag = true; + break; + case "fork": + _flag = true; + fnodes.push(_node.id); + break; + case "join": + hnodes.push(_node.id); + _flag = true; + break; + default: + layer.msg("鑺傜偣鏁版嵁寮傚父锛"); + return -1; + break; + } + nodes[_node.id] = _node; + } + if (startroundFlag == 0) { + layer.msg("蹇呴』鏈夊紑濮嬭妭鐐"); + return -1; + } + + if (endroundFlag == 0) { + layer.msg("蹇呴』鏈夌粨鏉熻妭鐐"); + return -1; + } + + if (fnodes.length != hnodes.length) { + layer.msg("鍒嗘祦鑺傜偣蹇呴』绛変簬鍚堟祦鑺傜偣"); + return -1; + } + return data; + } + + flowPanel.SetNodeEx = function (id, data) { flowPanel.setName(id, data.NodeName, "node", data); } - flowPanel.SetLineEx = function(id, data) { + flowPanel.SetLineEx = function (id, data) { flowPanel.setName(id, data.LineName, "line", data); } flowPanel.onItemDbClick = function (id, type) { @@ -91,7 +174,7 @@ function (i, item) { $("#" + item.id).css("background", "#999"); if (item.type == "start round mix") { - $("#" + item.id).css("background", "#5cb85c"); + $("#" + item.id).css("background", "#5cb85c"); } else { if (item.id == options.activityId) { $("#" + item.id).css("background", "#5bc0de"); //姝e湪澶勭悊 @@ -107,19 +190,22 @@ } } if (item.setInfo != undefined && item.setInfo.Taged != undefined) { - var _row = '
      '; + var tips = '
      '; var tagname = { "-1": "涓嶉氳繃", "1": "閫氳繃", "0": "椹冲洖" }; - _row += "

      澶勭悊浜猴細" + item.setInfo.UserName + "

      "; - _row += "

      缁撴灉锛" + tagname[item.setInfo.Taged] + "

      "; - _row += "

      澶勭悊鏃堕棿锛" + item.setInfo.TagedTime + "

      "; - _row += "

      澶囨敞锛" + item.setInfo.Description + "

      "; + tips += "

      澶勭悊浜猴細" + item.setInfo.UserName + "

      "; + tips += "

      缁撴灉锛" + tagname[item.setInfo.Taged] + "

      "; + tips += "

      澶勭悊鏃堕棿锛" + item.setInfo.TagedTime + "

      "; + tips += "

      澶囨敞锛" + item.setInfo.Description + "

      "; - $('#' + item.id).attr('data-toggle', 'tooltip'); - $('#' + item.id).attr('data-placement', 'bottom'); - $('#' + item.id).attr('title', _row); + $('#' + item.id).click(function () { + layer.tips(tips, '#' + item.id); + }); + } else { + $('#' + item.id).click(function () { + layer.tips('鏆傛棤澶勭悊淇℃伅', '#' + item.id); + }); } }); - $('[data-toggle="tooltip"]').tooltip({ "html": true }); } if (options.preview == 1) { preview(); @@ -147,7 +233,7 @@ }; var _NodeConfluenceType = { "0": "鎵鏈夋楠ら氳繃", "1": "涓涓楠ら氳繃鍗冲彲", "2": "鎸夌櫨鍒嗘瘮璁$畻" }; $.each(options.flowcontent.nodes, - function(i, item) { + function (i, item) { if (item.setInfo != undefined) { var _popoverhtml = ""; _popoverhtml += @@ -264,7 +350,7 @@ return flowPanel; } - exports('flowlayout'); + exports('flowlayout'); }); diff --git a/OpenAuth.Mvc/userJs/flowSchemeDesign.js b/OpenAuth.Mvc/userJs/flowSchemeDesign.js index 9b56ab07..60f96bbf 100644 --- a/OpenAuth.Mvc/userJs/flowSchemeDesign.js +++ b/OpenAuth.Mvc/userJs/flowSchemeDesign.js @@ -143,7 +143,7 @@ //鎻愪氦鏁版嵁 form.on('submit(formSubmit)', function (data) { - var content = flowDesignPanel.exportData(); + var content = flowDesignPanel.exportDataEx(); if (content == -1) { return false; //闃绘琛ㄥ崟璺宠浆銆 } diff --git a/寤鸿〃&鍒濆鍖栨暟鎹.sql b/寤鸿〃&鍒濆鍖栨暟鎹.sql index 5108cc7e..7c38585c 100644 Binary files a/寤鸿〃&鍒濆鍖栨暟鎹.sql and b/寤鸿〃&鍒濆鍖栨暟鎹.sql differ