Reandpunish.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.hr.emplmana.Reandpunish', {
  3. extend: 'Ext.app.Controller',
  4. FormUtil: Ext.create('erp.util.FormUtil'),
  5. BaseUtil: Ext.create('erp.util.BaseUtil'),
  6. views:[
  7. 'hr.emplmana.Reandpunish','core.form.Panel','core.form.MultiField','core.form.FileField',
  8. 'core.button.Add','core.button.Save','core.button.Close',
  9. 'core.button.Submit','core.button.ResAudit','core.button.ResSubmit','core.button.Audit',
  10. 'core.button.Update','core.button.Delete','core.form.YnField',
  11. 'core.trigger.TextAreaTrigger','core.trigger.DbfindTrigger'
  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. 'erpCloseButton': {
  26. click: function(btn){
  27. this.FormUtil.beforeClose(this);
  28. }
  29. },
  30. 'erpUpdateButton': {
  31. click: function(btn){
  32. this.FormUtil.onUpdate(this);
  33. }
  34. },
  35. 'erpDeleteButton': {
  36. click: function(btn){
  37. me.FormUtil.onDelete(Ext.getCmp('rp_id').value);
  38. }
  39. },
  40. 'erpAddButton': {
  41. click: function(){
  42. if(caller == 'Reandpunish'){
  43. me.FormUtil.onAdd('addReandpunish', '新增奖惩', 'jsps/hr/emplmana/reandpunish/reandpunish.jsp');
  44. }else{
  45. me.FormUtil.onAdd('addReandpunish1', '新增奖惩', 'jsps/hr/emplmana/reandpunish/reandpunish1.jsp');
  46. }
  47. }
  48. },
  49. 'erpSubmitButton': {
  50. afterrender: function(btn){
  51. var status = Ext.getCmp('rp_statuscode');
  52. if(status && status.value != 'ENTERING'){
  53. btn.hide();
  54. }
  55. },
  56. click: function(btn){
  57. me.FormUtil.onSubmit(Ext.getCmp('rp_id').value);
  58. }
  59. },
  60. 'erpResSubmitButton': {
  61. afterrender: function(btn){
  62. var status = Ext.getCmp('rp_statuscode');
  63. if(status && status.value != 'COMMITED'){
  64. btn.hide();
  65. }
  66. },
  67. click: function(btn){
  68. me.FormUtil.onResSubmit(Ext.getCmp('rp_id').value);
  69. }
  70. },
  71. 'erpAuditButton': {
  72. afterrender: function(btn){
  73. var status = Ext.getCmp('rp_statuscode');
  74. if(status && status.value != 'COMMITED'){
  75. btn.hide();
  76. }
  77. },
  78. click: function(btn){
  79. me.FormUtil.onAudit(Ext.getCmp('rp_id').value);
  80. }
  81. },
  82. 'field[name=rp_sourcecode]':{
  83. afterrender:function(f){
  84. f.setFieldStyle({
  85. 'color': 'red'
  86. });
  87. f.focusCls = 'mail-attach';
  88. var c = Ext.Function.bind(me.openSource, me);
  89. Ext.EventManager.on(f.inputEl, {
  90. mousedown : c,
  91. scope: f,
  92. buffer : 100
  93. });
  94. }
  95. },
  96. 'erpResAuditButton': {
  97. afterrender: function(btn){
  98. var status = Ext.getCmp('rp_statuscode');
  99. if(status && status.value != 'AUDITED'){
  100. btn.hide();
  101. }
  102. },
  103. click: function(btn){
  104. me.FormUtil.onResAudit(Ext.getCmp('rp_id').value);
  105. }
  106. }
  107. });
  108. },
  109. getForm: function(btn){
  110. return btn.ownerCt.ownerCt;
  111. },
  112. openSource : function(e, el, obj) {
  113. var f = obj.scope;
  114. if(f.value) {
  115. this.FormUtil.onAdd(null, f.ownerCt.down('#rp_sourcecode').value,
  116. f.ownerCt.down('#rp_sourcelink').value + '&_noc=1');
  117. }
  118. }
  119. });