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.

processInfo.js 3.9 KiB

4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. (function () {
  2. var processId = '';
  3. var taskId = '';
  4. var page = {
  5. init: function ($page, param) {
  6. processId = param.processId || '';
  7. taskId = param.taskId || '';
  8. $page.find('.lr-processInfo-page').toptab(['表单信息', '流程信息']).each(function (index) {
  9. var $this = $(this);
  10. switch (index) {
  11. case 0:
  12. $this.html('<div class="container" id="processInfocontainer1"></div>');
  13. break;
  14. case 1:
  15. $this.html('<div class="container" id="processInfocontainer2"></div>');
  16. break;
  17. }
  18. $this = null;
  19. });
  20. processinfo(param);
  21. }
  22. };
  23. // 流程发起初始化
  24. function processinfo(_param) {
  25. var req = {
  26. processId: _param.processId,
  27. taskId: _param.taskId
  28. };
  29. learun.layer.loading(true, "获取流程信息");
  30. learun.httpget(config.webapi + "learun/adms/workflow/processinfo", req, (data) => {
  31. if (data) {
  32. var flowdata = data;
  33. if (flowdata.status == 1) {// 流程数据加载成功
  34. var wfForms = flowdata.data.currentNode.wfForms;// 表单数据
  35. var schemeIds = [];
  36. var formreq = [];
  37. $.each(wfForms, function (_index, _item) {
  38. if (_item.formId) {
  39. schemeIds.push(_item.formId);
  40. var point = {
  41. schemeInfoId: _item.formId,
  42. processIdName: _item.field,
  43. keyValue: _param.processId,
  44. }
  45. formreq.push(point);
  46. }
  47. });
  48. learun.custmerform.loadScheme(schemeIds, function (scheme) {
  49. $('#processInfocontainer1').custmerform(scheme);
  50. // 设置表单的可查看权限
  51. $.each(flowdata.data.currentNode.authorizeFields || [], function (_index, _item) {
  52. if (_item.isLook === 0) {
  53. $('#processInfocontainer1').find('#' + _item.fieldId).parents('.lr-form-row').remove();
  54. }
  55. });
  56. $('#processInfocontainer1').setFormRead();
  57. });
  58. // 获取下自定义表单数据
  59. learun.httpget(config.webapi + "learun/adms/form/data", formreq, (data) => {
  60. if (data) {
  61. // 设置自定义表单数据
  62. $('#processInfocontainer1').custmerformSet(data);
  63. }
  64. });
  65. // 加载流程信息
  66. initTimeLine(flowdata.data.history);
  67. }
  68. }
  69. learun.layer.loading(false);
  70. });
  71. }
  72. function initTimeLine(flowHistory) {
  73. var nodelist = [];
  74. for (var i = 0, l = flowHistory.length; i < l; i++) {
  75. var item = flowHistory[i];
  76. var content = '';
  77. if (item.F_Result == 1) {
  78. content += '通过';
  79. }
  80. else {
  81. content += '不通过';
  82. }
  83. if (item.F_Description) {
  84. content += '【备注】' + item.F_Description;
  85. }
  86. var point = {
  87. title: item.F_NodeName,
  88. people: item.F_CreateUserName + ':',
  89. content: content,
  90. time: item.F_CreateDate
  91. };
  92. nodelist.push(point);
  93. }
  94. $('#processInfocontainer2').ftimeline(nodelist);
  95. }
  96. return page;
  97. })();