Employee.js 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. Ext.define('erp.view.hr.emplmana.Employee', {
  2. extend : 'Ext.Viewport',
  3. hideBorders: true,
  4. initComponent : function() {
  5. var me = this;
  6. Ext.apply(me, {
  7. layout: 'anchor',
  8. items : [ {
  9. xtype : 'erpFormPanel',
  10. anchor : '100% 40%',
  11. saveUrl : 'hr/emplmana/saveEmployee.action',
  12. deleteUrl : 'hr/emplmana/deleteEmployee.action',
  13. updateUrl : 'hr/emplmana/updateEmployee.action',
  14. auditUrl : 'hr/employee/auditEmployee.action',
  15. submitUrl : 'hr/employee/submitEmployee.action',
  16. resSubmitUrl : 'hr/employee/resSubmitEmployee.action',
  17. resAuditUrl : 'hr/employee/resAuditEmployee.action',
  18. getIdUrl : 'common/getId.action?seq=Employee_SEQ',
  19. keyField : 'em_id',
  20. statusField : 'em_statuscode'
  21. },{
  22. xtype:'tabpanel',
  23. anchor: '100% 50%',
  24. items:[{
  25. xtype: 'gridpanel',
  26. id: 'grid',
  27. anchor : '100% 60%',
  28. title: '兼职信息设置',
  29. columns: [{
  30. style :"text-align:center",
  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. style :"text-align:center",
  41. text: '岗位描述',
  42. width: 200,
  43. dataIndex: 'jo_description',
  44. ignore: true
  45. },{
  46. style :"text-align:center",
  47. text: '组织ID',
  48. width: 0,
  49. dataIndex: 'or_id',
  50. ignore: true
  51. },{
  52. text: '组织信息',
  53. style :"text-align:center",
  54. width: 140,
  55. dataIndex: 'or_name',
  56. editor: {
  57. xtype: 'dbfindtrigger'
  58. },
  59. dbfind: 'HrOrg|or_name',
  60. ignore: true
  61. },{
  62. style :"text-align:center",
  63. xtype: 'actioncolumn',
  64. text: '操作',
  65. width: 100,
  66. align: 'center',
  67. items: [{
  68. icon: basePath + 'resource/images/16/delete.png',
  69. tooltip: '删除',
  70. handler: function(view, rowIndex, colIndex) {
  71. var rec = view.getStore().getAt(rowIndex);
  72. warnMsg('确定删除?', function(btn){
  73. if(btn == 'yes'){
  74. view.ownerCt.deleteRecord(rec);
  75. } else if(btn == 'no'){
  76. return;
  77. }
  78. })
  79. }
  80. }]
  81. },{
  82. text: ' ',
  83. hidden: true,
  84. dataIndex: 'jo_id'
  85. }],
  86. necessaryField: 'jo_id',
  87. GridUtil: Ext.create('erp.util.GridUtil'),
  88. dbfinds: [{
  89. field: 'or_id',
  90. dbGridField: 'or_id'
  91. },{
  92. field: 'or_name',
  93. dbGridField: 'or_name'
  94. },{
  95. field: 'or_id',
  96. dbGridField: 'jo_orgid'
  97. },{
  98. field: 'or_name',
  99. dbGridField: 'jo_orgname'
  100. },{
  101. field: 'jo_name',
  102. dbGridField: 'jo_name'
  103. },{
  104. field: 'jo_description',
  105. dbGridField: 'jo_description'
  106. },{
  107. field: 'jo_id',
  108. dbGridField: 'jo_id'
  109. }],
  110. columnLines: true,
  111. plugins: [Ext.create('Ext.grid.plugin.CellEditing', {
  112. clicksToEdit: 1
  113. }),Ext.create('erp.view.core.plugin.CopyPasteMenu')],
  114. store: new Ext.data.Store({
  115. fields: ['jo_name', 'jo_description', 'jo_id','or_id', 'or_name'],
  116. data: [{},{},{},{},{}]
  117. }),
  118. deleteRecord: function(record) {
  119. var empId = Ext.getCmp('em_id').getValue();
  120. if(empId != null && empId > 0 && record.get('jo_id') >= 0 && record.get('jo_name') != null && record.get('jo_name') !='') {
  121. var grid = this, url = "hr/emplmana/deleteExtraJob.action";
  122. grid.setLoading(true);
  123. Ext.Ajax.request({
  124. url : basePath + url,
  125. params: {
  126. caller: caller,
  127. empId: empId,
  128. jobId: record.get('jo_id')
  129. },
  130. method : 'post',
  131. callback : function(opt, success, response){
  132. grid.setLoading(false);
  133. success && grid.store.remove(record);
  134. }
  135. });
  136. } else {
  137. this.store.remove(record);
  138. }
  139. }
  140. },{
  141. xtype: 'gridpanel',
  142. id: 'grid1',
  143. title: '组别信息设置',
  144. columns: [{
  145. style :"text-align:center",
  146. text: '人员编号',
  147. width: 0,
  148. dataIndex: 'eg_emcode',
  149. editor: {
  150. xtype: 'dbfindtrigger'
  151. },
  152. dbfind: 'UserGroup|ug_code',
  153. ignore: true
  154. },{
  155. style :"text-align:center",
  156. text: '组别编号',
  157. width: 160,
  158. dataIndex: 'eg_groupcode',
  159. editor: {
  160. xtype: 'dbfindtrigger'
  161. },
  162. dbfind: 'UserGroup|ug_code',
  163. ignore: true
  164. },{
  165. style :"text-align:center",
  166. text: '组别名称',
  167. width: 220,
  168. dataIndex: 'eg_name',
  169. ignore: true
  170. },{
  171. style :"text-align:center",
  172. text: '组别ID',
  173. width: 0,
  174. dataIndex: 'eg_id',
  175. ignore: true
  176. },{
  177. style :"text-align:center",
  178. xtype: 'actioncolumn',
  179. text: '操作',
  180. width: 100,
  181. align: 'center',
  182. items: [{
  183. icon: basePath + 'resource/images/16/delete.png',
  184. tooltip: '删除',
  185. handler: function(view, rowIndex, colIndex) {
  186. var rec = view.getStore().getAt(rowIndex);
  187. warnMsg('确定删除?', function(btn){
  188. if(btn == 'yes'){
  189. view.ownerCt.deleteRecord1(rec);
  190. } else if(btn == 'no'){
  191. return;
  192. }
  193. })
  194. }
  195. }]
  196. }],
  197. necessaryField: 'eg_groupcode',
  198. GridUtil: Ext.create('erp.util.GridUtil'),
  199. dbfinds: [{
  200. field: 'eg_groupcode',
  201. dbGridField: 'ug_code'
  202. },{
  203. field: 'eg_name',
  204. dbGridField: 'ug_name'
  205. }],
  206. columnLines: true,
  207. plugins: [Ext.create('Ext.grid.plugin.CellEditing', {
  208. clicksToEdit: 1
  209. }),Ext.create('erp.view.core.plugin.CopyPasteMenu')],
  210. store: new Ext.data.Store({
  211. fields: ['eg_emcode', 'eg_name', 'eg_id','eg_groupcode'],
  212. data: [{},{},{},{}]
  213. }),
  214. deleteRecord1: function(record) {
  215. var emCode = Ext.getCmp('em_code').getValue();
  216. var usergroup=record.get('eg_groupcode');
  217. if(emCode != null && usergroup != null) {
  218. var grid = this, url = "hr/emplmana/deleteUserGroup.action";
  219. grid.setLoading(false);
  220. Ext.Ajax.request({
  221. url : basePath + url,
  222. params: {
  223. caller: caller,
  224. emCode: emCode,
  225. usergroup: usergroup
  226. },
  227. method : 'post',
  228. callback : function(opt, success, response){
  229. grid.setLoading(false);
  230. success && grid.store.remove(record);
  231. }
  232. });
  233. } else {
  234. this.store.remove(record);
  235. }
  236. }
  237. }]
  238. }]
  239. });
  240. me.callParent(arguments);
  241. }
  242. });