FeeAccount.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.oa.fee.FeeAccount', {
  3. extend: 'Ext.app.Controller',
  4. FormUtil: Ext.create('erp.util.FormUtil'),
  5. BaseUtil: Ext.create('erp.util.BaseUtil'),
  6. views:[
  7. 'oa.fee.FeeAccountForm','oa.fee.FeeAccount',
  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. var me = this;
  40. me.FormUtil.setLoading(true);
  41. console.log(Ext.getCmp('date').value);
  42. Ext.Ajax.request({
  43. url : basePath + "oa/fee/startFeeAccount.action",
  44. params:{
  45. date:Ext.getCmp('date').value
  46. },
  47. timeout: 120000,
  48. method:'post',
  49. callback:function(options,success,response){
  50. me.FormUtil.setLoading(false);
  51. var localJson = new Ext.decode(response.responseText);
  52. if(localJson.success){
  53. endArSuccess(function(){
  54. window.location.reload();
  55. });
  56. } else {
  57. if(localJson.exceptionInfo){
  58. var str = localJson.exceptionInfo;
  59. if(str.trim().substr(0, 12) == 'AFTERSUCCESS'){//特殊情况:操作成功,但是出现警告,允许刷新页面
  60. str = str.replace('AFTERSUCCESS', '');
  61. showMessage('提示', str);
  62. window.location.reload();
  63. } else {
  64. showError(str);return;
  65. }
  66. }
  67. }
  68. }
  69. });
  70. },
  71. overAccount: function(){
  72. var me = this;
  73. me.FormUtil.setLoading(true);
  74. Ext.Ajax.request({
  75. url : basePath + "fa/ars/overAccount.action",
  76. params:{
  77. param:{date:Ext.getCmp('date').value},
  78. },
  79. method:'post',
  80. callback:function(options,success,response){
  81. me.FormUtil.setLoading(false);
  82. var localJson = new Ext.decode(response.responseText);
  83. if(localJson.success){
  84. unEndArSuccess(function(){
  85. window.location.reload();
  86. });
  87. } else {
  88. if(localJson.exceptionInfo){
  89. var str = localJson.exceptionInfo;
  90. if(str.trim().substr(0, 12) == 'AFTERSUCCESS'){//特殊情况:操作成功,但是出现警告,允许刷新页面
  91. str = str.replace('AFTERSUCCESS', '');
  92. showMessage('提示', str);
  93. window.location.reload();
  94. } else {
  95. showError(str);return;
  96. }
  97. }
  98. }
  99. }
  100. });
  101. },
  102. getCurrentYearmonth: function(f) {
  103. Ext.Ajax.request({
  104. url: basePath + 'oa/fee/getCurrentYearmonth.action',
  105. method: 'GET',
  106. callback: function(opt, s, r) {
  107. var rs = Ext.decode(r.responseText);
  108. if(rs.exceptionInfo) {
  109. showError(rs.exceptionInfo);
  110. } else if(rs.data) {
  111. f.setValue(rs.data);
  112. }
  113. }
  114. });
  115. }
  116. });