BatchCancelGoods.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.fa.ars.BatchCancelGoods', {
  3. extend: 'Ext.app.Controller',
  4. FormUtil: Ext.create('erp.util.FormUtil'),
  5. BaseUtil: Ext.create('erp.util.BaseUtil'),
  6. views:[
  7. 'fa.ars.BatchCancelGoods',
  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.getCurrentMonth(f);
  26. }
  27. }
  28. });
  29. },
  30. getForm: function(btn){
  31. return btn.ownerCt.ownerCt;
  32. },
  33. confirm: function(){
  34. var me = this;
  35. me.FormUtil.setLoading(true);
  36. Ext.Ajax.request({
  37. url : basePath + "fa/ars/cancelGoods.action",
  38. params:{
  39. date:Ext.getCmp('date').value
  40. },
  41. timeout: 120000,
  42. method:'post',
  43. callback:function(options,success,response){
  44. me.FormUtil.setLoading(false);
  45. var localJson = new Ext.decode(response.responseText);
  46. if(localJson.success){
  47. Ext.Msg.alert('提示', '取消成功', function(){
  48. window.location.reload();
  49. });
  50. } else {
  51. if(localJson.exceptionInfo){
  52. var str = localJson.exceptionInfo;
  53. if(str.trim().substr(0, 12) == 'AFTERSUCCESS'){//特殊情况:操作成功,但是出现警告,允许刷新页面
  54. str = str.replace('AFTERSUCCESS', '');
  55. showMessage('提示', str);
  56. window.location.reload();
  57. } else {
  58. showError(str);return;
  59. }
  60. }
  61. }
  62. }
  63. });
  64. },
  65. getCurrentMonth: function(f) {
  66. var me = this;
  67. Ext.Ajax.request({
  68. url: basePath + 'fa/getMonth.action',
  69. params: {
  70. type: 'MONTH-C'
  71. },
  72. callback: function(opt, s, r) {
  73. var rs = Ext.decode(r.responseText);
  74. if(rs.data) {
  75. me.currentMonth = rs.data.PD_DETNO;
  76. f.setValue(rs.data.PD_DETNO);
  77. }
  78. }
  79. });
  80. }
  81. });