Turnposition.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.hr.emplmana.Turnposition', {
  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. 'hr.emplmana.Turnposition','core.form.Panel','core.grid.Panel2','core.toolbar.Toolbar',
  9. 'core.button.Add','core.button.Save','core.button.Close','core.button.DeleteDetail',
  10. 'core.button.Update','core.button.Delete','core.form.YnField','core.form.FileField',
  11. 'core.button.ResAudit','core.button.Audit','core.button.Submit','core.button.ResSubmit',
  12. 'core.trigger.TextAreaTrigger','core.trigger.DbfindTrigger','core.button.TurnPosition'
  13. ],
  14. init:function(){
  15. var me = this;
  16. this.control({
  17. 'dbfindtrigger[name=tp_emcode]':{
  18. 'aftertrigger':function(){
  19. console.log('aa');
  20. Ext.getCmp('tp_oldposition').setValue(Ext.getCmp('tp_position').value);
  21. }
  22. },
  23. 'erpGridPanel2': {
  24. itemclick: this.onGridItemClick
  25. },
  26. 'erpSaveButton': {
  27. click: function(btn){
  28. var form = me.getForm(btn);
  29. if(Ext.getCmp(form.codeField).value == null || Ext.getCmp(form.codeField).value == ''){
  30. me.BaseUtil.getRandomNumber();//自动添加编号
  31. }
  32. this.FormUtil.beforeSave(this);
  33. }
  34. },
  35. 'erpCloseButton': {
  36. click: function(btn){
  37. this.FormUtil.beforeClose(this);
  38. }
  39. },
  40. 'erpUpdateButton': {
  41. click: function(btn){
  42. this.FormUtil.onUpdate(this);
  43. }
  44. },
  45. 'erpDeleteButton': {
  46. click: function(btn){
  47. me.FormUtil.onDelete(Ext.getCmp('tp_id').value);
  48. }
  49. },
  50. 'erpAddButton': {
  51. click: function(){
  52. me.FormUtil.onAdd('addTurnposition', '新增职位调用单', 'jsps/hr/emplmana/employee/turnposition.jsp');
  53. }
  54. },'erpSubmitButton': {
  55. afterrender: function(btn){
  56. var status = Ext.getCmp('tp_statuscode');
  57. if(status && status.value != 'ENTERING'){
  58. btn.hide();
  59. }
  60. },
  61. click: function(btn){
  62. me.FormUtil.onSubmit(Ext.getCmp('tp_id').value);
  63. }
  64. },
  65. 'erpResSubmitButton': {
  66. afterrender: function(btn){
  67. var status = Ext.getCmp('tp_statuscode');
  68. if(status && status.value != 'COMMITED'){
  69. btn.hide();
  70. }
  71. },
  72. click: function(btn){
  73. me.FormUtil.onResSubmit(Ext.getCmp('tp_id').value);
  74. }
  75. },
  76. 'erpAuditButton': {
  77. afterrender: function(btn){
  78. var status = Ext.getCmp('tp_statuscode');
  79. if(status && status.value != 'COMMITED'){
  80. btn.hide();
  81. }
  82. },
  83. click: function(btn){
  84. me.FormUtil.onAudit(Ext.getCmp('tp_id').value);
  85. }
  86. },
  87. 'erpResAuditButton': {
  88. afterrender: function(btn){
  89. var status = Ext.getCmp('tp_statuscode');
  90. if(status && status.value != 'AUDITED'){
  91. btn.hide();
  92. }
  93. },
  94. click: function(btn){
  95. me.FormUtil.onResAudit(Ext.getCmp('tp_id').value);
  96. }
  97. },
  98. 'erpTurnPositionButton': {
  99. afterrender: function(btn){
  100. var status = Ext.getCmp('tp_statuscode');
  101. if(status && status.value != 'AUDITED'){
  102. btn.hide();
  103. }
  104. },
  105. click: function(btn){
  106. var param = this.GridUtil.getAllGridStore();
  107. param = "[" + param.toString() + "]";
  108. warnMsg('确定要更新用户资料吗?', function(btn){
  109. if (btn == 'yes') {
  110. Ext.Ajax.request({
  111. url:basePath + "hr/emplmana/updatePosition.action",
  112. params:{
  113. param:param
  114. },
  115. method:'post',
  116. callback:function(options,success,response){
  117. var res = new Ext.decode(response.responseText);
  118. if(res.success){
  119. Ext.Msg.alert("提示", "更新员工资料成功!");
  120. }else{
  121. Ext.Msg.alert("提示", "更新员工资料失败!");
  122. }
  123. }
  124. });
  125. } else {
  126. return;
  127. }
  128. });
  129. }
  130. }
  131. });
  132. },
  133. onGridItemClick: function(selModel, record){//grid行选择
  134. this.GridUtil.onGridItemClick(selModel, record);
  135. },
  136. getForm: function(btn){
  137. return btn.ownerCt.ownerCt;
  138. }
  139. });