drop_down_list.html 12 KB

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