Periodsdetailfreeze.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.scm.reserve.Periodsdetailfreeze', {
  3. extend: 'Ext.app.Controller',
  4. FormUtil: Ext.create('erp.util.FormUtil'),
  5. BaseUtil: Ext.create('erp.util.BaseUtil'),
  6. views:[
  7. 'scm.reserve.PeriodsdetailfreezeForm','scm.reserve.Periodsdetailfreeze','core.button.Close',
  8. 'core.button.Freeze','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. 'erpFreezeButton':{
  19. click: function(btn){
  20. Ext.Ajax.request({
  21. url : basePath + "scm/reserves/Periodsdetailfreeze.action",
  22. params:{pd_detno:Ext.getCmp('pd_detno').value},
  23. method : 'post',
  24. callback : function(options,success,response){
  25. var res = new Ext.decode(response.responseText);
  26. if(res.exceptionInfo != null){
  27. showError(res.exceptionInfo);
  28. return;
  29. }
  30. if(res.success){
  31. Ext.Msg.alert("提示","冻结成功!");
  32. window.location.reload();
  33. }
  34. }
  35. });
  36. }
  37. },
  38. 'field[name=pd_detno]':{
  39. afterrender:function(f){
  40. me.getCurrentMonth(f);
  41. }
  42. },
  43. 'field[name=date]':{
  44. afterrender:function(f){
  45. me.getFreezeDetno(f);
  46. }
  47. }
  48. });
  49. },
  50. getCurrentMonth: function(f) {
  51. Ext.Ajax.request({
  52. url: basePath + 'fa/getMonth.action',
  53. params: {
  54. type: 'MONTH-P'
  55. },
  56. callback: function(opt, s, r) {
  57. var rs = Ext.decode(r.responseText);
  58. if(rs.data) {
  59. f.setValue(rs.data.PD_DETNO);
  60. }
  61. }
  62. });
  63. },
  64. getFreezeDetno: function(f) {
  65. Ext.Ajax.request({
  66. url: basePath + 'scm/reserve/getFreezeDetno.action',
  67. method: 'GET',
  68. callback: function(opt, s, r) {
  69. var rs = Ext.decode(r.responseText);
  70. if(rs.exceptionInfo) {
  71. showError(rs.exceptionInfo);
  72. } else if(rs.data) {
  73. f.setValue(rs.data);
  74. } else {
  75. f.setValue('无');
  76. }
  77. }
  78. });
  79. }
  80. });