common_work.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. $(function(){
  2. // 初始化部门下的收费站
  3. getFsStationList(GV("#center_manage"),function(obj){
  4. $("#fs_station").html(obj);
  5. // 初始化收费站下的人数
  6. getFsEmployee(GV("#fs_station"),function(obj){
  7. $("#fs_employee").html(obj);
  8. // 检索
  9. getFsWorkInfo();
  10. });
  11. });
  12. // 当前月份初始化
  13. $("#sel_month").val(getM()-1);
  14. $("#month_name").html( $("#sel_month").find("option:selected").text());
  15. // 收费站中心选择
  16. $("#fs_station").change(function(){
  17. var fee_station_id = GV(this);
  18. if(fee_station_id == ''){
  19. $("#fs_employee").html('');
  20. }else{
  21. getFsEmployee(fee_station_id,function(obj){
  22. $("#fs_employee").html(obj);
  23. });
  24. }
  25. })
  26. // 导管中心选择
  27. $("#center_manage").change(function(){
  28. var center_manage_id = GV(this);
  29. if(center_manage_id == ''){
  30. $("#fs_station,#fs_employee").html('');
  31. }else{
  32. getFsStationList(center_manage_id,function(obj){
  33. $("#fs_station").html(obj);
  34. });
  35. }
  36. })
  37. // 查询
  38. $("#searchBtn").click(function(){
  39. $("#month_name").html( $("#sel_month").find("option:selected").text() )
  40. getFsWorkInfo();
  41. })
  42. // end
  43. })
  44. /**
  45. * 检索出勤明细数据
  46. * @param {*} param
  47. */
  48. function getFsWorkInfo(){
  49. var param = {
  50. "start_time": "2017-"+(GV("#sel_month")-1)+"-25 23:00:00" ,
  51. "end_time": "2017-"+GV("#sel_month")+"-25 23:00:00"
  52. }
  53. if(GV("#fs_employee")!=''){
  54. param[ 'user_id'] = GV("#fs_employee");
  55. }else if(GV("#fs_station")!=''){
  56. param[ 'dept_id' ] = GV("#fs_station");
  57. }else if(GV("#center_manage") != ''){
  58. param[ 'parent_dept_id' ] = GV("#center_manage");
  59. }
  60. post_common_service("statistics/fs/work/person",param,function(data){
  61. $(".table-tbody").empty();
  62. if(data.length >0){
  63. var seq = 1;
  64. for(var i=0;i< data.length;i++){
  65. if(data[i].userName != undefined){
  66. $(".table-tbody").append( getTableContent(data[i],seq++));
  67. }
  68. }
  69. }
  70. },function(error){
  71. });
  72. }
  73. /**
  74. * 拼接表格内容
  75. * @param {*} obj
  76. * @param {*} seq
  77. */
  78. function getTableContent(obj,seq){
  79. var map_class = {};
  80. var workdays = 0;
  81. for(var z=0; z < obj.subStatisticsFsWork.length ;z++){
  82. map_class[obj.subStatisticsFsWork[z].class_type] = obj.subStatisticsFsWork[z].work_days ;
  83. workdays += GDV(obj.subStatisticsFsWork[z].work_days,0);
  84. }
  85. var content = "<tr><td>"+seq+"</td> <td >"+obj.feeStationName+"</td> <td >"+obj.userName+
  86. "</td> <td >"+obj.positionName+"</td><td>"+ GDV(map_class[3],0) +"</td><td>"+ GDV(map_class[1],0) +"</td><td>"+ GDV(map_class[2],0) +"</td><td>"+workdays+"</td><td>"+"</td> </tr>";
  87. return content;
  88. }