ソースを参照

Merge branch 'master' of http://git_xt.git.topm.win:8080/wenhongquan/VisualInspection

minitiger 8 年 前
コミット
73c869bed9
1 ファイル変更31 行追加7 行削除
  1. 31 7
      VisualInspection/js/teamClass/charge_team_schedule.js

+ 31 - 7
VisualInspection/js/teamClass/charge_team_schedule.js

@@ -303,11 +303,13 @@
 
 
         })
         })
 
 
-
+        var time_interval_obj = "";
 
 
         $(".table").delegate(".i-self","click",function(){
         $(".table").delegate(".i-self","click",function(){
             $("#team_info_ti").html($(this).prev().html());
             $("#team_info_ti").html($(this).prev().html());
             $(".save_class_info").data("data",$(this).prev());
             $(".save_class_info").data("data",$(this).prev());
+            // 将时间区间值的span 对象缓存起来
+            time_interval_obj =  $(this).parent().prev().children();
             temp_data = $(this).prev().data("data") ;
             temp_data = $(this).prev().data("data") ;
              $("#lists").show();
              $("#lists").show();
             $("#add_update").hide();
             $("#add_update").hide();
@@ -349,6 +351,19 @@
                 tip("时间设置不合理,开始时间不能大于结束时间");
                 tip("时间设置不合理,开始时间不能大于结束时间");
                 return ;
                 return ;
             }
             }
+            // 判断时间区间 
+            var start_time_interval = $(".modal-title span").html()+" "+ time_interval_obj.eq(1).html();
+            var end_time_interval = $(".modal-title span").html()+" "+ time_interval_obj.eq(2).html();
+
+            if(start_time_interval > end_time_interval){
+                var prev_date = new Date((start_time_interval+':00').replace(/-/,"/"));
+                prev_date.setDate(prev_date.getDate()-1) ;          
+                start_time_interval = prev_date.Format("yyyy-MM-dd HH:mm:00") ;
+            }
+            if(!(start_time >= start_time_interval && end_time <= end_time_interval)){
+                tip("不是当前值班时间段");
+                return ;
+            }
 
 
             // 这边需要判断一下,时间不能重叠
             // 这边需要判断一下,时间不能重叠
             for(var i=0;i<bind_data.length;i++){
             for(var i=0;i<bind_data.length;i++){
@@ -375,8 +390,8 @@
             if(event.event.id == -1){
             if(event.event.id == -1){
 
 
                 // 这边负责添加整个页面的数据 按车道排班 
                 // 这边负责添加整个页面的数据 按车道排班 
-                $('#add_fee_station').modal();
-                $(".modal-title").html("收费站排班表-"+event.event.start.Format("yyyy-MM-dd"));
+                $('#add_fee_station').modal({'backdrop': 'static'});
+                $(".modal-title").html("收费站排班表-<span>"+event.event.start.Format("yyyy-MM-dd")+"</span>");
 
 
                 $("#save_user_class").data("work_date",event.event.start.Format("yyyy-MM-dd "));
                 $("#save_user_class").data("work_date",event.event.start.Format("yyyy-MM-dd "));
 
 
@@ -393,7 +408,7 @@
                     for(var i=0;i<data.length;i++){
                     for(var i=0;i<data.length;i++){
                             var ct = data[i].class_type ;
                             var ct = data[i].class_type ;
                             $(".tr-"+ct ).data("cache",data[i]);
                             $(".tr-"+ct ).data("cache",data[i]);
-                            $(".tr-"+ct).append("<td>"+ classCode[ct].class_name +" "+classCode[ct].start_time+" - "+classCode[ct].end_time +"</td>");
+                            $(".tr-"+ct).append("<td><span>"+ classCode[ct].class_name +"</span> <span>"+classCode[ct].start_time+"</span> - <span>"+classCode[ct].end_time +"</span></td>");
                             var selectv = "<select class='form-control select-self'>"
                             var selectv = "<select class='form-control select-self'>"
                             selectv += ("<option value=''>请选择</option>");
                             selectv += ("<option value=''>请选择</option>");
                             for(var j=0;j<data[i].users.length;j++){
                             for(var j=0;j<data[i].users.length;j++){
@@ -426,7 +441,7 @@
 
 
                         post_common_service( "userClass/getList",param,function(data){
                         post_common_service( "userClass/getList",param,function(data){
                                 // 这边将值班数据检索出来,初始化收费站车道排班中
                                 // 这边将值班数据检索出来,初始化收费站车道排班中
-                                console.log(data);
+                                // console.log(data);
                                 if(data.length > 0){
                                 if(data.length > 0){
                                     $("#save_user_class").data("modify_flag",true);
                                     $("#save_user_class").data("modify_flag",true);
                                     $("#save_user_class").html("修改今日值班");
                                     $("#save_user_class").html("修改今日值班");
@@ -532,15 +547,24 @@
                         date.setDate(date.getDate()-1);
                         date.setDate(date.getDate()-1);
                         start_time = date.Format("yyyy-MM-dd")+" "+classCode[i+1].start_time+":00";
                         start_time = date.Format("yyyy-MM-dd")+" "+classCode[i+1].start_time+":00";
                     }
                     }
+                    // 这边需要转换一下,关于值
+                    var team_type_value = 1;
+                    if(i+1 == 1){
+                        team_type_value = 3 ;
+                    }else if(i+1 == 2){
+                        team_type_value = 1 ;
+                    }else{
+                        team_type_value = 2 ;
+                    }
                     var obj = {
                     var obj = {
-                        "class_type":i+1,
+                        "class_type":team_type_value,
                         "team_id":$("select[id*='_term']").eq(i).val(),
                         "team_id":$("select[id*='_term']").eq(i).val(),
                         "work_date": $("#save_term_class").data("date")+" 00:00:00",
                         "work_date": $("#save_term_class").data("date")+" 00:00:00",
                         "start_time": start_time,
                         "start_time": start_time,
                         "end_time": $("#save_term_class").data("date")+" "+classCode[i+1].end_time+":00",
                         "end_time": $("#save_term_class").data("date")+" "+classCode[i+1].end_time+":00",
                         "dept_id":user_dept_id
                         "dept_id":user_dept_id
                     };
                     };
-                    console.log(obj);
+                    // console.log(obj);
                     data.push(obj);
                     data.push(obj);
                 }
                 }
             }
             }