DesignationIndex.cshtml 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. @{
  2. ViewBag.Title = "流程指派";
  3. Layout = "~/Views/Shared/_LayoutIndex.cshtml";
  4. }
  5. <script>
  6. $(function () {
  7. InitialPage();
  8. GetTree();
  9. GetGrid();
  10. });
  11. //初始化页面
  12. function InitialPage() {
  13. //layout布局
  14. $('#layout').layout({
  15. applyDemoStyles: true,
  16. onresize: function () {
  17. $(window).resize()
  18. }
  19. });
  20. //resize重设(表格、树形)宽高
  21. $(window).resize(function (e) {
  22. window.setTimeout(function () {
  23. $('#gridTable').setGridWidth(($('.gridPanel').width()));
  24. $("#gridTable").setGridHeight($(window).height() - 169.5);
  25. $("#itemTree").setTreeHeight($(window).height() - 52);
  26. }, 200);
  27. e.stopPropagation();
  28. });
  29. }
  30. //加载树
  31. function GetTree() {
  32. var item = {
  33. height: $(window).height() - 52,
  34. param: { EnCode: "FlowSort" },
  35. url: "../../FlowManage/FlowDesign/GetTreeJson",
  36. onnodeclick: function (item) {
  37. if (item.Sort != "SchemeType") {
  38. var queryJson = { WFSchemeInfoId: item.id };
  39. searchGrid(queryJson);
  40. }
  41. }
  42. };
  43. //初始化
  44. $("#itemTree").treeview(item);
  45. }
  46. //加载表格流程是否完成(0运行中,1运行结束,2被召回,3不同意,4表示被驳回)
  47. function GetGrid() {
  48. var selectedRowIndex = 0;
  49. $("#gridTable").jqGrid({
  50. url: "../../FlowManage/FlowProcess/GetProcessPageListJson",
  51. datatype: "json",
  52. height: $(window).height() - 169.5,
  53. autowidth: true,
  54. colModel: [
  55. { label: '主键', name: 'id', hidden: true },
  56. { label: '节点id', name: 'activityid', hidden: true },
  57. { label: '实例模板id', name: 'processschemeid', hidden: true },
  58. { label: '实例编号', name: 'code', index: 'code', width: 100, align: 'left' },
  59. { label: '实例名称', name: 'customname', index: 'customname', width: 150, align: 'left' },
  60. { label: '分类', name: 'schemetypename', index: 'schemetypename', width: 80, align: 'left' },
  61. {
  62. label: "等级", name: "wflevel", index: "wflevel", width: 50, align: "center",
  63. formatter: function (cellvalue, options, rowObject) {
  64. if (cellvalue == 1) {
  65. return '<span class=\"label label-danger\">重要</span>';
  66. } else if (cellvalue == 2) {
  67. return '<span class=\"label label-primary\">普通</span>';
  68. } else {
  69. return '<span class=\"label label-success\">一般</span>';
  70. }
  71. }
  72. },
  73. { label: "当前节点", name: "activityname", index: "activityname", width: 90, align: "left" },
  74. {
  75. label: "状态", name: "isfinish", index: "isfinish", width: 80, align: "center",
  76. formatter: function (cellvalue, options, rowObject) {
  77. if (rowObject.enabledmark == 1) {
  78. if (cellvalue == 0) {
  79. return '<span class=\"label label-success\">运行中</span>';
  80. }
  81. else if (cellvalue == 1) {
  82. return '<span class=\"label label-info\">运行结束</span>';
  83. }
  84. else if (cellvalue == 2) {
  85. return '<span class=\"label label-important-learun\">取消</span>';
  86. }
  87. else if (cellvalue == 3) {
  88. return '<span class=\"label label-danger\">不同意</span>';
  89. }
  90. else if (cellvalue == 4) {
  91. return '<span class=\"label label-warning \">被驳回</span>';
  92. }
  93. }
  94. else {
  95. return '<span class=\"label label-inverse-learun \">暂停</span>';
  96. }
  97. }
  98. },
  99. { label: "创建用户", name: "createusername", index: "createusername", width: 80, align: "left" },
  100. {
  101. label: "创建时间", name: "createdate", index: "createdate", width: 150, align: "left",
  102. formatter: function (cellvalue, options, rowObject) {
  103. return formatDate(cellvalue, 'yyyy-MM-dd hh:mm:ss');
  104. }
  105. },
  106. { label: "备注", name: "description", index: "description", width: 200, align: "left" }
  107. ],
  108. viewrecords: true,
  109. rowNum: 30,
  110. rowList: [30, 50, 100],
  111. pager: "#gridPager",
  112. sortname: 'CreateDate desc',
  113. rownumbers: true,
  114. shrinkToFit: false,
  115. gridview: true,
  116. onSelectRow: function () {
  117. selectedRowIndex = $("#" + this.id).getGridParam('selrow');
  118. },
  119. gridComplete: function () {
  120. $("#" + this.id).setSelection(selectedRowIndex, false);
  121. }
  122. });
  123. //查询事件
  124. $("#btn_Search").click(function () {
  125. var queryJson = { Keyword: $("#txt_Keyword").val() };
  126. searchGrid(queryJson);
  127. });
  128. }
  129. //查询函数
  130. function searchGrid(queryJson) {
  131. $("#gridTable").jqGrid('setGridParam', {
  132. postData: { queryJson: JSON.stringify(queryJson) },
  133. }).trigger('reloadGrid');
  134. }
  135. //查看
  136. function btn_flowpreview() {
  137. var _processSchemeId = $("#gridTable").jqGridRowValue("processschemeid");
  138. var _processname = $("#gridTable").jqGridRowValue("customname");
  139. var _activityId = $("#gridTable").jqGridRowValue("activityid");
  140. if (_processSchemeId) {
  141. dialogOpen({
  142. id: "ProcessLookForm",
  143. title: '进度查看【' + _processname + '】',
  144. url: '../../FlowManage/FlowProcess/ProcessLookFrom?processSchemeId=' + _processSchemeId + '&activityId=' + _activityId,
  145. width: "1100px",
  146. height: "700px",
  147. btn: null,
  148. callBack: function (iframeId) {
  149. }
  150. });
  151. } else {
  152. dialogMsg('请选择需要查看的实例!', 0);
  153. }
  154. }
  155. //指派
  156. function btn_flowDesignate() {
  157. var keyValue = $("#gridTable").jqGridRowValue("id");
  158. var _processname = $("#gridTable").jqGridRowValue("customname");
  159. var _isfinish = $("#gridTable").jqGridRowValue("isfinish");
  160. if (keyValue) {
  161. if (_isfinish.indexOf("运行中") != -1) {
  162. dialogOpen({
  163. id: "ProcessDesignate",
  164. title: '指派【' + _processname + '】',
  165. url: '../../FlowManage/FlowProcess/ProcessDesignate?keyValue=' + keyValue,
  166. width: "1100px",
  167. height: "700px",
  168. callBack: function (iframeId) {
  169. top.frames[iframeId].AcceptClick();
  170. }
  171. });
  172. }
  173. else {
  174. dialogMsg('运行中的实例才允许指派!', 0);
  175. }
  176. } else {
  177. dialogMsg('请选择需要查看的实例!', 0);
  178. }
  179. }
  180. </script>
  181. <div class="ui-layout" id="layout" style="height: 100%; width: 100%;">
  182. <div class="ui-layout-west">
  183. <div class="west-Panel">
  184. <div class="panel-Title">流程模板</div>
  185. <div id="itemTree"></div>
  186. </div>
  187. </div>
  188. <div class="ui-layout-center">
  189. <div class="center-Panel">
  190. <div class="panel-Title">流程实例</div>
  191. <div class="titlePanel">
  192. <div class="title-search">
  193. <table>
  194. <tr>
  195. <td>
  196. <input id="txt_Keyword" type="text" class="form-control" placeholder="请输入要查询关键字" style="width: 200px;" />
  197. </td>
  198. <td style="padding-left: 5px;">
  199. <a id="btn_Search" class="btn btn-primary"><i class="fa fa-search"></i>&nbsp;查询</a>
  200. </td>
  201. </tr>
  202. </table>
  203. </div>
  204. <div class="toolbar">
  205. <div class="btn-group">
  206. <a id="lr-replace" class="btn btn-default" onclick="reload();"><i class="fa fa-refresh"></i>&nbsp;刷新</a>
  207. <a id="lr-flowpreview" class="btn btn-default" onclick="btn_flowpreview()"><i class="fa fa-eye"></i>&nbsp;查看</a>
  208. <a id="lr-flowpreview" class="btn btn-default" onclick="btn_flowDesignate()"><i class="fa fa-hand-pointer-o"></i>&nbsp;指派</a>
  209. </div>
  210. <script>$('.toolbar').authorizeButton()</script>
  211. </div>
  212. </div>
  213. <div class="gridPanel">
  214. <table id="gridTable"></table>
  215. <div id="gridPager"></div>
  216. </div>
  217. </div>
  218. </div>
  219. </div>