westernpilot

Untitled

Jan 27th, 2016
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.49 KB | None | 0 0
  1. /**
  2. * @class SWP.view.swpTabPanel.ExportFormDownloadButton This is ExportFormDownloadButton class.
  3. * It is Split button. This is used to download xpt file.
  4. * It is extended from the Ext.button.Split.
  5. * This is attached to export form.
  6. * @extends Ext.button.Split
  7. * @alias widget.downloadButton
  8. */
  9. var eWin = 0;
  10. Ext.define('SWP.view.swpTabPanel.ExportFormDownloadButton', {
  11. extend: 'Ext.button.Split',
  12. alias : 'widget.downloadButton',
  13. constructor:function(config){
  14. var me = this;
  15. me.setMenu(new Ext.menu.Menu({
  16. items: config.items,
  17. listeners:{
  18. /**
  19. * @event click
  20. * This Click event is fired when click on split button.
  21. * @param {Ext.button.Button} menu
  22. * @param {object} item
  23. * @param {object} e
  24. */
  25. click:function(menu, item, e, eOpts)
  26. {
  27. var me = this;
  28. var expDetails = me.up('form').down('dynamicformpanel').formVal.FORMS;
  29. var form = me.up('form');
  30. if(item.name == "dnXpt")
  31. {
  32. item.EXPSSDID = me.up('downloadButton').EXPSSDID;
  33. }
  34. if(item.name == "dnXpt" || menu == "dnXpt")
  35. {
  36. var expObj = {
  37. "iCrpId" : expDetails.CORPID,
  38. "iPrjId" :expDetails.PROJID ,
  39. "iStrtID": expDetails.STRUCTID,
  40. "iElemID" : expDetails.ELEMID,
  41. "iSSDID" : item.EXPSSDID,
  42. "iFileId" : expDetails.FILEID,
  43. "iFlg" : 2,
  44. "iSolId" : solId,
  45. "iFUID" : form.FUID,
  46. "iOutType" : 0,
  47. "iNetworkPath" : 0,
  48. "iCache" : 0
  49. };
  50. var expXml = [];
  51. SWP.util.Utility.objectToElement('R', SWP.util.Utility.parseObjKeysXML(expObj), expXml);
  52. expXml.pop();
  53. expXml.pop();
  54. expXml.pop();
  55. expXml.push('</R>');
  56.  
  57. PC.Ajax.request({
  58. url : config.btnUrl ,
  59. method : 'POST',
  60. me:me,
  61. headers:{
  62. "Accept":"application/json; charset=utf-8"
  63. },
  64. disableCaching: false,
  65. params:{
  66. 'strIPXML' : expXml.join('')
  67. },
  68. success : function (response) {
  69. var data = Ext.decode( response.responseText),processId=0,status=-1;
  70. if( data.R ){
  71. processId = data.R.Processid;
  72. var strIPXML= expXml.join('');
  73.  
  74. url = filepath.COMMON_REFRESH + "CrpID="+expDetails.CORPID+"&PrjID="+expDetails.PROJID+"&AppID=64&Flg=22&ProcessID=" + processId + "&ReportType=7";
  75. me.Exportdata(url, "Study");
  76. }
  77. }
  78. });
  79. }
  80. }
  81.  
  82. },
  83.  
  84. /**
  85. * This method is to show the exported data processing until export is completed by passing
  86. * specific url and message.
  87. * @param {url} url
  88. * @param {string} headerMsg
  89. */
  90. Exportdata : function (url, headerMsg) {
  91. var me= this;
  92. var window = Ext.create('Ext.window.Window',{
  93. title : headerMsg,
  94. width : 350,
  95. me:me,
  96. height : 250,
  97. layout : 'fit',
  98. plain : true,
  99. id : 'exportWin' + (++eWin),
  100. buttonAlign : 'center',
  101. items : [{
  102. xtype : 'box',
  103. autoEl : {
  104. tag : 'iframe',
  105. src : url,
  106. id : eWin,
  107. name : 'ExportFrame',
  108. height : '100%',
  109. width : '100%',
  110. style : 'cursor:pointer;top:10px'
  111. }
  112. }
  113. ]
  114. });
  115. $( "window.#button2" ).click(function() {
  116. alert( "Handler for .click() called." );
  117. });
  118. window.show();
  119. }
  120. }));
  121. this.callParent( arguments);
  122. }
  123. });
Add Comment
Please, Sign In to add comment