FaPost.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.fa.ars.FaPost', {
  3. extend: 'Ext.app.Controller',
  4. FormUtil: Ext.create('erp.util.FormUtil'),
  5. BaseUtil: Ext.create('erp.util.BaseUtil'),
  6. views:[
  7. 'fa.ars.FaPost',
  8. 'core.button.Confirm','core.button.Close','core.form.MonthDateField','core.form.ConDateField'
  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.confirmPost();
  21. }
  22. }
  23. });
  24. },
  25. getForm: function(btn){
  26. return btn.ownerCt.ownerCt;
  27. },
  28. confirmPost: function(){
  29. var me = this;
  30. var datef = Ext.getCmp('date'),
  31. from = datef ? (datef.firstVal ? Ext.Date.toString(datef.firstVal) : null ): null,
  32. to = datef ? (datef.secondVal ? Ext.Date.toString(datef.secondVal) : null ): null;
  33. var pclass = Ext.getCmp('pclass').value;
  34. me.FormUtil.setLoading(true);
  35. Ext.Ajax.request({
  36. url : basePath + "fa/faPost.action",
  37. params:{
  38. from : from,
  39. to : to,
  40. pclass : pclass
  41. },
  42. timeout: 120000,
  43. method:'post',
  44. callback:function(options,success,r){
  45. me.FormUtil.setLoading(false);
  46. var rs = Ext.decode(r.responseText);
  47. if(rs.exceptionInfo) {
  48. showError(rs.exceptionInfo);
  49. } else {
  50. Ext.Msg.alert("提示","过账成功!");
  51. window.location.reload();
  52. }
  53. }
  54. });
  55. }
  56. });