optim.html 11 KB

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