optim.html 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  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/tower3.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 id="tower_temperature">
  24. <div id="tower_temperature">
  25. <div scr="hot_water" style="width: 100px;height:100px;color: #26b72b;float:left">熱水溫度</div>
  26. <font size="1">{{ x }}</font><br>
  27. <div id="cold_water" style="width: 100px;height:100px;color: #8600FF;float:left">冷水溫度</div>
  28. <font size="1">{{ y }}</font><br>
  29. <div id="wet_water" style="width: 100px;height:100px;color: #737300;float:left">濕球溫度</div>
  30. <font size="1">{{ z }}</font><br>
  31. </div>
  32. <style>
  33. table {
  34. font-family: arial, sans-serif;
  35. border-collapse: collapse;
  36. width: 50%;
  37. }
  38. td, th {
  39. border: 1px solid #dddddd;
  40. text-align: left;
  41. padding: 8px;
  42. }
  43. tr:nth-child(even) {
  44. background-color: #dddddd;
  45. }
  46. </style>
  47. <body>
  48. <table>
  49. <tr>
  50. <th>當前狀態</th>
  51. <th></th>
  52. </tr>
  53. <tr>
  54. <td>水流量</td>
  55. <td>{{ x }} M*3/H</td>
  56. </tr>
  57. <tr>
  58. <td>風扇數</td>
  59. <td>{{ x }} 台</td>
  60. </tr>
  61. </table>
  62. <table>
  63. <tr>
  64. <th>效能最佳化</th>
  65. <th></th>
  66. </tr>
  67. <tr>
  68. <th>目前溫度</th>
  69. <th>{{ x }} 度C</th>
  70. </tr>
  71. <tr>
  72. <td>流量建議調整為</td>
  73. <td>{{ x }} M*3/H</td>
  74. </tr>
  75. <tr>
  76. <td>可節省水費</td>
  77. <td>{{ x }} 元/天</td>
  78. </tr>
  79. <tr>
  80. <td>風扇建議調整為</td>
  81. <td>{{ x }} 台</td>
  82. </tr>
  83. <tr>
  84. <td>可節省電費</td>
  85. <td>{{ x }} 元/天</td>
  86. </tr>
  87. <tr>
  88. <td>總節省費用</td>
  89. <td>{{ x }} 元/天</td>
  90. </tr>
  91. </table>
  92. <script type="text/javascript">
  93. var hot_water = echarts.init(document.getElementById("hot_water"));
  94. var cold_water = echarts.init(document.getElementById("cold_water"));
  95. var wet_water = echarts.init(document.getElementById("wet_water"));
  96. let date = transform_time_to_string(new Date());
  97. fetch(`/temperature/date=${date}`)
  98. .then(function(response) {
  99. return response.json();
  100. })
  101. .then(function(myJson) {
  102. // 配置圖表資訊
  103. console.log(myJson);
  104. option = {
  105. series: [{
  106. type: 'liquidFill',
  107. data: myJson['hot_water']
  108. }]
  109. };
  110. hot_water.setOption(option);
  111. option = {
  112. series: [{
  113. type: 'liquidFill',
  114. data: myJson['cold_water']
  115. }]
  116. };
  117. cold_water.setOption(option);
  118. option = {
  119. series: [{
  120. type: 'liquidFill',
  121. data: myJson['wet_water']
  122. }]
  123. };
  124. wet_water.setOption(option);
  125. });
  126. </script>
  127. <script>$(function() {
  128. $('.progress-fill span').each(function(){
  129. var percent = $(this).html();
  130. $(this).parent().css('width', percent);
  131. });
  132. $('.progress-fill2 span').each(function(){
  133. var percent = $(this).html();
  134. $(this).parent().css('width', percent);
  135. });
  136. $('.progress-fill3 span').each(function(){
  137. var percent = $(this).html();
  138. $(this).parent().css('width', percent);
  139. });
  140. $('.progress-fill4 span').each(function(){
  141. var percent = $(this).html();
  142. $(this).parent().css('width', percent);
  143. });
  144. });</script>
  145. <style>
  146. .container {
  147. width: 500px;
  148. margin: 20px;
  149. background: #fff;
  150. padding: 20px;
  151. overflow: hidden;
  152. float: left;
  153. }
  154. .horizontal .progress-bar {
  155. float: left;
  156. height: 18px;
  157. width: 100%;
  158. padding: 3px 0;
  159. }
  160. .horizontal .progress-track {
  161. position: relative;
  162. width: 100%;
  163. height: 20px;
  164. background: #ebebeb;
  165. }
  166. .horizontal .progress-fill {
  167. position: relative;
  168. background: #2883fa;
  169. height: 20px;
  170. width: 50%;
  171. color: #080707;
  172. text-align: center;
  173. font-family: "Lato","Verdana",sans-serif;
  174. font-size: 12px;
  175. line-height: 20px;
  176. }
  177. .horizontal .progress-fill2 {
  178. position: relative;
  179. background: #ba711e;
  180. height: 20px;
  181. width: 50%;
  182. color: #080707;
  183. text-align: center;
  184. font-family: "Lato","Verdana",sans-serif;
  185. font-size: 12px;
  186. line-height: 20px;
  187. }
  188. .horizontal .progress-fill3 {
  189. position: relative;
  190. background: #3dba1e;
  191. height: 20px;
  192. width: 50%;
  193. color: #080707;
  194. text-align: center;
  195. font-family: "Lato","Verdana",sans-serif;
  196. font-size: 12px;
  197. line-height: 20px;
  198. }
  199. .horizontal .progress-fill4 {
  200. position: relative;
  201. background: #f0ff1f;
  202. height: 20px;
  203. width: 50%;
  204. color: #080707;
  205. text-align: center;
  206. font-family: "Lato","Verdana",sans-serif;
  207. font-size: 12px;
  208. line-height: 20px;
  209. }
  210. .progress-group {
  211. display: flex;
  212. }
  213. .progress-label {
  214. width: 170px;
  215. text-align: right;
  216. padding-right: 10px;
  217. }
  218. .progress-label::after {
  219. content: ":";
  220. }
  221. </style>>
  222. <div class="container horizontal flat">
  223. <h2>測試驗證</h2>
  224. <div class="progress-group">
  225. <div class="progress-label">水流量</div>
  226. <div class="progress-bar horizontal">
  227. <div class="progress-track">
  228. <div class="progress-fill">
  229. <span>100%</span>
  230. </div>
  231. </div>
  232. </div>
  233. </div>
  234. <div class="progress-group">
  235. <div class="progress-label">風扇數</div>
  236. <div class="progress-bar horizontal">
  237. <div class="progress-track">
  238. <div class="progress-fill2">
  239. <span>75%</span>
  240. </div>
  241. </div>
  242. </div>
  243. </div>
  244. <div class="progress-group">
  245. <div class="progress-label">濕求溫度</div>
  246. <div class="progress-bar horizontal">
  247. <div class="progress-track">
  248. <div class="progress-fill3">
  249. <span>60%</span>
  250. </div>
  251. </div>
  252. </div>
  253. </div>
  254. <div class="progress-group">
  255. <div class="progress-label">熱水溫度</div>
  256. <div class="progress-bar horizontal">
  257. <div class="progress-track">
  258. <div class="progress-fill4">
  259. <span>20%</span>
  260. </div>
  261. </div>
  262. </div>
  263. </div>
  264. {% endblock %}