From 02742c5ad4ac7eedeb0d92f56121ef42f8efc462 Mon Sep 17 00:00:00 2001 From: yubaolee Date: Mon, 27 Feb 2017 18:56:02 +0800 Subject: [PATCH] add flow run user --- OpenAuth.App/Extention/WF_Runtime.cs | 8 +- .../Controllers/FlowDesignController.cs | 44 ++----- .../Views/FlowDesign/FlowNodeForm.cshtml | 111 +++++++++--------- .../Views/FlowDesign/FlowSchemeBuider.cshtml | 65 +++++++++- .../FlowInstances/ProcessLookForm.cshtml | 25 ---- OpenAuth.Mvc/Views/Shared/_FlowForm.cshtml | 6 +- 数据库设计关系图/OpenAuthDB.pdm | 4 +- 7 files changed, 137 insertions(+), 126 deletions(-) diff --git a/OpenAuth.App/Extention/WF_Runtime.cs b/OpenAuth.App/Extention/WF_Runtime.cs index ff0e5fef..87258890 100644 --- a/OpenAuth.App/Extention/WF_Runtime.cs +++ b/OpenAuth.App/Extention/WF_Runtime.cs @@ -591,14 +591,16 @@ namespace OpenAuth.App.Extention { MakeTagNode(_nextNodeId, -1, userId); } - else if (res != "1") + else if (res != "1") //则时res是会签结束节点的ID { MakeTagNode(_nextNodeId, 1, userId); + _runtimeModel.nextNodeId = res; + _runtimeModel.nextNodeType = GetNodeStatus(res); } else { - _runtimeModel.nextNodeId = res; - _runtimeModel.nextNodeType = GetNodeStatus(res); + _runtimeModel.nextNodeId = _nextNodeId; + _runtimeModel.nextNodeType = GetNodeStatus(_nextNodeId); } return res; } diff --git a/OpenAuth.Mvc/Areas/FlowManage/Controllers/FlowDesignController.cs b/OpenAuth.Mvc/Areas/FlowManage/Controllers/FlowDesignController.cs index 1f26087d..ad687844 100644 --- a/OpenAuth.Mvc/Areas/FlowManage/Controllers/FlowDesignController.cs +++ b/OpenAuth.Mvc/Areas/FlowManage/Controllers/FlowDesignController.cs @@ -7,6 +7,7 @@ using Infrastructure; using LeaRun.Util.WebControl; using OpenAuth.App; using OpenAuth.App.SSO; +using OpenAuth.App.ViewModel; using OpenAuth.Domain; using OpenAuth.Domain.Service; using OpenAuth.Mvc.Controllers; @@ -181,48 +182,17 @@ namespace OpenAuth.Mvc.Areas.FlowManage.Controllers var treeList = new List(); string companyid = ""; string departmentid = ""; - foreach (DataRow item in data.rows) + foreach (UserView item in data.rows) { TreeEntity tree = new TreeEntity(); - if (companyid != item["OrganizeId"].ToString()) - { - TreeEntity tree1 = new TreeEntity(); - companyid = item["OrganizeId"].ToString(); - tree1.id = item["OrganizeId"].ToString(); - tree1.text = item["OrganizeName"].ToString(); - tree1.value = item["OrganizeId"].ToString(); - tree1.isexpand = true; - tree1.complete = true; - tree1.hasChildren = true; - tree1.Attribute = "Sort"; - tree1.AttributeValue = "Organize"; - tree1.parentId = "0"; - tree1.img = "fa fa-home"; - treeList.Add(tree1); - } - if (departmentid != item["DepartmentId"].ToString() && !string.IsNullOrEmpty(item["DepartmentId"].ToString())) - { - TreeEntity tree1 = new TreeEntity(); - departmentid = item["DepartmentId"].ToString(); - tree1.id = item["DepartmentId"].ToString(); - tree1.text = item["DepartmentName"].ToString(); - tree1.value = item["DepartmentId"].ToString(); - tree1.isexpand = false; - tree1.complete = true; - tree1.hasChildren = true; - tree1.Attribute = "Sort"; - tree1.AttributeValue = "Department"; - tree1.parentId = item["OrganizeId"].ToString(); - tree1.img = "fa fa-umbrella"; - treeList.Add(tree1); - } - tree.id = item["UserId"].ToString(); - tree.text = item["RealName"].ToString(); - tree.value = item["UserId"].ToString(); + + tree.id = item.Id.ToString(); + tree.text = item.Name; + tree.value = item.Id.ToString(); tree.isexpand = true; tree.complete = true; tree.hasChildren = false; - tree.parentId = string.IsNullOrEmpty(item["DepartmentId"].ToString()) ? item["OrganizeId"].ToString() : item["DepartmentId"].ToString(); + tree.parentId = "0"; tree.showcheck = true; tree.img = "fa fa-user"; tree.Attribute = "mytype"; diff --git a/OpenAuth.Mvc/Areas/FlowManage/Views/FlowDesign/FlowNodeForm.cshtml b/OpenAuth.Mvc/Areas/FlowManage/Views/FlowDesign/FlowNodeForm.cshtml index 9b20686e..a6515024 100644 --- a/OpenAuth.Mvc/Areas/FlowManage/Views/FlowDesign/FlowNodeForm.cshtml +++ b/OpenAuth.Mvc/Areas/FlowManage/Views/FlowDesign/FlowNodeForm.cshtml @@ -184,60 +184,63 @@ allowSearch: true }); } + + function GetTree(authtype) { + this.$authtype = authtype; + var data = $.arrayClone(parent.AllAuthorizeCheckData[$authtype]); + var item = { + height: 262, + showcheck: true, + data: data, + oncheckboxclick: function (item, et, s) { + var $item = $("#" + item.mytype + "Div"); + if (et == 1) { + var mytype = ""; + var _html = ""; + var _title = ''; + switch (item.mytype) { + case "Role": + mytype = 'label-success'; + break; + case "Post": + mytype = 'label-info'; + break; + case "UserGroup": + mytype = 'label-warning'; + break; + case "User": + mytype = 'label-danger'; + break; + } + _html += '' + item.text + ''; + $item.append(_html); + $item.show(); + + $(".flow-card-box").click(function () { + $(this).remove(); + $('#' + $(this).attr('data-value')).setNoCheckedNodes($(this).attr('id')); + if ($item.find('.flow-card-box').length == 0) { + $item.hide(); + } + }) + } + else if (et == 0) { + $item.find('#' + item.id).remove(); + if ($item.find('.flow-card-box').length == 0) { + $item.hide(); + } + } + + } + }; + $("#" + authtype).treeview(item); + } function GetDesignateMemberTree() { //GetTree('Role'); //GetTree('Post'); //GetTree('UserGroup'); - //GetTree('User'); - //function GetTree(type) { - // var item = { - // height: 262, - // showcheck: true, - // data: $.arrayClone(parent.AllAuthorizeCheckData[type]), - // oncheckboxclick: function (item, et, s) { - // var $item = $("#" + item.mytype + "Div"); - // if (et == 1) { - // var mytype = ""; - // var _html = ""; - // var _title = ''; - // switch (item.mytype) { - // case "Role": - // mytype = 'label-success'; - // break; - // case "Post": - // mytype = 'label-info'; - // break; - // case "UserGroup": - // mytype = 'label-warning'; - // break; - // case "User": - // mytype = 'label-danger'; - // break; - // } - // _html += '' + item.text + ''; - // $item.append(_html); - // $item.show(); - - // $(".flow-card-box").click(function () { - // $(this).remove(); - // $('#' + $(this).attr('data-value')).setNoCheckedNodes($(this).attr('id')); - // if ($item.find('.flow-card-box').length == 0) { - // $item.hide(); - // } - // }) - // } - // else if (et == 0) { - // $item.find('#' + item.id).remove(); - // if ($item.find('.flow-card-box').length == 0) { - // $item.hide(); - // } - // } - - // } - // }; - // $("#" + type).treeview(item); - //} + GetTree('User'); } function initFrmCotent(data) { @@ -367,22 +370,16 @@
-
+ @*
-
+
*@
角色
-
- 岗位 -
-
- 用户组 -
用户
diff --git a/OpenAuth.Mvc/Areas/FlowManage/Views/FlowDesign/FlowSchemeBuider.cshtml b/OpenAuth.Mvc/Areas/FlowManage/Views/FlowDesign/FlowSchemeBuider.cshtml index 84ff805d..d939aa6d 100644 --- a/OpenAuth.Mvc/Areas/FlowManage/Views/FlowDesign/FlowSchemeBuider.cshtml +++ b/OpenAuth.Mvc/Areas/FlowManage/Views/FlowDesign/FlowSchemeBuider.cshtml @@ -90,7 +90,7 @@ }); } - + GetTree('User'); //保存为草稿 $('#btn_caogao').click(function () { if (!$('#step-1').Validform()) { @@ -133,6 +133,69 @@ return true; } /*=========基本配置(end)====================================================================*/ + function GetTree(type) { + $.SetForm({ + url: "../../FlowManage/FlowDesign/Get" + type + "CheckTreeJson", + success: function (data) { + AllAuthorizeCheckData[type] = $.arrayClone(data); + //var item = { + // height: $(window).height() - 131, + // showcheck: true, + // //url: "../../FlowManage/FlowDesign/Get" + type + "CheckTreeJson", + // data: data, + // oncheckboxclick: function (item, et, s) { + // var $item = $("#" + item.mytype + "Div"); + // if (et == 1) { + // var mytype = ""; + // var _html = ""; + // var _title = ''; + // switch (item.mytype) { + // case "Role": + // mytype = "角色"; + // break; + // case "Post": + // mytype = "岗位"; + // break; + // case "UserGroup": + // mytype = "用户组"; + // break; + // case "User": + // mytype = "用户"; + // break; + // } + // _html += '
'; + // _html += '
'; + // _html += ' '; + // _html += '
'; + // _html += '
'; + // _html += '

