env_info.html 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Aisky-Sixth</title>
  6. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  7. <!-- 新 Bootstrap4 核心 CSS 文件 -->
  8. <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.1.0/css/bootstrap.min.css">
  9. <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
  10. <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
  11. <!-- popper.min.js 用于弹窗、提示、下拉菜单 -->
  12. <script src="https://cdn.bootcss.com/popper.js/1.12.5/umd/popper.min.js"></script>
  13. <!-- 最新的 Bootstrap4 核心 JavaScript 文件 -->
  14. <script src="https://cdn.bootcss.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
  15. <!-- 引入 echarts.js -->
  16. <script src="https://cdn.staticfile.org/echarts/4.3.0/echarts.min.js"></script>
  17. <!--可用來建立使用者小圖示-->
  18. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
  19. <style>
  20. body {
  21. margin:0;
  22. }
  23. .navbar-dark .navbar-nav .nav-link {
  24. color: white;
  25. cursor: pointer;
  26. text-decoration:none;
  27. width: 110px;
  28. height: 46px;
  29. }
  30. .nav-top {
  31. line-height:40px;
  32. background-color: #C4C4C4;
  33. }
  34. .website_title{
  35. font-family: Roboto;
  36. font-style: normal;
  37. font-weight: normal;
  38. font-size: 30px;
  39. color: #000000;
  40. }
  41. .navbar-nav > li{
  42. float: none;
  43. display: inline-block;
  44. width: 110px;
  45. margin: 0 auto;
  46. text-align: center;
  47. }
  48. .navbar-nav > li a{
  49. font-size: 20px;
  50. }
  51. .main-page {
  52. margin-top: 200px;
  53. }
  54. .div-title {
  55. font-family: Roboto;
  56. font-style: normal;
  57. font-weight: bold;
  58. font-size: 36px;
  59. }
  60. .sensor {
  61. margin-top: 50px;
  62. }
  63. .flex {
  64. display: flex;
  65. flex-direction: row;
  66. flex-wrap: wrap;
  67. justify-content: center;
  68. }
  69. .set-link {
  70. display: inline-block;
  71. width: 350px;
  72. height: 100px;
  73. line-height: 100px;
  74. background: #008CBA;
  75. border: 1px solid #CFCFCF;
  76. box-sizing: border-box;
  77. color: #FFFFFF;
  78. border-radius: 10px;
  79. font-size: 36px;
  80. }
  81. .td_in {
  82. margin-top:10%;
  83. border-radius: 15px;
  84. text-align: center;
  85. background-color:#C4C4C4;
  86. width:150px;
  87. height: 100px;
  88. margin:auto;
  89. }
  90. .td_in:hover {
  91. cursor:pointer;
  92. }
  93. .sensor_status {
  94. width: 200px;
  95. height: 170px;
  96. background: #FFFFFF;
  97. border: 1px solid #CFCFCF;
  98. box-sizing: border-box;
  99. color: #000000;
  100. border-radius: 5px;
  101. font-size: 24px;
  102. margin:auto;
  103. }
  104. .show-info{
  105. position: absolute;
  106. background-color: #FFFFFF;
  107. border: 1px solid #949494;
  108. box-sizing: border-box;
  109. }
  110. .show-info > h1 {
  111. text-align: center;
  112. }
  113. .show-chart {
  114. height: 500px;
  115. border: 2px solid #FFF;
  116. background: #C4C4C4;
  117. }
  118. .btn-input input{
  119. background: #008CBA;
  120. border: 1px solid #CFCFCF;
  121. box-sizing: border-box;
  122. border-radius: 5px;
  123. width: 120px;
  124. height: 58px;
  125. text-align: center;
  126. line-height: 58px;
  127. font-size: 20px;
  128. margin-top: 50px;
  129. color: #FFFFFF;
  130. }
  131. .fa{
  132. display: inline-block;
  133. font: normal normal normal 14px/1 FontAwesome;
  134. font-size: inherit;
  135. text-rendering: auto;
  136. -webkit-font-smoothing: antialiased;
  137. }
  138. .fa-user-o:before{
  139. content: "\f2c0";
  140. }
  141. @media(max-width:373px){
  142. .card {
  143. margin-right: 0px;
  144. }
  145. }
  146. @media(max-width:577px){
  147. }
  148. @media(min-width:576px){
  149. }
  150. @media(min-width:768px){
  151. .navbar-nav > li {
  152. margin-left: 0px;
  153. }
  154. .navbar-nav .li-block {
  155. display:none;
  156. }
  157. }
  158. @media(min-width:991px){
  159. .navbar-nav > li {
  160. margin-left: 20px;
  161. }
  162. .navbar-nav .li-block {
  163. display:none;
  164. }
  165. .sensor {
  166. margin-right: 40px;
  167. }
  168. .btn-input input:last-child{
  169. margin-left:100px;
  170. }
  171. }
  172. @media(min-width:1200px){
  173. .navbar-nav > li {
  174. margin-left: 35px;
  175. }
  176. .navbar-nav .li-block {
  177. display: inline-block;
  178. width: 100px;
  179. }
  180. .sensor {
  181. margin-right: 40px;
  182. }
  183. .btn-input input:last-child{
  184. margin-left:100px;
  185. }
  186. }
  187. @media(min-width:1400px){
  188. .navbar-nav .li-block {
  189. display: inline-block;
  190. width: 200px;
  191. }
  192. .sensor {
  193. margin-right: 40px;
  194. }
  195. .btn-input input:last-child{
  196. margin-left:100px;
  197. }
  198. }
  199. @media(min-width:1689px) {
  200. .navbar-nav > li {
  201. margin-left: 50px;
  202. }
  203. .navbar-nav .li-block {
  204. display: inline-block;
  205. width: 500px;
  206. }
  207. .sensor {
  208. margin-right: 40px;
  209. }
  210. .btn-input input:last-child{
  211. margin-left:100px;
  212. }
  213. }
  214. </style>
  215. <script>
  216. function Echart(evt){
  217. $("#" + evt + "-div").css('display','block');
  218. //基於準備好的dom,初始化echarts例項
  219. var myChart = echarts.init(document.getElementsByClassName('' + evt)[0]);
  220. //指定圖表的配置項和資料
  221. var option = {
  222. xAxis: {
  223. type: 'category',
  224. data: ['2015', '2016', '2017', '2018', '2019', '2020', '2021']
  225. },
  226. yAxis: {
  227. type: 'value'
  228. },
  229. series: [{
  230. data: [820, 932, 901, 934, 1290, 1330, 1320],
  231. type: 'line'
  232. }]
  233. };
  234. //使用剛指定的配置項和資料顯示圖表
  235. myChart.setOption(option);
  236. };
  237. function downloadFile() {
  238. //藉型別陣列建構的 blob 來建立 URL
  239. let fileName = "fileName.csv";
  240. const data = getRandomData();
  241. let blob = new Blob([data], {
  242. type: "application/octet-stream"
  243. });
  244. var href = URL.createObjectURL(blob);
  245. // 從 Blob 取出資料
  246. var link = document.createElement("a");
  247. document.body.appendChild(link);
  248. link.href = href;
  249. link.download = fileName;
  250. link.click();
  251. };
  252. //假資料
  253. function getRandomData() {
  254. var header = "RandomHeader";
  255. var data = "";
  256. for (let i = 0; i < 5; i++) {
  257. for (var j = 0; j < 2; j++) {
  258. if (j > 0) {
  259. data = data + ",";
  260. }
  261. data = data + "Item" + i + "_" + j;
  262. }
  263. }
  264. return header + data;
  265. };
  266. $(function(){
  267. $(".airTem-cancel").click(function(){
  268. $("#airTem-div").css('display','none');
  269. });
  270. $(".airHum-cancel").click(function(){
  271. $("#airHum-div").css('display','none');
  272. });
  273. //監聽airTem匯出
  274. let airTemdownloadBtn = document.querySelector(".airTemdownloadBtn");
  275. airTemdownloadBtn.addEventListener("click", downloadFile);
  276. //監聽airHum匯出
  277. let airHumdownloadBtn = document.querySelector(".airHumdownloadBtn");
  278. airHumdownloadBtn.addEventListener("click", downloadFile);
  279. $("#airTem").click(function(){
  280. $("#airTem-div").css('display', 'block');
  281. });
  282. $("#airHum").click(function(){
  283. $("#airHum-div").css('display', 'block');
  284. });
  285. });
  286. </script>
  287. </head>
  288. <body>
  289. <nav class="fixed-top">
  290. <nav class="navbar navbar-expand-md nav-top justify-content-center">
  291. <div>
  292. <span class="website_title">環境資訊</span>
  293. </div>
  294. </nav>
  295. <nav class="navbar navbar-expand-md bg-dark navbar-dark nav-bottom">
  296. <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
  297. <span class="navbar-toggler-icon"></span>
  298. </button>
  299. <div class="collapse navbar-collapse" id="collapsibleNavbar">
  300. <ul class="navbar-nav">
  301. <li class="nav-item">
  302. <a class="nav-link" href="/">首頁</a>
  303. </li>
  304. <li class="nav-item">
  305. <a class="nav-link" href="#">關於我們</a>
  306. </li>
  307. <li class="nav-item">
  308. <a class="nav-link" href="#">案場資訊</a>
  309. </li>
  310. <li class="nav-item">
  311. <a class="nav-link" href="#">聯絡方法</a>
  312. </li>
  313. <li class="nav-item">
  314. <a class="nav-link" href="/map">案場地圖</a>
  315. </li>
  316. <li class="nav-item">
  317. <a class="nav-link" href="/system_status">環境資訊</a>
  318. </li>
  319. <li class="li-block"></li>
  320. <li class="nav-item">
  321. <a class="nav-link" href="#"><i class="fa fa-user-o"></i> {{params.username}}</a>
  322. </li>
  323. <li class="nav-item">
  324. <a class="nav-link" href="/logout">Logout</a>
  325. </li>
  326. </ul>
  327. </div>
  328. </nav>
  329. </nav>
  330. <div class="main-page">
  331. <form method="" action="">
  332. <div class="container-fluid">
  333. <div class="row">
  334. <div class="col flex">
  335. <div class="col-12 text-center">
  336. <h1 style="color:#008CBA;">節點1</h1>
  337. </div>
  338. <div class="row">
  339. <div class="col-1"></div>
  340. <div class="col-10 flex">
  341. <div class="sensor col-xl-2 col-lg-2 col-md-2 col-sm-8 col-xs-8" style="text-align:center;">
  342. <div class="div-title text-center">
  343. <div class="sensor_status">
  344. <div class="sensor_title" style="">
  345. <label>空氣溫度</label>
  346. </div>
  347. <div id="airTem" class="td_in" style=""></div>
  348. </div>
  349. </div>
  350. </div>
  351. <div class="sensor col-xl-2 col-lg-2 col-md-2 col-sm-8 col-xs-8" style="text-align:center;">
  352. <div class="div-title text-center">
  353. <div class="sensor_status">
  354. <div class="sensor_title" style="">
  355. <label>空氣濕度</label>
  356. </div>
  357. <div id="airHum" class="td_in" style=""></div>
  358. </div>
  359. </div>
  360. </div>
  361. <div class="sensor col-xl-2 col-lg-2 col-md-2 col-sm-8 col-xs-8" style="text-align:center;">
  362. <div class="div-title text-center">
  363. <div class="sensor_status">
  364. <div class="sensor_title" style="">
  365. <label>露點</label>
  366. </div>
  367. <div id="dewPoint" class="td_in" style=""></div>
  368. </div>
  369. </div>
  370. </div>
  371. <div class="sensor col-xl-2 col-lg-2 col-md-2 col-sm-8 col-xs-8" style="text-align:center;">
  372. <div class="div-title text-center">
  373. <div class="sensor_status">
  374. <div class="sensor_title" style="">
  375. <label>日照</label>
  376. </div>
  377. <div id="sun" class="td_in" style=""></div>
  378. </div>
  379. </div>
  380. </div>
  381. <div class="sensor col-xl-2 col-lg-2 col-md-2 col-sm-8 col-xs-8" style="text-align:center;">
  382. <div class="div-title text-center">
  383. <div class="sensor_status">
  384. <div class="sensor_title" style="">
  385. <label>土壤含水率</label>
  386. </div>
  387. <div id="soilHum" class="td_in" style=""></div>
  388. </div>
  389. </div>
  390. </div>
  391. <div class="sensor col-xl-2 col-lg-2 col-md-2 col-sm-8 col-xs-8" style="text-align:center;">
  392. <div class="div-title text-center">
  393. <div class="sensor_status">
  394. <div class="sensor_title" style="">
  395. <label>土壤溫度</label>
  396. </div>
  397. <div id="soilTem" class="td_in" style=""></div>
  398. </div>
  399. </div>
  400. </div>
  401. <div class="sensor col-xl-2 col-lg-2 col-md-2 col-sm-8 col-xs-8" style="text-align:center;">
  402. <div class="div-title text-center">
  403. <div class="sensor_status">
  404. <div class="sensor_title" style="">
  405. <label>土壤EC值</label>
  406. </div>
  407. <div id="soilEC" class="td_in" style=""></div>
  408. </div>
  409. </div>
  410. </div>
  411. <div class="sensor col-xl-2 col-lg-2 col-md-2 col-sm-8 col-xs-8" style="text-align:center;">
  412. <div class="div-title text-center">
  413. <div class="sensor_status">
  414. <div class="sensor_title" style="">
  415. <label>風速</label>
  416. </div>
  417. <div id="windSpd" class="td_in" style=""></div>
  418. </div>
  419. </div>
  420. </div>
  421. <div class="sensor col-xl-2 col-lg-2 col-md-2 col-sm-8 col-xs-8" style="text-align:center;">
  422. <div class="div-title text-center">
  423. <div class="sensor_status">
  424. <div class="sensor_title" style="">
  425. <label>風向</label>
  426. </div>
  427. <div id="windDin" class="td_in" style=""></div>
  428. </div>
  429. </div>
  430. </div>
  431. <div class="sensor col-xl-2 col-lg-2 col-md-2 col-sm-8 col-xs-8" style="text-align:center;">
  432. <div class="div-title text-center">
  433. <div class="sensor_status">
  434. <div class="sensor_title" style="">
  435. <label>降雨量</label>
  436. </div>
  437. <div id="rain" class="td_in" style=""></div>
  438. </div>
  439. </div>
  440. </div>
  441. <div class="sensor col-xl-2 col-lg-2 col-md-2 col-sm-8 col-xs-8" style="text-align:center;">
  442. <div class="div-title text-center">
  443. <div class="sensor_status">
  444. <div class="sensor_title" style="">
  445. <label>大氣壓</label>
  446. </div>
  447. <div id="atmosphere" class="td_in" style=""></div>
  448. </div>
  449. </div>
  450. </div>
  451. <div class="sensor col-xl-2 col-lg-2 col-md-2 col-sm-8 col-xs-8" style="text-align:center;">
  452. <div class="div-title text-center">
  453. <div class="sensor_status">
  454. <div class="sensor_title" style="">
  455. <label>RF</label>
  456. </div>
  457. <div class="td_in" style=""></div>
  458. </div>
  459. </div>
  460. </div>
  461. <div class="sensor col-xl-2 col-lg-2 col-md-2 col-sm-8 col-xs-8" style="text-align:center;">
  462. <div class="div-title text-center">
  463. <div class="sensor_status">
  464. <div class="sensor_title" style="">
  465. <label><img src="../static/img/battery.png" style="width:40px;"></label>
  466. </div>
  467. <div class="td_in" style=""></div>
  468. </div>
  469. </div>
  470. </div>
  471. <div class="sensor col-xl-2 col-lg-2 col-md-2 col-sm-8 col-xs-8" style="text-align:center;"></div>
  472. <div class="sensor col-xl-2 col-lg-2 col-md-2 col-sm-8 col-xs-8" style="text-align:center;"></div>
  473. <div id="airTem-div" class="show-info col-xl-10 col-lg-10 col-md-10 col-sm-10 col-xs-10" style="display: none;">
  474. <br>
  475. <h1>空氣溫度</h1>
  476. <center>
  477. <select name="airTem-day" class="text-right">
  478. <option value="year">year</option>
  479. <option value="month">month</option>
  480. <option value="day">day</option>
  481. </select>
  482. <span>從</span>
  483. <label for="airTem-start"></label><input id="airTem-start" type="date">
  484. <span>到</span>
  485. <label for="airTem-end"></label><input id="airTem-end" type="date">
  486. <span>為止</span>
  487. <input type="button" value="查詢" onclick="Echart('airTem');">
  488. </center>
  489. <div class="row">
  490. <div class="col-1"></div>
  491. <div class="col-10 airTem show-chart" style="margin-top: 10px;text-align:center;"></div>
  492. <div class="col-1"></div>
  493. </div>
  494. <div class="btn-input" style="text-align:center;">
  495. <input type="button" value="關閉" style="margin-left:0px;" class="airTem-cancel">
  496. <input class="airTemdownloadBtn" type="button" value="匯出">
  497. </div>
  498. </div>
  499. <div id="airHum-div" class="show-info col-xl-10 col-lg-10 col-md-10 col-sm-10 col-xs-10" style="display: none;">
  500. <br>
  501. <h1>空氣濕度</h1>
  502. <center>
  503. <select name="airHum-day" class="text-right">
  504. <option value="year">year</option>
  505. <option value="month">month</option>
  506. <option value="day">day</option>
  507. </select>
  508. <span>從</span>
  509. <label for="airHum-start"></label><input id="airHum-start" type="date">
  510. <span>到</span>
  511. <label for="airHum-end"></label><input id="airHum-end" type="date">
  512. <span>為止</span>
  513. <input type="button" value="查詢" onclick="Echart('airHum');">
  514. </center>
  515. <div class="row">
  516. <div class="col-1"></div>
  517. <div class="col-10 airHum show-chart" style="margin-top: 10px;text-align:center;"></div>
  518. <div class="col-1"></div>
  519. </div>
  520. <div class="btn-input" style="text-align:center;">
  521. <input type="button" value="關閉" style="margin-left:0px;" class="airHum-cancel">
  522. <input class="airHumdownloadBtn" type="button" value="匯出">
  523. </div>
  524. </div>
  525. </div>
  526. <div class="col-1"></div>
  527. </div>
  528. </div>
  529. </div>
  530. </div>
  531. </form>
  532. </div>
  533. </body>
  534. </html>