소스 검색

修改接口地址,重新计算开始日期

wukai 1 년 전
부모
커밋
d99a811797
1개의 변경된 파일23개의 추가작업 그리고 18개의 파일을 삭제
  1. 23 18
      main.html

+ 23 - 18
main.html

@@ -42,14 +42,14 @@
         <input type="text" id="datepicker1" readonly="readonly" style="pointer-events: none;">
     </div>
     <div style="margin-top: 5px;" class="hourPointSelect">
-        <select id="hourP1" style="margin-left: 34px;width: 147px;border-radius: 4px;height: 18px;"></select>        
+        <select id="hourP1" style="margin-left: 34px;width: 147px;border-radius: 4px;height: 18px;"></select>
     </div>
     <div style="margin-top: 5px;">
         <label for="datepicker2">结束:</label>
         <input type="text" id="datepicker2" readonly="readonly" style="pointer-events: none;">
     </div>
     <div style="margin-top: 5px;" class="hourPointSelect">
-        <select id="hourP2" style="margin-left: 34px;width: 147px;border-radius: 4px;height: 18px;"></select>        
+        <select id="hourP2" style="margin-left: 34px;width: 147px;border-radius: 4px;height: 18px;"></select>
     </div>
     <div style="margin-top: 5px;" class="hourAreaSelect">
         <label>时间:</label>
@@ -2270,7 +2270,7 @@
             onClose: function (selectedDate) {
                 $("#datepicker2").datepicker("option", "minDate", selectedDate);
                 $("#datepicker2").val('');
-                var isNowDay = selectedDate==new Date().Format("yyyy-MM-dd"); 
+                var isNowDay = selectedDate==new Date().Format("yyyy-MM-dd");
                 var hour1Opts = [];
                 var nowHour = new Date().Format("h");
                 for (var i = 0; i < 24; i++) {
@@ -2290,7 +2290,7 @@
             rangeSelect: true,
             defaultDate: new Date().Format("yyyy-MM-dd"),
             onClose:function(selectedDate){
-                var isNowDay = selectedDate==new Date().Format("yyyy-MM-dd");                
+                var isNowDay = selectedDate==new Date().Format("yyyy-MM-dd");
                 var hour2Opts = [];
                 var nowHour = new Date().Format("h");
                 for (var i = 0; i < 24; i++) {
@@ -2326,16 +2326,21 @@
             var code = $(this).addClass("active").attr("itemcode");
             var $date_select = $("#date_select").attr("itemcode",code)
             var day = new Date();
-            var day1 = new Date().setDate(day.getDate() - 7)
+            if(day.getHours()<7){
+                day=day.setDate(day.getDate()-2);
+            }else{
+                day=day.setDate(day.getDate()-1);
+            }
+            var day1 = new Date().setDate(new Date(day).getDate() - 7);
             $("#datepicker1").val(new Date(day1).Format("yyyy-MM-dd"))
             $("#datepicker2").datepicker("option", "minDate", new Date(day1).Format("yyyy-MM-dd"));
-            $("#datepicker2").val(day.Format("yyyy-MM-dd"))
+            $("#datepicker2").val(new Date(day).Format("yyyy-MM-dd"))
             $("#hour1,#hourP1").val("7")
             $("#hour2,#hourP2").val("19")
             switch (parseInt(code)) {
                 case 1:
                     //alert("生产");
-                    e.stopPropagation();                    
+                    e.stopPropagation();
                     $("#date_select .hourAreaSelect").hide();
                     $("#date_select .hourPointSelect").hide();
                     $date_select.show().css({
@@ -2346,23 +2351,23 @@
                     break;
                 case 2:
                     // alert("停机原因");
-                    e.stopPropagation();                    
+                    e.stopPropagation();
                     $("#date_select .hourAreaSelect").hide();
                     $("#date_select .hourPointSelect").show();
                     $date_select.show().css({
                         "top": $(this).offset().top-10  + "px",
                         "left": $("#imp_item").offset().left- $("#date_select").width()-20 + "px"
-                    })                    
+                    })
                     break;
                 case 3:
                     // alert("叫料");
-                    e.stopPropagation();                    
+                    e.stopPropagation();
                     $("#date_select .hourAreaSelect").show();
                     $("#date_select .hourPointSelect").hide();
                     $date_select.show().css({
                         "top": $(this).offset().top-10 + "px",
                         "left": $(this).offset().left -  $("#date_select").width()-20 + "px"
-                    })                    
+                    })
                     break;
                 case 4:
                     // alert("断纱");
@@ -2372,7 +2377,7 @@
                     $date_select.show().css({
                         "top": $(this).offset().top-10 + "px",
                         "left": $(this).offset().left -  $("#date_select").width()-20 + "px"
-                    })                    
+                    })
                     break;
                 case 5:
                     // alert("下卷");
@@ -2382,7 +2387,7 @@
                     $date_select.show().css({
                         "top": $(this).offset().top-10 + "px",
                         "left": $(this).offset().left -  $("#date_select").width()-20 + "px"
-                    })                    
+                    })
                     break;
                 case 6:
                     // alert("告警");
@@ -2392,7 +2397,7 @@
                     $date_select.show().css({
                         "top": $(this).offset().top-10 + "px",
                         "left": $(this).offset().left -  $("#date_select").width()-20 + "px"
-                    })                    
+                    })
                     break;
                 case 7:
                     // alert("平方米克重")
@@ -2408,7 +2413,7 @@
         $("#date_select .dateSelected_ok").on('click', function () {
             var s1 = $("#datepicker1").val()
             var s2 = $("#datepicker2").val()
-            if (s1 == "" || s2 == "") return;            
+            if (s1 == "" || s2 == "") return;
             //var devcode = $.trim($("#imp_devcode").val())
             var itemcode = $("#date_select").attr("itemcode");
             switch (parseInt(itemcode)) {
@@ -2425,17 +2430,17 @@
                 case 3:
                     var h1 = $("#hour1").val();
                     var h2 = $("#hour2").val();
-                    window.open(SERVER_URL + "/export/export/stops/type/7?start="+s1+"&end="+s2+"&st="+h1+"&et="+h2);
+                    window.open(SERVER_URL + "/export/stops/type/7?start="+s1+"&end="+s2+"&st="+h1+"&et="+h2);
                     break;
                 case 4:
                     var h1 = $("#hour1").val();
                     var h2 = $("#hour2").val();
-                    window.open(SERVER_URL + "/export/export/stops/type/1?start="+s1+"&end="+s2+"&st="+h1+"&et="+h2);
+                    window.open(SERVER_URL + "/export/stops/type/1?start="+s1+"&end="+s2+"&st="+h1+"&et="+h2);
                     break;
                 case 5:
                     var h1 = $("#hour1").val();
                     var h2 = $("#hour2").val();
-                    window.open(SERVER_URL + "/export/export/stops/type/6?start="+s1+"&end="+s2+"&st="+h1+"&et="+h2);
+                    window.open(SERVER_URL + "/export/stops/type/6?start="+s1+"&end="+s2+"&st="+h1+"&et="+h2);
                     break;
                 case 6:
                     var h1 = $("#hourP1").val();