optim.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501
  1. {% extends "index.html" %}
  2. {% block title %}智能最佳化{% endblock %}
  3. {% block head %}
  4. {{ super() }}
  5. {% endblock %}
  6. {% block body %}
  7. <script type="text/javascript" src="/static/tower.js"></script>
  8. <div id='select_boxes'>
  9. <select class="select-item" id="company-list" onChange="onChangeColumn1();">
  10. <option value=0>公司</option>
  11. </select>
  12. <select class="select-item" id="factory-list" onChange="onChangeColumn2();">
  13. <option value=0>工廠</option>
  14. </select>
  15. <select class="select-item" id="department-list" onChange="onChangeColumn3();">
  16. <option value=0>廠區</option>
  17. </select>
  18. <select class="select-item" id="towerGroup-list">
  19. <option value=0>機組</option>
  20. </select>
  21. <button id="tower_btn" onclick="click_button();"><i class="fas fa-search me-2"></i>搜尋</button>
  22. </div>
  23. <div class="ps-5 fw-bold">
  24. <p>機組1 總共有{{count}}座水塔</p>
  25. </div>
  26. <body>
  27. <div id="tower_temperature">
  28. <div id="tower_temperature">
  29. <div class="row px-0 mx-0">
  30. <div class="col-lg-4 text-center">
  31. <div scr="hot_water" class="fw-bold">
  32. <h1><i style="color:#FF0000;" class="fas fa-thermometer-half me-2"></i>熱水溫度(°C)</h1>
  33. <!-- <font size="1">{{ x }}</font><br> -->
  34. <div id="app" class="chart"></div>
  35. </div>
  36. </div>
  37. <div class="col-lg-4 text-center">
  38. <div id="cold_water" class="fw-bold">
  39. <h1><i style="color:#0174c7;" class="fas fa-thermometer-half me-2"></i>冷水溫度(°C)</h1>
  40. <!-- <font size="1">{{ y }}</font><br> -->
  41. <div id="app2"></div>
  42. </div>
  43. </div>
  44. <div class="col-lg-4 text-center">
  45. <div id="wet_water" class="fw-bold">
  46. <h1><i style="color:#3dba1e;" class="fas fa-thermometer-half me-2"></i>濕球溫度(°C)</h1>
  47. <!-- <font size="1">{{ z }}</font><br> -->
  48. <div id="app3"></div>
  49. </div>
  50. </div>
  51. </div>
  52. </div>
  53. <script src="/static/echarts.min.js"></script>
  54. <script src="/static/echarts-liquidfill.js"></script>
  55. <script>
  56. var hot = '{{x}}'
  57. var cold = '{{y}}'
  58. var wet = '{{z}}'
  59. console.log(hot);
  60. console.log(cold);
  61. console.log(wet);
  62. var chart = echarts.init(document.getElementById("app"));
  63. chart.setOption({
  64. series: [
  65. {
  66. type: "liquidFill",
  67. name: 'Liquid Fill',
  68. data: [{
  69. name: 'First Data',
  70. value: 0.6,
  71. itemStyle: {
  72. color: '#FF0000'
  73. },
  74. }],
  75. radius: '70%',
  76. outline: {
  77. show: false
  78. },
  79. radius: '70%',
  80. outline: {
  81. show: false
  82. },
  83. outline: {
  84. show: false
  85. },
  86. label: {
  87. formatter: function (param) {
  88. return hot;
  89. },
  90. fontSize: 28
  91. }
  92. }
  93. ],
  94. });
  95. </script>
  96. <script>
  97. var hot = '{{x}}'
  98. var cold = '{{y}}'
  99. var wet = '{{z}}'
  100. console.log(hot);
  101. console.log(cold);
  102. console.log(wet);
  103. const chart2 = echarts.init(document.getElementById("app2"));
  104. chart2.setOption({
  105. series: [
  106. {
  107. type: "liquidFill",
  108. name: 'Liquid Fill',
  109. data: [{
  110. name: 'First Data',
  111. value: 0.6,
  112. itemStyle: {
  113. color: '#0174c7'
  114. },
  115. }],
  116. radius: '70%',
  117. outline: {
  118. show: false
  119. },
  120. radius: '70%',
  121. outline: {
  122. show: false
  123. },
  124. outline: {
  125. show: false
  126. },
  127. label: {
  128. formatter: function (param) {
  129. return cold;
  130. },
  131. fontSize: 28
  132. }
  133. }
  134. ],
  135. });
  136. </script>
  137. <script>
  138. var hot = '{{x}}'
  139. var cold = '{{y}}'
  140. var wet = '{{z}}'
  141. console.log(hot);
  142. console.log(cold);
  143. console.log(wet);
  144. const chart3 = echarts.init(document.getElementById("app3"));
  145. chart3.setOption({
  146. series: [
  147. {
  148. type: "liquidFill",
  149. name: 'Liquid Fill',
  150. data: [{
  151. name: 'First Data',
  152. value: 0.6,
  153. itemStyle: {
  154. color: '#3dba1e'
  155. },
  156. }],
  157. radius: '70%',
  158. outline: {
  159. show: false
  160. },
  161. outline: {
  162. show: false
  163. },
  164. label: {
  165. formatter: function (param) {
  166. return wet;
  167. },
  168. fontSize: 28
  169. }
  170. }
  171. ],
  172. });
  173. </script>
  174. <!-- <script>
  175. const chart2 = echarts.init(document.getElementById("cold_water_data"));
  176. chart2.setOption({
  177. series: [
  178. {
  179. type: "liquidFill",
  180. data: [0.6, 0.5, 0.4, 0.3]
  181. }
  182. ]
  183. });
  184. </script>
  185. <script>
  186. const chart3 = echarts.init(document.getElementById("wet_water_data"));
  187. chart3.setOption({
  188. series: [
  189. {
  190. type: "liquidFill",
  191. data: [0.6, 0.5, 0.4, 0.3]
  192. }
  193. ]
  194. });
  195. </script> -->
  196. <!-- css -->
  197. <style>
  198. table {
  199. font-family: arial, sans-serif;
  200. border-collapse: collapse;
  201. width: 50%;
  202. }
  203. td,
  204. th {
  205. border: 1px solid #dddddd;
  206. text-align: left;
  207. padding: 8px;
  208. }
  209. tr:nth-child(even) {
  210. background-color: #dddddd;
  211. }
  212. </style>
  213. <section class="tower_data my-3">
  214. <div class="card">
  215. <div class="row px-0 mx-0">
  216. <div class="col-lg-6">
  217. <h1 class="ps-0">當前狀態</h1>
  218. </div>
  219. <div class="col-lg-6">
  220. <h1 class="ps-0">效能最佳化</h1>
  221. </div>
  222. </div>
  223. <div class="row px-0 mx-0">
  224. <div class="col-lg-6">
  225. <table class="table">
  226. <tr>
  227. <td>水流量</td>
  228. <td>{{ waterflow }} M*3/H</td>
  229. </tr>
  230. <tr>
  231. <td>風扇數</td>
  232. <td>{{ fannum }} 台</td>
  233. </tr>
  234. </table>
  235. </div>
  236. <div class="col-lg-6">
  237. <table class="table">
  238. <tr>
  239. <th>目前溫度</th>
  240. <th>{{ x }} 度C</th>
  241. </tr>
  242. <tr>
  243. <td>流量建議調整為</td>
  244. <td>{{ flowchange }} M*3/H</td>
  245. </tr>
  246. <tr>
  247. <td>可節省水費</td>
  248. <td>{{ savewater }} 元/天</td>
  249. </tr>
  250. <tr>
  251. <td>風扇建議調整為</td>
  252. <td>{{ fanchange }} 台</td>
  253. </tr>
  254. <tr>
  255. <td>可節省電費</td>
  256. <td>{{ saveelec }} 元/天</td>
  257. </tr>
  258. <tr>
  259. <td>總節省費用</td>
  260. <td>{{ total }} 元/天</td>
  261. </tr>
  262. </table>
  263. </div>
  264. </div>
  265. </div>
  266. </section>
  267. <!-- <script src="/static/echarts.min.js"></script>
  268. <script src="/static/echarts-liquidfill.js"></script>
  269. <script>
  270. // const chart = echarts.init(document.getElementById("app"));
  271. var hot_water = echarts.init(document.getElementById("app"));
  272. var cold_water = echarts.init(document.getElementById("app2"));
  273. var wet_water = echarts.init(document.getElementById("app3"));
  274. let date = transform_time_to_string(new Date());
  275. fetch(`/temperature/date=${date}`)
  276. .then(function (response) {
  277. return response.json();
  278. })
  279. .then(function (myJson) {
  280. hot_water.setOption({
  281. series: [
  282. {
  283. type: "liquidFill",
  284. data: [0.6, 0.5, 0.4, 0.3]
  285. }
  286. ]
  287. });
  288. cold_water.setOption({
  289. series: [
  290. {
  291. type: "liquidFill",
  292. data: [0.6, 0.5, 0.4, 0.3]
  293. }
  294. ]
  295. });
  296. wet_water.setOption({
  297. series: [
  298. {
  299. type: "liquidFill",
  300. data: [0.6, 0.5, 0.4, 0.3]
  301. }
  302. ]
  303. });
  304. });
  305. </script> -->
  306. <!-- <script type="text/javascript">
  307. var hot_water = echarts.init(document.getElementById("hot_water"));
  308. var cold_water = echarts.init(document.getElementById("cold_water"));
  309. var wet_water = echarts.init(document.getElementById("wet_water"));
  310. let date = transform_time_to_string(new Date());
  311. fetch(`/temperature/date=${date}`)
  312. .then(function (response) {
  313. return response.json();
  314. })
  315. .then(function (myJson) {
  316. // 配置圖表資訊
  317. console.log(myJson);
  318. option = {
  319. series: [{
  320. type: 'liquidFill',
  321. data: myJson['hot_water']
  322. }]
  323. };
  324. hot_water.setOption(option);
  325. option = {
  326. series: [{
  327. type: 'liquidFill',
  328. data: myJson['cold_water']
  329. }]
  330. };
  331. cold_water.setOption(option);
  332. option = {
  333. series: [{
  334. type: 'liquidFill',
  335. data: myJson['wet_water']
  336. }]
  337. };
  338. wet_water.setOption(option);
  339. });
  340. </script> -->
  341. <!-- css -->
  342. <!-- <style>
  343. .horizontal .progress-bar {
  344. float: left;
  345. height: 50px;
  346. width: 100%;
  347. padding: 3px 0;
  348. }
  349. .horizontal .progress-track {
  350. position: relative;
  351. width: 100%;
  352. height: 50px;
  353. background: #ebebeb;
  354. }
  355. .horizontal .progress-fill {
  356. position: relative;
  357. background: #2883fa;
  358. height: 50px;
  359. width: 50%;
  360. color: #080707;
  361. text-align: center;
  362. font-family: "Lato", "Verdana", sans-serif;
  363. font-size: 16px;
  364. line-height: 20px;
  365. }
  366. .horizontal .progress-fill2 {
  367. position: relative;
  368. background: #ba711e;
  369. height: 50px;
  370. width: 50%;
  371. color: #080707;
  372. text-align: center;
  373. font-family: "Lato", "Verdana", sans-serif;
  374. font-size: 16px;
  375. line-height: 20px;
  376. }
  377. .horizontal .progress-fill3 {
  378. position: relative;
  379. background: #3dba1e;
  380. height: 50px;
  381. width: 50%;
  382. color: #080707;
  383. text-align: center;
  384. font-family: "Lato", "Verdana", sans-serif;
  385. font-size: 16px;
  386. line-height: 20px;
  387. }
  388. .horizontal .progress-fill4 {
  389. position: relative;
  390. background: #f0ff1f;
  391. height: 50px;
  392. width: 50%;
  393. color: #080707;
  394. text-align: center;
  395. font-family: "Lato", "Verdana", sans-serif;
  396. font-size: 16px;
  397. line-height: 20px;
  398. }
  399. .progress-label {
  400. width: 170px;
  401. text-align: right;
  402. padding-right: 10px;
  403. font-size: 16px;
  404. }
  405. .progress-group {
  406. display: flex;
  407. }
  408. .progress-label::after {
  409. content: ":";
  410. }
  411. </style> -->
  412. <div class="card mt-5">
  413. <div class="horizontal flat">
  414. <h1><i style="color:#0174c7;" class="far fa-chart-bar me-1"></i>測試驗證</h1>
  415. <div class="progress-group">
  416. <div class="progress-label d-flex align-items-center justify-content-end">水流量</div>
  417. <div class="progress-bar horizontal my-2">
  418. <div class="progress-track">
  419. <div class="progress-fill d-flex align-items-center justify-content-center">
  420. <span>100%</span>
  421. </div>
  422. </div>
  423. </div>
  424. </div>
  425. <div class="progress-group">
  426. <div class="progress-label d-flex align-items-center justify-content-end">風扇數</div>
  427. <div class="progress-bar horizontal my-2">
  428. <div class="progress-track">
  429. <div class="progress-fill2 d-flex align-items-center justify-content-center">
  430. <span>75%</span>
  431. </div>
  432. </div>
  433. </div>
  434. </div>
  435. <div class="progress-group">
  436. <div class="progress-label d-flex align-items-center justify-content-end">濕求溫度</div>
  437. <div class="progress-bar horizontal my-2">
  438. <div class="progress-track">
  439. <div class="progress-fill3 d-flex align-items-center justify-content-center">
  440. <span>60%</span>
  441. </div>
  442. </div>
  443. </div>
  444. </div>
  445. <div class="progress-group">
  446. <div class="progress-label d-flex align-items-center justify-content-end">熱水溫度</div>
  447. <div class="progress-bar horizontal my-2">
  448. <div class="progress-track">
  449. <div class="progress-fill4 d-flex align-items-center justify-content-center">
  450. <span>20%</span>
  451. </div>
  452. </div>
  453. </div>
  454. </div>
  455. </div>
  456. <script>$(function () {
  457. $('.progress-fill span').each(function () {
  458. var percent = $(this).html();
  459. $(this).parent().css('width', percent);
  460. });
  461. $('.progress-fill2 span').each(function () {
  462. var percent = $(this).html();
  463. $(this).parent().css('width', percent);
  464. });
  465. $('.progress-fill3 span').each(function () {
  466. var percent = $(this).html();
  467. $(this).parent().css('width', percent);
  468. });
  469. $('.progress-fill4 span').each(function () {
  470. var percent = $(this).html();
  471. $(this).parent().css('width', percent);
  472. });
  473. });</script>
  474. {% endblock %}