Periodsdetailfreeze.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. }
  33. }
  34. });
  35. }
  36. },
  37. 'field[name=pd_detno]':{
  38. afterrender:function(f){
  39. me.getCurrentMonth(f);
  40. }
  41. },
  42. 'field[name=date]':{
  43. afterrender:function(f){
  44. me.getFreezeDetno(f);
  45. }
  46. }
  47. });
  48. },
  49. getCurrentMonth: function(f) {
  50. Ext.Ajax.request({
  51. url: basePath + 'fa/getMonth.action',
  52. params: {
  53. type: 'MONTH-P'
  54. },
  55. callback: function(opt, s, r) {
  56. var rs = Ext.decode(r.responseText);
  57. if(rs.data) {
  58. f.setValue(rs.data.PD_DETNO);
  59. }
  60. }
  61. });
  62. },
  63. getFreezeDetno: function(f) {
  64. Ext.Ajax.request({
  65. url: basePath + 'scm/reserve/getFreezeDetno.action',
  66. method: 'GET',
  67. callback: function(opt, s, r) {
  68. var rs = Ext.decode(r.responseText);
  69. if(rs.exceptionInfo) {
  70. showError(rs.exceptionInfo);
  71. } else if(rs.data) {
  72. f.setValue(rs.data);
  73. } else {
  74. f.setValue('无');
  75. }
  76. }
  77. });
  78. }
  79. });