PackageStandard.js 3.3 KB

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