1
0

drop_down_list.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  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. <style>
  18. .newcondition_css {
  19. padding: 10px;
  20. margin-top: 10px;
  21. background-color: honeydew;
  22. }
  23. hr {
  24. margin-top: 5px;
  25. margin-bottom: 5px;
  26. }
  27. </style>
  28. </head>
  29. <body>
  30. <!--
  31. <script>
  32. // [系統]更新: Array / renew_system function
  33. system_object = new Array();
  34. system_object[0] = [" "];
  35. system_object[1] = [" ", "清洗槽組立"];
  36. system_object[2] = [" ", "發酵桶組立"];
  37. system_object[3] = [" ", "乾燥桶組立"];
  38. function renew_system(index) {
  39. var Value="";
  40. for(var i=0; i<system_object[index].length; i++){
  41. Value = Value + '<option value=' + system_object[index][i] + '> ' + system_object[index][i] + '</option>';
  42. }
  43. var sectorSelect = document.getElementById("system");
  44. sectorSelect.innerHTML = Value;
  45. $('#product_index').text(index)
  46. }
  47. // [模組]更新: Array / renew_system function
  48. module_object = new Array();
  49. module_object[0] = [" "];
  50. module_object[1] = [" ", "c1上蓋組立", "c2內桶槽組立"];
  51. module_object[2] = [" ", "f1上蓋組立", "f2控制盒組立"];
  52. module_object[3] = [" ", "d1上蓋組立", "d2控制盒組立"];
  53. function renew_module(index) {
  54. var Value="";
  55. for(var i=0; i<module_object[index].length; i++){
  56. Value = Value + '<option value=' + module_object[index][i] + '>' + module_object[index][i] + '</option>';
  57. }
  58. var sectorSelect = document.getElementById("module");
  59. sectorSelect.innerHTML = Value;
  60. $('#system_index').text(index)
  61. }
  62. // // [零件]更新: Array / renew_system function
  63. component_object = new Array();
  64. component_object[0] = [" "];
  65. component_object[1][1] = [" ", "c1_M10平墊圈", "c1_M10螺帽"];
  66. component_object[1][2] = [" ", "c2_內桶槽", "c2_內桶槽固定環"];
  67. component_object[2][1] = [" ", "f1_吸料機入料管", "f1_入料斗擋板"];
  68. component_object[2][2] = [" ", "f2_LED指示燈 綠色 TB12LED-G0201", "f2_K3 LED指示燈-主板"];
  69. component_object[3][1] = [" ", "d1_軸心(單邊出軸)", "d1_墊片M18x25x1.5"];
  70. component_object[3][2] = [" ", "d2_M3x5螺絲", "d2_M3x5銅柱 1公1母"];
  71. function renew_component(product_index, index) {
  72. var Value="";
  73. for(var i=0; i<component_object[product_index][index].length; i++){
  74. Value = Value + '<option value=' + component_object[product_index][index] + '>' + component_object[index][i] + '</option>';
  75. }
  76. var sectorSelect = document.getElementById("component");
  77. sectorSelect.innerHTML = Value;
  78. $('#module_index').text(index)
  79. }
  80. // // 輸出零件 index
  81. function renew_item(index) {
  82. $('#component_index').text(index)
  83. }
  84. </script>
  85. -->
  86. <br>
  87. 產品:
  88. <select id="product" onChange="renew_system(this.selectedIndex);">
  89. </select>
  90. 系統:
  91. <select id="system" onChange="renew_module(this.selectedIndex);">
  92. </select>
  93. 模組:
  94. <select id="module" onChange="renew_component(this.selectedIndex);">
  95. </select>
  96. 零件:
  97. <select id="component" onChange="">
  98. <input type="button" id="input_value" value="取值" onclick="printValue();"><br>
  99. 取值: <span id="span_value"></span>
  100. </select><br>
  101. <script>
  102. // 輸出關鍵字
  103. function printValue() {
  104. // database 取值語法
  105. var data = 'select * from teststock1213';
  106. // 取得下拉式選單選擇的 value
  107. var product_value = $("#product").val();
  108. var system_value = $("#system").val();
  109. var module_value = $("#module").val();
  110. var component_value = $("#component").val();
  111. if (product_value != '*' || system_value != '*' || module_value != '*' || component_value != '*') {
  112. data += ' WHERE ';
  113. if (product_value != '*') {
  114. data += '`產品` = ' + product_value;
  115. if (system_value != '*' || module_value != '*' || component_value != '*') {
  116. data += ' AND ';
  117. }
  118. }
  119. if (system_value != '*') {
  120. data += '`系統` = ' + system_value;
  121. if (module_value != '*' || component_value != '*') {
  122. data += ' AND ';
  123. }
  124. }
  125. if (module_value != '*') {
  126. data += '`模組` = ' + module_value;
  127. if (component_value != '*') {
  128. data += ' AND ';
  129. }
  130. }
  131. if (component_value != '*') {
  132. data += '`零件` = ' + component_value;
  133. }
  134. }
  135. // if product_value
  136. $("#span_value").text(data)
  137. }
  138. // 資料庫中的所有 [產品]
  139. var product_item = ["*", "清洗貨櫃", "發酵貨櫃", "乾燥貨櫃"]
  140. var inner = '';
  141. for (let i = 0; i < product_item.length; i++) {
  142. inner += '<option value="' + product_item[i] + '">' + product_item[i] + '</option>';
  143. }
  144. var sectorSelect = document.getElementById("product");
  145. sectorSelect.innerHTML = inner;
  146. // 資料庫中的所有 [系統]
  147. var system_item = ["*", "清洗槽組立", "發酵桶組立", "乾燥桶組立"]
  148. var inner = '';
  149. for (let i = 0; i < system_item.length; i++) {
  150. inner += '<option value="' + system_item[i] + '">' + system_item[i] + '</option>';
  151. }
  152. var sectorSelect = document.getElementById("system");
  153. sectorSelect.innerHTML = inner;
  154. // 資料庫中的所有 [模組]
  155. var module_item = ["*", "上蓋組立", "內桶槽組立", "控制盒組立"]
  156. var inner = '';
  157. for (let i = 0; i < module_item.length; i++) {
  158. inner += '<option value="' + module_item[i] + '">' + module_item[i] + '</option>';
  159. }
  160. var sectorSelect = document.getElementById("module");
  161. sectorSelect.innerHTML = inner;
  162. // 資料庫中的所有 [零件]
  163. var component_item = ["*", "M10平墊圈", "M10螺帽", "內桶槽", "內桶槽固定環", "吸料機入料管",
  164. "入料斗擋板", "LED指示燈_綠色 TB12LED-G0201", "K3 LED指示燈-主板",
  165. "軸心(單邊出軸)", "墊片M18x25x1.5", "M3x5螺絲", "M3x5銅柱 1公1母"]
  166. var inner = '';
  167. for (let i = 0; i < component_item.length; i++) {
  168. inner += '<option value="' + component_item[i] + '">' + component_item[i] + '</option>';
  169. }
  170. var sectorSelect = document.getElementById("component");
  171. sectorSelect.innerHTML = inner;
  172. // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  173. // 系統的 index
  174. var sysIndex;
  175. // [系統]更新: Array / renew_system function
  176. system_object = new Array();
  177. system_object[0] = ["*"];
  178. system_object[1] = ["*", "清洗槽組立"];
  179. system_object[2] = ["*", "發酵桶組立"];
  180. system_object[3] = ["*", "乾燥桶組立"];
  181. function renew_system(index) {
  182. sysIndex = index
  183. var inner = '';
  184. for (let i = 0; i < system_object[index].length; i++) {
  185. inner += '<option value="' + system_object[index][i] + '">' + system_object[index][i] + '</option>';
  186. }
  187. var sectorSelect = document.getElementById("system");
  188. sectorSelect.innerHTML = inner;
  189. }
  190. // 模組的 index
  191. var moIndex;
  192. // [模組]更新: Array / renew_system function
  193. module_object = new Array();
  194. module_object[0] = ["*"];
  195. module_object[1] = ["*", "清洗槽組立"];
  196. module_object[2] = ["*", "發酵桶組立"];
  197. module_object[3] = ["*", "乾燥桶組立"];
  198. module_object[0][0] = ["*"];
  199. module_object[1][1] = ["*", "c1上蓋組立", "c2內桶槽組立"];
  200. module_object[2][1] = ["*", "f1上蓋組立", "f2控制盒組立"];
  201. module_object[3][1] = ["*", "d1上蓋組立", "d2控制盒組立"];
  202. function renew_module(index) {
  203. moIndex = index
  204. var inner = '';
  205. for (let i = 0; i < module_object[sysIndex][index].length; i++) {
  206. inner += '<option value="' + module_object[sysIndex][index][i] + '">' + module_object[sysIndex][index][i] + '</option>';
  207. }
  208. var sectorSelect = document.getElementById("module");
  209. sectorSelect.innerHTML = inner;
  210. }
  211. // 零件
  212. // // [零件]更新: Array / renew_system function
  213. component_object = new Array();
  214. component_object[0] = ["*"];
  215. component_object[1] = ["*", "清洗槽組立"];
  216. component_object[2] = ["*", "發酵桶組立"];
  217. component_object[3] = ["*", "乾燥桶組立"];
  218. component_object[0][0] = ["*"];
  219. component_object[1][1] = ["*", "c1上蓋組立", "c2內桶槽組立"];
  220. component_object[2][1] = ["*", "f1上蓋組立", "f2控制盒組立"];
  221. component_object[3][1] = ["*", "d1上蓋組立", "d2控制盒組立"];
  222. component_object[0][0][0] = ["*"];
  223. component_object[1][1][0] = ["*"];
  224. component_object[1][1][1] = ["*", "c1_M10平墊圈", "c1_M10螺帽"];
  225. component_object[1][1][2] = ["*", "c2_內桶槽", "c2_內桶槽固定環"];
  226. component_object[2][1][0] = ["*"];
  227. component_object[2][1][1] = ["*", "f1_吸料機入料管", "f1_入料斗擋板"];
  228. component_object[2][1][2] = ["*", "f2_LED指示燈 綠色 TB12LED-G0201", "f2_K3 LED指示燈-主板"];
  229. component_object[3][1][0] = ["*"];
  230. component_object[3][1][1] = ["*", "d1_軸心(單邊出軸)", "d1_墊片M18x25x1.5"];
  231. component_object[3][1][2] = ["*", "d2_M3x5螺絲", "d2_M3x5銅柱 1公1母"];
  232. function renew_component(index) {
  233. var Value = "";
  234. for (var i = 0; i < component_object[sysIndex][moIndex][index].length; i++) {
  235. Value = Value + '<option value="' + component_object[sysIndex][moIndex][index][i] + '">' + component_object[sysIndex][moIndex][index][i] + '</option>';
  236. }
  237. var sectorSelect = document.getElementById("component");
  238. sectorSelect.innerHTML = Value;
  239. }
  240. </script>
  241. <!-- // 資料庫中的所有 [產品]
  242. var product_item = ["*", "清洗貨櫃", "發酵貨櫃", "乾燥貨櫃"]
  243. var inner = '';
  244. for (let i = 0; i < product_item.length; i++) {
  245. inner += '<option value="' + product_item[i] + '">' + product_item[i] + '</option>';
  246. }
  247. var sectorSelect = document.getElementById("product");
  248. sectorSelect.innerHTML = inner; -->
  249. <table class="table table-bordered">
  250. <tr>
  251. {% for i1 in labels %}
  252. <th>{{i1}}</th>
  253. {% endfor %}
  254. </tr>
  255. {% for i in content %}
  256. <tr id="tr_content">
  257. <td>{{ i[0] }}</td>
  258. <td>{{ i[1] }}</td>
  259. <td>{{ i[2] }}</td>
  260. <td>{{ i[3] }}</td>
  261. <td>{{ i[4] }}</td>
  262. <td>{{ i[5] }}</td>
  263. <td>{{ i[6] }}</td>
  264. <td>{{ i[7] }}</td>
  265. <td>{{ i[8] }}</td>
  266. <td>{{ i[9] }}</td>
  267. <td>{{ i[10] }}</td>
  268. <td>{{ i[11] }}</td>
  269. <td>{{ i[12] }}</td>
  270. <td>{{ i[13] }}</td>
  271. <td>{{ i[14] }}</td>
  272. <td>{{ i[15] }}</td>
  273. </tr>
  274. {% endfor %}
  275. </table>
  276. </body>
  277. </html>