You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

185 regels
7.7 KiB

  1. (function () {
  2. var processId = '';
  3. var taskId = '';
  4. var nodeMap = {};
  5. var page = {
  6. init: function ($page, param) {
  7. var _html = '<div class="lr-form-header-submit" style="display:block;" >操作</div>';
  8. $header = $page.parents('.f-page').find('.f-page-header');
  9. $header.append(_html);
  10. headText = $header.find('.f-page-title').text();
  11. processId = param.processId || '';
  12. taskId = param.taskId || '';
  13. $page.find('.lr-nmyprocessInfo-page').toptab(['表单信息', '流程信息']).each(function (index) {
  14. var $this = $(this);
  15. switch (index) {
  16. case 0:
  17. $this.html('<div class="container" id="nmyprocessInfocontainer1"></div>');
  18. break;
  19. case 1:
  20. $this.html('<div class="container" id="nmyprocessInfocontainer2"></div>');
  21. break;
  22. }
  23. $this = null;
  24. });
  25. processinfo(param);
  26. // 操作
  27. $header.find('.lr-form-header-submit').on('tap', function () {
  28. var actionsheetData = [];
  29. actionsheetData.push({
  30. text: '催办审核',
  31. group: '1',
  32. event: function () {
  33. learun.layer.confirm('是否确认催办审核?', function (_index) {
  34. if (_index === '1') {
  35. learun.layer.loading(true, "催办审核中");
  36. learun.httppost(config.webapi + "learun/adms/newwf/urge", processId, function (data) {
  37. learun.layer.loading(false);
  38. });
  39. }
  40. }, '数字化智慧校园', ['取消', '确定']);
  41. }
  42. });
  43. if (param.isStart == 0) {
  44. actionsheetData.push({
  45. text: '撤销流程',
  46. group: '2',
  47. mark: true,
  48. event: function () {
  49. learun.layer.confirm('是否确认撤销流程?', function (_index) {
  50. if (_index === '1') {
  51. learun.layer.loading(true, "撤销流程中");
  52. learun.httppost(config.webapi + "learun/adms/newwf/revoke", processId, function (data) {
  53. learun.layer.loading(false);
  54. var prepage = learun.nav.getpage('nworkflow/myflow');
  55. prepage.grid[0].reload();
  56. learun.nav.closeCurrent();
  57. });
  58. }
  59. }, '数字化智慧校园', ['取消', '确定']);
  60. }
  61. });
  62. }
  63. learun.actionsheet({
  64. id: 'myprocessInfo2',
  65. data: actionsheetData,
  66. cancel: function () {
  67. }
  68. });
  69. });
  70. }
  71. };
  72. // 流程发起初始化
  73. function processinfo(_param) {
  74. var req = {
  75. processId: _param.processId,
  76. taskId: _param.taskId
  77. };
  78. learun.layer.loading(true, "获取流程信息");
  79. learun.httpget(config.webapi + "learun/adms/newwf/processinfo", req, function (data) {
  80. if (data) {
  81. var info = data.info;
  82. var schemeObj = JSON.parse(info.Scheme);
  83. var currentNode;
  84. var formreq = [];
  85. var schemeIds = [];
  86. var authorizeFields = [];
  87. // 获取当前节点
  88. $.each(schemeObj.nodes, function (_index, _item) {
  89. if (_item.id == info.CurrentNodeId) {
  90. currentNode = _item;
  91. }
  92. nodeMap[_item.id] = _item;
  93. });
  94. $.each(currentNode.wfForms, function (_index, _item) {
  95. if (_item.formId) {
  96. schemeIds.push(_item.formId);
  97. var point = {
  98. schemeInfoId: _item.formId,
  99. processIdName: _item.field,
  100. keyValue: _param.processId,
  101. }
  102. formreq.push(point);
  103. $.each(_item.authorize, function (_jindex, _jitem) {
  104. _jitem.fieldId = _jindex;
  105. authorizeFields.push(_jitem);
  106. });
  107. }
  108. });
  109. learun.custmerform.loadScheme(schemeIds, function (scheme) {
  110. $('#nmyprocessInfocontainer1').custmerform(scheme);
  111. // 设置表单的可查看权限
  112. $.each(authorizeFields, function (_index, _item) {
  113. if (_item.isLook === 0) {
  114. $('#nmyprocessInfocontainer1').find('#' + _item.fieldId).parents('.lr-form-row').remove();
  115. }
  116. });
  117. $('#nmyprocessInfocontainer1').setFormRead();
  118. });
  119. // 获取下自定义表单数据
  120. learun.httpget(config.webapi + "learun/adms/form/data", formreq, function (data) {
  121. if (data) {
  122. // 设置自定义表单数据
  123. $('#nmyprocessInfocontainer1').custmerformSet(data);
  124. }
  125. });
  126. // 加载流程信息
  127. initTimeLine(info.TaskLogList);
  128. }
  129. learun.layer.loading(false);
  130. });
  131. }
  132. function initTimeLine(flowHistory) {
  133. var nodelist = [];
  134. learun.clientdata.getAll('department', {
  135. callback: function (departmentMap) {
  136. learun.clientdata.getAll('user', {
  137. callback: function (userMap) {
  138. for (var i = 0, l = flowHistory.length; i < l; i++) {
  139. var item = flowHistory[i];
  140. var name = (item.F_CreateUserName || '系统处理') + ':';
  141. if (item.F_CreateUserId && userMap[item.F_CreateUserId]) {
  142. var _department = departmentMap[userMap[item.F_CreateUserId].departmentId];
  143. if (_department) {
  144. name = '【' + _department.name + '】' + name;
  145. }
  146. }
  147. var content = item.F_OperationName;
  148. if (item.F_Des) {
  149. content += '【审批意见】' + item.F_Des;
  150. }
  151. var nodeName = '';
  152. if (item.F_NodeId && nodeMap[item.F_NodeId]) {
  153. nodeName = nodeMap[item.F_NodeId].name;
  154. }
  155. var point = {
  156. title: item.F_NodeName || nodeName,
  157. people: name,
  158. content: content,
  159. time: item.F_CreateDate
  160. };
  161. nodelist.push(point);
  162. }
  163. $('#nmyprocessInfocontainer2').ftimeline(nodelist);
  164. }
  165. });
  166. }
  167. });
  168. }
  169. return page;
  170. })();