index.php 34 KB

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