Close.js.svn-base 911 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. Ext.define('erp.view.oa.doc.Close',{
  2. extend: 'Ext.Button',
  3. alias: 'widget.erpCloseButton',
  4. cls:'x-btn-close',
  5. style: {
  6. marginLeft: '10px'
  7. },
  8. text:null,
  9. initComponent : function(){
  10. this.callParent(arguments);
  11. },
  12. handler: function(btn){
  13. var modal=parent.Ext.getCmp('modalwindow');
  14. if(modal){
  15. var history=modal.historyMaster;
  16. Ext.Ajax.request({
  17. url: basePath + 'common/changeMaster.action',
  18. params: {
  19. to: history
  20. },
  21. callback: function(opt, s, r) {
  22. if (s) {
  23. modal.close();
  24. } else {
  25. alert('切换到原账套失败!');
  26. }
  27. }
  28. });
  29. } else {
  30. var main = parent.Ext.getCmp("content-panel");
  31. if(main){
  32. main.getActiveTab().close();
  33. } else {
  34. var win = parent.Ext.ComponentQuery.query('window');
  35. if(win){
  36. Ext.each(win, function(){
  37. this.close();
  38. });
  39. } else {
  40. window.close();
  41. }
  42. }
  43. }
  44. }
  45. });