PreviewIndex.cshtml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. @{
  2. ViewBag.Title = "流程预览";
  3. Layout = "~/Views/Shared/_FlowForm.cshtml";
  4. }
  5. <link href="~/Content/styles/learun-flow.css" rel="stylesheet" />
  6. <script>
  7. var keyValue = request('keyValue');
  8. var schemeVersion = request('schemeVersion');
  9. var processSchemeId = request('processSchemeId');
  10. $(function () {
  11. var schemeContent;
  12. var _width = $(window).width() * 0.9 - 20;
  13. if (_width > 1000)
  14. {
  15. _width = 1000;
  16. }
  17. if (keyValue) {
  18. $.SetForm({
  19. url: "../../FlowManage/FlowDesign/GetSchemeContentJson",
  20. param: { keyValue: keyValue, SchemeVersion: schemeVersion },
  21. success: function (data) {
  22. schemeContent = JSON.parse(data.SchemeContent);
  23. $('#frmpreview').frmPreview({
  24. tablecotent: schemeContent.Frm.FrmContent,
  25. width: _width
  26. });
  27. $('#frmname').html(schemeContent.Frm.FrmName);
  28. console.log(schemeContent);
  29. $('#FlowPanel').flowdesign({
  30. height: $(window).height() - 18,
  31. width: $(window).width() - 20,
  32. flowcontent: schemeContent.Flow,
  33. frmData: JSON.parse(schemeContent.Frm == "" ?"[]":schemeContent.Frm.FrmContent),
  34. haveTool: false,
  35. preview:1
  36. });
  37. }
  38. });
  39. }
  40. else {
  41. $.SetForm({
  42. url: "../../FlowManage/FlowProcess/GetProcessSchemeJson",
  43. param: { keyValue: processSchemeId },
  44. success: function (data) {
  45. schemeContent = JSON.parse(JSON.parse(data.SchemeContent).SchemeContent);
  46. $('#frmpreview').frmPreview({
  47. tablecotent: schemeContent.Frm.FrmContent,
  48. width: _width,
  49. });
  50. $('#frmname').html(schemeContent.Frm.FrmName);
  51. $('#FlowPanel').flowdesign({
  52. height: $(window).height() - 18,
  53. width: $(window).width() - 20,
  54. flowcontent: schemeContent.Flow,
  55. frmData: JSON.parse(schemeContent.Frm == "" ? "[]" : schemeContent.Frm.FrmContent),
  56. haveTool: false,
  57. preview: 1
  58. });
  59. }
  60. });
  61. }
  62. //resize重设(表格、树形)宽高
  63. $(window).resize(function (e) {
  64. window.setTimeout(function () {
  65. $('#previewpage').css("height", e.currentTarget.innerHeight-20);
  66. $('#formAreas').css("width", e.currentTarget.innerWidth * 0.9-20);
  67. if (schemeContent != undefined)
  68. {
  69. $('#FlowPanel').flowdesign({
  70. height: e.currentTarget.innerHeight - 18,
  71. width: e.currentTarget.innerWidth - 20,
  72. flowcontent: schemeContent.Flow,
  73. haveTool: false
  74. });
  75. }
  76. }, 200);
  77. e.stopPropagation();
  78. });
  79. $('#formAreas').css("width", $(window).width() * 0.9-20);
  80. $('#previewpage').css("height", $(window).height()-20);
  81. });
  82. function flowshow()
  83. {
  84. $('#previewpage').hide();
  85. $('#FlowPanel').show();
  86. }
  87. function frmshow() {
  88. $('#FlowPanel').hide();
  89. $('#previewpage').show();
  90. }
  91. </script>
  92. <div style="position:absolute;top:0; right:100px;z-index:1000;background:rgba(0, 0, 0, 0.1);padding:10px;border-radius:0px 0px 5px 5px;">
  93. <a class="btn btn-success" onclick="flowshow()">&nbsp;流程预览</a>
  94. <a class="btn btn-default" onclick="frmshow()">&nbsp;表单预览</a>
  95. </div>
  96. <div class="panels">
  97. <div id="previewpage" style="overflow-y:auto;background-color:#fff;display:none;border: 1px solid #ccc;">
  98. <div id="formAreas" style="margin: 30px auto;max-width: 1000px;">
  99. <div style="border-bottom:1px solid #ccc;text-align:center"><span id="frmname"></span></div>
  100. <div class="app_layout app_preview" id="frmpreview"></div>
  101. </div>
  102. </div>
  103. <div id="FlowPanel" style="margin: 0px;border: 1px solid #ccc;"></div>
  104. </div>
  105. <style>
  106. body {
  107. overflow: hidden;
  108. }
  109. .panels {
  110. padding: 10px;
  111. }
  112. </style>