CountReport.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.fa.gla.CountReport', {
  3. extend: 'Ext.app.Controller',
  4. FormUtil: Ext.create('erp.util.FormUtil'),
  5. BaseUtil: Ext.create('erp.util.BaseUtil'),
  6. views:[
  7. 'fa.gla.CountReportForm','fa.gla.CountReport',
  8. 'core.button.Confirm','core.button.Close','core.form.MonthDateField'
  9. ] ,
  10. init:function(){
  11. var me = this;
  12. this.control({
  13. 'erpCloseButton': {
  14. click: function(btn){
  15. me.FormUtil.onClose();
  16. }
  17. },
  18. 'erpConfirmButton': {
  19. click: function(btn){
  20. this.confirm();
  21. }
  22. },
  23. 'monthdatefield': {
  24. afterrender: function(f) {
  25. me.getCurrentYearmonth(f);
  26. }
  27. }
  28. });
  29. },
  30. getForm: function(btn){
  31. return btn.ownerCt.ownerCt;
  32. },
  33. confirm: function(){
  34. alert('计算成功');
  35. /*Ext.Ajax.request({
  36. url : basePath + "fa/fix/confirmAutoDepreciation.action",
  37. params:{
  38. param:{date:Ext.getCmp('date').value},
  39. },
  40. method:'post',
  41. callback:function(options,success,response){
  42. var localJson = new Ext.decode(response.responseText);
  43. if(localJson.success){
  44. postSuccess(function(){
  45. window.location.reload();
  46. });
  47. } else {
  48. if(localJson.exceptionInfo){
  49. var str = localJson.exceptionInfo;
  50. if(str.trim().substr(0, 12) == 'AFTERSUCCESS'){//特殊情况:操作成功,但是出现警告,允许刷新页面
  51. str = str.replace('AFTERSUCCESS', '');
  52. showError(str);
  53. postSuccess(function(){
  54. window.location.reload();
  55. });
  56. } else {
  57. showError(str);return;
  58. }
  59. }
  60. }
  61. }
  62. });*/
  63. },
  64. getCurrentYearmonth: function(f) {
  65. Ext.Ajax.request({
  66. url: basePath + 'fa/gla/getCurrentYearmonth.action',
  67. method: 'GET',
  68. callback: function(opt, s, r) {
  69. var rs = Ext.decode(r.responseText);
  70. if(rs.exceptionInfo) {
  71. showError(rs.exceptionInfo);
  72. } else if(rs.data) {
  73. f.setValue(rs.data);
  74. }
  75. }
  76. });
  77. }
  78. });