HrOrgStr.js 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.hr.employee.HrOrgStr', {
  3. extend: 'Ext.app.Controller',
  4. FormUtil: Ext.create('erp.util.FormUtil'),
  5. BaseUtil: Ext.create('erp.util.BaseUtil'),
  6. views:[
  7. 'hr.employee.HrOrgStr','hr.employee.HrOrgStrTree',
  8. 'core.form.YnField',
  9. 'core.form.Panel',
  10. 'core.trigger.TextAreaTrigger','core.trigger.DbfindTrigger',
  11. 'core.grid.Panel2',
  12. 'hr.emplmana.EducationGrid','hr.emplmana.PositionGrid','hr.emplmana.WorkGrid',
  13. 'hr.emplmana.ReandpunishGrid','core.grid.YnColumn','core.toolbar.Toolbar'
  14. ],
  15. init:function(){
  16. var me = this;
  17. me.datamanager = [];
  18. this.control({
  19. 'hrOrgStrTree': {
  20. itemmousedown:function(selModel,record){
  21. var emid,emcode='';
  22. if(record.data.leaf){
  23. emid = record.data.id;
  24. } else {
  25. emcode = record.data.qtip;
  26. }
  27. me.getFormData(emid, emcode);
  28. }
  29. },
  30. 'erpFormPanel': {
  31. afterrender: function(f){
  32. f.readOnly = true;
  33. var items = f.items.items;
  34. Ext.each(items, function(item){
  35. item.setFieldStyle('background:#f1f1f1;');
  36. item.setReadOnly(true);
  37. });
  38. }
  39. }
  40. });
  41. },
  42. getForm: function(btn){
  43. return btn.ownerCt.ownerCt;
  44. },
  45. getFormData: function(id, code){
  46. var condition = '';
  47. if(id==null){
  48. condition = "em_code='" + code + "'";
  49. } else {
  50. condition = 'em_id=' + id;
  51. }
  52. Ext.Ajax.request({//拿到tree数据
  53. url : basePath + 'hr/employee/getEmployee.action',
  54. params: {
  55. condition: condition
  56. },
  57. async: false,
  58. callback : function(options,success,response){
  59. var res = new Ext.decode(response.responseText);
  60. if(res.success){
  61. var employee = res.employee;
  62. Ext.getCmp('em_name').setValue(employee.em_name);
  63. Ext.getCmp('em_sex').setValue(employee.em_sex == '男' || employee.em_sex == 'M' ? '男':'女');
  64. Ext.getCmp('em_birthday').setValue(Ext.util.Format.date(new Date(employee.em_birthday),'Y-m-d H:i:s'));
  65. Ext.getCmp('em_indate').setValue(Ext.util.Format.date(new Date(employee.em_indate),'Y-m-d H:i:s'));
  66. Ext.getCmp('em_nation').setValue(employee.em_nation);
  67. Ext.getCmp('em_polity').setValue(employee.em_polity);
  68. Ext.getCmp('em_native').setValue(employee.em_native);
  69. Ext.getCmp('em_blood').setValue(employee.em_blood);
  70. Ext.getCmp('em_weight').setValue(employee.em_weight);
  71. Ext.getCmp('em_height').setValue(employee.em_height);
  72. Ext.getCmp('em_marry').setValue(employee.em_marry == -1 ? '未婚':'已婚');
  73. Ext.getCmp('em_iccode').setValue(employee.em_iccode);
  74. Ext.getCmp('em_worktime').setValue(employee.em_worktime == 0 ? '没有工作经验':(employee.em_worktime + ' 年'));
  75. Ext.getCmp('em_email').setValue(employee.em_email);
  76. Ext.getCmp('em_address').setValue(employee.em_address);
  77. Ext.getCmp('em_heathlevel').setValue(employee.em_heathlevel);
  78. Ext.getCmp('em_speciality').setValue(employee.em_speciality);
  79. Ext.getCmp('em_finishschool').setValue(employee.em_finishschool);
  80. Ext.getCmp('em_culture').setValue(employee.em_culture);
  81. Ext.getCmp('em_mobile').setValue(employee.em_mobile);
  82. Ext.getCmp('em_position').setValue(employee.em_position);
  83. Ext.getCmp('em_defaultorname').setValue(employee.em_defaultorname);
  84. Ext.getCmp('em_depart').setValue(employee.em_depart);
  85. Ext.getCmp('em_code').setValue(employee.em_code);
  86. Ext.getCmp('em_professname').setValue(employee.em_professname);
  87. Ext.getCmp('em_class').setValue(employee.em_class);
  88. Ext.getCmp('em_ctel').setValue(employee.em_ctel);
  89. Ext.getCmp('em_contact').setValue(employee.em_contact);
  90. Ext.getCmp('em_tel').setValue(employee.em_tel);
  91. } else if(res.exceptionInfo){
  92. showError(res.exceptionInfo);
  93. }
  94. }
  95. });
  96. }
  97. });