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.
 
 
 
 
 
 

133 lines
5.3 KiB

  1. (function () {
  2. var processId = '';
  3. var taskId = '';
  4. var nodeMap = {};
  5. var page = {
  6. init: function ($page, param) {
  7. processId = param.processId || '';
  8. taskId = param.taskId || '';
  9. $page.find('.lr-nprocessInfo-page').toptab(['表单信息', '流程信息']).each(function (index) {
  10. var $this = $(this);
  11. switch (index) {
  12. case 0:
  13. $this.html('<div class="container" id="nprocessInfocontainer1"></div>');
  14. break;
  15. case 1:
  16. $this.html('<div class="container" id="nprocessInfocontainer2"></div>');
  17. break;
  18. }
  19. $this = null;
  20. });
  21. processinfo(param);
  22. }
  23. };
  24. // 流程发起初始化
  25. function processinfo(_param) {
  26. var req = {
  27. processId: _param.processId,
  28. taskId: _param.taskId
  29. };
  30. learun.layer.loading(true, "获取流程信息");
  31. learun.httpget(config.webapi + "learun/adms/newwf/processinfo", req, function (data) {
  32. if (data) {
  33. var info = data.info;
  34. var schemeObj = JSON.parse(info.Scheme);
  35. var currentNode;
  36. var formreq = [];
  37. var schemeIds = [];
  38. var authorizeFields = [];
  39. // 获取当前节点
  40. $.each(schemeObj.nodes, function (_index, _item) {
  41. if (_item.id == info.CurrentNodeId) {
  42. currentNode = _item;
  43. }
  44. nodeMap[_item.id] = _item;
  45. });
  46. $.each(currentNode.wfForms, function (_index, _item) {
  47. if (_item.formId) {
  48. schemeIds.push(_item.formId);
  49. var point = {
  50. schemeInfoId: _item.formId,
  51. processIdName: _item.field,
  52. keyValue: _param.processId,
  53. }
  54. formreq.push(point);
  55. $.each(_item.authorize, function (_jindex, _jitem) {
  56. _jitem.fieldId = _jindex;
  57. authorizeFields.push(_jitem);
  58. });
  59. }
  60. });
  61. learun.custmerform.loadScheme(schemeIds, function (scheme) {
  62. $('#nprocessInfocontainer1').custmerform(scheme);
  63. // 设置表单的可查看权限
  64. $.each(authorizeFields, function (_index, _item) {
  65. if (_item.isLook === 0) {
  66. $('#nprocessInfocontainer1').find('#' + _item.fieldId).parents('.lr-form-row').remove();
  67. }
  68. });
  69. $('#nprocessInfocontainer1').setFormRead();
  70. });
  71. // 获取下自定义表单数据
  72. learun.httpget(config.webapi + "learun/adms/form/data", formreq, function (data) {
  73. if (data) {
  74. // 设置自定义表单数据
  75. $('#nprocessInfocontainer1').custmerformSet(data);
  76. }
  77. });
  78. // 加载流程信息
  79. initTimeLine(info.TaskLogList);
  80. console.log(data);
  81. }
  82. learun.layer.loading(false);
  83. });
  84. }
  85. function initTimeLine(flowHistory) {
  86. var nodelist = [];
  87. learun.clientdata.getAll('department', {
  88. callback: function (departmentMap) {
  89. learun.clientdata.getAll('user', {
  90. callback: function (userMap) {
  91. for (var i = 0, l = flowHistory.length; i < l; i++) {
  92. var item = flowHistory[i];
  93. var name = (item.F_CreateUserName || '系统处理') + ':';
  94. if (item.F_CreateUserId && userMap[item.F_CreateUserId]) {
  95. var _department = departmentMap[userMap[item.F_CreateUserId].departmentId];
  96. if (_department) {
  97. name = '【' + _department.name + '】' + name;
  98. }
  99. }
  100. var content = item.F_OperationName;
  101. if (item.F_Des) {
  102. content += '【审批意见】' + item.F_Des;
  103. }
  104. var nodeName = '';
  105. if (item.F_NodeId && nodeMap[item.F_NodeId]) {
  106. nodeName = nodeMap[item.F_NodeId].name;
  107. }
  108. var point = {
  109. title: item.F_NodeName || nodeName,
  110. people: name,
  111. content: content,
  112. time: item.F_CreateDate
  113. };
  114. nodelist.push(point);
  115. }
  116. $('#nprocessInfocontainer2').ftimeline(nodelist);
  117. }
  118. });
  119. }
  120. });
  121. }
  122. return page;
  123. })();