bpmn-set-read.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. var copyrightid = sp.getUrlName("copyrightid");
  2. var directionid = sp.getUrlName("directionid");
  3. var userid = sp.getUrlName("userid");
  4. var routeid = sp.getUrlName("routeid");
  5. var routeinfoid = sp.getUrlName("routeinfoid");
  6. var get_AccessToken = localStorage.getItem("GlWorkPlatform-AccessToken");
  7. var bpmnModeler = new BpmnJS({
  8. container: '#canvas',
  9. //additionalModules: [customTranslateModule],
  10. keyboard: {
  11. bindTo: window
  12. },
  13. additionalModules: [{
  14. // 禁用左侧默认工具栏
  15. paletteProvider: ['value', ''], // 去不干净,还是默认生成空白 dom
  16. // // 禁用滚轮滚动
  17. // // 禁止拖动线
  18. bendpoints: ['value', ''],
  19. // // 禁止点击节点出现contextPad
  20. contextPadProvider: ['value', ''],
  21. // // 禁止双击节点出现label编辑框
  22. labelEditingProvider: ['value', '']
  23. }]
  24. });
  25. var diagramXML = "";
  26. var doneArray = [];
  27. var processArray = [];
  28. var waitArray = [];
  29. var doneLineArray = [];
  30. function importXML(xml) {
  31. // import diagram
  32. bpmnModeler.importXML(xml, function(err) {
  33. if (err) {
  34. return console.error('could not import BPMN 2.0 diagram', err);
  35. }
  36. var canvas = bpmnModeler.get('canvas');
  37. // zoom to fit full viewport
  38. canvas.zoom('fit-viewport');
  39. // canvas.addMarker('fifthTask_ANONYMOUS', 'highlight');
  40. //const successIds = highLightData.highLine.concat(highLightData.highPoint)
  41. //const procesingIds = highLightData.waitingToDo;
  42. setNodeColor(doneArray, bpmnModeler, 'nodeSuccess');
  43. setNodeColor(processArray, bpmnModeler, 'nodeProcing');
  44. setNodeColor(waitArray, bpmnModeler, 'nodeWaiting');
  45. setNodeColor(doneLineArray, bpmnModeler, 'nodeLineSuccess');
  46. });
  47. }
  48. function getXML() {
  49. $.ajax({
  50. type: "post",
  51. url: apiurljs.login + "workflow/getWorkFlowData",
  52. data: {
  53. "copyrightid": s4.encryptData_CBC(copyrightid)
  54. },
  55. dataType: "text",
  56. success: function(obj) {
  57. var response = strToJson(s4.decryptData_CBC(JSON.parse(obj).data))
  58. let domParser = new DOMParser();
  59. let xmlDom = domParser.parseFromString(response, 'text/xml')
  60. let xmlTaskDom = xmlDom.getElementsByTagName('task')
  61. let infoArray_ = angular.element(document.body).scope().ctl.infoArray
  62. for (let i = 0; i < xmlTaskDom.length; i++) {
  63. let task = xmlTaskDom[i]
  64. let names = []
  65. infoArray_.forEach((item => {
  66. let ENDNODEID = item.ENDNODEID
  67. let USERNAMEFROM = item.USERNAMEFROM
  68. if (ENDNODEID == task.id) {
  69. if(names.indexOf(item.USERNAME) == -1){
  70. names.push(item.USERNAME)
  71. }
  72. // names.push(USERNAMEFROM)
  73. }
  74. }))
  75. if (names.length > 0) {
  76. let name = task.getAttribute('name')
  77. task.setAttribute("name", name + `\n(${names.join(',')})`)
  78. }
  79. }
  80. var sXML = new XMLSerializer()
  81. diagramXML = sXML.serializeToString(xmlDom);
  82. if (diagramXML == "") {
  83. //美观版,带边框的
  84. //diagramXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <definitions xmlns=\"http://www.omg.org/spec/BPMN/20100524/MODEL\" xmlns:bpmndi=\"http://www.omg.org/spec/BPMN/20100524/DI\" xmlns:omgdc=\"http://www.omg.org/spec/DD/20100524/DC\" xmlns:omgdi=\"http://www.omg.org/spec/DD/20100524/DI\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" targetNamespace=\"\" xsi:schemaLocation=\"http://www.omg.org/spec/BPMN/20100524/MODEL http://www.omg.org/spec/BPMN/2.0/20100501/BPMN20.xsd\"> <collaboration id=\"sid-c0e745ff-361e-4afb-8c8d-2a1fc32b1424\"> <participant id=\"sid-87F4C1D6-25E1-4A45-9DA7-AD945993D06F\" name=\"工作流程\" processRef=\"sid-C3803939-0872-457F-8336-EAE484DC4A04\" /> </collaboration> <process id=\"sid-C3803939-0872-457F-8336-EAE484DC4A04\" name=\"Customer\" processType=\"None\" isClosed=\"false\" isExecutable=\"false\"> <extensionElements /> <laneSet id=\"sid-b167d0d7-e761-4636-9200-76b7f0e8e83a\"> <lane id=\"sid-57E4FE0D-18E4-478D-BC5D-B15164E93254\"> <flowNodeRef>sid-D7F237E8-56D0-4283-A3CE-4F0EFE446138</flowNodeRef> <flowNodeRef>sid-52EB1772-F36E-433E-8F5B-D5DFD26E6F26</flowNodeRef> <flowNodeRef>sid-E433566C-2289-4BEB-A19C-1697048900D2</flowNodeRef> </lane> </laneSet> <startEvent id=\"sid-D7F237E8-56D0-4283-A3CE-4F0EFE446138\" name=\"开始\"> <outgoing>sid-7B791A11-2F2E-4D80-AFB3-91A02CF2B4FD</outgoing> </startEvent> <task id=\"sid-52EB1772-F36E-433E-8F5B-D5DFD26E6F26\" name=\"开始工作\"> <incoming>sid-7B791A11-2F2E-4D80-AFB3-91A02CF2B4FD</incoming> <outgoing>sid-EE8A7BA0-5D66-4F8B-80E3-CC2751B3856A</outgoing> </task> <sequenceFlow id=\"sid-7B791A11-2F2E-4D80-AFB3-91A02CF2B4FD\" name=\"填报表单\" sourceRef=\"sid-D7F237E8-56D0-4283-A3CE-4F0EFE446138\" targetRef=\"sid-52EB1772-F36E-433E-8F5B-D5DFD26E6F26\" /> <sequenceFlow id=\"sid-EE8A7BA0-5D66-4F8B-80E3-CC2751B3856A\" name=\"转结束\" sourceRef=\"sid-52EB1772-F36E-433E-8F5B-D5DFD26E6F26\" targetRef=\"sid-E433566C-2289-4BEB-A19C-1697048900D2\" /> <endEvent id=\"sid-E433566C-2289-4BEB-A19C-1697048900D2\" name=\"结束\"> <incoming>sid-EE8A7BA0-5D66-4F8B-80E3-CC2751B3856A</incoming> </endEvent> </process> <bpmndi:BPMNDiagram id=\"sid-74620812-92c4-44e5-949c-aa47393d3830\"> <bpmndi:BPMNPlane id=\"sid-cdcae759-2af7-4a6d-bd02-53f3352a731d\" bpmnElement=\"sid-c0e745ff-361e-4afb-8c8d-2a1fc32b1424\"> <bpmndi:BPMNShape id=\"sid-87F4C1D6-25E1-4A45-9DA7-AD945993D06F_gui\" bpmnElement=\"sid-87F4C1D6-25E1-4A45-9DA7-AD945993D06F\" isHorizontal=\"true\"> <omgdc:Bounds x=\"42.5\" y=\"75\" width=\"933\" height=\"250\" /> <bpmndi:BPMNLabel labelStyle=\"sid-84cb49fd-2f7c-44fb-8950-83c3fa153d3b\"> <omgdc:Bounds x=\"47.49999999999999\" y=\"170.42857360839844\" width=\"12.000000000000014\" height=\"59.142852783203125\" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id=\"sid-57E4FE0D-18E4-478D-BC5D-B15164E93254_gui\" bpmnElement=\"sid-57E4FE0D-18E4-478D-BC5D-B15164E93254\" isHorizontal=\"true\"> <omgdc:Bounds x=\"72.5\" y=\"75\" width=\"903\" height=\"250\" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id=\"sid-D7F237E8-56D0-4283-A3CE-4F0EFE446138_gui\" bpmnElement=\"sid-D7F237E8-56D0-4283-A3CE-4F0EFE446138\"> <omgdc:Bounds x=\"150\" y=\"165\" width=\"30\" height=\"30\" /> <bpmndi:BPMNLabel labelStyle=\"sid-e0502d32-f8d1-41cf-9c4a-cbb49fecf581\"> <omgdc:Bounds x=\"152\" y=\"197\" width=\"26\" height=\"14\" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id=\"sid-52EB1772-F36E-433E-8F5B-D5DFD26E6F26_gui\" bpmnElement=\"sid-52EB1772-F36E-433E-8F5B-D5DFD26E6F26\"> <omgdc:Bounds x=\"352.5\" y=\"140\" width=\"100\" height=\"80\" /> <bpmndi:BPMNLabel labelStyle=\"sid-84cb49fd-2f7c-44fb-8950-83c3fa153d3b\"> <omgdc:Bounds x=\"360.5\" y=\"172\" width=\"84\" height=\"12\" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id=\"sid-E433566C-2289-4BEB-A19C-1697048900D2_gui\" bpmnElement=\"sid-E433566C-2289-4BEB-A19C-1697048900D2\"> <omgdc:Bounds x=\"634\" y=\"166\" width=\"28\" height=\"28\" /> <bpmndi:BPMNLabel labelStyle=\"sid-e0502d32-f8d1-41cf-9c4a-cbb49fecf581\"> <omgdc:Bounds x=\"635\" y=\"196\" width=\"26\" height=\"14\" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id=\"sid-EE8A7BA0-5D66-4F8B-80E3-CC2751B3856A_gui\" bpmnElement=\"sid-EE8A7BA0-5D66-4F8B-80E3-CC2751B3856A\"> <omgdi:waypoint xsi:type=\"omgdc:Point\" x=\"453\" y=\"180\" /> <omgdi:waypoint xsi:type=\"omgdc:Point\" x=\"635\" y=\"180\" /> <bpmndi:BPMNLabel> <omgdc:Bounds x=\"525\" y=\"155\" width=\"38\" height=\"14\" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id=\"sid-7B791A11-2F2E-4D80-AFB3-91A02CF2B4FD_gui\" bpmnElement=\"sid-7B791A11-2F2E-4D80-AFB3-91A02CF2B4FD\"> <omgdi:waypoint xsi:type=\"omgdc:Point\" x=\"179\" y=\"180\" /> <omgdi:waypoint xsi:type=\"omgdc:Point\" x=\"353\" y=\"180\" /> <bpmndi:BPMNLabel> <omgdc:Bounds x=\"241\" y=\"155\" width=\"50\" height=\"14\" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> <bpmndi:BPMNLabelStyle id=\"sid-e0502d32-f8d1-41cf-9c4a-cbb49fecf581\"> <omgdc:Font name=\"Arial\" size=\"11\" isBold=\"false\" isItalic=\"false\" isUnderline=\"false\" isStrikeThrough=\"false\" /> </bpmndi:BPMNLabelStyle> <bpmndi:BPMNLabelStyle id=\"sid-84cb49fd-2f7c-44fb-8950-83c3fa153d3b\"> <omgdc:Font name=\"Arial\" size=\"12\" isBold=\"false\" isItalic=\"false\" isUnderline=\"false\" isStrikeThrough=\"false\" /> </bpmndi:BPMNLabelStyle> </bpmndi:BPMNDiagram> </definitions>\r\n\r\n";
  85. //最简版,不带边框
  86. diagramXML =
  87. "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <definitions xmlns=\"http://www.omg.org/spec/BPMN/20100524/MODEL\" xmlns:bpmndi=\"http://www.omg.org/spec/BPMN/20100524/DI\" xmlns:omgdc=\"http://www.omg.org/spec/DD/20100524/DC\" xmlns:omgdi=\"http://www.omg.org/spec/DD/20100524/DI\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" targetNamespace=\"\" xsi:schemaLocation=\"http://www.omg.org/spec/BPMN/20100524/MODEL http://www.omg.org/spec/BPMN/2.0/20100501/BPMN20.xsd\"> <process id=\"Process_0ou37ig\"> <startEvent id=\"StartEvent_142ym73\" name=\"开始\"> <outgoing>SequenceFlow_0gqlk33</outgoing> </startEvent> <task id=\"Task_020vyoo\" name=\"开始工作\"> <incoming>SequenceFlow_0gqlk33</incoming> <outgoing>SequenceFlow_02bni32</outgoing> </task> <sequenceFlow id=\"SequenceFlow_0gqlk33\" name=\"填报表单\" sourceRef=\"StartEvent_142ym73\" targetRef=\"Task_020vyoo\" /> <endEvent id=\"EndEvent_1wus1l9\" name=\"结束\"> <incoming>SequenceFlow_02bni32</incoming> </endEvent> <sequenceFlow id=\"SequenceFlow_02bni32\" name=\"转结束\" sourceRef=\"Task_020vyoo\" targetRef=\"EndEvent_1wus1l9\" /> </process> <bpmndi:BPMNDiagram id=\"sid-74620812-92c4-44e5-949c-aa47393d3830\"> <bpmndi:BPMNPlane id=\"sid-cdcae759-2af7-4a6d-bd02-53f3352a731d\" bpmnElement=\"Process_0ou37ig\"> <bpmndi:BPMNShape id=\"StartEvent_142ym73_di\" bpmnElement=\"StartEvent_142ym73\"> <omgdc:Bounds x=\"115.14214214214215\" y=\"96.31831831831832\" width=\"36\" height=\"36\" /> <bpmndi:BPMNLabel> <omgdc:Bounds x=\"122\" y=\"135\" width=\"22\" height=\"17\" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id=\"Task_020vyoo_di\" bpmnElement=\"Task_020vyoo\"> <omgdc:Bounds x=\"281.17217217217216\" y=\"74\" width=\"100\" height=\"80\" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id=\"SequenceFlow_0gqlk33_di\" bpmnElement=\"SequenceFlow_0gqlk33\"> <omgdi:waypoint xsi:type=\"omgdc:Point\" x=\"151\" y=\"114\" /> <omgdi:waypoint xsi:type=\"omgdc:Point\" x=\"281\" y=\"114\" /> <bpmndi:BPMNLabel> <omgdc:Bounds x=\"194.74712643678163\" y=\"92\" width=\"44\" height=\"17\" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id=\"EndEvent_1wus1l9_di\" bpmnElement=\"EndEvent_1wus1l9\"> <omgdc:Bounds x=\"544.1721721721722\" y=\"96\" width=\"36\" height=\"36\" /> <bpmndi:BPMNLabel> <omgdc:Bounds x=\"551\" y=\"135\" width=\"22\" height=\"17\" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id=\"SequenceFlow_02bni32_di\" bpmnElement=\"SequenceFlow_02bni32\"> <omgdi:waypoint xsi:type=\"omgdc:Point\" x=\"381\" y=\"114\" /> <omgdi:waypoint xsi:type=\"omgdc:Point\" x=\"544\" y=\"114\" /> <bpmndi:BPMNLabel> <omgdc:Bounds x=\"446\" y=\"92\" width=\"33\" height=\"17\" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> <bpmndi:BPMNLabelStyle id=\"sid-e0502d32-f8d1-41cf-9c4a-cbb49fecf581\"> <omgdc:Font name=\"Arial\" size=\"11\" isBold=\"false\" isItalic=\"false\" isUnderline=\"false\" isStrikeThrough=\"false\" /> </bpmndi:BPMNLabelStyle> <bpmndi:BPMNLabelStyle id=\"sid-84cb49fd-2f7c-44fb-8950-83c3fa153d3b\"> <omgdc:Font name=\"Arial\" size=\"12\" isBold=\"false\" isItalic=\"false\" isUnderline=\"false\" isStrikeThrough=\"false\" /> </bpmndi:BPMNLabelStyle> </bpmndi:BPMNDiagram> </definitions> ";
  88. }
  89. importXML(diagramXML);
  90. },
  91. error: function(response) {
  92. diagramXML =
  93. "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <definitions xmlns=\"http://www.omg.org/spec/BPMN/20100524/MODEL\" xmlns:bpmndi=\"http://www.omg.org/spec/BPMN/20100524/DI\" xmlns:omgdc=\"http://www.omg.org/spec/DD/20100524/DC\" xmlns:omgdi=\"http://www.omg.org/spec/DD/20100524/DI\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" targetNamespace=\"\" xsi:schemaLocation=\"http://www.omg.org/spec/BPMN/20100524/MODEL http://www.omg.org/spec/BPMN/2.0/20100501/BPMN20.xsd\"> <process id=\"Process_0ou37ig\"> <startEvent id=\"StartEvent_142ym73\" name=\"开始\"> <outgoing>SequenceFlow_0gqlk33</outgoing> </startEvent> <task id=\"Task_020vyoo\" name=\"开始工作\"> <incoming>SequenceFlow_0gqlk33</incoming> <outgoing>SequenceFlow_02bni32</outgoing> </task> <sequenceFlow id=\"SequenceFlow_0gqlk33\" name=\"填报表单\" sourceRef=\"StartEvent_142ym73\" targetRef=\"Task_020vyoo\" /> <endEvent id=\"EndEvent_1wus1l9\" name=\"结束\"> <incoming>SequenceFlow_02bni32</incoming> </endEvent> <sequenceFlow id=\"SequenceFlow_02bni32\" name=\"转结束\" sourceRef=\"Task_020vyoo\" targetRef=\"EndEvent_1wus1l9\" /> </process> <bpmndi:BPMNDiagram id=\"sid-74620812-92c4-44e5-949c-aa47393d3830\"> <bpmndi:BPMNPlane id=\"sid-cdcae759-2af7-4a6d-bd02-53f3352a731d\" bpmnElement=\"Process_0ou37ig\"> <bpmndi:BPMNShape id=\"StartEvent_142ym73_di\" bpmnElement=\"StartEvent_142ym73\"> <omgdc:Bounds x=\"115.14214214214215\" y=\"96.31831831831832\" width=\"36\" height=\"36\" /> <bpmndi:BPMNLabel> <omgdc:Bounds x=\"122\" y=\"135\" width=\"22\" height=\"17\" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id=\"Task_020vyoo_di\" bpmnElement=\"Task_020vyoo\"> <omgdc:Bounds x=\"281.17217217217216\" y=\"74\" width=\"100\" height=\"80\" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id=\"SequenceFlow_0gqlk33_di\" bpmnElement=\"SequenceFlow_0gqlk33\"> <omgdi:waypoint xsi:type=\"omgdc:Point\" x=\"151\" y=\"114\" /> <omgdi:waypoint xsi:type=\"omgdc:Point\" x=\"281\" y=\"114\" /> <bpmndi:BPMNLabel> <omgdc:Bounds x=\"194.74712643678163\" y=\"92\" width=\"44\" height=\"17\" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id=\"EndEvent_1wus1l9_di\" bpmnElement=\"EndEvent_1wus1l9\"> <omgdc:Bounds x=\"544.1721721721722\" y=\"96\" width=\"36\" height=\"36\" /> <bpmndi:BPMNLabel> <omgdc:Bounds x=\"551\" y=\"135\" width=\"22\" height=\"17\" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id=\"SequenceFlow_02bni32_di\" bpmnElement=\"SequenceFlow_02bni32\"> <omgdi:waypoint xsi:type=\"omgdc:Point\" x=\"381\" y=\"114\" /> <omgdi:waypoint xsi:type=\"omgdc:Point\" x=\"544\" y=\"114\" /> <bpmndi:BPMNLabel> <omgdc:Bounds x=\"446\" y=\"92\" width=\"33\" height=\"17\" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> <bpmndi:BPMNLabelStyle id=\"sid-e0502d32-f8d1-41cf-9c4a-cbb49fecf581\"> <omgdc:Font name=\"Arial\" size=\"11\" isBold=\"false\" isItalic=\"false\" isUnderline=\"false\" isStrikeThrough=\"false\" /> </bpmndi:BPMNLabelStyle> <bpmndi:BPMNLabelStyle id=\"sid-84cb49fd-2f7c-44fb-8950-83c3fa153d3b\"> <omgdc:Font name=\"Arial\" size=\"12\" isBold=\"false\" isItalic=\"false\" isUnderline=\"false\" isStrikeThrough=\"false\" /> </bpmndi:BPMNLabelStyle> </bpmndi:BPMNDiagram> </definitions> ";
  94. }
  95. });
  96. }
  97. function getRouteList() {
  98. var postData = {
  99. directionid: directionid,
  100. userid: userid,
  101. routeid: routeid,
  102. routeinfoid: routeinfoid,
  103. }
  104. $.ajax({
  105. type: "post",
  106. url: apiurljs.login + "g2app/abase/queryDataRouteList",
  107. headers: {
  108. Authorization: "Bearer " + get_AccessToken,
  109. },
  110. data: JSON.stringify({
  111. data: s4.encryptData_CBC(JSON.stringify(postData))
  112. }),
  113. dataType: "json",
  114. contentType: "application/json",
  115. success: function(obj) {
  116. var response = strToJson(s4.decryptData_CBC(obj.data));
  117. angular.element(document.body).scope().ctl.infoArray = response.data;
  118. response.data.forEach(function(item, index) {
  119. if (item.DIRECTIONID) {
  120. item.DIRECTIONID = item.DIRECTIONID.replace("_" + copyrightid, "");
  121. }
  122. if (item.STARTNODEID) {
  123. item.STARTNODEID = item.STARTNODEID.replace("_" + copyrightid, "");
  124. }
  125. if (item.ENDNODEID) {
  126. item.ENDNODEID = item.ENDNODEID.replace("_" + copyrightid, "");
  127. }
  128. })
  129. //流转记录长读等于1 表示
  130. if (response.data.length == 1) {
  131. doneArray.push(response.data[0].STARTNODEID);
  132. doneLineArray.push(response.data[0].DIRECTIONID);
  133. if (response.data[0].STATUS == "1") {
  134. waitArray.push(item.ENDNODEID);
  135. } else if (response.data[0].STATUS == "2" || response.data[0].STATUS ==
  136. "0") {
  137. processArray.push(response.data[0].ENDNODEID);
  138. }
  139. } else {
  140. response.data.forEach(function(item, index) {
  141. doneLineArray.push(item.DIRECTIONID);
  142. if (index != response.data.length - 1) {
  143. doneArray.push(item.STARTNODEID);
  144. doneArray.push(item.ENDNODEID);
  145. } else {
  146. var myDeal = false;
  147. var myInfo = "";
  148. var isEnd = false;
  149. if (item.USERID == "STOP") {
  150. isEnd = true;
  151. }
  152. if (item.USERID == userid) {
  153. myDeal = true;
  154. myInfo = item;
  155. }
  156. if (isEnd) {
  157. doneArray.push(item.ENDNODEID);
  158. } else {
  159. if (myDeal) {
  160. if (myInfo.STATUS == "1") {
  161. waitArray.push(item.ENDNODEID);
  162. } else if (myInfo.STATUS == "2") {
  163. processArray.push(item.ENDNODEID);
  164. }
  165. } else {
  166. if (item.STATUS == "1") {
  167. waitArray.push(item.ENDNODEID);
  168. } else if (item.STATUS == "2") {
  169. processArray.push(item.ENDNODEID);
  170. }
  171. }
  172. }
  173. }
  174. })
  175. }
  176. getXML()
  177. },
  178. error: function(response) {
  179. console.log(response);
  180. }
  181. });
  182. }
  183. function setNodeColor(ids, newBpmn, colorClass) {
  184. var elementRegistry = newBpmn.get('elementRegistry');
  185. //流程图过长解析需要时间
  186. setTimeout(function () {
  187. ids.forEach(function (item) {
  188. if (elementRegistry._elements[item]) {
  189. var element = elementRegistry._elements[item].gfx
  190. element.classList.add(colorClass)
  191. }
  192. })
  193. }, 100)
  194. }
  195. var app = angular.module('app', []);
  196. //定义一个全局的截图插件变量
  197. var cropper;
  198. app.controller("formeditCtrl", ["$scope", "$http", "$timeout", "$sce", function($scope, $http, $timeout, $sce) {
  199. var self = this;
  200. var s4 = new SM4Util();
  201. self.userId = $.cookie("GlWorkPlatform-userid");
  202. self.userName = $.cookie("GlWorkPlatform-chineseName");
  203. self.get_AccessToken = localStorage.getItem("GlWorkPlatform-AccessToken");
  204. self.tabOpen = false; //右侧是否打开
  205. self.infoArray = [];
  206. self.loadXML1 = function() {
  207. getRouteList();
  208. }
  209. self.loadXML2 = function() {
  210. getXML();
  211. }
  212. self.changeInfoTab = function() {
  213. self.tabOpen = !self.tabOpen;
  214. self.loadXML2();
  215. }
  216. self.loadXML1();
  217. self.getItemNode = function(obj) {
  218. self.tabOpen = true; //右侧是否打开
  219. self.loadXML2();
  220. $scope.$apply();
  221. var indexNum = -1;
  222. self.infoArray.forEach(function(item, index) {
  223. if (obj.id == item.ENDNODEID) {
  224. indexNum = index;
  225. }
  226. })
  227. if (indexNum > -1) {
  228. setTimeout(function() {
  229. $(".right-show-content").scrollTop($(".item-flow-info").eq(indexNum).offset()
  230. .top);
  231. }, 100)
  232. } else {
  233. setTimeout(function() {
  234. $(".right-show-content").scrollTop(0);
  235. }, 100)
  236. }
  237. }
  238. }])