ventilate.html 12 KB

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