EmpWorkDateModelSet.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.hr.attendance.EmpWorkDateModelSet', {
  3. extend: 'Ext.app.Controller',
  4. FormUtil: Ext.create('erp.util.FormUtil'),
  5. BaseUtil: Ext.create('erp.util.BaseUtil'),
  6. views:[
  7. 'hr.attendance.EmpWorkDateModelSet','hr.attendance.EmpTree1','hr.attendance.Toolbar1',
  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. });
  31. },
  32. getForm: function(btn){
  33. return btn.ownerCt.ownerCt;
  34. },
  35. getFormData: function(id, code){
  36. var condition = '';
  37. if(id==null){
  38. condition = "em_code='" + code + "'";
  39. } else {
  40. condition = 'em_id=' + id;
  41. }
  42. Ext.Ajax.request({//拿到tree数据
  43. url : basePath + 'hr/employee/getEmployee.action',
  44. params: {
  45. condition: condition
  46. },
  47. async: false,
  48. callback : function(options,success,response){
  49. var res = new Ext.decode(response.responseText);
  50. if(res.success){
  51. var employee = res.employee;
  52. Ext.getCmp('em_name').setValue(employee.em_name);
  53. Ext.getCmp('em_sex').setValue(employee.em_sex == '男' || employee.em_sex == 'M' ? '男':'女');
  54. Ext.getCmp('em_birthday').setValue(Ext.util.Format.date(new Date(employee.em_birthday),'Y-m-d H:i:s'));
  55. Ext.getCmp('em_indate').setValue(Ext.util.Format.date(new Date(employee.em_indate),'Y-m-d H:i:s'));
  56. Ext.getCmp('em_nation').setValue(employee.em_nation);
  57. Ext.getCmp('em_polity').setValue(employee.em_polity);
  58. Ext.getCmp('em_native').setValue(employee.em_native);
  59. Ext.getCmp('em_blood').setValue(employee.em_blood);
  60. Ext.getCmp('em_weight').setValue(employee.em_weight);
  61. Ext.getCmp('em_height').setValue(employee.em_height);
  62. Ext.getCmp('em_marry').setValue(employee.em_marry == -1 ? '未婚':'已婚');
  63. Ext.getCmp('em_iccode').setValue(employee.em_iccode);
  64. Ext.getCmp('em_worktime').setValue(employee.em_worktime == 0 ? '没有工作经验':(employee.em_worktime + ' 年'));
  65. Ext.getCmp('em_email').setValue(employee.em_email);
  66. Ext.getCmp('em_address').setValue(employee.em_address);
  67. Ext.getCmp('em_heathlevel').setValue(employee.em_heathlevel);
  68. Ext.getCmp('em_speciality').setValue(employee.em_speciality);
  69. Ext.getCmp('em_finishschool').setValue(employee.em_finishschool);
  70. Ext.getCmp('em_culture').setValue(employee.em_culture);
  71. Ext.getCmp('em_mobile').setValue(employee.em_mobile);
  72. Ext.getCmp('em_position').setValue(employee.em_position);
  73. Ext.getCmp('em_defaultorname').setValue(employee.em_defaultorname);
  74. Ext.getCmp('em_depart').setValue(employee.em_depart);
  75. Ext.getCmp('em_code').setValue(employee.em_code);
  76. Ext.getCmp('em_professname').setValue(employee.em_professname);
  77. Ext.getCmp('em_class').setValue(employee.em_class);
  78. Ext.getCmp('em_ctel').setValue(employee.em_ctel);
  79. Ext.getCmp('em_contact').setValue(employee.em_contact);
  80. Ext.getCmp('em_tel').setValue(employee.em_tel);
  81. } else if(res.exceptionInfo){
  82. showError(res.exceptionInfo);
  83. }
  84. }
  85. });
  86. }
  87. });