名称:' + item.text + '

'; + // _html += '

类别:' + mytype + '

'; + // _html += '
'; + // _html += '
'; + // $item.append(_html); + // $item.show(); + + // $(".card-box").click(function () { + // $(this).remove(); + // $('#' + $(this).attr('data-value')).setNoCheckedNodes($(this).attr('id')); + // if ($item.find('.card-box-img').length == 0) { + // $item.hide(); + // } + // }) + // } + // else if (et == 0) { + // $item.find('#' + item.id).remove(); + // if ($item.find('.card-box-img').length == 0) { + // $item.hide(); + // } + // } + + // } + //}; + //$("#" + type).treeview(item); + } + }); + } /*=========表单选择(begin)==================================================================*/ var _frmdatabase = ""; diff --git a/OpenAuth.Mvc/Areas/FlowManage/Views/FlowInstances/ProcessLookForm.cshtml b/OpenAuth.Mvc/Areas/FlowManage/Views/FlowInstances/ProcessLookForm.cshtml index 23b6b834..c2ca0c66 100644 --- a/OpenAuth.Mvc/Areas/FlowManage/Views/FlowInstances/ProcessLookForm.cshtml +++ b/OpenAuth.Mvc/Areas/FlowManage/Views/FlowInstances/ProcessLookForm.cshtml @@ -45,28 +45,3 @@
- diff --git a/OpenAuth.Mvc/Views/Shared/_FlowForm.cshtml b/OpenAuth.Mvc/Views/Shared/_FlowForm.cshtml index bbe80bab..252457ad 100644 --- a/OpenAuth.Mvc/Views/Shared/_FlowForm.cshtml +++ b/OpenAuth.Mvc/Views/Shared/_FlowForm.cshtml @@ -15,8 +15,12 @@ - + + + @* + *@ +