MonthAccountOver.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.fa.gla.MonthAccountOver', {
  3. extend: 'Ext.app.Controller',
  4. FormUtil: Ext.create('erp.util.FormUtil'),
  5. BaseUtil: Ext.create('erp.util.BaseUtil'),
  6. views:[
  7. 'fa.gla.MonthAccountOverForm','fa.gla.MonthAccountOver',
  8. 'core.button.OverAccount','core.button.Close','core.form.MonthDateField','core.button.StartAccount'
  9. ] ,
  10. init:function(){
  11. var me = this;
  12. this.control({
  13. 'erpCloseButton': {
  14. click: function(btn){
  15. me.FormUtil.onClose();
  16. }
  17. },
  18. 'erpStartAccountButton': {
  19. click: function(btn){
  20. this.startAccount();
  21. }
  22. },
  23. 'erpOverAccountButton': {
  24. click: function(btn){
  25. this.overAccount();
  26. }
  27. },
  28. 'monthdatefield': {
  29. afterrender: function(f) {
  30. me.getCurrentYearmonth(f);
  31. }
  32. }
  33. });
  34. },
  35. getForm: function(btn){
  36. return btn.ownerCt.ownerCt;
  37. },
  38. startAccount: function(){
  39. Ext.Ajax.request({
  40. url : basePath + "fa/gla/startAccount.action",
  41. params:{
  42. param:{date:Ext.getCmp('date').value},
  43. },
  44. method:'post',
  45. callback:function(options,success,response){
  46. var localJson = new Ext.decode(response.responseText);
  47. if(localJson.success){
  48. endArSuccess(function(){
  49. window.location.reload();
  50. });
  51. } else {
  52. if(localJson.exceptionInfo){
  53. var str = localJson.exceptionInfo;
  54. if(str.trim().substr(0, 12) == 'AFTERSUCCESS'){//特殊情况:操作成功,但是出现警告,允许刷新页面
  55. str = str.replace('AFTERSUCCESS', '');
  56. showMessage('提示', str);
  57. window.location.reload();
  58. } else {
  59. showError(str);return;
  60. }
  61. }
  62. }
  63. }
  64. });
  65. },
  66. overAccount: function(){
  67. Ext.Ajax.request({
  68. url : basePath + "fa/gla/overAccount.action",
  69. params:{
  70. param:{date:Ext.getCmp('date').value},
  71. },
  72. method:'post',
  73. callback:function(options,success,response){
  74. var localJson = new Ext.decode(response.responseText);
  75. if(localJson.success){
  76. unEndArSuccess(function(){
  77. window.location.reload();
  78. });
  79. } else {
  80. if(localJson.exceptionInfo){
  81. var str = localJson.exceptionInfo;
  82. if(str.trim().substr(0, 12) == 'AFTERSUCCESS'){//特殊情况:操作成功,但是出现警告,允许刷新页面
  83. str = str.replace('AFTERSUCCESS', '');
  84. showMessage('提示', str);
  85. window.location.reload();
  86. } else {
  87. showError(str);return;
  88. }
  89. }
  90. }
  91. }
  92. });
  93. },
  94. getCurrentYearmonth: function(f) {
  95. Ext.Ajax.request({
  96. url: basePath + 'fa/gla/getCurrentYearmonth.action',
  97. method: 'GET',
  98. callback: function(opt, s, r) {
  99. var rs = Ext.decode(r.responseText);
  100. if(rs.exceptionInfo) {
  101. showError(rs.exceptionInfo);
  102. } else if(rs.data) {
  103. f.setValue(rs.data);
  104. }
  105. }
  106. });
  107. }
  108. });