index.php 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173
  1. <?php
  2. include($_SERVER['DOCUMENT_ROOT'] . "/Authorization/script/php/permission/check_right.php");
  3. ?>
  4. <!doctype html>
  5. <html class="fixed">
  6. <head>
  7. <!-- Basic -->
  8. <meta charset="UTF-8">
  9. <title>設計資料庫查詢系統</title>
  10. <meta name="keywords" content="HTML5 Admin Template" />
  11. <meta name="description" content="JSOFT Admin - Responsive HTML5 Template">
  12. <meta name="author" content="JSOFT.net">
  13. <script src="./assets/vendor/jquery/jquery.js"></script>
  14. <script src="/Common/script/js/user-image.js"></script>
  15. <script src="./assets/vendor/jquery-hoverIntent/jquery.hoverIntent.js"></script>
  16. <!-- Mobile Metas -->
  17. <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
  18. <!-- Web Fonts -->
  19. <link href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800|Shadows+Into+Light" rel="stylesheet" type="text/css">
  20. <!-- jstree CSS -->
  21. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.3.4/themes/default/style.min.css">
  22. <!-- Vendor CSS -->
  23. <link rel="stylesheet" href="assets/vendor/bootstrap/css/bootstrap.css" />
  24. <link rel="stylesheet" href="assets/vendor/font-awesome/css/font-awesome.css" />
  25. <link rel="stylesheet" href="assets/vendor/magnific-popup/magnific-popup.css" />
  26. <link rel="stylesheet" href="assets/vendor/bootstrap-datepicker/css/datepicker3.css" />
  27. <link rel="stylesheet" href="assets/vendor/pnotify/pnotify.custom.css" />
  28. <!-- Specific Page Vendor CSS -->
  29. <link rel="stylesheet" href="assets/vendor/jquery-ui/css/ui-lightness/jquery-ui-1.10.4.custom.css" />
  30. <link rel="stylesheet" href="assets/vendor/bootstrap-multiselect/bootstrap-multiselect.css" />
  31. <link rel="stylesheet" href="assets/vendor/morris/morris.css" />
  32. <link rel="stylesheet" href="assets/vendor/bootstrap-fileupload/bootstrap-fileupload.min.css" />
  33. <!-- Theme CSS -->
  34. <link rel="stylesheet" href="assets/stylesheets/theme.css" />
  35. <!-- Skin CSS -->
  36. <link rel="stylesheet" href="assets/stylesheets/skins/default.css" />
  37. <!-- Theme Custom CSS -->
  38. <link rel="stylesheet" href="assets/stylesheets/theme-custom.css">
  39. <!-- Head Libs -->
  40. <script src="assets/vendor/modernizr/modernizr.js"></script>
  41. <!-- chart.js -->
  42. <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
  43. <!-- DataTable -->
  44. <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.25/css/jquery.dataTables.css">
  45. <script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.25/js/jquery.dataTables.js"></script>
  46. <!-- Icon -->
  47. <link rel="shortcut icon" href="assets/images/favicon.ico" />
  48. <link href="https://js.arcgis.com/4.21/esri/themes/light/main.css" rel="stylesheet">
  49. <link href="./CustomCSS/main.css" rel="stylesheet">
  50. <script src="./script/js/bootstrap.js"></script>
  51. <script src="./script/js/pdfobject.min.js"></script>
  52. <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.3.4/jstree.min.js"></script>
  53. <script src="./script/js/jstreeAJAX.js"></script>
  54. <script src="https://js.arcgis.com/4.21/"></script>
  55. <style>
  56. html.no-overflowscrolling .nano>.nano-content {
  57. overflow: auto;
  58. }
  59. .page-header>ul {
  60. list-style: none;
  61. padding: 0;
  62. margin: 0;
  63. }
  64. .page-header>ul>li {
  65. display: inline-block;
  66. font-size: 25px;
  67. color: #FFFFFF;
  68. }
  69. .page-header>ul>li.right {
  70. float: right;
  71. padding-right: 10px;
  72. }
  73. .input-search {
  74. margin-top: 8px;
  75. }
  76. .page-header li>label {
  77. margin-top: 13px;
  78. border-bottom: 4px solid #0088cc;
  79. height: 41px;
  80. }
  81. .sidebar-left {
  82. box-shadow: 0 0 0;
  83. }
  84. .jstree-default .jstree-icon {
  85. color: #ffe693;
  86. }
  87. .jqsfield {
  88. color: white;
  89. font: 10px arial, san serif;
  90. text-align: left;
  91. }
  92. .jstree-anchor {
  93. width: 250px;
  94. text-overflow: ellipsis;
  95. overflow: hidden;
  96. white-space: nowrap;
  97. }
  98. .jstree-anchor,
  99. .jstree-anchor:link,
  100. .jstree-anchor:visited,
  101. .jstree-anchor:hover,
  102. .jstree-anchor:active {
  103. color: #fff;
  104. }
  105. td,
  106. th {
  107. text-align: center;
  108. }
  109. th {
  110. width: 30%;
  111. }
  112. .nav-main {
  113. padding: 15px;
  114. }
  115. .node-hidden {
  116. display: none;
  117. }
  118. html.fixed .page-header {
  119. left: 349px;
  120. }
  121. html.fixed .content-body {
  122. margin-left: 350px;
  123. }
  124. .sidebar-left {
  125. width: 350px;
  126. }
  127. #datatable-ajax tr:hover {
  128. background-color: #e8e8e8;
  129. }
  130. #viewDiv {
  131. height: 100%;
  132. width: 100%;
  133. }
  134. #zoom {
  135. margin-bottom: 5px;
  136. }
  137. #actions {
  138. padding: 5px;
  139. }
  140. .container {
  141. height: 50%;
  142. width: 100%;
  143. }
  144. #createSlideDiv {
  145. background-color: white;
  146. opacity: 0.9;
  147. color: black;
  148. padding: 6px;
  149. }
  150. #slidesDiv {
  151. background-color: white;
  152. opacity: 0.9;
  153. color: black;
  154. padding: 10px;
  155. visibility: hidden;
  156. bottom: 20px;
  157. overflow-y: auto;
  158. text-align: center;
  159. height: 260px;
  160. }
  161. #slidesDiv .slide {
  162. /* Show cursor as pointer when on a slide */
  163. cursor: pointer;
  164. margin-bottom: 6px;
  165. }
  166. #slidesDiv .slide .title {
  167. /* Center the title text */
  168. text-align: center;
  169. }
  170. /* Draw active slide with a nice border around the thumbnail */
  171. #slidesDiv .slide.active img {
  172. box-shadow: 0px 0px 12px black;
  173. border-style: solid;
  174. border-width: thin;
  175. border-color: black;
  176. }
  177. .pdfobject-container {
  178. height: 730px;
  179. }
  180. #topbar {
  181. background: #fff;
  182. padding: 10px;
  183. }
  184. #datatable-ajax_length {
  185. width: 100%;
  186. }
  187. .multiselect {
  188. width: 200px;
  189. }
  190. .selectBox {
  191. position: relative;
  192. width: 200px;
  193. }
  194. .selectBox select {
  195. width: 100%;
  196. font-weight: bold;
  197. }
  198. .overSelect {
  199. position: absolute;
  200. left: 0;
  201. right: 0;
  202. top: 0;
  203. bottom: 0;
  204. }
  205. .checkboxes {
  206. display: none;
  207. border: 1px #dadada solid;
  208. background-color: white;
  209. z-index: 2;
  210. position: absolute;
  211. width: 200px;
  212. display: none;
  213. }
  214. .checkboxes label {
  215. display: block;
  216. padding-left: 10px;
  217. padding-right: 10px;
  218. padding-top: 5px;
  219. padding-bottom: 5px;
  220. }
  221. .checkboxes label:hover {
  222. background-color: #1e90ff;
  223. color: #ffffff;
  224. }
  225. .multiselect {
  226. display: inline-block;
  227. }
  228. #filter-slide {
  229. width: 100%;
  230. }
  231. </style>
  232. <script>
  233. $(document).ready(function() {
  234. getToken();
  235. });
  236. var token;
  237. function getToken() {
  238. var t;
  239. $.ajax({
  240. url: "./scripts/PHP/access_token.php",
  241. type: "GET",
  242. async: false,
  243. }).done(function(data) {
  244. token = data;
  245. //data = JSON.parse(data);
  246. }).error(function(e) {
  247. console.log(e);
  248. });
  249. }
  250. require([
  251. "esri/config",
  252. "esri/Map",
  253. "esri/WebScene",
  254. "esri/views/SceneView",
  255. "esri/core/urlUtils",
  256. "esri/identity/OAuthInfo",
  257. "esri/identity/IdentityManager",
  258. "esri/widgets/Legend",
  259. "esri/widgets/Home",
  260. "esri/widgets/Fullscreen",
  261. "esri/widgets/Slider",
  262. "esri/widgets/BasemapGallery",
  263. "esri/widgets/LayerList",
  264. "esri/layers/GroupLayer",
  265. "esri/layers/FeatureLayer",
  266. "esri/widgets/FeatureTable",
  267. "esri/tasks/support/Query",
  268. "esri/layers/SceneLayer",
  269. "esri/widgets/Zoom",
  270. "esri/widgets/Compass",
  271. "esri/widgets/NavigationToggle",
  272. "esri/widgets/Slice",
  273. "esri/widgets/Search",
  274. "esri/geometry/Point",
  275. "esri/geometry/Polyline",
  276. "esri/webscene/Slide",
  277. "esri/symbols/WebStyleSymbol",
  278. "esri/widgets/DirectLineMeasurement3D",
  279. "esri/widgets/AreaMeasurement3D",
  280. "esri/Graphic",
  281. "esri/widgets/Search/LocatorSearchSource",
  282. "esri/renderers/UniqueValueRenderer",
  283. "esri/geometry/geometryEngine",
  284. "esri/widgets/Expand",
  285. "esri/layers/GeoJSONLayer",
  286. "esri/PopupTemplate",
  287. "esri/renderers/Renderer",
  288. "esri/geometry/projection",
  289. "esri/layers/WMTSLayer"
  290. ], (esriConfig, Map, WebScene, SceneView, urlUtils, OAuthInfo, esriId,
  291. Legend,
  292. Home,
  293. Fullscreen,
  294. Slider,
  295. BasemapGallery,
  296. LayerList,
  297. GroupLayer,
  298. FeatureLayer,
  299. FeatureTable,
  300. Query,
  301. SceneLayer,
  302. Zoom,
  303. Compass,
  304. NavigationToggle,
  305. Slice,
  306. Search,
  307. Point,
  308. Polyline,
  309. Slide,
  310. WebStyleSymbol,
  311. DirectLineMeasurement3D,
  312. AreaMeasurement3D,
  313. Graphic,
  314. LocatorSearchSource,
  315. UniqueValueRenderer,
  316. geometryEngine,
  317. Expand, GeoJsonLayer, PopupTemplate, Renderer, projection, WMTSLayer) => {
  318. esriConfig.apiKey = token;
  319. let activeWidget = null;
  320. const webscene = new WebScene({
  321. portalItem: {
  322. id: "6b4e83dd94c4410db4bece82262b2573"
  323. },
  324. opacity: .75,
  325. showAttribution: false,
  326. });
  327. var featureLayer = new FeatureLayer({
  328. url: "https://services3.arcgis.com/W6g8dmWX0ILAHcNd/arcgis/rest/services/%E5%B7%A5%E7%A8%8B%E8%A8%AD%E8%A8%88%E8%B3%87%E6%96%99%E5%BA%AB/FeatureServer",
  329. outFields: ["*"],
  330. //renderer: poleRenderer,
  331. title: "工程設計資料庫",
  332. elevationInfo: "on-the-ground",
  333. visible: true
  334. });
  335. featureLayer.listMode = "hide";
  336. webscene.add(featureLayer);
  337. const wmts1 = new WMTSLayer({
  338. url: "https://wmts.nlsc.gov.tw/wmts",
  339. activeLayer: {
  340. id: "EMAP96"
  341. },
  342. visible: false
  343. });
  344. const wmts2 = new WMTSLayer({
  345. url: "https://wmts.nlsc.gov.tw/wmts",
  346. activeLayer: {
  347. id: "PHOTO2"
  348. },
  349. visible: false
  350. });
  351. const wmts3 = new WMTSLayer({
  352. url: "https://wmts.nlsc.gov.tw/wmts",
  353. activeLayer: {
  354. id: "EMAP2"
  355. },
  356. visible: true
  357. });
  358. const mapGroupLayer = new GroupLayer({
  359. title: "電子地圖",
  360. visible: true,
  361. visibilityMode: "exclusive",
  362. layers: [wmts1, wmts2, wmts3],
  363. opacity: 0.75
  364. });
  365. webscene.add(mapGroupLayer);
  366. const view = new SceneView({
  367. container: "viewDiv",
  368. map: webscene,
  369. popup: {
  370. defaultPopupTemplateEnabled: true,
  371. dockEnabled: true,
  372. dockOptions: {
  373. breakpoint: false,
  374. buttonEnabled: false,
  375. position: "bottom-right",
  376. }
  377. }
  378. });
  379. window.view = view;
  380. view.ui.empty("top-left");
  381. //view.ui.empty("manual");
  382. // view.ui.add(
  383. // new Expand({
  384. // view: view,
  385. // content: new BasemapGallery({
  386. // view: view
  387. // }),
  388. // autoCollapse: true,
  389. // group: "top-left"
  390. // }),
  391. // "top-left"
  392. // );
  393. var layerList = new LayerList({
  394. view: view,
  395. listItemCreatedFunction: defineActions
  396. });
  397. view.ui.add(
  398. new Expand({
  399. view: view,
  400. content: layerList,
  401. autoCollapse: true,
  402. group: "top-left",
  403. expandIconClass: "esri-icon-basemap",
  404. expandTooltip: "選擇底圖"
  405. }),
  406. "top-left"
  407. );
  408. view.ui.add(
  409. new Expand({
  410. view: view,
  411. content: new Legend({
  412. view: view
  413. }),
  414. autoCollapse: true,
  415. group: "top-left"
  416. }),
  417. "top-left"
  418. );
  419. view.ui.add(
  420. new Home({
  421. view: view,
  422. group: "top-left"
  423. }),
  424. "top-left"
  425. );
  426. //新增量測工具
  427. view.ui.add("topbar", "bottom-right");
  428. document
  429. .getElementById("distanceButton")
  430. .addEventListener("click", (event) => {
  431. setActiveWidget(null);
  432. if (!event.target.classList.contains("active")) {
  433. setActiveWidget("distance");
  434. } else {
  435. setActiveButton(null);
  436. }
  437. });
  438. document
  439. .getElementById("areaButton")
  440. .addEventListener("click", (event) => {
  441. setActiveWidget(null);
  442. if (!event.target.classList.contains("active")) {
  443. setActiveWidget("area");
  444. } else {
  445. setActiveButton(null);
  446. }
  447. });
  448. document
  449. .getElementById("clear")
  450. .addEventListener("click", (event) => {
  451. setActiveWidget(null);
  452. setActiveButton(null);
  453. });
  454. function setActiveWidget(type) {
  455. switch (type) {
  456. case "distance":
  457. activeWidget = new DirectLineMeasurement3D({
  458. view: view
  459. });
  460. // skip the initial 'new measurement' button
  461. activeWidget.viewModel.start().catch((error) => {
  462. if (promiseUtils.isAbortError(error)) {
  463. return; // don't display abort errors
  464. }
  465. throw error; // throw other errors since they are of interest
  466. });
  467. view.ui.add(activeWidget, "bottom-left");
  468. setActiveButton(document.getElementById("distanceButton"));
  469. break;
  470. case "area":
  471. activeWidget = new AreaMeasurement3D({
  472. view: view
  473. });
  474. // skip the initial 'new measurement' button
  475. activeWidget.viewModel.start().catch((error) => {
  476. if (promiseUtils.isAbortError(error)) {
  477. return; // don't display abort errors
  478. }
  479. throw error; // throw other errors since they are of interest
  480. });
  481. view.ui.add(activeWidget, "bottom-left");
  482. setActiveButton(document.getElementById("areaButton"));
  483. break;
  484. case null:
  485. if (activeWidget) {
  486. view.ui.remove(activeWidget);
  487. activeWidget.destroy();
  488. activeWidget = null;
  489. }
  490. break;
  491. }
  492. }
  493. function defineActions(event) {
  494. // The event object contains an item property.
  495. // is is a ListItem referencing the associated layer
  496. // and other properties. You can control the visibility of the
  497. // item, its title, and actions using this object.
  498. const item = event.item;
  499. // Adds a slider for updating a group layer's opacity
  500. if (item.title === "電子地圖") {
  501. const slider = new Slider({
  502. min: 0,
  503. max: 1,
  504. precision: 2,
  505. values: [1],
  506. visibleElements: {
  507. labels: true,
  508. rangeLabels: true
  509. }
  510. });
  511. item.panel = {
  512. content: slider,
  513. className: "esri-icon-sliders-horizontal",
  514. title: "修改地圖透明度"
  515. }
  516. slider.on("thumb-drag", (event) => {
  517. const {
  518. value
  519. } = event;
  520. item.layer.opacity = value;
  521. })
  522. }
  523. }
  524. function setActiveButton(selectedButton) {
  525. // focus the view to activate keyboard shortcuts for sketching
  526. view.focus();
  527. const elements = document.getElementById("topbar").getElementsByClassName("active");
  528. for (let i = 0; i < elements.length; i++) {
  529. elements[i].classList.remove("active");
  530. }
  531. if (selectedButton) {
  532. selectedButton.classList.add("active");
  533. }
  534. }
  535. view.ui.add(
  536. new Fullscreen({
  537. view: view,
  538. group: "top-left"
  539. }),
  540. "top-right"
  541. );
  542. view.ui.add(
  543. new Zoom({
  544. view: view
  545. }),
  546. "top-right"
  547. );
  548. view.ui.add(
  549. new NavigationToggle({
  550. view: view
  551. }),
  552. "top-right"
  553. );
  554. view.ui.add(
  555. new Compass({
  556. view: view
  557. }),
  558. "top-right"
  559. );
  560. $("#measureExpendDiv .esri-widget--button").click(function() {
  561. if (pMeasureExpand.expanded) {
  562. activeMeasureWidget.viewModel.newMeasurement();
  563. } else {
  564. activeMeasureWidget.viewModel.clearMeasurement();
  565. }
  566. });
  567. function zoomToLayer(layer) {
  568. return layer.queryExtent().then((response) => {
  569. console.log(response.extent.height);
  570. console.log(response.extent.width);
  571. var zoom = (response.extent.height > response.extent.width ? response.extent.height : response.extent.width) / 474;
  572. console.log(view.zoom);
  573. view.goTo({
  574. target: response.extent,
  575. tilt: 0,
  576. heading: 0,
  577. //zoom: zoom
  578. }/*, {
  579. speedFactor: 6,
  580. easing: "linear"
  581. }*/).catch((error) => {
  582. console.log("error");
  583. console.error(error);
  584. }).then(() => {
  585. console.log(view.zoom);
  586. view.goTo({
  587. center: view.center,
  588. zoom: view.zoom - 1
  589. }, {
  590. speedFactor: 30,
  591. easing: "linear"
  592. });
  593. });
  594. });
  595. }
  596. $('#treeAjaxHTML').on("select_node.jstree", function(e, data) {
  597. if (data.node.text.includes("-")) {
  598. project_id = data.node.text.split("-")[0];
  599. featureLayer.definitionExpression = "計畫編號 = '" + project_id + "'";
  600. console.log(featureLayer)
  601. zoomToLayer(featureLayer);
  602. }
  603. /*else{
  604. type = data.node.text;
  605. console.log(type);
  606. featureLayer.definitionExpression = "工程類別 = '"+ type + "'";
  607. zoomToLayer(featureLayer);
  608. }*/
  609. });
  610. view.when(function() {
  611. layerList.on("trigger-action", (event) => {
  612. // Capture the action id.
  613. const id = event.action.id;
  614. if (id === "increase-opacity") {
  615. // if the increase-opacity action is triggered, then
  616. // increase the opacity of the GroupLayer by 0.25
  617. if (mapGroupLayer.opacity < 1) {
  618. mapGroupLayer.opacity += 0.25;
  619. }
  620. } else if (id === "decrease-opacity") {
  621. // if the decrease-opacity action is triggered, then
  622. // decrease the opacity of the GroupLayer by 0.25
  623. if (mapGroupLayer.opacity > 0) {
  624. mapGroupLayer.opacity -= 0.25;
  625. }
  626. }
  627. });
  628. });
  629. });
  630. var db_table = {};
  631. $.ajax({
  632. url: "./script/php/get_db_table.php",
  633. type: "GET",
  634. async: false,
  635. contentType: "application/json",
  636. dataType: "json"
  637. }).done(function(data) {
  638. db_table = data;
  639. }).error(function(error) {
  640. console.log(error);
  641. });
  642. db_table["notes"] = merge_object_by_key(db_table["notes"], "project_id", "notes");
  643. var notes_button_list = [...new Set([].concat(...Object.values(db_table["notes"])))];
  644. var search_data = {
  645. "category": get_value_list_by_key(db_table["category"], null, -1, "category_id").toString().split(","),
  646. "project": get_value_list_by_key(db_table["project"], null, -1, "project_id"),
  647. "type": get_value_list_by_key(db_table["type"], null, -1, "type_id").toString().split(","),
  648. "notes": notes_button_list
  649. };
  650. var filter_base_data = search_data;
  651. function get_value_list_by_key(obj_list, key_search, target_value, key_save) {
  652. output_list = [];
  653. obj_list.forEach(element => {
  654. if (target_value != -1) {
  655. target_value.forEach(e => {
  656. if (e.toString() == element[key_search].toString()) {
  657. output_list.push(element[key_save]);
  658. }
  659. });
  660. } else {
  661. output_list.push(element[key_save]);
  662. }
  663. });
  664. output_list = [...new Set(output_list)];
  665. return output_list;
  666. }
  667. function merge_object_by_key(obj, key, value) {
  668. output_object = {};
  669. while (obj.length > 0) {
  670. pop_out = obj.pop();
  671. if (output_object[pop_out[key]] == undefined) {
  672. output_object[pop_out[key]] = [pop_out[value]];
  673. } else {
  674. output_object[pop_out[key]].push(pop_out[value]);
  675. }
  676. }
  677. return output_object
  678. }
  679. </script>
  680. </head>
  681. <body>
  682. <script type="application/javascript">
  683. var test;
  684. var i = 0;
  685. var download;
  686. var fileName;
  687. var folder;
  688. var software;
  689. var userName = 'maabim';
  690. jQuery(window).load(function() {
  691. var url_href = window.location.href;
  692. var url = new URL(url_href);
  693. var type = url.searchParams.get("type");
  694. var projectId = url.searchParams.get("projectId");
  695. if (projectId != null) {
  696. var projectNode = $(".jstree-anchor").filter(function() {
  697. return $(this).text().includes(projectId);
  698. });
  699. let nodeId = projectNode[0].attributes.id.value;
  700. $('#treeAjaxHTML').jstree("select_node", nodeId);
  701. $("#treeAjaxHTML").jstree("close_all");
  702. }
  703. });
  704. //var typeId = node[0].attributes.id.value;
  705. </script>
  706. <section class="body">
  707. <!-- start: header -->
  708. <header class="header">
  709. <div class="logo-container">
  710. <div class="banner-txt">設計資料庫查詢系統</div>
  711. <div class="visible-xs toggle-sidebar-left" data-toggle-class="sidebar-left-opened" data-target="html" data-fire-event="sidebar-left-opened">
  712. <i class="fa fa-bars" aria-label="Toggle sidebar"></i>
  713. </div>
  714. </div>
  715. <!-- start: search & user box -->
  716. <div class="header-right">
  717. <span class="separator"></span>
  718. <ul class="notifications">
  719. <li>
  720. <a id="upload-btn" href="./Upload.php" class="notification-icon" data-toggle="tooltip" title="匯入工具" data-placement="bottom">
  721. <i class="fa fa-upload"></i>
  722. </a>
  723. <a href="/Front-Page/home.php" class="notification-icon" data-toggle="tooltip" title="綜合登入入口" data-placement="bottom">
  724. <i class="fa fa-home"></i>
  725. </a>
  726. </li>
  727. </ul>
  728. <span class="separator"></span>
  729. <div id="userbox" class="userbox">
  730. <a href="#" data-toggle="dropdown">
  731. <figure class="profile-picture"> <img src="assets/images/!logged-user.jpg" alt="Joseph Doe" class="img-circle" data-lock-picture="assets/images/!logged-user.jpg" /> </figure>
  732. <div class="profile-info" data-lock-name="John Doe" data-lock-email="johndoe@JSOFT.com"> <span class="name"><?php echo $_SESSION['name'] ?></span> <span class="role"><?php echo ($groupName); ?></span> </div> <i class="fa custom-caret"></i>
  733. </a>
  734. <div class="dropdown-menu">
  735. <ul class="list-unstyled">
  736. <li class="divider"></li>
  737. <li> <a role="menuitem" tabindex="-1" href="./script/php/Logout.php"><i class="fa fa-power-off"></i> Logout</a> </li>
  738. </ul>
  739. </div>
  740. </div>
  741. </div>
  742. <!-- end: search & user box -->
  743. </header>
  744. <!-- end: header -->
  745. <div class="inner-wrapper">
  746. <!-- start: sidebar -->
  747. <aside id="sidebar-left" class="sidebar-left">
  748. <div class="nano">
  749. <div class="nano-content">
  750. <nav id="menu" class="nav-main" role="navigation">
  751. <div class="widget-header clearfix">
  752. <h6 class="title pull-left mt-xs">資料庫文件</h6>
  753. </div>
  754. <div class="widget-content">
  755. <div class="jstree jstree-1 jstree-default" id="treeAjaxHTML"></div>
  756. </div>
  757. </nav>
  758. </div>
  759. </div>
  760. </aside>
  761. <!-- end: sidebar -->
  762. <section role="main" class="content-body">
  763. <header class="page-header">
  764. <ul>
  765. <li>
  766. <label id="header"></label>
  767. </li>
  768. <li class="right">
  769. <a class="mb-xs mt-xs mr-xs modal-with-move-anim btn btn-default" href="#advancedSearch"><i class="fa fa-search"></i> 進階搜尋</a>
  770. </li>
  771. </ul>
  772. </header>
  773. <div class="row">
  774. <div id="advancedSearch" class="zoom-anim-dialog modal-block modal-block-primary mfp-hide">
  775. <section class="panel">
  776. <header class="panel-heading">
  777. <h2 class="panel-title">進階搜尋</h2>
  778. </header>
  779. <div class="panel-body">
  780. <form class="form-horizontal form-bordered" method="get">
  781. <div class="form-group" id="category">
  782. <label class="col-md-3 control-label">工程類別:</label>
  783. <div class="multiselect col-md-6">
  784. <div class="selectBox">
  785. <select>
  786. <option>選擇工程</option>
  787. </select>
  788. <div class="overSelect"></div>
  789. </div>
  790. <div class="checkboxes form-inline" style="display: none; overflow-y:scroll; height:300px">
  791. <label for="category-any"><input type="checkbox" id="category-any" value="any" checked /> 全選</label>
  792. <!-- append option -->
  793. </div>
  794. </div>
  795. </div>
  796. <div class="form-group" id="project">
  797. <label class="col-md-3 control-label">專案類別:</label>
  798. <div class="multiselect col-md-6">
  799. <div class="selectBox">
  800. <select>
  801. <option>選擇專案</option>
  802. </select>
  803. <div class="overSelect"></div>
  804. </div>
  805. <div class="checkboxes form-inline" style="display: none; overflow-y:scroll; height:300px">
  806. <label for="project-any"><input type="checkbox" id="project-any" value="any" checked /> 全選</label>
  807. <!-- append option -->
  808. </div>
  809. </div>
  810. </div>
  811. <div class="form-group" id="type">
  812. <label class="col-md-3 control-label">文件類別:</label>
  813. <div class="multiselect col-md-6">
  814. <div class="selectBox">
  815. <select>
  816. <option>選擇文件</option>
  817. </select>
  818. <div class="overSelect"></div>
  819. </div>
  820. <div class="checkboxes form-inline" style="display: none; overflow-y:scroll; height:300px">
  821. <label for="type-any"><input type="checkbox" id="type-any" value="any" checked /> 全選</label>
  822. <!-- append option -->
  823. </div>
  824. </div>
  825. </div>
  826. <div class="form-group" id="notes" style="display: bllock;" hidden>
  827. <label class="col-md-3 control-label">設計圖類別:</label>
  828. <div class="multiselect col-md-6">
  829. <div class="selectBox">
  830. <select>
  831. <option>選擇設計圖</option>
  832. </select>
  833. <div class="overSelect"></div>
  834. </div>
  835. <div class="checkboxes form-inline" style="display: none; overflow-y:scroll; height:300px">
  836. <label for="notes-any"><input type="checkbox" id="notes-any" value="any" checked /> 全選</label>
  837. <!-- append option -->
  838. </div>
  839. </div>
  840. </div>
  841. <div class="form-group">
  842. <label class="col-md-3 control-label" for="search-word">文字搜尋:</label>
  843. <div class="col-md-6">
  844. <input type="text" class="form-control" placeholder="輸入關鍵字" id="search-word">
  845. </div>
  846. </div>
  847. </form>
  848. </div>
  849. <footer class="panel-footer">
  850. <div class="row">
  851. <div class="col-md-12 text-right">
  852. <div id="treeAjaxJSON" class="jstree jstree-4 jstree-default" role="tree" style="display: none;">
  853. <ul class="jstree-container-ul jstree-children">
  854. <li class="jstree-initial-node jstree-loading jstree-leaf jstree-last">
  855. <i class="jstree-icon jstree-ocl"></i>
  856. <a class="jstree-anchor" href="#"><i class="jstree-icon jstree-themeicon-hidden"></i>Loading ...</a>
  857. </li>
  858. </ul>
  859. </div>
  860. <div class="progress progress-striped light active m-md" style="display: none;">
  861. <div class="progress-bar progress-bar-primary" id="progress-bars" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"></div>
  862. </div>
  863. <div class="jstree jstree-4 jstree-default" id="loading" style="display: none;">
  864. <ul class="jstree-container-ul">
  865. <li class="jstree-loading">
  866. <i class="jstree-icon jstree-ocl"></i>讀取中 ...
  867. </li>
  868. </ul>
  869. </div>
  870. <div id="advanced-search-button-group" style="display: block;">
  871. <p id="warning-text" style="display: none; color: red;">警告! 篩選結果多於 1000 筆 </p>
  872. <button class="btn btn-warning" id="keep-search-button" style="display: none;">仍要搜尋</button>
  873. <button class="btn btn-primary" id="advanced-search-button" style="display: inline-block;">搜尋</button>
  874. <button class="btn btn-default modal-dismiss">取消</button>
  875. </div>
  876. </div>
  877. </div>
  878. </footer>
  879. </section>
  880. </div>
  881. <div class="col-md-6">
  882. <section class="panel" id="search-filter-panel" style="display: none;">
  883. <div class="panel-body">
  884. <form class="form-horizontal form-bordered" id="search-filter" method="get" hidden>
  885. <div class="form-group">
  886. <label class="col-md-3 control-label">工程類別:</label>
  887. <div class="col-md-7" id="f-category">
  888. <!-- append option -->
  889. </div>
  890. </div>
  891. <div class="form-group">
  892. <label class="col-md-3 control-label">專案類別:</label>
  893. <div class="col-md-7" id="f-project">
  894. <!-- append option -->
  895. </div>
  896. </div>
  897. <div class="form-group">
  898. <label class="col-md-3 control-label">文件類別:</label>
  899. <div class="col-md-7" id="f-type">
  900. <!-- append option -->
  901. </div>
  902. </div>
  903. <div class="form-group" id="filter_notes" style="display: none;">
  904. <label class="col-md-3 control-label">設計圖類別:</label>
  905. <div class="col-md-7" id="f-notes">
  906. <!-- append option -->
  907. </div>
  908. </div>
  909. </form>
  910. <i class="text-center fa fa-sort-desc" id="filter-slide"></i>
  911. </div>
  912. </section>
  913. <section class="panel">
  914. <div class="panel-body">
  915. <button id="reset" type="button" class="mb-xs mr-xs btn btn-default" style="float: right;"><i class="fa fa-reply"></i> 上一層</button>
  916. <table style="width:99%;" class="table table-bordered table-striped" id="datatable-ajax">
  917. <thead>
  918. <tr>
  919. <th id="SN">項次</th>
  920. <th id="name">類別</th>
  921. <th>關鍵字</th>
  922. <th>版次</th>
  923. <th>檔案數</th>
  924. </tr>
  925. </thead>
  926. <tbody>
  927. </tbody>
  928. </table>
  929. </div>
  930. </section>
  931. <section class="panel">
  932. <div id="panel" class="panel-body" style="height: 210px;">
  933. <div class="table-responsive" style="display:none;">
  934. <table class="table table-bordered mb-none" id="tableDetail">
  935. <tbody>
  936. <tr>
  937. <th>計畫編號</th>
  938. <td id="plan_code"></td>
  939. </tr>
  940. <tr>
  941. <th>計畫名稱</th>
  942. <td id="plan_name"></td>
  943. </tr>
  944. <tr>
  945. <th>圖名</th>
  946. <td id="fileName"></td>
  947. </tr>
  948. <tr>
  949. <th>版次</th>
  950. <td id="version"></td>
  951. </tr>
  952. <tr>
  953. <th>文件</th>
  954. <td id="download"></td>
  955. </tr>
  956. </tbody>
  957. </table>
  958. </div>
  959. </div>
  960. </section>
  961. </div>
  962. <div class="col-md-6">
  963. <div class="tabs">
  964. <ul class="nav nav-tabs nav-justified">
  965. <li class="active">
  966. <a href="#arcgisTab" data-toggle="tab" class="text-center"><i class="fa fa-map-marker"></i> ArcGIS</a>
  967. </li>
  968. <li>
  969. <a href="#pdfTab" data-toggle="tab" class="text-center"><i class="fa fa-file"></i> Pdf 預覽</a>
  970. </li>
  971. </ul>
  972. <div class="tab-content">
  973. <div id="arcgisTab" class="tab-pane active">
  974. <div id="arcgis" class="panel-body" style="height: 730px;">
  975. <div class="mapok" style="height:100%">
  976. <div id="topbar" class="esri-component esri-widget">
  977. <button id="distanceButton" class="action-button esri-icon-measure-line" type="button" title="Measure distance between two points"></button>
  978. <button id="areaButton" class="action-button esri-icon-measure-area" type="button" title="Measure area"></button>
  979. <button id="clear" class="action-button esri-icon-trash" title="Clear Measurements"></button>
  980. </div>
  981. <div id="viewDiv"></div>
  982. <div id="measureExpendDiv"></div>
  983. <div id="measureExpendDiv2"></div>
  984. <div id="slidesDiv" class="esri-widget"></div>
  985. <span style="display:none;" id="project-id"></span>
  986. </div>
  987. </div>
  988. </div>
  989. <div id="pdfTab" class="tab-pane">
  990. <div id="pdfFile"></div>
  991. </div>
  992. </div>
  993. </div>
  994. </div>
  995. </div>
  996. </section>
  997. </div>
  998. </section>
  999. </div>
  1000. <script>
  1001. var userName = "<?php echo $_SESSION['name'] ?>";
  1002. var role = "<?php echo ($groupName); ?>";
  1003. var right = <?php echo $right; ?>;
  1004. db_table["category"].forEach(element => {
  1005. option_id = "c" + element["category_id"] + "-l" + element["list_id"];
  1006. $("#category .checkboxes").append("<label class='category-button' for=" + option_id + "><input type='checkbox' class='category-option' value=" + element["category_name"] + " id=" + option_id + " />" + element["category_name"] + "</label>");
  1007. filter_option_id = "f-c" + element["category_id"]
  1008. list_id = element["list_id"];
  1009. $("#f-category").append("<button type='button' class='mb-xs mt-xs mr-xs btn btn-primary' id=" + filter_option_id + " list_id=" + list_id + " style='display:none;'>" + element["category_name"] + "</button>");
  1010. });
  1011. db_table["project"].forEach(element => {
  1012. option_id = "p" + element["project_id"];
  1013. $("#project .checkboxes").append("<label class='project-button' for=" + option_id + "><input type='checkbox' class='project-option' value=" + element["project_id"] + " id=" + option_id + " />[" + element["project_id"] + "] " + element["project_name"] + "</label>");
  1014. filter_option_id = "f-" + option_id;
  1015. $("#f-project").append("<button type='button' class='mb-xs mt-xs mr-xs btn btn-primary' id=" + filter_option_id + " style='display:none;'>" + element["project_name"] + "</button>");
  1016. });
  1017. db_table["type"].forEach(element => {
  1018. option_id = "t" + element["type_id"];
  1019. $("#type .checkboxes").append("<label class='type-button' for=" + option_id + "><input type='checkbox' class='type-option' value=" + element["type_name"] + " id=" + option_id + " />" + element["type_name"] + "</label>");
  1020. filter_option_id = "f-" + option_id;
  1021. $("#f-type").append("<button type='button' class='mb-xs mt-xs mr-xs btn btn-primary' id=" + filter_option_id + " style='display:none;'>" + element["type_name"] + "</button>");
  1022. });
  1023. for (i = 0; i < notes_button_list.length; i++) {
  1024. option_id = "n" + i;
  1025. $("#notes .checkboxes").append("<label class='notes-button' for=" + option_id + "><input type='checkbox' class='notes-option' value=" + notes_button_list[i] + " id=" + option_id + " />" + notes_button_list[i] + "</label>");
  1026. filter_option_id = "f-" + option_id;
  1027. $("#f-notes").append("<button type='button' class='mb-xs mt-xs mr-xs btn btn-primary' id=" + filter_option_id + " style='display:none;'>" + notes_button_list[i] + "</button>");
  1028. }
  1029. if (right < 2) {
  1030. $("#upload-btn").hide();
  1031. }
  1032. </script>
  1033. <!-- Vendor -->
  1034. <script src="assets/vendor/magnific-popup/magnific-popup.js"></script>
  1035. <!-- Examples -->
  1036. <script src='./script/js/search.js'></script>
  1037. <script src='./script/js/filter.js'></script>
  1038. <script src="assets/javascripts/ui-elements/examples.modals.js"></script>
  1039. </body>
  1040. </html>