JprocessCommunicate.js 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. Ext.define('erp.view.common.JProcess.JprocessCommunicate',{
  2. extend: 'Ext.Viewport',
  3. layout: 'fit',
  4. hideBorders: true,
  5. autoScroll: false,
  6. style: {
  7. background: '#D3D3D3',
  8. },
  9. BaseUtil:Ext.create('erp.util.BaseUtil'),
  10. FormUitl:Ext.create('erp.util.FormUtil'),
  11. initComponent : function(){
  12. var me = this;
  13. Ext.apply(me, {
  14. items: [{
  15. id: 'Viewport',
  16. layout: 'auto',
  17. autoScroll: true,
  18. xtype: 'panel',
  19. style: {
  20. background: '#FFFFFF'
  21. },
  22. items: [{
  23. id: 'app-header',
  24. xtype: 'box',
  25. height: 5,
  26. style: 'background: #f0f0f0;color: #596F8F;font-size: 16px;font-weight: 200;padding: 5px 5px;text-shadow: 0 1px 0 #fff'
  27. },{
  28. xtype: 'toolbar',
  29. id: 'currentNodeToolbar',
  30. layout: {
  31. type: 'hbox',
  32. align: 'right'
  33. },
  34. bodyStyle: {
  35. background: '#f0f0f0',
  36. border: 'none'
  37. },
  38. style: {
  39. background: '#f0f0f0',
  40. border: 'none'
  41. },
  42. items: [{
  43. xtype: 'tbtext',
  44. id: 'processname'
  45. },
  46. '->', {
  47. xtype: 'tbtext',
  48. id: 'label1',
  49. text: '<span style="font-weight: bold !important;font-size:18px">审批沟通</span>'
  50. },
  51. '->', {
  52. xtype: 'tbtext',
  53. id: 'label2'
  54. }]
  55. },{xtype: 'toolbar',
  56. layout: {
  57. type: 'hbox',
  58. align: 'right'
  59. },
  60. bodyStyle: {
  61. background: '#f0f0f0',
  62. border: 'none'
  63. },
  64. style: {
  65. background: '#f0f0f0',
  66. border: 'none',
  67. padding:'0 10 0 0'
  68. },
  69. items: ['->', {
  70. xtype: 'tbtext',
  71. id: 'currentnode'
  72. },
  73. '-', {
  74. xtype: 'tbtext',
  75. id: 'launchername'
  76. },
  77. '-', {
  78. xtype: 'tbtext',
  79. id: 'launchtime'
  80. }]
  81. }]
  82. }]
  83. });
  84. me.callParent(arguments);
  85. },
  86. BaseUtil: Ext.create('erp.util.BaseUtil'),
  87. listeners: {
  88. afterrender: function(){
  89. var me=this;
  90. var view=Ext.getCmp('Viewport');
  91. var taskId=getUrlParam('formCondition').split("=")[1];
  92. Ext.Ajax.request({ //获取当前节点对应的JProcess对象
  93. url: basePath + 'plm/task/getTaskInfo.action',
  94. params: {
  95. taskId: taskId,
  96. _noc: 1
  97. },
  98. success: function(response) {
  99. var res = new Ext.decode(response.responseText);
  100. var url = basePath + res.info.SOURCELINK;
  101. url += '&_noc=1&datalistId=NaN&NoButton=1'; // 不限制权限
  102. Ext.getCmp('currentnode').setText('当前节点:<font size=2 color="red">' + res.info.NAME + '</font>');
  103. Ext.getCmp('launchername').setText('当前节点:<font size=2 color="red">' + res.info.RECORDER + '</font>');
  104. Ext.getCmp('launchtime').setText('发起时间:<font size=2 color="red">'+Ext.Date.format(new Date(res.info.RECORDDATE), "Y-m-d H:i:s")+'</font>');
  105. var panel=new Ext.panel.Panel({
  106. tag: 'iframe',
  107. id: 'mm',
  108. style: {
  109. background: '#f0f0f0',
  110. border: 'none'
  111. },
  112. frame: true,
  113. border: false,
  114. layout: 'fit',
  115. height: window.innerHeight,
  116. iconCls: 'x-tree-icon-tab-tab',
  117. html: '<iframe id="iframe_maindetail" name = "iframe_maindetail" src="' + url + '" height="100%" width="100%" frameborder="0" scrolling="auto"></iframe>'
  118. });
  119. view.insert(4,{id:'dbform',
  120. layout: 'column',
  121. autoScroll:true,
  122. buttonAlign:'center',
  123. bodyStyle: 'background:#f1f1f1;',
  124. frame:true,
  125. fieldDefaults: {
  126. labelWidth: 70,
  127. fieldStyle:'background:#FFFAFA;color:#515151;'
  128. },
  129. xtype:'form',
  130. items: [{
  131. xtype: 'textareafield',
  132. fieldLabel: '任务描述',
  133. id:'description',
  134. name: 'description',
  135. value:res.info.DESCRIPTION,
  136. readOnly:true,
  137. columnWidth: 0.5
  138. },{
  139. fieldLabel: '回复信息',
  140. xtype: 'textareafield',
  141. name: 'reply',
  142. id: 'reply',
  143. allowBlank:false,
  144. fieldStyle:'background:#fffac0;color:#515151;',
  145. columnWidth: 0.5
  146. }],
  147. buttons:[{
  148. xtype:'button',
  149. text:'回复',
  150. iconCls: 'x-button-icon-save',
  151. cls: 'x-btn-gray',
  152. formBind: true,
  153. width: 60,
  154. style: {
  155. marginLeft: '10px'
  156. },
  157. handler:function(){
  158. me.replyCommmunicate(taskId);
  159. }
  160. },{
  161. xtype:'button',
  162. text: $I18N.common.button.erpCloseButton,
  163. iconCls: 'x-button-icon-close',
  164. cls: 'x-btn-gray',
  165. width: 60,
  166. style: {
  167. marginLeft: '10px'
  168. },
  169. handler:function(btn){
  170. me.BaseUtil.getActiveTab().close();
  171. }
  172. }]
  173. });
  174. view.insert(5,panel);
  175. }
  176. });
  177. }
  178. },
  179. replyCommmunicate:function(taskId){
  180. var me=this;
  181. var FormUtil=Ext.create('erp.util.FormUtil');
  182. FormUtil.setLoading(true);
  183. var reply=Ext.getCmp('reply').value;
  184. Ext.Ajax.request({
  185. url : basePath + 'common/replyCommunicateTask.action',
  186. params: {
  187. taskId:taskId,
  188. reply:reply
  189. },
  190. method : 'post',
  191. callback : function(opt, s, res){
  192. FormUtil.setLoading(false);
  193. var r = new Ext.decode(res.responseText);
  194. if(r.exceptionInfo){
  195. showError(r.exceptionInfo);return;
  196. } else if(r.success){
  197. if (parent && parent.Ext.getCmp('content-panel')) {
  198. var firstGrid = parent.Ext.getCmp('content-panel').items.items[0].firstGrid;
  199. if (firstGrid && firstGrid != null) {
  200. firstGrid.loadNewStore();
  201. }
  202. }
  203. showMessage('提示','回复成功',1000);
  204. FormUtil.onClose();
  205. }
  206. }
  207. });
  208. },
  209. endCommunicate: function(){
  210. }
  211. });