JProcessTransfer.js 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.common.JProcessTransfer', {
  3. extend: 'Ext.app.Controller',
  4. FormUtil: Ext.create('erp.util.FormUtil'),
  5. BaseUtil: Ext.create('erp.util.BaseUtil'),
  6. GridUtil: Ext.create('erp.util.GridUtil'),
  7. views:[
  8. 'core.form.Panel','common.JProcess.JprocessTransfer','core.grid.Panel2','core.toolbar.Toolbar','core.form.MultiField',
  9. 'core.button.Save','core.button.Add','core.button.Close','core.button.Delete','core.button.Update','core.button.Banned','core.button.ResBanned',
  10. 'core.trigger.DbfindTrigger','core.trigger.TextAreaTrigger','core.form.YnField','core.form.StatusField'
  11. ],
  12. init:function(){
  13. var me = this;
  14. this.control({
  15. 'erpSaveButton': {
  16. click: function(btn){
  17. var form = me.getForm(btn);
  18. var codevalue=Ext.getCmp(form.codeField).value;
  19. if(codevalue == null ||codevalue == ''){
  20. me.BaseUtil.getRandomNumber();//自动添加编号
  21. }
  22. me.FormUtil.beforeSave(this);
  23. },
  24. afterrender:function(btn){
  25. var value=Ext.getCmp('jt_id').getValue();
  26. if(value){
  27. btn.setDisabled(true);
  28. }
  29. }
  30. },
  31. 'erpUpdateButton': {
  32. click: function(btn){
  33. me.FormUtil.onUpdate(this);
  34. },
  35. afterrender:function(btn){
  36. var value=Ext.getCmp('jt_id').getValue();
  37. if(!value){
  38. btn.setDisabled(true);
  39. }
  40. }
  41. },
  42. 'messagebox':{
  43. hide:function(btn){
  44. var grid=Ext.getCmp('grid');
  45. var storeparam={
  46. caller:caller,
  47. condition:"Jt_id is not null"
  48. };
  49. me.GridUtil.loadNewStore(grid,storeparam);
  50. }
  51. },
  52. 'erpDeleteButton': {
  53. click: function(btn){
  54. me.FormUtil.onDelete(Ext.getCmp('jt_id').value);
  55. },
  56. afterrender:function(btn){
  57. var value=Ext.getCmp('jt_id').getValue();
  58. if(!value){
  59. btn.setDisabled(true);
  60. }
  61. }
  62. },
  63. 'hidden[id=jt_id]':{
  64. change:function(field){
  65. Ext.ComponentQuery.query('erpSaveButton')[0].hide();
  66. Ext.ComponentQuery.query('erpDeleteButton')[0].setDisabled(false);
  67. Ext.ComponentQuery.query('erpUpdateButton')[0].setDisabled(false);
  68. }
  69. },
  70. 'hidden[id=jt_statuscode]':{
  71. change:function(field){
  72. if(field.value=='VALID'){
  73. Ext.ComponentQuery.query('erpResBannedButton')[0].setDisabled(true);
  74. Ext.ComponentQuery.query('erpBannedButton')[0].setDisabled(false);
  75. }else {
  76. Ext.ComponentQuery.query('erpResBannedButton')[0].setDisabled(false);
  77. Ext.ComponentQuery.query('erpBannedButton')[0].setDisabled(true);
  78. }
  79. }
  80. },
  81. 'erpAddButton': {
  82. click: function(btn){
  83. me.getForm(btn).getForm().reset();
  84. Ext.ComponentQuery.query('erpSaveButton')[0].show();
  85. Ext.ComponentQuery.query('erpDeleteButton')[0].setDisabled(true);
  86. Ext.ComponentQuery.query('erpUpdateButton')[0].setDisabled(true);
  87. Ext.ComponentQuery.query('erpBannedButton')[0].setDisabled(true);
  88. Ext.ComponentQuery.query('erpResBannedButton')[0].setDisabled(true);
  89. }
  90. },
  91. 'erpCloseButton': {
  92. click: function(btn){
  93. me.FormUtil.beforeClose(me);
  94. }
  95. },
  96. 'combo[id=jt_transfertype]':{
  97. change:function(combo,newvalue){
  98. var field=Ext.getCmp('jt_processdefid');
  99. if(field&&newvalue=='part'){
  100. field.setFieldStyle("background:#fffac0;color:#515151;");
  101. }else if(field&&newvalue!='part') {
  102. field.setFieldStyle("background:#FFFAFA;color:#515151;");
  103. }
  104. }
  105. },
  106. 'erpBannedButton':{
  107. click:function(btn){
  108. me.FormUtil.onBanned(Ext.getCmp('jt_id').getValue());
  109. },
  110. afterrender:function(btn){
  111. var value=Ext.getCmp('jt_statuscode').getValue();
  112. if(value!='VALID'){
  113. btn.setDisabled(true);
  114. }
  115. }
  116. },
  117. 'erpResBannedButton':{
  118. click:function(btn){
  119. me.FormUtil.onResBanned(Ext.getCmp('jt_id').getValue());
  120. },
  121. afterrender:function(btn){
  122. var value=Ext.getCmp('jt_statuscode').getValue();
  123. if(value=='VALID'){
  124. btn.setDisabled(true);
  125. }
  126. }
  127. },
  128. 'erpGridPanel2':{
  129. itemclick:function( grid,record ){
  130. Ext.getCmp('form').getForm().setValues(record.data);
  131. }
  132. }
  133. });
  134. },
  135. getForm: function(btn){
  136. return btn.ownerCt.ownerCt;
  137. }
  138. });