ventilate.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport"
  6. content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
  7. <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
  8. <meta name="format-detection" content="telephone=no">
  9. <title>index</title>
  10. <link rel="stylesheet" type="text/css" href="../../css/api.css" />
  11. <link rel="stylesheet" type="text/css" href="../../css/style.css" />
  12. <link rel="stylesheet" href="../../css/projeck.css">
  13. </head>
  14. <style>
  15. body,
  16. html {
  17. background: #ececee;
  18. }
  19. .api_layout {
  20. /* border-top: 1px solid #37b0e9; */
  21. padding: 8px 10px;
  22. -webkit-box-sizing: border-box;
  23. -moz-box-sizing: border-box;
  24. box-sizing: border-box;
  25. }
  26. .top {
  27. width: 100%;
  28. height: 200px;
  29. position: relative;
  30. }
  31. .top img {
  32. width: 100%;
  33. height: 100%;
  34. border-radius: 10px;
  35. }
  36. .top p{
  37. position: absolute;
  38. right: 8px;
  39. bottom: 8px;
  40. font-weight: bold;
  41. font-size: 15px;
  42. }
  43. .content {
  44. padding: 15px;
  45. background: white;
  46. -webkit-box-sizing: border-box;
  47. -moz-box-sizing: border-box;
  48. box-sizing: border-box;
  49. width: 100%;
  50. /* margin-bottom: 13px; */
  51. margin-top: 6px;
  52. position: relative;
  53. padding-top: 13px;
  54. box-shadow: 0 3px 29px 0 rgba(59, 74, 116, 0.14);
  55. }
  56. .borderRa {
  57. -webkit-border-radius: 10px;
  58. -moz-border-radius: 10px;
  59. border-radius: 10px;
  60. }
  61. .con_two {
  62. display: inline-block;
  63. height: 100%;
  64. }
  65. .content .title {
  66. text-align: center;
  67. font-size: 15px;
  68. color: #222627;
  69. font-weight: bold;
  70. }
  71. .borderRa:after {
  72. content: "";
  73. position: absolute;
  74. top: 50px;
  75. left: 0;
  76. width: 100%;
  77. height: 1px;
  78. background: #F3F3F3;
  79. }
  80. .content .condition {
  81. display: inline-block;
  82. width: 100%;
  83. height: 140px;
  84. background: white;
  85. position: relative;
  86. padding-top: 30px;
  87. }
  88. .condition .draught {
  89. width: 14px;
  90. height: 14px;
  91. border-radius: 50%;
  92. background: #ff3d27;
  93. }
  94. .circular-name{
  95. display: flex;
  96. justify-content: center;
  97. align-items: center;
  98. }
  99. .circular-name span{
  100. font-size: 15px;
  101. margin-left: 5px;
  102. }
  103. .content .condition .statistical {
  104. display: inline-block;
  105. width: 100%;
  106. }
  107. .content .condition .statistical img {
  108. width: 100%;
  109. height: 100%;
  110. }
  111. .con {
  112. display: inline-block;
  113. width: 100%;
  114. height: 100%;
  115. padding: 0;
  116. }
  117. #tab_bar {
  118. width: 100%;
  119. height: 30px;
  120. }
  121. #tab_bar ul {
  122. padding: 0px;
  123. margin: 0px;
  124. height: 30px;
  125. text-align: center;
  126. border-bottom:1px solid #f8f8fb;
  127. }
  128. #tab_bar li {
  129. list-style-type: none;
  130. float: left;
  131. width: 90px;
  132. height:30px;
  133. line-height: 24px;
  134. color: #222627;
  135. }
  136. .tab_css {
  137. width: 100%;
  138. display: none;
  139. margin-top: 10px;
  140. }
  141. .tab_css .head {
  142. width: 100%;
  143. height: 40px;
  144. background:#F3F6FA;
  145. border-radius: 2px;
  146. color: #222627;
  147. display: flex;
  148. justify-content: space-between;
  149. }
  150. .head li {
  151. list-style: none;
  152. line-height: 40px;
  153. width: 25%;
  154. color: #222627;
  155. font-size: 13px;
  156. text-align: center;
  157. }
  158. .head li:first-child {
  159. width: 50%;
  160. }
  161. .items {
  162. padding: 0;
  163. margin: 0;
  164. width: 100%;
  165. border-radius: 2px;
  166. color: #222627;
  167. }
  168. .items .list {
  169. padding: 10px 0;
  170. text-align: center;
  171. display: flex;
  172. justify-content: space-between;
  173. position: relative;
  174. align-items: center;
  175. }
  176. .items .list span {
  177. width: 25%;
  178. color: #222627;
  179. font-size: 13px;
  180. }
  181. .list span:first-child {
  182. width: 50%;
  183. padding: 0 5px;
  184. box-sizing: border-box;
  185. }
  186. .list::after {
  187. content: '';
  188. position: absolute;
  189. bottom: 0;
  190. left: 0;
  191. width: 100%;
  192. height: 1px;
  193. background: #E8E9EA;
  194. }
  195. .list span:nth-child(2) {
  196. background:#64dcff;
  197. height: 20px;
  198. line-height: 20px;
  199. }
  200. #contents{
  201. margin-top: 23px;
  202. }
  203. </style>
  204. <body>
  205. <div class="api_layout">
  206. <div class="top">
  207. <img src="../../image/tou.jpeg" alt="">
  208. <p class="time-box"></p>
  209. </div>
  210. <div class="content borderRa">
  211. <p class="title">风机运行状况</p>
  212. <pseudo:after></pseudo:after>
  213. <div class="condition">
  214. <div class="Chart flex-space" id="fanStatus">
  215. </div>
  216. <p style="margin-top: 20px;height: 13px;font-size: 14px;margin-left: 15px;line-height: 13px;">风量小时趋势</p>
  217. <div class="statistical">
  218. <div class="" style="width:100%">
  219. <canvas id="downWell" style="width: 100%;height:204px"></canvas>
  220. </div>
  221. </div>
  222. </div>
  223. </div>
  224. <div class="content borderRa con_two" style="padding: 15px 5px;">
  225. <p class="title">风机参数</p>
  226. <pseudo:after></pseudo:after>
  227. <div id="contents" class="con">
  228. <div id="tab_bar">
  229. <ul>
  230. <li id="tab1" onclick="myclick(1)" style="color: #3498DB;border-bottom: 2px solid #009FE8;font-weight: bold;">
  231. 1#风机
  232. </li>
  233. <li id="tab2" onclick="myclick(2)">
  234. 2#风机
  235. </li>
  236. </ul>
  237. <div class="" style="width:100%">
  238. <canvas id="downWell" style="width: 100%;height:10px"></canvas>
  239. </div>
  240. </div>
  241. <div class="tab_css" id="tab1_content" style="display: block">
  242. </div>
  243. <div class="tab_css" id="tab2_content">
  244. </div>
  245. </div>
  246. </div>
  247. </div>
  248. </body>
  249. <script type="text/template" id="fanStatusTemplate">
  250. <div style="width:50%" class="canvasParent centertT">
  251. <div class="circular-name">
  252. <i class="draught" style="background:#{{=it.blower1=='close'?'ff3d27':'00b067'}}"></i>
  253. <span class="canvasTitle">1#风机</span>
  254. </div>
  255. <img src="../../icon/{{=it.blower1=='close'?'ju.png':'status.gif'}}" alt="" style="width: 100px;height: 100px;margin-top: 9px;">
  256. </div>
  257. <div class="centertT" style="width:50%">
  258. <div class="circular-name">
  259. <div class="draught" style="background:#{{=it.blower2=='close'?'ff3d27':'00b067'}}"></div>
  260. <span class="canvasTitle">2#风机</span>
  261. </div>
  262. <img src="../../icon/{{=it.blower2=='close'?'ju.png':'status.gif'}}" alt="" style="width: 100px;height: 100px;margin-top: 9px;">
  263. </div>
  264. </script>
  265. <script type="text/template" id="fanTemplate">
  266. <ul class="head">
  267. <li>参数名称</li>
  268. <li>数值</li>
  269. <li>单位</li>
  270. </ul>
  271. <ul class="items">
  272. {{ for (var i = 0;i<it.data.length;i++) { }}
  273. <li class="list">
  274. <span>{{=it.data[i].name}}</span>
  275. <span>{{=it.data[i].value}}</span>
  276. <span>{{=it.data[i].unit}}</span>
  277. </li>
  278. {{ } }}
  279. </ul>
  280. </script>
  281. <script type="text/template" id="fan2Template">
  282. <ul class="head">
  283. <li>参数名称</li>
  284. <li>数值</li>
  285. <li>单位</li>
  286. </ul>
  287. <ul class="items">
  288. {{ for (var i = 0;i<it.data.length;i++) { }}
  289. <li class="list">
  290. <span>{{=it.data[i].name}}</span>
  291. <span>{{=it.data[i].value}}</span>
  292. <span>{{=it.data[i].unit}}</span>
  293. </li>
  294. {{ } }}
  295. </ul>
  296. </script>
  297. <script type="text/javascript" src="../../script/api.js"></script>
  298. <script src="../../script/f2.js"></script>
  299. <script type="text/javascript" src="../../script/doT.min.js"></script>
  300. <script type="text/javascript" src="../../script/config.js"></script>
  301. <script type="text/javascript">
  302. var header =''
  303. apiready = function(){
  304. setInterval(function () {
  305. $api.html($api.dom('.time-box'), getNowFormatDate());
  306. }, 1000)
  307. var info = $api.getStorage('data'),
  308. token = JSON.parse(info).data.access_token;
  309. headers = {
  310. "Authorization": "Bearer " + token
  311. };
  312. getFanStatus(headers)
  313. getCanvasData(headers)
  314. fanData(1)
  315. };
  316. // 风机状态
  317. function getFanStatus(headers) {
  318. $http.fnReuestDataNologing(UrlRouter.getFanStatus,headers,'get','',function (ret,err) {
  319. if (ret.code === 0) {
  320. $apis.html(fanStatus,'#fanStatusTemplate',ret.data);
  321. }
  322. })
  323. }
  324. // 风量趋势
  325. function getCanvasData(headers) {
  326. $http.fnReuestDataNologing(UrlRouter.getFanData,headers,'get','',function (ret,err) {
  327. if (ret.code === 0) {
  328. var data = ret.data
  329. var chart = new F2.Chart({
  330. id: 'downWell',
  331. pixelRatio: window.devicePixelRatio
  332. });
  333. var defs = {
  334. tem: {
  335. tickCount: 5,
  336. min: 0,
  337. alias: '风量'
  338. }
  339. };
  340. chart.source(data, defs);
  341. chart.axis('time', {
  342. label: function label(text, index, total) {
  343. var textCfg = {};
  344. if (index === 0) {
  345. textCfg.textAlign = 'right';
  346. } else if (index === total - 1) {
  347. textCfg.textAlign = 'center';
  348. }
  349. return textCfg;
  350. }
  351. });
  352. chart.tooltip({
  353. showCrosshairs: true
  354. });
  355. chart.line().position('time*tem').shape('smooth');
  356. chart.point().position('time*tem').shape('smooth').style({
  357. stroke: '#fff',
  358. lineWidth: 1
  359. });
  360. chart.render();
  361. }
  362. })
  363. }
  364. // #1,#2,风机数据
  365. function fanData(type) {
  366. $http.fnReuestDataNologing(UrlRouter.getFanDatas,header,'post',{num:type},function (ret,err) {
  367. if (ret.code === 0) {
  368. if (type == 1) {
  369. $apis.html(tab1_content,'#fanTemplate',ret);
  370. }else {
  371. $apis.html(tab2_content,'#fan2Template',ret);
  372. }
  373. }
  374. })
  375. }
  376. // tab切换
  377. var myclick = function (v) {
  378. var llis = document.getElementsByTagName("li");
  379. for (var i = 0; i < llis.length; i++) {
  380. var lli = llis[i];
  381. if (lli == document.getElementById("tab" + v)) {
  382. lli.style['border-bottom'] = '2px solid #009FE8';
  383. lli.style.color = "#3498DB";
  384. lli.style.fontWeight="bold";
  385. } else {
  386. lli.style['border-bottom'] = "none";
  387. lli.style.color = "#273438";
  388. lli.style.fontWeight="normal";
  389. }
  390. }
  391. var divs = document.getElementsByClassName("tab_css");
  392. for (var i = 0; i < divs.length; i++) {
  393. var divv = divs[i];
  394. if (divv == document.getElementById("tab" + v + "_content")) {
  395. divv.style.display = "block";
  396. console.log(v,'v');
  397. fanData(v)
  398. } else {
  399. fanData(v)
  400. divv.style.display = "none";
  401. }
  402. }
  403. }
  404. </script>
  405. </html>