BatchCancelEstimate.js 2.4 KB

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