MonthUnOver.js 1.8 KB

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