optim.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  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. <body>
  24. <div id="tower_temperature">
  25. <div id="tower_temperature">
  26. <div class="row px-0 mx-0">
  27. <div class="col-lg-4">
  28. <div scr="hot_water" class="fw-bold">
  29. <h1><i style="color:#FF0000;" class="fas fa-thermometer-half me-2"></i>熱水溫度(°C)</h1>
  30. <div id="hot_water_data">
  31. <font size="1">{{ x }}</font><br>
  32. </div>
  33. </div>
  34. </div>
  35. <div class="col-lg-4 text-center">
  36. <div id="cold_water" class="fw-bold">
  37. <h1><i style="color:#0174c7;" class="fas fa-thermometer-half me-2"></i>冷水溫度(°C)</h1>
  38. <font size="1">{{ y }}</font><br>
  39. </div>
  40. </div>
  41. <div class="col-lg-4 text-end">
  42. <div id="wet_water" class="fw-bold">
  43. <h1><i style="color:#3dba1e;" class="fas fa-thermometer-half me-2"></i>濕球溫度(°C)</h1>
  44. <font size="1">{{ z }}</font><br>
  45. </div>
  46. </div>
  47. </div>
  48. </div>
  49. <script>
  50. var hot = '{{x}}'
  51. var cold = '{{y}}'
  52. var wet = '{{z}}'
  53. console.log(hot)
  54. console.log(hot)
  55. console.log(wet)
  56. const chart = echarts.init(document.getElementById("hot_water_data"));
  57. chart.setOption({
  58. series: [
  59. {
  60. type: "liquidFill",
  61. data: [0.6, 0.5, 0.4, 0.3]
  62. }
  63. ]
  64. });
  65. </script>
  66. <script>
  67. const chart2 = echarts.init(document.getElementById("cold_water_data"));
  68. chart2.setOption({
  69. series: [
  70. {
  71. type: "liquidFill",
  72. data: [0.6, 0.5, 0.4, 0.3]
  73. }
  74. ]
  75. });
  76. </script>
  77. <script>
  78. const chart3 = echarts.init(document.getElementById("wet_water_data"));
  79. chart3.setOption({
  80. series: [
  81. {
  82. type: "liquidFill",
  83. data: [0.6, 0.5, 0.4, 0.3]
  84. }
  85. ]
  86. });
  87. </script>
  88. <!-- css -->
  89. <!-- <style>
  90. table {
  91. font-family: arial, sans-serif;
  92. border-collapse: collapse;
  93. width: 50%;
  94. }
  95. td,
  96. th {
  97. border: 1px solid #dddddd;
  98. text-align: left;
  99. padding: 8px;
  100. }
  101. tr:nth-child(even) {
  102. background-color: #dddddd;
  103. }
  104. </style> -->
  105. <section class="tower_data my-3">
  106. <div class="card">
  107. <div class="row px-0 mx-0">
  108. <div class="col-lg-6">
  109. <h1 class="ps-0">當前狀態</h1>
  110. </div>
  111. <div class="col-lg-6">
  112. <h1 class="ps-0">校能最佳化</h1>
  113. </div>
  114. </div>
  115. <div class="row px-0 mx-0">
  116. <div class="col-lg-6">
  117. <table class="table">
  118. <tr>
  119. <td>水流量</td>
  120. <td>{{ x }} M*3/H</td>
  121. </tr>
  122. <tr>
  123. <td>風扇數</td>
  124. <td>{{ x }} 台</td>
  125. </tr>
  126. </table>
  127. </div>
  128. <div class="col-lg-6">
  129. <table class="table">
  130. <tr>
  131. <th>目前溫度</th>
  132. <th>{{ x }} 度C</th>
  133. </tr>
  134. <tr>
  135. <td>流量建議調整為</td>
  136. <td>{{ x }} M*3/H</td>
  137. </tr>
  138. <tr>
  139. <td>可節省水費</td>
  140. <td>{{ x }} 元/天</td>
  141. </tr>
  142. <tr>
  143. <td>風扇建議調整為</td>
  144. <td>{{ x }} 台</td>
  145. </tr>
  146. <tr>
  147. <td>可節省電費</td>
  148. <td>{{ x }} 元/天</td>
  149. </tr>
  150. <tr>
  151. <td>總節省費用</td>
  152. <td>{{ x }} 元/天</td>
  153. </tr>
  154. </table>
  155. </div>
  156. </div>
  157. </div>
  158. </section>
  159. <!-- <script src="/static/echarts.min.js"></script>
  160. <script src="/static/echarts-liquidfill.js"></script>
  161. <script>
  162. // const chart = echarts.init(document.getElementById("app"));
  163. var hot_water = echarts.init(document.getElementById("app"));
  164. var cold_water = echarts.init(document.getElementById("app2"));
  165. var wet_water = echarts.init(document.getElementById("app3"));
  166. let date = transform_time_to_string(new Date());
  167. fetch(`/temperature/date=${date}`)
  168. .then(function (response) {
  169. return response.json();
  170. })
  171. .then(function (myJson) {
  172. console.log(myJson);
  173. console.log(1);
  174. hot_water.setOption({
  175. series: [
  176. {
  177. type: "liquidFill",
  178. data: [0.6, 0.5, 0.4, 0.3]
  179. }
  180. ]
  181. });
  182. cold_water.setOption({
  183. series: [
  184. {
  185. type: "liquidFill",
  186. data: [0.6, 0.5, 0.4, 0.3]
  187. }
  188. ]
  189. });
  190. wet_water.setOption({
  191. series: [
  192. {
  193. type: "liquidFill",
  194. data: [0.6, 0.5, 0.4, 0.3]
  195. }
  196. ]
  197. });
  198. });
  199. </script> -->
  200. <!-- <script type="text/javascript">
  201. var hot_water = echarts.init(document.getElementById("hot_water"));
  202. var cold_water = echarts.init(document.getElementById("cold_water"));
  203. var wet_water = echarts.init(document.getElementById("wet_water"));
  204. let date = transform_time_to_string(new Date());
  205. fetch(`/temperature/date=${date}`)
  206. .then(function (response) {
  207. return response.json();
  208. })
  209. .then(function (myJson) {
  210. // 配置圖表資訊
  211. console.log(myJson);
  212. option = {
  213. series: [{
  214. type: 'liquidFill',
  215. data: myJson['hot_water']
  216. }]
  217. };
  218. hot_water.setOption(option);
  219. option = {
  220. series: [{
  221. type: 'liquidFill',
  222. data: myJson['cold_water']
  223. }]
  224. };
  225. cold_water.setOption(option);
  226. option = {
  227. series: [{
  228. type: 'liquidFill',
  229. data: myJson['wet_water']
  230. }]
  231. };
  232. wet_water.setOption(option);
  233. });
  234. </script> -->
  235. <!-- css -->
  236. <!-- <style>
  237. .horizontal .progress-bar {
  238. float: left;
  239. height: 50px;
  240. width: 100%;
  241. padding: 3px 0;
  242. }
  243. .horizontal .progress-track {
  244. position: relative;
  245. width: 100%;
  246. height: 50px;
  247. background: #ebebeb;
  248. }
  249. .horizontal .progress-fill {
  250. position: relative;
  251. background: #2883fa;
  252. height: 50px;
  253. width: 50%;
  254. color: #080707;
  255. text-align: center;
  256. font-family: "Lato", "Verdana", sans-serif;
  257. font-size: 16px;
  258. line-height: 20px;
  259. }
  260. .horizontal .progress-fill2 {
  261. position: relative;
  262. background: #ba711e;
  263. height: 50px;
  264. width: 50%;
  265. color: #080707;
  266. text-align: center;
  267. font-family: "Lato", "Verdana", sans-serif;
  268. font-size: 16px;
  269. line-height: 20px;
  270. }
  271. .horizontal .progress-fill3 {
  272. position: relative;
  273. background: #3dba1e;
  274. height: 50px;
  275. width: 50%;
  276. color: #080707;
  277. text-align: center;
  278. font-family: "Lato", "Verdana", sans-serif;
  279. font-size: 16px;
  280. line-height: 20px;
  281. }
  282. .horizontal .progress-fill4 {
  283. position: relative;
  284. background: #f0ff1f;
  285. height: 50px;
  286. width: 50%;
  287. color: #080707;
  288. text-align: center;
  289. font-family: "Lato", "Verdana", sans-serif;
  290. font-size: 16px;
  291. line-height: 20px;
  292. }
  293. .progress-label {
  294. width: 170px;
  295. text-align: right;
  296. padding-right: 10px;
  297. font-size: 16px;
  298. }
  299. .progress-group {
  300. display: flex;
  301. }
  302. .progress-label::after {
  303. content: ":";
  304. }
  305. </style> -->
  306. <div class="card mt-5">
  307. <div class="horizontal flat">
  308. <h1><i style="color:#0174c7;" class="far fa-chart-bar me-1"></i>測試驗證</h1>
  309. <div class="progress-group">
  310. <div class="progress-label d-flex align-items-center justify-content-end">水流量</div>
  311. <div class="progress-bar horizontal my-2">
  312. <div class="progress-track">
  313. <div class="progress-fill d-flex align-items-center justify-content-center">
  314. <span>100%</span>
  315. </div>
  316. </div>
  317. </div>
  318. </div>
  319. <div class="progress-group">
  320. <div class="progress-label d-flex align-items-center justify-content-end">風扇數</div>
  321. <div class="progress-bar horizontal my-2">
  322. <div class="progress-track">
  323. <div class="progress-fill2 d-flex align-items-center justify-content-center">
  324. <span>75%</span>
  325. </div>
  326. </div>
  327. </div>
  328. </div>
  329. <div class="progress-group">
  330. <div class="progress-label d-flex align-items-center justify-content-end">濕求溫度</div>
  331. <div class="progress-bar horizontal my-2">
  332. <div class="progress-track">
  333. <div class="progress-fill3 d-flex align-items-center justify-content-center">
  334. <span>60%</span>
  335. </div>
  336. </div>
  337. </div>
  338. </div>
  339. <div class="progress-group">
  340. <div class="progress-label d-flex align-items-center justify-content-end">熱水溫度</div>
  341. <div class="progress-bar horizontal my-2">
  342. <div class="progress-track">
  343. <div class="progress-fill4 d-flex align-items-center justify-content-center">
  344. <span>20%</span>
  345. </div>
  346. </div>
  347. </div>
  348. </div>
  349. </div>
  350. <script>$(function () {
  351. $('.progress-fill span').each(function () {
  352. var percent = $(this).html();
  353. $(this).parent().css('width', percent);
  354. });
  355. $('.progress-fill2 span').each(function () {
  356. var percent = $(this).html();
  357. $(this).parent().css('width', percent);
  358. });
  359. $('.progress-fill3 span').each(function () {
  360. var percent = $(this).html();
  361. $(this).parent().css('width', percent);
  362. });
  363. $('.progress-fill4 span').each(function () {
  364. var percent = $(this).html();
  365. $(this).parent().css('width', percent);
  366. });
  367. });</script>
  368. {% endblock %}