BatchCancelEstimate.js 3.7 KB

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