Reandpunish.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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',
  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. this.FormUtil.beforeSave(this);
  19. }
  20. },
  21. 'erpCloseButton': {
  22. click: function(btn){
  23. this.FormUtil.beforeClose(this);
  24. }
  25. },
  26. 'erpUpdateButton': {
  27. click: function(btn){
  28. this.FormUtil.onUpdate(this);
  29. }
  30. },
  31. 'erpDeleteButton': {
  32. click: function(btn){
  33. me.FormUtil.onDelete(Ext.getCmp('rp_id').value);
  34. }
  35. },
  36. 'erpAddButton': {
  37. click: function(){
  38. me.FormUtil.onAdd('addReandpunish', '新增奖惩', 'jsps/hr/emplmana/reandpunish/reandpunish.jsp');
  39. }
  40. },
  41. 'erpSubmitButton': {
  42. afterrender: function(btn){
  43. var status = Ext.getCmp('rp_statuscode');
  44. if(status && status.value != 'ENTERING'){
  45. btn.hide();
  46. }
  47. },
  48. click: function(btn){
  49. me.FormUtil.onSubmit(Ext.getCmp('rp_id').value);
  50. }
  51. },
  52. 'erpResSubmitButton': {
  53. afterrender: function(btn){
  54. var status = Ext.getCmp('rp_statuscode');
  55. if(status && status.value != 'COMMITED'){
  56. btn.hide();
  57. }
  58. },
  59. click: function(btn){
  60. me.FormUtil.onResSubmit(Ext.getCmp('rp_id').value);
  61. }
  62. },
  63. 'erpAuditButton': {
  64. afterrender: function(btn){
  65. var status = Ext.getCmp('rp_statuscode');
  66. if(status && status.value != 'COMMITED'){
  67. btn.hide();
  68. }
  69. },
  70. click: function(btn){
  71. me.FormUtil.onAudit(Ext.getCmp('rp_id').value);
  72. }
  73. },
  74. 'field[name=rp_sourcecode]':{
  75. afterrender:function(f){
  76. f.setFieldStyle({
  77. 'color': 'red'
  78. });
  79. f.focusCls = 'mail-attach';
  80. var c = Ext.Function.bind(me.openSource, me);
  81. Ext.EventManager.on(f.inputEl, {
  82. mousedown : c,
  83. scope: f,
  84. buffer : 100
  85. });
  86. }
  87. },
  88. 'erpResAuditButton': {
  89. afterrender: function(btn){
  90. var status = Ext.getCmp('rp_statuscode');
  91. if(status && status.value != 'AUDITED'){
  92. btn.hide();
  93. }
  94. },
  95. click: function(btn){
  96. me.FormUtil.onResAudit(Ext.getCmp('rp_id').value);
  97. }
  98. }
  99. });
  100. },
  101. getForm: function(btn){
  102. return btn.ownerCt.ownerCt;
  103. },
  104. openSource : function(e, el, obj) {
  105. var f = obj.scope;
  106. if(f.value) {
  107. this.FormUtil.onAdd(null, f.ownerCt.down('#rp_sourcecode').value,
  108. f.ownerCt.down('#rp_sourcelink').value + '&_noc=1');
  109. }
  110. },
  111. });