Vehiclemaintain.js 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.oa.vehicle.Vehiclemaintain', {
  3. extend: 'Ext.app.Controller',
  4. FormUtil: Ext.create('erp.util.FormUtil'),
  5. BaseUtil: Ext.create('erp.util.BaseUtil'),
  6. views:[
  7. 'oa.vehicle.Vehiclemaintain','core.form.Panel','core.form.FileField','core.form.MultiField','core.button.End','core.button.ResEnd',
  8. 'core.button.Add','core.button.Submit','core.button.Audit','core.button.Save','core.button.Close','core.button.Print',
  9. 'core.button.Upload','core.button.Update','core.button.Delete','core.button.ResAudit','core.button.ResSubmit',
  10. 'core.trigger.DbfindTrigger','core.trigger.TextAreaTrigger','core.trigger.AutoCodeTrigger','core.button.TurnFYBX',
  11. 'core.form.YnField','core.trigger.DbfindTrigger','core.button.Scan'
  12. ],
  13. init:function(){
  14. var me = this;
  15. this.control({
  16. 'erpSaveButton': {
  17. click: function(btn){
  18. var form = me.getForm(btn);
  19. if(Ext.getCmp(form.codeField).value == null || Ext.getCmp(form.codeField).value == ''){
  20. me.BaseUtil.getRandomNumber();//自动添加编号
  21. }
  22. this.FormUtil.beforeSave(this);
  23. }
  24. },
  25. 'erpDeleteButton' : {
  26. afterrender: function(btn){
  27. var status = Ext.getCmp('vd_statuscode');
  28. if(status && status.value != 'ENTERING'){
  29. btn.hide();
  30. }
  31. },
  32. click: function(btn){
  33. me.FormUtil.onDelete(Ext.getCmp('vd_id').value);
  34. }
  35. },
  36. 'erpEndButton': {
  37. afterrender: function(btn){
  38. var status = Ext.getCmp('vd_statuscode');
  39. if(status && status.value == 'FINISH'){
  40. btn.hide();
  41. }
  42. },
  43. click: function(btn){
  44. this.FormUtil.onEnd(Ext.getCmp('vd_id').value);
  45. }
  46. },
  47. 'erpResEndButton': {
  48. afterrender: function(btn){
  49. var status = Ext.getCmp('vd_statuscode');
  50. if(status && status.value != 'FINISH'){
  51. btn.hide();
  52. }
  53. },
  54. click: function(btn){
  55. this.FormUtil.onResEnd(Ext.getCmp('vd_id').value);
  56. }
  57. },
  58. 'erpUpdateButton': {
  59. afterrender: function(btn){
  60. var status = Ext.getCmp('vd_statuscode');
  61. if(status && status.value != 'ENTERING'){
  62. btn.hide();
  63. }
  64. },
  65. click: function(btn){
  66. this.FormUtil.onUpdate(this);
  67. }
  68. },
  69. 'erpAddButton': {
  70. click: function(){
  71. me.FormUtil.onAdd('addVehiclemaintain', '新增车辆维修单', 'jsps/oa/vehicle/vehiclemaintain.jsp');
  72. }
  73. },
  74. 'erpCloseButton': {
  75. click: function(btn){
  76. me.FormUtil.beforeClose(me);
  77. }
  78. },'erpSubmitButton': {
  79. afterrender: function(btn){
  80. var status = Ext.getCmp('vd_statuscode');
  81. if(status && status.value != 'ENTERING'){
  82. btn.hide();
  83. }
  84. },
  85. click: function(btn){
  86. me.FormUtil.onSubmit(Ext.getCmp('vd_id').value);
  87. }
  88. },
  89. 'erpResSubmitButton': {
  90. afterrender: function(btn){
  91. var status = Ext.getCmp('vd_statuscode');
  92. if(status && status.value != 'COMMITED'){
  93. btn.hide();
  94. }
  95. },
  96. click: function(btn){
  97. me.FormUtil.onResSubmit(Ext.getCmp('vd_id').value);
  98. }
  99. },
  100. 'erpAuditButton': {
  101. afterrender: function(btn){
  102. var status = Ext.getCmp('vd_statuscode');
  103. if(status && status.value != 'COMMITED'){
  104. btn.hide();
  105. }
  106. },
  107. click: function(btn){
  108. me.FormUtil.onAudit(Ext.getCmp('vd_id').value);
  109. }
  110. },'erpResAuditButton': {
  111. afterrender: function(btn){
  112. var status = Ext.getCmp('vd_statuscode');
  113. if(status && status.value != 'AUDITED'){
  114. btn.hide();
  115. }
  116. },
  117. click: function(btn){
  118. me.FormUtil.onResAudit(Ext.getCmp('vd_id').value);
  119. }
  120. },
  121. 'erpTurnFYBXButton':{
  122. afterrender: function(btn){
  123. var status = Ext.getCmp('vd_statuscode');
  124. var turnstatus=Ext.getCmp('vd_turnstatus');
  125. if((status && status.value != 'AUDITED')||turnstatus.value=='已转'){
  126. btn.hide();
  127. }
  128. },
  129. click: function(btn){
  130. warnMsg("确定要转入费用报销单吗?", function(btn){
  131. if(btn == 'yes'){
  132. me.FormUtil.getActiveTab().setLoading(true);//loading...
  133. Ext.Ajax.request({
  134. url : basePath + 'oa/vehiclemaintain/turnFYBX.action',
  135. params: {
  136. caller: caller,
  137. id: Ext.getCmp('vd_id').value
  138. },
  139. method : 'post',
  140. callback : function(options,success,response){
  141. me.FormUtil.getActiveTab().setLoading(false);
  142. var localJson = new Ext.decode(response.responseText);
  143. if(localJson.exceptionInfo){
  144. showError(localJson.exceptionInfo);
  145. }
  146. if(localJson.success){
  147. turnSuccess(function(){
  148. var id = localJson.id;
  149. var url = "jsps/oa/fee/feePleaseFYBX.jsp?whoami=FeePlease!FYBX&formCondition=fp_id=" + id + "&gridCondition=fpd_fpid=" + id;
  150. me.FormUtil.onAdd('FeePlease' + id, '费用报销单' + id, url);
  151. });
  152. }
  153. }
  154. });
  155. }
  156. });
  157. }
  158. }
  159. });
  160. },
  161. getForm: function(btn){
  162. return btn.ownerCt.ownerCt;
  163. }
  164. });