Employee.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. Ext.define('erp.view.hr.emplmana.Employee', {
  2. extend : 'Ext.Viewport',
  3. layout : 'anchor',
  4. initComponent : function() {
  5. var me = this;
  6. Ext.apply(me, {
  7. items : [ {
  8. xtype : 'erpFormPanel',
  9. anchor : '100% 40%',
  10. saveUrl : 'hr/emplmana/saveEmployee.action',
  11. deleteUrl : 'hr/emplmana/deleteEmployee.action',
  12. updateUrl : 'hr/emplmana/updateEmployee.action',
  13. auditUrl : 'hr/employee/auditEmployee.action',
  14. submitUrl : 'hr/employee/submitEmployee.action',
  15. resSubmitUrl : 'hr/employee/resSubmitEmployee.action',
  16. resAuditUrl : 'hr/employee/resAuditEmployee.action',
  17. getIdUrl : 'common/getId.action?seq=Employee_SEQ',
  18. keyField : 'em_id',
  19. statusField : 'em_statuscode'
  20. }, {
  21. xtype: 'gridpanel',
  22. id: 'grid',
  23. anchor : '100% 60%',
  24. title: '其它岗位设置',
  25. columns: [{
  26. text: '所属组织',
  27. width: 140,
  28. dataIndex: 'jo_orgname',
  29. ignore: true
  30. },{
  31. text: '岗位名称',
  32. width: 160,
  33. dataIndex: 'jo_name',
  34. editor: {
  35. xtype: 'dbfindtrigger'
  36. },
  37. dbfind: 'Job|jo_name',
  38. ignore: true
  39. },{
  40. text: '岗位描述',
  41. width: 200,
  42. dataIndex: 'jo_description',
  43. ignore: true
  44. },{
  45. xtype: 'actioncolumn',
  46. text: '操作',
  47. width: 100,
  48. align: 'center',
  49. items: [{
  50. icon: basePath + 'resource/images/16/delete.png',
  51. tooltip: '删除',
  52. handler: function(view, rowIndex, colIndex) {
  53. var rec = view.getStore().getAt(rowIndex);
  54. view.ownerCt.deleteRecord(rec);
  55. }
  56. }]
  57. },{
  58. text: ' ',
  59. hidden: true,
  60. dataIndex: 'jo_id'
  61. }],
  62. necessaryField: 'jo_id',
  63. GridUtil: Ext.create('erp.util.GridUtil'),
  64. dbfinds: [{
  65. field: 'jo_orgname',
  66. dbGridField: 'jo_orgname'
  67. },{
  68. field: 'jo_name',
  69. dbGridField: 'jo_name'
  70. },{
  71. field: 'jo_description',
  72. dbGridField: 'jo_description'
  73. },{
  74. field: 'jo_id',
  75. dbGridField: 'jo_id'
  76. }],
  77. columnLines: true,
  78. plugins: [Ext.create('Ext.grid.plugin.CellEditing', {
  79. clicksToEdit: 1
  80. })],
  81. store: new Ext.data.Store({
  82. fields: ['jo_orgname', 'jo_name', 'jo_description', 'jo_id'],
  83. data: [{},{},{},{},{}]
  84. }),
  85. deleteRecord: function(record) {
  86. var empId = Ext.getCmp('em_id').getValue();
  87. if(empId != null && empId > 0 && record.get('jo_id') > 0) {
  88. var grid = this, url = "hr/emplmana/deleteExtraJob.action";
  89. grid.setLoading(true);
  90. Ext.Ajax.request({
  91. url : basePath + url,
  92. params: {
  93. caller: caller,
  94. empId: empId,
  95. jobId: record.get('jo_id')
  96. },
  97. method : 'post',
  98. callback : function(opt, success, response){
  99. grid.setLoading(false);
  100. success && grid.store.remove(record);
  101. }
  102. });
  103. } else {
  104. this.store.remove(record);
  105. }
  106. }
  107. }]
  108. });
  109. me.callParent(arguments);
  110. }
  111. });