UnPeriodsdetail.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.scm.reserve.UnPeriodsdetail', {
  3. extend: 'Ext.app.Controller',
  4. FormUtil: Ext.create('erp.util.FormUtil'),
  5. BaseUtil: Ext.create('erp.util.BaseUtil'),
  6. views:[
  7. 'scm.reserve.UnPeriodsdetail','core.button.Close',
  8. 'core.button.UnCheckPost','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. 'erpUnCheckPostButton':{
  19. click: function(btn){
  20. this.confirm();
  21. }
  22. },
  23. 'monthdatefield': {
  24. afterrender: function(f) {
  25. me.getCurrentYearmonth(f);
  26. }
  27. }
  28. });
  29. },
  30. getForm: function(btn){
  31. return btn.ownerCt.ownerCt;
  32. },
  33. confirm: function(){
  34. Ext.Ajax.request({
  35. url : basePath + "scm/reserve/unperiodsdetail.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. } else {
  45. if(localJson.exceptionInfo){
  46. var str = localJson.exceptionInfo;
  47. if(str.trim().substr(0, 12) == 'AFTERSUCCESS'){//特殊情况:操作成功,但是出现警告,允许刷新页面
  48. str = str.replace('AFTERSUCCESS', '');
  49. showMessage('提示', str);
  50. window.location.reload();
  51. } else {
  52. showError(str);return;
  53. }
  54. }
  55. }
  56. }
  57. });
  58. },
  59. getCurrentYearmonth: function(f) {
  60. Ext.Ajax.request({
  61. url: basePath + 'scm/reserve/getCurrentYearmonth.action',
  62. method: 'GET',
  63. callback: function(opt, s, r) {
  64. var rs = Ext.decode(r.responseText);
  65. if(rs.exceptionInfo) {
  66. showError(rs.exceptionInfo);
  67. } else if(rs.data) {
  68. f.setValue(rs.data);
  69. }
  70. }
  71. });
  72. }
  73. });