NewProductCon.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.scm.product.NewProductCon', {
  3. extend: 'Ext.app.Controller',
  4. FormUtil: Ext.create('erp.util.FormUtil'),
  5. BaseUtil: Ext.create('erp.util.BaseUtil'),
  6. views:[
  7. 'scm.product.NewProductCon','core.form.Panel','core.button.Scan',
  8. 'core.button.Add','core.button.Submit','core.button.Audit','core.button.Save','core.button.Close','core.button.ResSubmit',
  9. 'core.button.Update','core.button.Delete','core.button.ResAudit',
  10. 'core.trigger.TextAreaTrigger','core.trigger.DbfindTrigger'
  11. ],
  12. init:function(){
  13. var me = this;
  14. this.control({
  15. 'erpSaveButton': {
  16. click: function(btn){
  17. //申请编号
  18. if(Ext.getCmp('npc_code').value == null || Ext.getCmp('npc_code').value == ''){
  19. me.BaseUtil.getRandomNumber();
  20. }
  21. this.FormUtil.beforeSave(me);
  22. }
  23. },
  24. 'erpCloseButton': {
  25. click: function(btn){
  26. this.FormUtil.beforeClose(this);
  27. }
  28. },
  29. 'erpUpdateButton': {
  30. afterrender: function(btn){
  31. var status = Ext.getCmp('npc_statuscode');
  32. if(status && status.value != 'ENTERING'){
  33. btn.hide();
  34. }
  35. },
  36. click: function(btn){
  37. this.FormUtil.onUpdate(this);
  38. }
  39. },
  40. 'erpDeleteButton': {
  41. afterrender: function(btn){
  42. var status = Ext.getCmp('npc_statuscode');
  43. if(status && status.value != 'ENTERING'){
  44. btn.hide();
  45. }
  46. },
  47. click: function(btn){
  48. this.FormUtil.onDelete(Ext.getCmp('npc_id').value);
  49. }
  50. },
  51. 'erpAddButton': {
  52. click: function(){
  53. me.FormUtil.onAdd('newProductCon', '新物料受控试产申请单', 'jsps/scm/product/newProductCon.jsp');
  54. }
  55. },
  56. 'erpSubmitButton': {
  57. afterrender: function(btn){
  58. var status = Ext.getCmp('npc_statuscode');
  59. if(status && status.value != 'ENTERING'){
  60. btn.hide();
  61. }
  62. },
  63. click: function(btn){
  64. me.FormUtil.onSubmit(Ext.getCmp('npc_id').value);
  65. }
  66. },
  67. 'erpResSubmitButton':{
  68. afterrender: function(btn){
  69. var status = Ext.getCmp('npc_statuscode');
  70. if(status && status.value != 'COMMITED'){
  71. btn.hide();
  72. }
  73. },
  74. click: function(btn){
  75. me.FormUtil.onResSubmit(Ext.getCmp('npc_id').value);
  76. }
  77. },
  78. 'erpAuditButton': {
  79. afterrender: function(btn){
  80. var status = Ext.getCmp('npc_statuscode');
  81. if(status && status.value != 'COMMITED'){
  82. btn.hide();
  83. }
  84. },
  85. click: function(btn){
  86. me.FormUtil.onAudit(Ext.getCmp('npc_id').value);
  87. }
  88. },
  89. 'erpResAuditButton':{
  90. afterrender: function(btn){
  91. var status = Ext.getCmp('npc_statuscode');
  92. if(status && status.value != 'AUDITED'){
  93. btn.hide();
  94. }
  95. },
  96. click: function(btn){
  97. me.FormUtil.onResAudit(Ext.getCmp('npc_id').value);
  98. }
  99. }
  100. });
  101. },
  102. getForm: function(btn){
  103. return btn.ownerCt.ownerCt;
  104. },
  105. save: function(btn){
  106. var me = this;
  107. var form = me.getForm(btn);
  108. if(Ext.getCmp(form.codeField).value == null || Ext.getCmp(form.codeField).value == ''){
  109. me.BaseUtil.getRandomNumber();//自动添加编号
  110. }
  111. me.FormUtil.beforeSave(me);
  112. }
  113. });