Index.cshtml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. @using VberAdmin.Web.Models.Table
  2. @using Microsoft.AspNetCore.Mvc.Rendering
  3. @using VberAdmin.Web.Models.Modals
  4. @using VberAdmin.Web.Models.Search
  5. @using VberZero
  6. @{
  7. //ViewBag.Title = L("StateTitle");
  8. ViewBag.Title = "工作流程信息维护";
  9. string activeMenu = PermissionNames.VberSystemMgWorkflowMg; //The menu item will be active for this page.
  10. ViewBag.ActiveMenu = activeMenu;
  11. var table = new VmTable(VzConsts.ApiAppUrl + "Workflow/GetAll", activeMenu, new VmSearch(new List<VmSearchItem>()
  12. {
  13. //new SearchItem("dd", L("stateName")).SetSearchIcon("q_u","ddd"),
  14. //new SearchItem("ff", L("stateName")).SetSelectItem("<option value=\"\">000</option><option value=\"S10001\">111</option><option value=\"S10002\">222</option>").SetSearchIcon("q_u","fff"),
  15. //new SearchItem("name1", L("stateName"),FieldType.D),
  16. new VmSearchItem("id", "流程编号"),
  17. new VmSearchItem("title", "流程名称")
  18. })).AddItems(new List<VmTableItem>()
  19. {
  20. new("id", "流程编号"),
  21. new("title", "流程名称"),
  22. new VmTableItem("", "操作").WithFormatter("ActionsFormatter"),
  23. });
  24. //var modalBody = new VmModalBody()
  25. // .AddInputs(new List<VmInputBase>()
  26. // {
  27. // new VmInputHidden("id"),
  28. // })
  29. // .AddInput(new VmInput("displayValue", L("displayValue")))
  30. // .AddGroup(new List<VmInputBase>()
  31. // {
  32. // new VmInput("name", L("stateName")).WithDisabled(),
  33. // new VmInput("codeKey", L("codeKey")).WithDisabled(),
  34. // new VmInput("codeValue", L("codeValue")).WithDisabled(),
  35. // }, 3);
  36. //var modal = new VmModal().WithHeaderAndFooter(L("state"), "").WithBody(modalBody);
  37. var modal = new VmModal().WithHeaderAndFooter("流程测试").WithBody("<div id=\"test-box\"></div>");
  38. }
  39. @await Html.PartialAsync("_Table", table)
  40. @await Html.PartialAsync("_Modal", modal)
  41. @section scripts
  42. {
  43. @*<script src="~/Content/Plugins/PrintPreView/print-preview.js"></script>*@
  44. <script src="~/js/workflowHelper.js" asp-append-version="false"></script>
  45. <script type="text/javascript">
  46. let $table = $('#table');
  47. $(function() {
  48. var funs = window.LoadTable();
  49. funs["btnCreate"] = function() {
  50. window.open("/wf/design");
  51. };
  52. funs["btnUpdate"] = function() {
  53. let row = $table.VbTable("getSelection");
  54. if (row) {
  55. window.open(`/wf/design/${row.id}?v=${row.version}`);
  56. }
  57. };
  58. });
  59. //$('#print').printPreview({
  60. // printBody: ".table-box",
  61. // cssUrl: '../../Content/Plugins/bootstrap-3.3.7/css/bootstrap.css,../../Content/Css/Site.css'
  62. //});
  63. function TestStart(id,version) {
  64. $.vbAjax4({
  65. url: abp.appUrl + "Workflow/GetByVersion",
  66. data: { id: id, version: version },
  67. success: (res) => {
  68. OpenModal({
  69. showBefore:() => {
  70. $('#test-box').VbWorkflow("useDyForm",res.inputs);
  71. },
  72. save:() => {
  73. const inputs =$('#test-box').VbWorkflow("getDyFormData",res.inputs);
  74. console.log("===========>",inputs);
  75. $.vbAjax1({
  76. url: abp.appUrl + "Workflow/Start",
  77. data: { id: id, version: version, inputs: inputs }
  78. });
  79. }
  80. });
  81. }
  82. });
  83. }
  84. </script>
  85. <script id="formatter" type="text/javascript">
  86. function ActionsFormatter(v, r) {
  87. let str = `<button type="button" class="btn btn-sm btn-primary" onclick="TestStart('${r.id}','${r.version}')">测试</button>`;
  88. return str;
  89. }
  90. </script>
  91. }