| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198 |
- $(function(){
- setVisit();
- var road_manager;
- if(roleContains("STATION")){
- road_manager = getCurrentUser().road_manager_id;
- }
- if(roleContains("ROAD_MANAGER")){
- road_manager = getCurrentUser().organid;
- }
- setRoadManagerSelect("#center_manage",road_manager,true);
- $.jeDate("#sel_month",{
- isinitVal:true,
- format: 'YYYY/MM' // 分隔符可以任意定义,该例子表示只显示年月
- });
- // 初始化部门下的收费站
- getFsStationList(GV("#center_manage"),function(obj){
- $("#fs_station").html(obj);
- var dept;
- if(roleContains("STATION")){
- dept = getCurrentUser().organid;
- }
- $("#fs_station").val(dept);
- // 初始化收费站下的人数
- getFsEmployee(GV("#fs_station"),function(obj){
- $("#fs_employee").html(obj);
- // 检索
- getFsWorkInfo(0);
- });
- });
- // 当初始化月份值
- var months = month_method_2();
- // for(var i=0; i < months.length;i++){
- // $("#sel_month").append('<option value= "'+ months[i] +'">'+ months[i] +'</option>');
- // }
- // 当前月份初始化
- // $("#sel_month").val(months[months.length-1 ]);
- // 根据月份确定天数
- monthChange();
-
- $("#month_name").html( GV("#sel_month"));
- // 收费站中心选择
- $("#fs_station").change(function(){
- var fee_station_id = GV(this);
- if(fee_station_id == ''){
- $("#fs_employee").html('');
- }else{
- getFsEmployee(fee_station_id,function(obj){
- $("#fs_employee").html(obj);
- });
- }
- })
- // 导管中心选择
- $("#center_manage").change(function(){
- var center_manage_id = GV(this);
- if(center_manage_id == ''){
- $("#fs_station,#fs_employee").html('');
- }else{
- getFsStationList(center_manage_id,function(obj){
- $("#fs_station").html(obj);
- var dept;
- if(roleContains("STATION")){
- dept = getCurrentUser().organid;
- }
- $("#fs_station").val(dept);
- });
- }
- })
- // 查询
- $("#searchBtn").click(function(){
- $("#month_name").html( GV("#sel_month") )
- getFsWorkInfo(1);
- })
- // end
- /**
- * 检索出勤明细数据
- * @param {*} param
- */
- function getFsWorkInfo(flag){
- var param = {
- "start_time": timeTranslate( GV("#sel_month") ) ,
- "end_time": (GV("#sel_month")+"/25 23:00:00").replace("/","-").replace("/","-")
- }
-
- if(GV("#fs_employee")!=''){
- param[ 'user_id'] = GV("#fs_employee");
- }else if(GV("#fs_station")!=''){
- param[ 'dept_id' ] = GV("#fs_station");
- }else if(GV("#center_manage") != ''){
- param[ 'parent_dept_id' ] = GV("#center_manage");
- }
- post_common_service("statistics/fs/work/info",param,function(data){
- if(flag == 0 && $("#c-a-tbody").children().length > 0 ){
- return ;
- }
- // 月份变化
- monthChange();
- $("#c-a-tbody").empty();
- if(data.length >0){
- var seq = 1 ;
- for(var i=0;i< data.length;i++){
- if(data[i].userName != undefined){
- $("#c-a-tbody").append( getTableContent(data[i],seq++));
- }
- }
- }
- },function(error){
- });
- }
- })
- /**
- * 拼接表格内容
- * @param {*} obj
- * @param {*} seq
- */
- function getTableContent(obj,seq){
- var days = getDaysByDate(GV("#sel_month")+"/01");
- var map_class = {};
- for(var z=0; z < obj.subStatisticsFsWork.length ;z++){
- if(obj.subStatisticsFsWork[z].check_id !=undefined){
-
- map_class[getD(obj.subStatisticsFsWork[z].work_date)+"-"+obj.subStatisticsFsWork[z].class_type] = 2;
-
- }else{
- if( map_class[getD(obj.subStatisticsFsWork[z].work_date)+"-"+obj.subStatisticsFsWork[z].class_type] == null ){
- map_class[getD(obj.subStatisticsFsWork[z].work_date)+"-"+obj.subStatisticsFsWork[z].class_type] = 1;
- }
- }
- }
- var class_html = [];
- for(var d=0;d<3;d++){
- var class_type = 3;
- if(d != 0){
- class_type = d ;
- }
- for(var i=26; i<=days; i++){
- if( map_class[i+"-"+class_type] !=undefined ){
- if( map_class[i+"-"+class_type]==1){
- class_html[d] += '<td>/</td>' ;
- }else{
- class_html[d] += '<td class="b-grey">/</td>' ;
- }
- }else{
- class_html[d] += '<td></td>' ;
- }
- }
- for(var i=1; i<=25; i++){
- if( map_class[i+"-"+class_type] !=undefined ){
- if( map_class[i+"-"+class_type]==1){
- class_html[d] += '<td>/</td>' ;
- }else{
- class_html[d] += '<td class="b-grey">/</td>' ;
- }
- }else{
- class_html[d] += '<td></td>' ;
- }
- }
- }
- var content = "<tr><td rowspan='3'>"+seq+"</td> <td rowspan='3'>"+obj.feeStationName+"</td> <td rowspan='3'>"+obj.userName+
- "</td> <td rowspan='3'>"+obj.positionName+"</td><td rowspan='3'>"+ obj.workno +"</td><td>夜班</td> "+class_html[0]+"<td rowspan='3'>"+
- obj.work_days+"</td><td rowspan='3'>"+convertT(obj.work_minutes)+"</td><td rowspan='3'></td> </tr>\
- <tr><td>早班</td> "+class_html[1]+" </tr>\
- <tr><td>中班</td> "+ class_html[2] +" </tr>" ;
- return content;
- }
- /**
- * 月份变化 , 天数变化
- */
- function monthChange(){
- $(".m28").show();
- $(".m"+getDaysByDate(GV("#sel_month")+'/01')).hide();
- }
- function setVisit(){
- if(roleContains("STATION")){
- $("#center_manage").attr("disabled","disabled");
- $("#fs_station").attr("disabled","disabled");
- }
- if(roleContains("ROAD_MANAGER")){
- $("#center_manage").attr("disabled","disabled");
- }
- }
|