Job.js 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.hr.emplmana.Job', {
  3. extend: 'Ext.app.Controller',
  4. FormUtil: Ext.create('erp.util.FormUtil'),
  5. BaseUtil: Ext.create('erp.util.BaseUtil'),
  6. views:[
  7. 'hr.emplmana.Job','core.form.Panel','core.button.Sync','core.button.Submit',
  8. 'core.button.Audit','core.button.ResAudit','core.button.ResSubmit',
  9. 'core.button.Add','core.button.Save','core.button.Close','core.button.CopyPower',
  10. 'core.button.Update','core.button.Delete','core.form.YnField','core.button.Banned','core.button.ResBanned',
  11. 'core.trigger.TextAreaTrigger','core.trigger.DbfindTrigger'
  12. ],
  13. init:function(){
  14. var me = this;
  15. this.control({
  16. 'erpSyncButton': {
  17. afterrender: function(btn){
  18. btn.autoClearCache = true;
  19. }
  20. },
  21. 'erpSaveButton': {
  22. click: function(btn){
  23. var form = me.getForm(btn);
  24. if(Ext.getCmp(form.codeField).value == null || Ext.getCmp(form.codeField).value == ''){
  25. me.BaseUtil.getRandomNumber();//自动添加编号
  26. }
  27. this.FormUtil.beforeSave(this);
  28. }
  29. },
  30. 'erpCloseButton': {
  31. click: function(btn){
  32. this.FormUtil.beforeClose(this);
  33. }
  34. },
  35. 'erpUpdateButton': {
  36. afterrender: function(btn){
  37. var status = Ext.getCmp('jo_statuscode');
  38. if(status && status.value == 'DISABLE'){
  39. btn.hide();
  40. }
  41. },
  42. click: function(btn){
  43. this.FormUtil.onUpdate(this);
  44. }
  45. },
  46. 'erpDeleteButton': {
  47. afterrender: function(btn){
  48. var status = Ext.getCmp('jo_statuscode');
  49. if(status && status.value == 'DISABLE'){
  50. btn.hide();
  51. }
  52. },
  53. click: function(btn){
  54. me.FormUtil.onDelete(Ext.getCmp('jo_id').value);
  55. }
  56. },
  57. 'erpAddButton': {
  58. click: function(){
  59. me.FormUtil.onAdd('addJob', '新增岗位资料', 'jsps/hr/emplmana/employee/job.jsp');
  60. }
  61. },'erpSubmitButton': {
  62. afterrender: function(btn){
  63. var status = Ext.getCmp('jo_statuscode');
  64. if(status && status.value != 'ENTERING'){
  65. btn.hide();
  66. }
  67. },
  68. click: function(btn){
  69. me.FormUtil.onSubmit(Ext.getCmp('jo_id').value);
  70. }
  71. },
  72. 'erpResSubmitButton': {
  73. afterrender: function(btn){
  74. var status = Ext.getCmp('jo_statuscode');
  75. if(status && status.value != 'COMMITED'){
  76. btn.hide();
  77. }
  78. },
  79. click: function(btn){
  80. me.FormUtil.onResSubmit(Ext.getCmp('jo_id').value);
  81. }
  82. },
  83. 'erpAuditButton': {
  84. afterrender: function(btn){
  85. var status = Ext.getCmp('jo_statuscode');
  86. if(status && status.value != 'COMMITED'){
  87. btn.hide();
  88. }
  89. },
  90. click: function(btn){
  91. me.FormUtil.onAudit(Ext.getCmp('jo_id').value);
  92. }
  93. },
  94. 'erpResAuditButton': {
  95. afterrender: function(btn){
  96. var status = Ext.getCmp('jo_statuscode');
  97. if(status && status.value != 'AUDITED'){
  98. btn.hide();
  99. }
  100. },
  101. click: function(btn){
  102. me.FormUtil.onResAudit(Ext.getCmp('jo_id').value);
  103. }
  104. },
  105. 'erpBannedButton': {
  106. afterrender: function(btn){
  107. var status = Ext.getCmp('jo_statuscode');
  108. if(status && status.value == 'DISABLE'){
  109. btn.hide();
  110. }
  111. },
  112. click: function(btn){
  113. this.FormUtil.onBanned(Ext.getCmp('jo_id').value);
  114. }
  115. },
  116. 'erpResBannedButton': {
  117. afterrender: function(btn){
  118. var status = Ext.getCmp('jo_statuscode');
  119. if(status && status.value != 'DISABLE'){
  120. btn.hide();
  121. }
  122. },
  123. click: function(btn){
  124. this.FormUtil.onResBanned(Ext.getCmp('jo_id').value);
  125. }
  126. },
  127. 'erpCopyPowerButton': {//复制权限
  128. click: function() {
  129. var id = Ext.getCmp('jo_id').value;
  130. if(id == null || id == 0) {
  131. return;
  132. }
  133. var win = Ext.getCmp('power-copy-win');
  134. if(!win ) {
  135. win = Ext.create('Ext.Window', {
  136. id: 'power-copy-win',
  137. width: 800,
  138. height: 400,
  139. title: '选择目标岗位',
  140. layout: {
  141. type: 'vbox'
  142. },
  143. defaults: {
  144. margin: '3 3 3 10'
  145. },
  146. items: [{
  147. xtype: 'dbfindtrigger',
  148. fieldLabel: '岗位编号',
  149. id: 'jo_code_source',
  150. name: 'jo_code_source'
  151. }, {
  152. xtype: 'displayfield',
  153. fieldLabel: '岗位名称',
  154. id: 'jo_name_source',
  155. name: 'jo_name_source'
  156. }, {
  157. xtype: 'displayfield',
  158. fieldLabel: '岗位描述',
  159. id: 'jo_description_source',
  160. name: 'jo_description_source'
  161. }, {
  162. xtype: 'hidden',
  163. fieldLabel: 'ID',
  164. id: 'jo_id_source',
  165. name: 'jo_id_source'
  166. }],
  167. buttonAlign: 'center',
  168. buttons: [{
  169. text: $I18N.common.button.erpConfirmButton,
  170. cls: 'x-btn-blue',
  171. handler: function(btn) {
  172. var w = btn.ownerCt.ownerCt;
  173. if(w.down('#jo_id_source').value > 0) {
  174. warnMsg('确定复制 ' + w.down('#jo_name_source').value + ' 的权限吗?', function(btn){
  175. if(btn == 'yes'){
  176. me.copyPower(Ext.getCmp('jo_id').value, w.down('#jo_id_source').value);
  177. }
  178. });
  179. }
  180. }
  181. }, {
  182. text: $I18N.common.button.erpCloseButton,
  183. cls: 'x-btn-blue',
  184. handler: function(btn) {
  185. btn.ownerCt.ownerCt.close();
  186. }
  187. }]
  188. });
  189. }
  190. win.show();
  191. }
  192. }
  193. });
  194. },
  195. getForm: function(btn){
  196. return btn.ownerCt.ownerCt;
  197. },
  198. copyPower: function(id, sourceid) {
  199. Ext.Ajax.request({
  200. });
  201. }
  202. });