|
|
@@ -0,0 +1,253 @@
|
|
|
+
|
|
|
+$(function(){
|
|
|
+
|
|
|
+ // 初始化部门下的收费站
|
|
|
+ getFsStationList(GV("#center_manage"),function(obj){
|
|
|
+ $("#fs_station").html(obj);
|
|
|
+ // 初始化收费站下的人数
|
|
|
+ getFsEmployee(GV("#fs_station"),function(obj){
|
|
|
+ $("#fs_employee").html(obj);
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ // 当前月份初始化
|
|
|
+ $("#sel_month").val(getM()-1);
|
|
|
+
|
|
|
+ // 根据月份确定天数
|
|
|
+ monthChange();
|
|
|
+ $("#month_name").html( $("#sel_month").find("option:selected").text());
|
|
|
+
|
|
|
+
|
|
|
+ // 收费站中心选择
|
|
|
+ $("#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);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ // 查询
|
|
|
+ $("#searchBtn").click(function(){
|
|
|
+
|
|
|
+ $("#month_name").html( $("#sel_month").find("option:selected").text() )
|
|
|
+
|
|
|
+ var param = {
|
|
|
+ "start_time": "2017-"+(GV("#sel_month")-1)+"-25 23:00:00" ,
|
|
|
+ "end_time": "2017-"+GV("#sel_month")+"-25 23:00:00"
|
|
|
+ }
|
|
|
+
|
|
|
+ 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){
|
|
|
+ // 月份变化
|
|
|
+ monthChange();
|
|
|
+ $(".table-tbody").empty();
|
|
|
+ if(data.length >0){
|
|
|
+ for(var i=0;i< data.length;i++){
|
|
|
+ $(".table-tbody").append( getTableContent(data[i],i+1));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },function(error){
|
|
|
+ });
|
|
|
+ })
|
|
|
+ // end
|
|
|
+})
|
|
|
+
|
|
|
+function getTableContent(obj,seq){
|
|
|
+ var days = getDays(GV("#sel_month")-1);
|
|
|
+ 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{
|
|
|
+ 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'>"+ "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"+getDays(GV("#sel_month")-1)).hide();
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * xxx分钟 转化 xx时xx分
|
|
|
+ */
|
|
|
+function convertT(minute){
|
|
|
+ return minute/60 +"时"+minute%60+"分";
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 获取当前月份值
|
|
|
+ */
|
|
|
+function getM(datet){
|
|
|
+ var date = new Date();
|
|
|
+ if(date!=undefined && datet instanceof Date){
|
|
|
+ date = datet ;
|
|
|
+ }
|
|
|
+ return date.getMonth() +1 ;
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 根据Date 获取天数值
|
|
|
+ * parm: string date
|
|
|
+ * return int
|
|
|
+ */
|
|
|
+function getD(date){
|
|
|
+ var datev = new Date(date) ;
|
|
|
+ return datev.getDate() ;
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 根据收费站id获取该收费站下的人员列表
|
|
|
+ * param: fs_station_id , func 异步回调
|
|
|
+ * return: String , List Option
|
|
|
+ */
|
|
|
+function getFsEmployee(fs_station_id , func){
|
|
|
+ var param = {
|
|
|
+ "organid":fs_station_id
|
|
|
+ }
|
|
|
+ post_common_service("user/getFsUserList",param,function(data){
|
|
|
+ var resultStr = ''
|
|
|
+ if(data.length > 0){
|
|
|
+ resultStr = "<option value=''>全部</option>";
|
|
|
+ for(var i=0;i<data.length;i++){
|
|
|
+ resultStr += "<option value="+data[i].id+">"+data[i].truename+"</option>";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ func(resultStr);
|
|
|
+ },function(error){
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 根据道管中心id 获取收费站select 列表
|
|
|
+ * param: center_manage_id , func 异步回调方法
|
|
|
+ * return: String select 下 List<Option>
|
|
|
+ */
|
|
|
+function getFsStationList(center_manage_id,func){
|
|
|
+ var param = {
|
|
|
+ "parentid":center_manage_id
|
|
|
+ }
|
|
|
+ post_common_service("dept/getDeptInfosByDeptId",param,function(data){
|
|
|
+ var str = '';
|
|
|
+ if(data.length > 0){
|
|
|
+ str = "<option value=''>全部</option>";
|
|
|
+ for(var i=0;i<data.length;i++){
|
|
|
+ str += "<option value="+data[i].id+">"+data[i].organname+"</option>";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ func(str);
|
|
|
+ },function(error){
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 根据选择器 回去value值
|
|
|
+ * param: id 选择器
|
|
|
+ * return value
|
|
|
+ */
|
|
|
+function GV(selector){
|
|
|
+ return $(selector).val();
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 根据选择器,获取html值
|
|
|
+ * param:selector 选择器
|
|
|
+ * return: html value
|
|
|
+ */
|
|
|
+function GH(selector){
|
|
|
+ return $(selector).html();
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 根据月份,判断当前月份天数
|
|
|
+ * param: month String 月份 ,datet Date 年份
|
|
|
+ * return:days( 28,29,30,31 )
|
|
|
+ */
|
|
|
+function getDays(mouth,datet){
|
|
|
+ //构造当前日期对象
|
|
|
+ var date = new Date();
|
|
|
+ if(date!=undefined && datet instanceof Date){
|
|
|
+ date = datet ;
|
|
|
+ }
|
|
|
+ //获取年份
|
|
|
+ var year = date.getFullYear();
|
|
|
+ //定义当月的天数;
|
|
|
+ var days ;
|
|
|
+ //当月份为二月时,根据闰年还是非闰年判断天数
|
|
|
+ if(mouth == 2){
|
|
|
+ days= year % 4 == 0 ? 29 : 28;
|
|
|
+ }
|
|
|
+ else if(mouth == 1 || mouth == 3 || mouth == 5 || mouth == 7 || mouth == 8 || mouth == 10 || mouth == 12){
|
|
|
+ //月份为:1,3,5,7,8,10,12 时,为大月.则天数为31;
|
|
|
+ days= 31;
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ days= 30;
|
|
|
+ }
|
|
|
+ return days ;
|
|
|
+}
|