GetShareRate.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.fa.gla.GetShareRate', {
  3. extend: 'Ext.app.Controller',
  4. FormUtil: Ext.create('erp.util.FormUtil'),
  5. BaseUtil: Ext.create('erp.util.BaseUtil'),
  6. views:[
  7. 'fa.gla.GetShareRate',
  8. 'core.button.CatchData','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. 'erpCatchDataButton': {
  19. click: function(btn){
  20. this.catchDate();
  21. }
  22. },
  23. 'monthdatefield': {
  24. afterrender: function(f) {
  25. this.getCurrentMonth(f, "MONTH-A");
  26. }
  27. }
  28. });
  29. },
  30. getForm: function(btn){
  31. return btn.ownerCt.ownerCt;
  32. },
  33. catchDate: function(){
  34. Ext.Ajax.request({
  35. url : basePath + "fa/gla/getShareRate.action",
  36. params:{
  37. param:{date:Ext.getCmp('date').value},
  38. },
  39. method:'post',
  40. callback:function(options,success,response){
  41. var localJson = new Ext.decode(response.responseText);
  42. if(localJson.success){
  43. Ext.Msg.alert("提示","操作成功!");
  44. window.location.reload();
  45. } else {
  46. if(localJson.exceptionInfo){
  47. var str = localJson.exceptionInfo;
  48. if(str.trim().substr(0, 12) == 'AFTERSUCCESS'){//特殊情况:操作成功,但是出现警告,允许刷新页面
  49. str = str.replace('AFTERSUCCESS', '');
  50. showMessage('提示', str);
  51. window.location.reload();
  52. } else {
  53. showError(str);return;
  54. }
  55. }
  56. }
  57. }
  58. });
  59. },
  60. getCurrentMonth: function(f, type) {
  61. Ext.Ajax.request({
  62. url: basePath + 'fa/getMonth.action',
  63. params: {
  64. type: type
  65. },
  66. callback: function(opt, s, r) {
  67. var rs = Ext.decode(r.responseText);
  68. if(rs.data) {
  69. f.setValue(rs.data.PD_DETNO);
  70. }
  71. }
  72. });
  73. }
  74. });