JTakeTask.js 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. Ext.define('erp.view.common.JProcess.JTakeTask',{
  2. extend: 'Ext.Viewport',
  3. /*layout: 'fit', */
  4. hideBorders: true,
  5. layout:'anchor',
  6. id:'jTakeTask',
  7. initComponent : function(){
  8. var me = this;
  9. me.callParent(arguments);
  10. },
  11. BaseUtil: Ext.create('erp.util.BaseUtil'),
  12. listeners: {
  13. afterrender: function(){
  14. var me=this;
  15. var nodewin=Ext.getCmp('win-nodeflow'+id);
  16. if(nodewin){
  17. nodewin.show();
  18. }else {
  19. var s=getUrlParam("formCondition").replace(/IS/g,'=');
  20. var nodeId=s.split("=")[1];
  21. Ext.Ajax.request({ //获取当前节点对应的JProcess对象
  22. url: basePath + 'common/getCurrentNode.action',
  23. params: {
  24. jp_nodeId: nodeId,
  25. master: master,
  26. _noc: 1
  27. },
  28. success: function(response) {
  29. var res = new Ext.decode(response.responseText);
  30. ProcessData = res.info.currentnode;
  31. var formCondition = ProcessData.jp_keyName + "IS" + ProcessData.jp_keyValue;
  32. var gridCondition = '';
  33. if (ProcessData.jp_keyName) {
  34. gridCondition = ProcessData.jp_formDetailKey + 'IS' + ProcessData.jp_keyValue;
  35. }
  36. var url = basePath + ProcessData.jp_url;
  37. var myurl;
  38. if (me.BaseUtil.contains(url, '?', true)) {
  39. myurl = url + '&formCondition=' + formCondition + '&gridCondition=' + gridCondition;
  40. } else {
  41. myurl = url + '?formCondition=' + formCondition + '&gridCondition=' + gridCondition;
  42. }
  43. myurl += '&_noc=1&datalistId=NaN&NoButton=1'; // 不限制权限
  44. if (master) {
  45. myurl += '&newMaster=' + master;
  46. }
  47. Ext.create('Ext.window.Window', {
  48. id : 'win-nodeflow' + id,
  49. title: '<span style="color:#CD6839;">设置节点处理人</span>',
  50. iconCls: 'x-button-icon-set',
  51. closeAction: 'destroy',
  52. height : '90%',
  53. width : '95%',
  54. maximizable : true,
  55. buttonAlign : 'center',
  56. layout : 'anchor',
  57. items : [ {
  58. tag : 'iframe',
  59. frame : true,
  60. anchor : '100% 100%',
  61. layout : 'fit',
  62. html : '<iframe id="iframe_maindetail" src="'+myurl+'" height="100%" width="100%" frameborder="0" scrolling="auto"></iframe>'
  63. }],
  64. buttons:['->',{
  65. text:'接&nbsp;&nbsp;管',
  66. iconCls: 'x-button-icon-save',
  67. cls: 'x-btn-gray',
  68. width : 65,
  69. style: {
  70. marginLeft: '10px'
  71. },
  72. handler:function(btn){
  73. var contentpanel =parent.Ext.getCmp("content-panel");
  74. var s=getUrlParam("formCondition").replace(/IS/g,'=');
  75. var index = s.indexOf('=');
  76. if(index!=-1){
  77. var nodeId=s.split("=")[1];
  78. Ext.Ajax.request({
  79. url: basePath +'common/takeOverTask.action',
  80. params: {
  81. em_code:emcode,
  82. nodeId: nodeId,
  83. needreturn:true
  84. },
  85. callback : function(options,success,response){
  86. var text = Ext.decode(response.responseText);
  87. if(text.success){
  88. Ext.Msg.alert('提示',"你已接受该审批任务!",function(){
  89. window.location.href=basePath+"/jsps/common/jprocessDeal.jsp?formCondition=jp_nodeIdIS"+nodeId;
  90. /* if(contentpanel){
  91. contentpanel.getActiveTab().close();
  92. }*/
  93. });
  94. }else if(text.exceptionInfo){
  95. showError("该任务已经被接管!");
  96. if(contentpanel){
  97. contentpanel.getActiveTab().close();
  98. }
  99. }
  100. }
  101. });
  102. }
  103. }
  104. },{
  105. text:'关 &nbsp;&nbsp;闭',
  106. iconCls: 'x-button-icon-close',
  107. cls: 'x-btn-gray',
  108. width: 65,
  109. style: {
  110. marginLeft: '10px'
  111. },
  112. handler:function(btn){
  113. btn.ownerCt.ownerCt.close();
  114. me.BaseUtil.getActiveTab().close();
  115. }
  116. },'->']
  117. }).show();
  118. }
  119. });
  120. /*Ext.Msg.show({
  121. title:'确定接管该任务吗?',
  122. msg: '如果接管该任务,你将成为该任务节点的办理人,须在指定时间内审批该任务',
  123. buttons: Ext.Msg.YESNOCANCEL,
  124. fn: function(btn){
  125. if (btn == 'yes'){
  126. var o = parent.Ext.getCmp("content-panel").getActiveTab();
  127. var s=getUrlParam("formCondition").replace(/IS/g,'=');
  128. var index = s.indexOf('=');
  129. if(index!=-1){
  130. var nodeId=s.split("=")[1];
  131. Ext.Ajax.request({
  132. url: basePath +'common/takeOverTask.action',
  133. params: {
  134. em_code:em_code,
  135. nodeId: nodeId,
  136. needreturn:true
  137. },
  138. callback : function(options,success,response){
  139. var text = Ext.decode(response.responseText);
  140. if(text.success){
  141. Ext.Msg.alert('提示',"你已接受该审批任务!",function(){
  142. o.close();
  143. window.location.href=basePath+"/jsps/common/jprocessDeal.jsp?formCondition=jp_nodeIdIS"+nodeId;
  144. });
  145. }else if(text.exceptionInfo){
  146. showError("该任务已经被接管!");
  147. }
  148. }
  149. });
  150. }
  151. }
  152. else if(btn='no'){
  153. console.log(this.xtype);
  154. console.log(parent);
  155. parent.Ext.getCmp("content-panel").getActiveTab().close();
  156. } else if(btn='cancel'){
  157. console.log(parent);
  158. parent.Ext.getCmp("content-panel").getActiveTab().close();
  159. }
  160. },
  161. animateTarget: 'elId',
  162. icon: Ext.window.MessageBox.QUESTION
  163. });*/
  164. }
  165. }
  166. },
  167. processResult:function(){
  168. }
  169. });