Quellcode durchsuchen

导出功能调整:添加设备编号及时点段

liling vor 1 Jahr
Ursprung
Commit
bc59d2a4a2
1 geänderte Dateien mit 19 neuen und 5 gelöschten Zeilen
  1. 19 5
      main.html

+ 19 - 5
main.html

@@ -23,6 +23,7 @@
 			<div itemcode="4"><span>生产趋势</span><img src="image/imp2.png" style="float: right;margin-top: 7px;"></div>
 			<div itemcode="5"><span>能耗趋势</span><img src="image/imp2.png" style="float: right;margin-top: 7px;"></div>
 			-->
+            <div ><span>指定设备</span><input id="imp_devcode" type="text" placeholder="设备编号" maxlength="4" style="width: 80px;margin-left: 8px;font-size: 12px;"></div>
 			<div itemcode="1"><span>最近7天</span><img src="image/imp2.png" style="float: right;margin-top: 7px;"></div>
 			<div itemcode="2"><span>自定义日期</span><img src="image/imp2.png" style="float: right;margin-top: 7px;"></div>
 		</div>
@@ -36,6 +37,12 @@
 				<label for="datepicker2">结束:</label>
 				<input type="text" id="datepicker2" readonly="readonly" style="pointer-events: none;">
 			</div>
+            <div style="margin-top: 5px;">
+                <label>时点:</label>
+                <select id="hour1" style="margin-left: 5px;width: 63px;"></select>
+                <label>到</label>
+                <select id="hour2" style="width: 63px;"></select>
+            </div>
 			<div class="dateSelected_ok"><button type=button>确定</button></div>
 		</div>
 		<div id="search"><input type="text" placeholder="请输入设备编号" maxlength="4"><img style="position: absolute;top: 20%;right: 5px;" src="image/search_icon.png" class="search_btn"></div>
@@ -2230,6 +2237,7 @@
 		$("#imp_item>div").on('click',function(e){
 					//导出数据
 					var code = $(this).attr("itemcode")
+                    var devcode =$.trim($("#imp_devcode").val())
 					if(code=="2")
 					{
                         //自定义日期导出
@@ -2239,16 +2247,18 @@
 							"top":$(this).offset().top+47+"px",
 							"left":$(this).offset().left+$("#imp_item").width()-$("#date_select").width()-5+"px"
 						})
-					}else window.open(SERVER_URL+"/export")
+					}else if(code=="1") window.open(SERVER_URL+"/export?devcode="+devcode)
+                    else e.stopPropagation();
 		})
 		//自定义导出日期确定
 		$("#date_select .dateSelected_ok").on('click',function(){
 					var s1=$("#datepicker1").val()
 					var s2=$("#datepicker2").val()
 					if(s1=="" || s2=="") return;
-					//s1 = Date.parse(s1)
-					//s2 = Date.parse(s2)
-					window.open(SERVER_URL+"/export?start="+s1+"&end="+s2)
+					var h1 = $("#hour1").val();
+					var h2 = $("#hour2").val();
+                    var devcode = $.trim($("#imp_devcode").val())
+					window.open(SERVER_URL+"/export?devcode="+devcode+"&start="+s1+"&end="+s2+"&hour="+h1+"-"+h2)
 					$("body").trigger('click')
 		});
 		$("#autoplayer_btn").off().on('click',function(){
@@ -2306,7 +2316,11 @@
                 })
             })
         })
-
+        var hourOpts = [];
+        for (var i = 0; i < 25; i++) {
+            hourOpts.push('<option value="'+i+'">'+i+' 时</option>');
+        }
+        $("#hour2,#hour1").html(hourOpts.join(''))
         function GetData() {
             $.getJSON(SERVER_URL + "/index", {}, function (res) {
                 setTimeout(function () {