component-list.php 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. <?php
  2. include($_SERVER['DOCUMENT_ROOT'] . "/Authorization/script/php/permission/check_right.php");
  3. ?>
  4. <!doctype html>
  5. <html class="fixed sidebar-left-collapsed">
  6. <head>
  7. <?php include("bim-support-header.html"); ?>
  8. <script src="./script/js/global.js"></script>
  9. <script type="application/javascript">
  10. var rvtName = [];
  11. var categoryTable = [];
  12. var year = [];
  13. //當選擇大項時,需要展示所有'細項分類'內的元件
  14. var category = [];
  15. //現在的細項分類
  16. var type = "";
  17. //現在的大項分類
  18. var parent = "";
  19. var userName = "<?php echo $_SESSION['name'] ?>";
  20. var role = "<?php echo ($groupName); ?>";
  21. var right = <?php echo ($right); ?>;
  22. var url_href = window.location.href;
  23. var url = new URL(url_href);
  24. url.searchParams.get("type") == null ? type = "" : type = url.searchParams.get("type");
  25. parent = url.searchParams.get("parent");
  26. var $grid;
  27. pageHeader = "元件庫";
  28. </script>
  29. </head>
  30. <body>
  31. <canvas id="c"></canvas>
  32. <section class="body">
  33. <!-- start: header -->
  34. <header-menu></header-menu>
  35. <!-- end: header -->
  36. <div class="inner-wrapper">
  37. <!-- start: sidebar -->
  38. <side-bar></side-bar>
  39. <!-- end: sidebar -->
  40. <section role="main" class="content-body">
  41. <header class="page-header">
  42. <h2>{{pageHeader}}</h2>
  43. </header>
  44. <!-- start: page -->
  45. <section class="content-with-menu content-with-menu-has-toolbar media-gallery">
  46. <div class="content-with-menu-container">
  47. <inner-menu>
  48. <template v-slot:inner-equipment>
  49. <equipment-list></equipment-list>
  50. </template>
  51. </inner-menu>
  52. <div class="inner-body mg-main">
  53. <div class="inner-toolbar">
  54. <ul>
  55. <search-bar></search-bar>
  56. <filter-bar></filter-bar>
  57. </ul>
  58. </div>
  59. <filter-content></filter-content>
  60. <div class="row mg-files" data-sort-destination data-sort-id="media-gallery" id="content">
  61. </div>
  62. </div>
  63. </div>
  64. </section>
  65. <!-- end: page -->
  66. </section>
  67. </div>
  68. </section>
  69. <script>
  70. /*Vue */
  71. vm.mount('.body');
  72. addUserImage(userName.charAt(0), role);
  73. </script>
  74. <?php include("bim-support-body.html"); ?>
  75. <script type="application/javascript">
  76. $(function() {
  77. //撈現在類別內的元件
  78. $.ajax({
  79. url: "./script/php/equipment_group.php",
  80. type: "GET",
  81. data: {
  82. type: type,
  83. parent: parent
  84. },
  85. contentType: "application/json",
  86. dataType: "json"
  87. }).done(function(data) {
  88. year = data['year'];
  89. rvtName = data['rvtName'];
  90. category = data["category"];
  91. //一開始進入BIM元件庫顯示
  92. if (url.search == "") {
  93. $("#content").append("<h1 style='color: red;'>注意!BIM元件庫需配合BIM程式庫中的拖放元件API使用!</h1>");
  94. $("#content").append("<h3>請選擇左方類別以搜尋元件,搜尋到需要的元件請點擊加入清單按鈕</h3>");
  95. $("#content").append("<h3>到BIM程式庫下載拖放元件API,並參考操作方式以進行元件放置動作</h3>");
  96. $("#content").css("padding", "0");
  97. $("#content").css("text-align", "center");
  98. $("a").each(function() {
  99. if ($(this).context.name != "" && $(this).context.className == "menu-item" && $(this).context.name != parent) {
  100. //其他大項類別不要產生ul
  101. $(this).closest("ul").remove();
  102. }
  103. });
  104. } else {
  105. $.when(initThreeJS()).then(function() {
  106. $grid = $("#content").isotope({
  107. itemSelector: ".isotope-item",
  108. layoutMode: 'fitRows'
  109. });
  110. //若選到細項,該細項內沒有元件檔案
  111. if ($("#content").children().length == 0) {
  112. $("#content").append("<h3>此類別沒有元件檔案</h3>");
  113. $("#content").css("padding", "0");
  114. $("#content").css("text-align", "center");
  115. }
  116. }).then(function() {
  117. //元件有時候會不排版
  118. setTimeout(function() {
  119. $grid.isotope()
  120. }, 100);
  121. });
  122. }
  123. }).error(function(error) {
  124. console.log(error);
  125. });
  126. $.ajax({
  127. url: "./script/php/equipment_revitVersion.php",
  128. type: "GET",
  129. data: {
  130. type: type,
  131. parent: parent
  132. },
  133. contentType: "application/json",
  134. dataType: "json"
  135. }).done(function(data) {
  136. //篩選內元件版本
  137. for (var i = 0; i < data.length; i++) {
  138. $("#revitVersion").append('<label><input type="checkbox" value=".' + data[i] + '" /> ' + data[i] + '</label> ');
  139. }
  140. }).error(function(error) {
  141. console.log(error);
  142. });
  143. //被選到的類別highlight起來
  144. for (var i = 0; i < jsonData.length; i++) {
  145. for (var j = 0; j < jsonData[i].children.length; j++) {
  146. $("a").each(function() {
  147. if (jsonData[i].category_name == parent) {
  148. //選到的是細項類別
  149. if (jsonData[i].children[j].component_name == type) {
  150. var searchText = jsonData[i].children[j].component_name;
  151. var found;
  152. if ($(this).context.innerText == searchText && $(this).context.name == jsonData[i].category_name) {
  153. $(this).context.classList.add("highlight");
  154. $(this).context.parentNode.parentNode.parentNode.classList.add("nav-expanded");
  155. }
  156. //選到的是大項類別
  157. } else if (type == "") {
  158. var searchText = parent;
  159. var found;
  160. if ($(this).context.innerText == searchText && $(this).context.name == jsonData[i].category_name) {
  161. if (!$(this).context.classList.contains("highlight")) {
  162. $(this).context.classList.add("highlight");
  163. $(this).context.setAttribute("style", "background: #0088cc");
  164. } else {
  165. $(this).context.removeAttribute("href");
  166. }
  167. } else if ($(this).context.name != "" && $(this).context.className == "menu-item" && $(this).context.name != parent) {
  168. //其他大項類別不要產生ul
  169. $(this).closest("ul").remove();
  170. }
  171. }
  172. }
  173. });
  174. }
  175. }
  176. });
  177. </script>
  178. <script src="./script/js/data-sort.js"></script>
  179. <script src="script/js/3Dpic.js" type="module"></script>
  180. </body>
  181. </html>