1
0

reclaimedwater_tank.html 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>{{ title }}</title>
  6. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  7. <!-- 新 Bootstrap4 核心 CSS 文件 -->
  8. <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.1.0/css/bootstrap.min.css">
  9. <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
  10. <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
  11. <!-- popper.min.js 用于弹窗、提示、下拉菜单 -->
  12. <script src="https://cdn.bootcss.com/popper.js/1.12.5/umd/popper.min.js"></script>
  13. <!-- 最新的 Bootstrap4 核心 JavaScript 文件 -->
  14. <script src="https://cdn.bootcss.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
  15. <!--可用來建立使用者小圖示-->
  16. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
  17. <script language="JavaScript">
  18. var rtid = '{{tid}}';
  19. $(document).ready(function(){
  20. $("#coffee_title_pc").text('R' + rtid + ' 中水桶操作介面');
  21. $("#coffee_title_phone").text('R' + rtid + ' 中水桶操作介面');
  22. });
  23. var WebUpdate_set = setInterval(function(){WebUpdate(rtid)} , 10 * 1000);
  24. </script>
  25. <script>
  26. // 清水入水電磁閥
  27. function tankSolenoidWaterIn(params) {
  28. if (params == '1') {
  29. var data = { "tank_num": "ReclaimedWaterTank", "command": "tank_solenoid_water_in_status", "value": "on" };
  30. } else if (params == '0') {
  31. var data = { "tank_num": "ReclaimedWaterTank", "command": "tank_solenoid_water_in_status", "value": "off" };
  32. } else {
  33. var status = "off";
  34. var check = $("input[name=tank_solenoid_water_in_status]:checked");
  35. console.log('check:', check);
  36. //大於0代表有被選中
  37. if (check.length > 0) {
  38. status = "on";
  39. $("#cmn-toggle-41").prop('checked', false);
  40. if (!confirm("你確定要開啟清水入水電磁閥嗎?")) {
  41. return false;
  42. };
  43. } else {
  44. $("#cmn-toggle-41").prop('checked', true);
  45. if (!confirm("你確定要關閉清水入水電磁閥嗎?")) {
  46. return false;
  47. };
  48. };
  49. var data = { "tank_num": "ReclaimedWaterTank", "command": "tank_solenoid_water_in_status", "value": status };
  50. }
  51. $.post('/mqtt/1', data, function (res) {
  52. console.log('data:', data)
  53. if (res == 'on') {
  54. $("#cmn-toggle-41").prop('checked', true);
  55. } else if (res == 'off') {
  56. $("#cmn-toggle-41").prop('checked', false);
  57. } else {
  58. console.log(res)
  59. };
  60. }, 'text')
  61. }
  62. // 廢水出水電磁閥
  63. function tankSolenoidWaterOut(params) {
  64. if (params == '1') {
  65. var data = { "tank_num": "ReclaimedWaterTank", "command": "tank_solenoid_water_out_status", "value": "on" };
  66. } else if (params == '0') {
  67. var data = { "tank_num": "ReclaimedWaterTank", "command": "tank_solenoid_water_out_status", "value": "off" };
  68. } else {
  69. var status = "off";
  70. var check = $("input[name=tank_solenoid_water_out_status]:checked");
  71. console.log('check:', check);
  72. //大於0代表有被選中
  73. if (check.length > 0) {
  74. status = "on";
  75. $("#cmn-toggle-44").prop('checked', false);
  76. if (!confirm("你確定要開啟廢水出水電磁閥嗎?")) {
  77. return false;
  78. };
  79. } else {
  80. $("#cmn-toggle-44").prop('checked', true);
  81. if (!confirm("你確定要關閉廢水出水電磁閥嗎?")) {
  82. return false;
  83. };
  84. };
  85. var data = { "tank_num": "ReclaimedWaterTank", "command": "tank_solenoid_water_out_status", "value": status };
  86. }
  87. $.post('/mqtt/1', data, function (res) {
  88. console.log('data:', data)
  89. if (res == 'on') {
  90. $("#cmn-toggle-44").prop('checked', true);
  91. } else if (res == 'off') {
  92. $("#cmn-toggle-44").prop('checked', false);
  93. } else {
  94. console.log(res)
  95. };
  96. }, 'text')
  97. }
  98. // 中水出水電磁閥
  99. function tankSolenoidReclaimedOut(params) {
  100. if (params == '1') {
  101. var data = { "tank_num": "ReclaimedWaterTank", "command": "tank_solenoid_reclaimed_out_status", "value": "on" };
  102. } else if (params == '0') {
  103. var data = { "tank_num": "ReclaimedWaterTank", "command": "tank_solenoid_reclaimed_out_status", "value": "off" };
  104. } else {
  105. var status = "off";
  106. var check = $("input[name=tank_solenoid_reclaimed_out_status]:checked");
  107. console.log('check:', check);
  108. //大於0代表有被選中
  109. if (check.length > 0) {
  110. status = "on";
  111. $("#cmn-toggle-47").prop('checked', false);
  112. if (!confirm("你確定要開啟中水出水電磁閥嗎?")) {
  113. return false;
  114. };
  115. } else {
  116. $("#cmn-toggle-47").prop('checked', true);
  117. if (!confirm("你確定要關閉中水出水電磁閥嗎?")) {
  118. return false;
  119. };
  120. };
  121. var data = { "tank_num": "ReclaimedWaterTank", "command": "tank_solenoid_reclaimed_out_status", "value": status };
  122. }
  123. $.post('/mqtt/1', data, function (res) {
  124. console.log('data:', data)
  125. if (res == 'on') {
  126. $("#cmn-toggle-47").prop('checked', true);
  127. } else if (res == 'off') {
  128. $("#cmn-toggle-47").prop('checked', false);
  129. } else {
  130. console.log(res)
  131. };
  132. }, 'text')
  133. }
  134. // 幫浦(清洗槽入水)
  135. function tankPumpCleanwaterIn(params) {
  136. if (params == '1') {
  137. var data = { "tank_num": "ReclaimedWaterTank", "command": "tank_pump_cleanwater_in_status", "value": "on" };
  138. } else if (params == '0') {
  139. var data = { "tank_num": "ReclaimedWaterTank", "command": "tank_pump_cleanwater_in_status", "value": "off" };
  140. } else {
  141. var status = "off";
  142. var check = $("input[name=tank_pump_cleanwater_in_status]:checked");
  143. console.log('check:', check);
  144. //大於0代表有被選中
  145. if (check.length > 0) {
  146. status = "on";
  147. $("#cmn-toggle-50").prop('checked', false);
  148. if (!confirm("你確定要開啟幫浦(清洗槽入水)嗎?")) {
  149. return false;
  150. };
  151. } else {
  152. $("#cmn-toggle-50").prop('checked', true);
  153. if (!confirm("你確定要關閉幫浦(清洗槽入水)嗎?")) {
  154. return false;
  155. };
  156. };
  157. var data = { "tank_num": "ReclaimedWaterTank", "command": "tank_pump_cleanwater_in_status", "value": status };
  158. }
  159. $.post('/mqtt/1', data, function (res) {
  160. console.log('data:', data)
  161. if (res == 'on') {
  162. $("#cmn-toggle-50").prop('checked', true);
  163. } else if (res == 'off') {
  164. $("#cmn-toggle-50").prop('checked', false);
  165. } else {
  166. console.log(res)
  167. };
  168. }, 'text')
  169. }
  170. </script>
  171. <script language="JavaScript">
  172. function changeUpdate() {
  173. clearInterval(WebUpdate_set);
  174. var webupdate_time = $("input[name=webupdate_time]").val()
  175. console.log('webupdate_time' + webupdate_time)
  176. WebUpdate_set = setInterval(function(){WebUpdate(rtid)} , webupdate_time * 1000);
  177. }
  178. </script>
  179. </head>
  180. <body>
  181. <div id="wrapper">
  182. <div id="coffee_header">
  183. <!-- 匯入共同使用的 header.html 內容 -->
  184. {% include 'header.html' %}
  185. </div>
  186. <h4>致動器</h4>
  187. <table border="1" class="table-all" cellpadding="3" style="text-align: center;">
  188. <tr>
  189. <td style="color:red;">Valve</td>
  190. <td>清水入水<br>電磁閥</td>
  191. <td>中水出水<br>電磁閥</td>
  192. <td>廢水出水<br>電磁閥</td>
  193. <td>入水清洗槽<br>幫浦</td>
  194. </tr>
  195. <tr>
  196. <td>
  197. <span style="color:#C0C0C0;">off</span>
  198. <span style="color:#008CBA;">on</span>
  199. </td>
  200. <td>
  201. <div class="switch_div">
  202. <div class="switch">
  203. <input type="checkbox" class="cmn-toggle cmn-toggle-round" id="cmn-toggle-40">
  204. </div>
  205. <div class="switch text-center">
  206. {% if tank_solenoid_water_in == 1 %}
  207. <input type="checkbox" class="cmn-toggle cmn-toggle-round-flat" id="cmn-toggle-41" checked
  208. name="tank_solenoid_water_in_status" value="ON" onclick="tankSolenoidWaterIn()">
  209. {% else %}
  210. <input type="checkbox" class="cmn-toggle cmn-toggle-round-flat" id="cmn-toggle-41"
  211. name="tank_solenoid_water_in_status" value="OFF" onclick="tankSolenoidWaterIn()">
  212. {% endif %}
  213. <label class="label_ActuatorStatus" for="cmn-toggle-41"></label>
  214. </div>
  215. <div class="switch">
  216. <input type="checkbox" class="cmn-toggle cmn-toggle-yes-no" id="cmn-toggle-42">
  217. </div>
  218. </div>
  219. </td>
  220. <td>
  221. <div class="switch_div">
  222. <div class="switch">
  223. <input type="checkbox" class="cmn-toggle cmn-toggle-round" id="cmn-toggle-46">
  224. </div>
  225. <div class="switch text-center">
  226. {% if tank_solenoid_reclaimed_out == 1 %}
  227. <input type="checkbox" class="cmn-toggle cmn-toggle-round-flat" id="cmn-toggle-47" checked
  228. name="tank_solenoid_reclaimed_out_status" value="ON" onclick="tankSolenoidReclaimedOut()">
  229. {% else %}
  230. <input type="checkbox" class="cmn-toggle cmn-toggle-round-flat" id="cmn-toggle-47"
  231. name="tank_solenoid_reclaimed_out_status" value="OFF" onclick="tankSolenoidReclaimedOut()">
  232. {% endif %}
  233. <label class="label_ActuatorStatus" for="cmn-toggle-47"></label>
  234. </div>
  235. <div class="switch">
  236. <input type="checkbox" class="cmn-toggle cmn-toggle-yes-no" id="cmn-toggle-48">
  237. </div>
  238. </div>
  239. </td>
  240. <td>
  241. <div class="switch_div">
  242. <div class="switch">
  243. <input type="checkbox" class="cmn-toggle cmn-toggle-round" id="cmn-toggle-43">
  244. </div>
  245. <div class="switch text-center">
  246. {% if tank_solenoid_water_out == 1 %}
  247. <input type="checkbox" class="cmn-toggle cmn-toggle-round-flat" id="cmn-toggle-44" checked
  248. name="tank_solenoid_water_out_status" value="ON" onclick="tankSolenoidWaterOut()">
  249. {% else %}
  250. <input type="checkbox" class="cmn-toggle cmn-toggle-round-flat" id="cmn-toggle-44"
  251. name="tank_solenoid_water_out_status" value="OFF" onclick="tankSolenoidWaterOut()">
  252. {% endif %}
  253. <label class="label_ActuatorStatus" for="cmn-toggle-44"></label>
  254. </div>
  255. <div class="switch">
  256. <input type="checkbox" class="cmn-toggle cmn-toggle-yes-no" id="cmn-toggle-45">
  257. </div>
  258. </div>
  259. </td>
  260. <td>
  261. <div class="switch_div">
  262. <div class="switch">
  263. <input type="checkbox" class="cmn-toggle cmn-toggle-round" id="cmn-toggle-49">
  264. </div>
  265. <div class="switch text-center">
  266. {% if tank_pump_reclaimed_out == 1 %}
  267. <input type="checkbox" class="cmn-toggle cmn-toggle-round-flat" id="cmn-toggle-50" checked
  268. name="tank_pump_reclaimed_out_status" value="ON" onclick="tankPumpCleanwaterIn()">
  269. {% else %}
  270. <input type="checkbox" class="cmn-toggle cmn-toggle-round-flat" id="cmn-toggle-50"
  271. name="tank_pump_reclaimed_out_status" value="OFF" onclick="tankPumpCleanwaterIn()">
  272. {% endif %}
  273. <label class="label_ActuatorStatus" for="cmn-toggle-50"></label>
  274. </div>
  275. <div class="switch">
  276. <input type="checkbox" class="cmn-toggle cmn-toggle-yes-no" id="cmn-toggle-51">
  277. </div>
  278. </div>
  279. </td>
  280. </tr>
  281. <tr>
  282. <td><span style="color:#008CBA;"><b>ON</b></span></td>
  283. <td><input type="button" class="input-button-on" value="ON" onclick="tankSolenoidWaterIn('1')"></td>
  284. <td><input type="button" class="input-button-on" value="ON" onclick="tankSolenoidReclaimedOut('1')"></td>
  285. <td><input type="button" class="input-button-on" value="ON" onclick="tankSolenoidWaterOut('1')"></td>
  286. <td><input type="button" class="input-button-on" value="ON" onclick="tankPumpCleanwaterIn('1')"></td>
  287. </tr>
  288. <tr>
  289. <td><span style="color:#C0C0C0;"><b>OFF</b></span></td>
  290. <td><input type="button" class="input-button-off" value="OFF" onclick="tankSolenoidWaterIn('0')"></td>
  291. <td><input type="button" class="input-button-off" value="OFF" onclick="tankSolenoidReclaimedOut('0')"></td>
  292. <td><input type="button" class="input-button-off" value="OFF" onclick="tankSolenoidWaterOut('0')"></td>
  293. <td><input type="button" class="input-button-off" value="OFF" onclick="tankPumpCleanwaterIn('0')"></td>
  294. </tr>
  295. </table>
  296. <div id="coffee_footer">
  297. <!-- 匯入共同使用的 footer.html 內容 -->
  298. {% include 'footer.html' %}
  299. </div>
  300. </div>
  301. </body>
  302. <script>
  303. // jQuery 更新感測器致動器狀態
  304. function WebUpdate(rtid) {
  305. $.get('/loading/R' + rtid, '', function (res) {
  306. if (res.tank_solenoid_water_in == 0) {
  307. $("#cmn-toggle-41").prop('checked', false);
  308. } else if (res.tank_solenoid_water_in == 1) {
  309. $("#cmn-toggle-41").prop('checked', true);
  310. }
  311. if (res.tank_solenoid_water_out == 0) {
  312. $("#cmn-toggle-44").prop('checked', false);
  313. } else if (res.tank_solenoid_water_out == 1) {
  314. $("#cmn-toggle-44").prop('checked', true);
  315. }
  316. if (res.tank_solenoid_reclaimed_out == 0) {
  317. $("#cmn-toggle-47").prop('checked', false);
  318. } else if (res.tank_solenoid_reclaimed_out == 1) {
  319. $("#cmn-toggle-47").prop('checked', true);
  320. }
  321. if (res.tank_pump_reclaimed_out == 0) {
  322. $("#cmn-toggle-50").prop('checked', false);
  323. } else if (res.tank_pump_reclaimed_out == 1) {
  324. $("#cmn-toggle-50").prop('checked', true);
  325. }
  326. }, 'json');
  327. }
  328. </script>
  329. </html>