Design.cshtml 5.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. @using VberZero.Workflow.StepBodies
  2. @using Abp.Extensions
  3. @using VberZero.Tools.StringModel
  4. @{
  5. //ViewBag.Title = L("StateTitle");
  6. ViewBag.Title = "工作流程设计器";
  7. ViewBag.ActiveMenu = PermissionNames.VberSystemMgWorkflowMg; //The menu item will be active for this page.
  8. string id = ViewBag.Id??"";
  9. int version = ViewBag.Version;
  10. IEnumerable<VberWorkflowStepBody> stepBodies = ViewBag.StepBodies;
  11. }
  12. @section css
  13. {
  14. @*<link href="/css/workflow.min.css" rel="stylesheet">*@
  15. }
  16. <div id="workflow-container" style="width: 100%;height: 100%">
  17. </div>
  18. @section scripts
  19. {
  20. @* <script src="~/libs-ext/jsplumb/dist/js/jsplumb.js" asp-append-version="false"></script> *@
  21. <script src="~/js/workflowHelper.js" asp-append-version="false"></script>
  22. <script type="text/javascript">
  23. //WF.stepBodies= @Html.Raw(stepBodies.Obj2String());
  24. //console.log("StepBody", WF.stepBodies);
  25. function SetSize(el) {
  26. var $content = $('.page>.wrapper>.content');
  27. $('#vber_content_container').css({padding:0}).width($content.width()).height($content.height());
  28. $(el).width($content.width());
  29. $(el).height($content.height());
  30. }
  31. $(function () {
  32. var workflowContainer = $('#workflow-container');
  33. SetSize(workflowContainer);
  34. @if (id.IsNullOrEmpty())
  35. {
  36. <text>
  37. workflowContainer.VbWorkflow({
  38. stepBodies: @Html.Raw(stepBodies.Obj2String()),
  39. submit: Create
  40. });
  41. </text>
  42. }
  43. else
  44. {
  45. <text>
  46. $.vbAjax4({
  47. url: abp.appUrl + "Workflow/GetByVersion",
  48. data: { id: '@(id)', version: @version },
  49. success: (res) => {
  50. workflowContainer.VbWorkflow({
  51. data: res || [],
  52. stepBodies: @Html.Raw(stepBodies.Obj2String()),
  53. submit: Update
  54. });
  55. }
  56. });
  57. </text>
  58. }
  59. //workflowContainer.VbWorkflow({
  60. // data:{"id":"Test","version":"","title":"测试工作流01","group":"GR01 ","icon":"","color":"","description":"",
  61. // "inputs":[
  62. // [{"id":"25743ead9f184eb69a78142650c13175","name":"test","label":"t01","items":[],"styles":[],"rules":[],"type":"text"}],[{"id":"2a4fdee6400640e3a77593a50a9a5993","name":"demo","label":"d01","items":[],"styles":[],"rules":[],"type":"text"}],[{"id":"3fd3598ecd4d49358a48d6c9f58087a7","name":"tr","label":"单选框","items":[{"label":"123","value":"3"},{"label":"33","value":"44"}],"styles":[],"rules":[],"type":"radio"}]
  63. // ],"nodes":[{"key":"start_141bf80e039946efb53f474bf6ba800a","title":"流程开始","icon":"fa fa-play","type":"success","group":"1","endpointOptions":[{"anchor":"Bottom","maxConnections":-1,"uuid":"start_141bf80e039946efb53f474bf6ba800a_Bottom"}],"position":[500,20],"parentNodes":[],"nextNodes":[{"nodeId":"step_ecb8d32b5b64481f8fa22b651a6b1b6a","label":"条件22","conditions":[{"field":"test","operator":">=","value":"3"}]}]},{"key":"end_ed3bdec599df4378bcb478fe3a865f5b","title":"流程结束","icon":"fa fa-square","type":"danger","group":"1","endpointOptions":[{"anchor":"Top","maxConnections":-1,"uuid":"end_ed3bdec599df4378bcb478fe3a865f5b_Top"}],"position":[500,260],"parentNodes":["step_ecb8d32b5b64481f8fa22b651a6b1b6a"],"nextNodes":[]},{"key":"step_ecb8d32b5b64481f8fa22b651a6b1b6a","title":"任务节点","icon":"fa fa-cog","type":"primary","group":"2","endpointOptions":[{"anchor":"Top","maxConnections":-1,"uuid":"step_ecb8d32b5b64481f8fa22b651a6b1b6a_Top"},{"anchor":"Bottom","maxConnections":-1,"uuid":"step_ecb8d32b5b64481f8fa22b651a6b1b6a_Bottom"}],"position":[500,140],"stepBody":{"Name":"FixedUserAudit","DisplayName":"指定用户审核","Inputs":{"UserId":{"Name":"UserId","DisplayName":"审核人","InputType":{"Name":"SELECT_USERS","Attributes":{},"Validator":{"Name":"NULL","Attributes":{}}},"Value":"admin"}},"StepBodyType":"VberZero.Workflows.GeneralAuditingStepBody, VberYue.Zero, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"},"parentNodes":["start_141bf80e039946efb53f474bf6ba800a"],"nextNodes":[{"nodeId":"end_ed3bdec599df4378bcb478fe3a865f5b","label":"条件33","conditions":[{"field":"demo","operator":"!=","value":"4"}]}]}]},
  64. // stepBodies:@Html.Raw(stepBodies.Obj2String()),
  65. // submit:Create
  66. //});
  67. //const stepBodies = workflowContainer.VbWorkflow("setStepBodies",@Html.Raw(stepBodies.Obj2String()));
  68. //workflowContainer.VbWorkflow("getStepBodies");
  69. //console.log("StepBody", stepBodies);
  70. });
  71. function Create(data) {
  72. console.log(data);
  73. $.vbAjax({
  74. url: abp.appUrl + "Workflow/Create",
  75. data: data
  76. });
  77. }
  78. function Update(data) {
  79. console.log(data);
  80. $.vbAjax({
  81. url: abp.appUrl + "Workflow/Update",
  82. data: data
  83. });
  84. }
  85. </script>
  86. <script id="formatter" type="text/javascript">
  87. </script>
  88. }