temphumi.jsp 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  1. <%--
  2. Created by IntelliJ IDEA.
  3. User: SamRichard
  4. Date: 2019/7/19
  5. Time: 14:28
  6. To change this template use File | Settings | File Templates.
  7. --%>
  8. <%@ page language="java" import="java.util.*" pageEncoding="utf-8" %>
  9. <%@ page import="org.apache.commons.lang3.StringUtils" %>
  10. <%
  11. String IMEI = (String)request.getParameter("IMEI");
  12. String strStartTime = (String)request.getParameter("starttime");
  13. String strEndTime = (String)request.getParameter("endtime");
  14. String strName = (String)request.getParameter("name");
  15. String strSrc = (String)request.getParameter("src");
  16. %>
  17. <!DOCTYPE html>
  18. <html lang="ch">
  19. <head>
  20. <title>阻力监控后台管理系统-设备管理</title>
  21. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  22. <meta content="width=device-width, initial-scale=1.0" name="viewport"/>
  23. <meta content="" name="description"/>
  24. <meta content="" name="author"/>
  25. <!-- BEGIN GLOBAL MANDATORY STYLES -->
  26. <link href="css/gfonts1.css" rel="stylesheet" type="text/css">
  27. <link href="css/font-awesome.min.css" rel="stylesheet" type="text/css">
  28. <link href="css/simple-line-icons.min.css" rel="stylesheet">
  29. <link href="css/bootstrap-editable.css" rel="stylesheet">
  30. <link href="css/bootstrap.min.css" rel="stylesheet">
  31. <!-- END GLOBAL MANDATORY STYLES -->
  32. <!-- BEGIN PAGE LEVEL STYLES -->
  33. <!-- BEGIN THEME STYLES -->
  34. <link href="css/components.css" id="style_components" rel="stylesheet">
  35. <link href="css/plugins.css" rel="stylesheet" type="text/css">
  36. <link href="css/layout.css" rel="stylesheet" type="text/css">
  37. <link href="css/default.css" rel="stylesheet" id="style_color">
  38. <link href="css/sweetalert.css" rel="stylesheet">
  39. <link href="css/bootstrap-datetimepicker.min.css" rel="stylesheet" media="screen">
  40. <!-- END THEME STYLES -->
  41. <!-- js -->
  42. <!-- Load jQuery -->
  43. <script src="js/jquery.min.js"></script>
  44. <script src="js/jquery-migrate.min.js" type="text/javascript"></script>
  45. <!-- IMPORTANT! Load jquery-ui-1.10.3.custom.min.js before bootstrap.js to fix bootstrap tooltip conflict with jquery ui tooltip -->
  46. <script src="js/jquery-ui-1.10.3.custom.min.js" type="text/javascript"></script>
  47. <script src="js/bootstrap.min.js" type="text/javascript"></script>
  48. <!-- BEGIN PAGE LEVEL SCRIPTS -->
  49. <script src="js/metronic.js"></script>
  50. <script src="js/scripts/layout.js"></script>
  51. <script src="js/bootstrap-hover-dropdown.min.js" type="text/javascript"></script>
  52. <script src="js/jquery.slimscroll.min.js" type="text/javascript"></script>
  53. <script src="js/jquery.blockui.min.js" type="text/javascript"></script>
  54. <script src="js/jquery.cokie.min.js" type="text/javascript"></script>
  55. <script src="js/jquery.uniform.min.js" type="text/javascript"></script>
  56. <script src="js/morris.min.js" type="text/javascript"></script>
  57. <script src="js/raphael-min.js" type="text/javascript"></script>
  58. <script src="js/jquery.sparkline.min.js" type="text/javascript"></script>
  59. <script src="js/highcharts/highcharts.js"></script>
  60. <script src="js/highcharts/boost.js"></script>
  61. <!-- END CORE PLUGINS -->
  62. <script src="js/sweetalert.min.js"></script>
  63. <script src="js/jBox.min.js"></script>
  64. <script src="js/bootstrap-datetimepicker.min.js" charset="UTF-8"></script>
  65. <script src="js/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
  66. <script src="js/highcharts/no-data-to-display.js"></script>
  67. <!-- END PAGE LEVEL PLUGINS -->
  68. <!-- test -->
  69. <link rel="shortcut icon" href="favicon.ico">
  70. </head>
  71. <!-- END HEAD -->
  72. <!-- BEGIN BODY -->
  73. <!-- DOC: Apply "page-header-menu-fixed" class to set the mega menu fixed -->
  74. <!-- DOC: Apply "page-header-top-fixed" class to set the top menu fixed -->
  75. <body>
  76. <!-- BEGIN PAGE CONTAINER -->
  77. <div class="page-container">
  78. <!-- BEGIN PAGE HEAD -->
  79. <jsp:include page="frame_head.jsp" flush="false"></jsp:include>
  80. <!-- END PAGE HEAD -->
  81. <!-- BEGIN PAGE CONTENT -->
  82. <div class="page-content">
  83. <div class="container">
  84. <form class="row form-inline" id="t2" style="margin-top: 15px;margin-bottom: 14px;padding-left: 15px;">
  85. <fieldset>
  86. <div class="col-md-3 form-group">
  87. <div class="input-group date form_datetime" data-date="2016/09/16 00:00:00+0800" data-date-format="yyyy-mm-dd hh:ii:00" data-link-field="dtp_input1" id="starttime">
  88. <input class="form-control" size="16" type="text" value="" readonly>
  89. <span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span>
  90. <span class="input-group-addon"><span class="glyphicon glyphicon-th"></span></span>
  91. </div>
  92. <input type="hidden" id="dtp_input1" value="" /><br/>
  93. </div>
  94. <div class="col-md-3 form-group">
  95. <div class="input-group date form_datetime" data-date="2016-09-16T05:25:07+08:00" data-date-format="yyyy-mm-dd hh:ii:00" data-link-field="dtp_input2" id="endtime">
  96. <input class="form-control" size="16" type="text" value="" readonly>
  97. <span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span>
  98. <span class="input-group-addon"><span class="glyphicon glyphicon-th"></span></span>
  99. </div>
  100. <input type="hidden" id="dtp_input2" value="" /><br/>
  101. </div>
  102. <div class="col-md-3 form-group">
  103. <button id="getdata" type="button" class="btn btn-primary btn-block">查看</button>
  104. </div>
  105. <div class="col-md-3 form-group">
  106. <button type="button" class="btn btn-primary btn-block" onclick="JavaScript:history.go(-1)">返回</button>
  107. </div>
  108. </fieldset>
  109. </form>
  110. <div id="temphumi" class="col-md-12"></div>
  111. </div>
  112. </div>
  113. <!-- END PAGE CONTENT -->
  114. <!-- END PAGE CONTENT -->
  115. <jsp:include page="frame_tail.jsp" flush="false"></jsp:include>
  116. <!-- END PAGE CONTAINER -->
  117. </div>
  118. <!--
  119. <script src="js/jquery-3.1.1.min.js"></script>
  120. <script src="js/bootstrap.min.js"></script>
  121. <script src="js/sweetalert2.min.js"></script>
  122. -->
  123. <!-- for IE support -->
  124. <!--
  125. <script src="js/es6-promise.auto.min.js"></script>
  126. -->
  127. <script>
  128. (function($){
  129. Date.prototype.format = function(fmt) {
  130. var o = {
  131. "M+" : this.getMonth()+1, //月份
  132. "d+" : this.getDate(), //日
  133. "h+" : this.getHours(), //小时
  134. "m+" : this.getMinutes(), //分
  135. "s+" : this.getSeconds(), //秒
  136. "q+" : Math.floor((this.getMonth()+3)/3), //季度
  137. "S" : this.getMilliseconds() //毫秒
  138. };
  139. if(/(y+)/.test(fmt)) {
  140. fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));
  141. }
  142. for(var k in o) {
  143. if(new RegExp("("+ k +")").test(fmt)){
  144. fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));
  145. }
  146. }
  147. return fmt;
  148. }
  149. }(jQuery));
  150. jQuery(document).ready(function () {
  151. //Metronic.init(); // init metronic core components
  152. //Layout.init(); // init current layout
  153. // IE8 Fix: function.bind polyfill
  154. if (Metronic.isIE8() && !Function.prototype.bind) {
  155. Function.prototype.bind = function (oThis) {
  156. if (typeof this !== "function") {
  157. // closest thing possible to the ECMAScript 5 internal IsCallable function
  158. throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
  159. }
  160. var aArgs = Array.prototype.slice.call(arguments, 1),
  161. fToBind = this,
  162. fNOP = function () {
  163. },
  164. fBound = function () {
  165. return fToBind.apply(this instanceof fNOP && oThis ? this : oThis,
  166. aArgs.concat(Array.prototype.slice.call(arguments)));
  167. };
  168. fNOP.prototype = this.prototype;
  169. fBound.prototype = new fNOP();
  170. return fBound;
  171. };
  172. }
  173. });
  174. //设置中文
  175. Highcharts.setOptions({
  176. lang:{
  177. contextButtonTitle:"图表导出菜单",
  178. decimalPoint:".",
  179. downloadJPEG:"下载JPEG图片",
  180. downloadPDF:"下载PDF文件",
  181. downloadPNG:"下载PNG文件",
  182. downloadSVG:"下载SVG文件",
  183. drillUpText:"返回 {series.name}",
  184. loading:"加载中",
  185. months:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],
  186. noData:"没有数据",
  187. numericSymbols: [ "千" , "兆" , "G" , "T" , "P" , "E"],
  188. printChart:"打印图表",
  189. resetZoom:"恢复缩放",
  190. resetZoomTitle:"恢复图表",
  191. //shortMonths: [ "Jan" , "Feb" , "Mar" , "Apr" , "May" , "Jun" , "Jul" , "Aug" , "Sep" , "Oct" , "Nov" , "Dec"],
  192. shortMonths: [ "1" , "2" , "3" , "4" , "5" , "6" , "7" , "8" , "9" , "10" , "11" , "12"],
  193. thousandsSep:",",
  194. weekdays: ["星期一", "星期二", "星期三", "星期三", "星期四", "星期五", "星期六","星期天"]
  195. },
  196. global : {
  197. useUTC : false
  198. }
  199. });
  200. //图表属性
  201. var options = {
  202. chart: {
  203. zoomType: 'x',
  204. },
  205. boost: {
  206. useGPUTranslations: true
  207. },
  208. title: {
  209. text: '温湿度曲线图'
  210. },
  211. subtitle : {
  212. text: ""
  213. },
  214. xAxis: {
  215. type: 'datetime',
  216. dateTimeLabelFormats: {
  217. //millisecond: '%H:%M:%S.%L',
  218. second: '%H:%M:%S',
  219. minute: '%H:%M',
  220. hour: '%H:%M',
  221. day: '%m-%d',
  222. week: '%m-%d',
  223. month: '%Y-%m',
  224. year: '%Y'
  225. },
  226. },
  227. tooltip: {
  228. shared: true,
  229. //crosshairs: true,
  230. positioner : function(width, height, point)
  231. {
  232. return {
  233. x : 70,
  234. y : 1
  235. }
  236. },
  237. dateTimeLabelFormats: {
  238. millisecond: '%H:%M:%S.%L',
  239. second: '%H:%M:%S',
  240. minute: '%H:%M',
  241. hour: '%H:%M',
  242. day: '%Y-%m-%d',
  243. week: '%m-%d',
  244. month: '%Y-%m',
  245. year: '%Y'
  246. }
  247. },
  248. yAxis: [{
  249. title: {
  250. text: '温度值(℃)'
  251. }
  252. },{
  253. opposite:true,
  254. title: {
  255. text: '湿度值(RH)'
  256. }
  257. }],
  258. legend: {
  259. enabled: true
  260. },
  261. credits:{
  262. enabled:false, // 版权信息
  263. text:"杭州慧景科技股份有限公司",
  264. href:"http://www.hzhjkj.com/"
  265. },
  266. // animation:禁止动画
  267. // enableMouseTracking:禁止鼠标移到线上时,线条变粗
  268. plotOptions: {
  269. series: {
  270. animation: false,
  271. marker: {
  272. enabled: false,
  273. states: {
  274. hover: {
  275. enabled: false
  276. }
  277. }
  278. },
  279. //enableMouseTracking: false,
  280. turboThreshold:100000
  281. }
  282. },// 优化性能损耗结束
  283. series: [],
  284. };
  285. var starttime = '<%=strStartTime%>';
  286. var endtime = '<%=strEndTime%>';
  287. var $startime = $("#starttime");
  288. var $endtime = $("#endtime");
  289. //初始函数
  290. $(function () {
  291. if (<%=StringUtils.isNotBlank(strStartTime) && StringUtils.isNotBlank(strEndTime)%>) {
  292. var a = new Date(Date.parse('<%=strStartTime%>'.replace(/-/g, "/")));
  293. var b = new Date(Date.parse('<%=strEndTime%>'.replace(/-/g, "/")));
  294. $startime.datetimepicker('update', a);
  295. $endtime.datetimepicker('update', b);
  296. //setType(a, b);
  297. //$("#timequickselect").val(6).trigger("change");
  298. } else {
  299. var date = new Date();
  300. date.setSeconds(0);
  301. date.setMilliseconds(0);
  302. date.setMinutes(date.getMinutes() + 10);
  303. var date2 = new Date(date.getTime());
  304. date2.setHours(0);
  305. date2.setMinutes(0);
  306. date2.setSeconds(0);
  307. $startime.datetimepicker('update', date2);
  308. $endtime.datetimepicker('update', date);
  309. starttime = date2.toISOString();
  310. endtime = date.toISOString();
  311. };
  312. })
  313. var chart;
  314. //请求数据
  315. function queryData() {
  316. /*
  317. $.getJSON('https://data.jianshukeji.com/jsonp?filename=json/usdeur.json&callback=?', function (data) {
  318. options.subtitle.text = (new Date(starttime)).toLocaleDateString();
  319. options.series[0].data = data;
  320. chart = new Highcharts.chart("resistance", options);
  321. });
  322. */
  323. var urladdr = "gettemphumi.cpp?starttime=" + encodeURI(starttime) + "&endtime=" + encodeURI(endtime) +
  324. "&IMEI=<%=IMEI%>&name=" + encodeURI("<%=strName%>") + "&timestamp=" + new Date().getTime();
  325. $.ajax({
  326. url: urladdr,
  327. type: "get",
  328. dataType: "json",
  329. success: function (data) {
  330. if (data === null || data.series.length === 0) {
  331. clearTimeout(refreshtimer);
  332. swal({
  333. type: 'success',
  334. title: '无数据',
  335. timer: 3000
  336. }).then(
  337. function () {
  338. },
  339. // handling the promise rejection
  340. function (dismiss) {
  341. if (dismiss === 'timer') {
  342. console.log('I was closed by the timer')
  343. }
  344. }
  345. )
  346. return;
  347. }
  348. options.subtitle.text = (new Date(starttime)).toLocaleDateString();
  349. var otext = "温湿度曲线图";
  350. if ('<%=strName%>' != 'undefined')
  351. otext = '<%=strName%>_' + otext;
  352. options.title.text = otext;
  353. options.series = data.series;
  354. if (chart) {
  355. chart = null;
  356. }
  357. chart = new Highcharts.chart("temphumi", options);
  358. }
  359. })
  360. }
  361. $("#getdata").click(function () {
  362. starttime = $("#dtp_input1").val();
  363. endtime = $("#dtp_input2").val();
  364. queryData();
  365. })
  366. </script>
  367. </body>
  368. <!-- END BODY -->
  369. </html>