MakeComplete.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.fa.gla.MakeComplete', {
  3. extend: 'Ext.app.Controller',
  4. FormUtil: Ext.create('erp.util.FormUtil'),
  5. views: ['fa.gla.MakeComplete', 'core.button.Close'],
  6. init: function(){
  7. this.control({
  8. 'displayfield[name=yearmonth]': {
  9. afterrender: function(f) {
  10. this.getCurrentMonth(f);
  11. }
  12. },
  13. 'button[id=deal]': {
  14. click: function(btn) {
  15. var form = btn.ownerCt.ownerCt;
  16. this.deal(form);
  17. }
  18. }
  19. });
  20. },
  21. getCurrentMonth: function(f) {
  22. Ext.Ajax.request({
  23. url: basePath + 'fa/getMonth.action',
  24. params: {
  25. type: 'MONTH-A'
  26. },
  27. callback: function(opt, s, r) {
  28. var rs = Ext.decode(r.responseText);
  29. if(rs.data) {
  30. f.setValue(rs.data.PD_DETNO);
  31. }
  32. }
  33. });
  34. },
  35. deal: function(form) {
  36. var tab = this.FormUtil.getActiveTab();
  37. tab.setLoading(true);
  38. Ext.Ajax.request({
  39. url: basePath + 'fa/gla/makecomplete.action',
  40. timeout: 4800000,
  41. callback: function(opt, s, r) {
  42. tab.setLoading(false);
  43. var rs = Ext.decode(r.responseText);
  44. if(rs.success) {
  45. if(rs.data) {
  46. showMessage('提示', rs.data);
  47. } else {
  48. alert('结转成功!');
  49. }
  50. } else if(rs.exceptionInfo) {
  51. showMessage('提示', rs.exceptionInfo);
  52. }
  53. }
  54. });
  55. }
  56. });