index.php 37 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334
  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. let highlightSelect;
  332. const webscene = new WebScene({
  333. portalItem: {
  334. id: "6b4e83dd94c4410db4bece82262b2573"
  335. },
  336. opacity: 1,
  337. showAttribution: false,
  338. });
  339. const simpleMakerRenderer = {
  340. type: "unique-value",
  341. legendOptions: {
  342. title: "工程類別"
  343. },
  344. field: "工程類別",
  345. uniqueValueInfos: getUniqueValueInfos2(),
  346. };
  347. const typeRenderer = {
  348. type: "unique-value",
  349. legendOptions: {
  350. title: "工程類別"
  351. },
  352. field: "工程類別",
  353. uniqueValueInfos: getUniqueValueInfos()
  354. };
  355. //getUniqueValueInfos()
  356. function getUniqueValueInfos() {
  357. var array = [];
  358. for (const [key, value] of Object.entries(color)) {
  359. let data = JSON.parse(`{
  360. "value": "${key}",
  361. "label": "${key}",
  362. "symbol": {
  363. "type": "simple-fill",
  364. "color": "${value}",
  365. "width": "6px",
  366. "style": "solid",
  367. "outline": {
  368. "color": "#00FFFF",
  369. "width": 2
  370. }
  371. }
  372. }`);
  373. array.push(data);
  374. }
  375. return array;
  376. }
  377. /* */
  378. function getUniqueValueInfos2() {
  379. var array = [];
  380. for (const [key, value] of Object.entries(color)) {
  381. let data = JSON.parse(`{
  382. "value": "${key}",
  383. "label": "${key}",
  384. "symbol": {
  385. "type": "simple-marker",
  386. "color": "${value}",
  387. "size": 12,
  388. "outline": {
  389. "color": "#00FFFF",
  390. "width": 2
  391. }
  392. }
  393. }`);
  394. array.push(data);
  395. }
  396. return array;
  397. }
  398. const labelClass = {
  399. // autocasts as new LabelClass()
  400. symbol: {
  401. type: "text", // autocasts as new TextSymbol()
  402. color: "blue",
  403. font: {
  404. // autocast as new Font()
  405. family: "Playfair Display",
  406. size: 10,
  407. weight: "bold"
  408. }
  409. },
  410. minScale: 150000,
  411. labelExpressionInfo: {
  412. expression: "$feature.計畫名稱"
  413. },
  414. // labelPosition:"parallel",
  415. // labelPlacement: "above-center",
  416. };
  417. var projectLayer = new FeatureLayer({
  418. 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",
  419. outFields: ["*"],
  420. //renderer: poleRenderer,
  421. title: "工程設計資料庫",
  422. elevationInfo: "on-the-ground",
  423. visible: true,
  424. opacity: 0.8,
  425. renderer: typeRenderer,
  426. labelingInfo: [labelClass],
  427. });
  428. projectLayer.listMode = "hide";
  429. webscene.add(projectLayer);
  430. const projectRenderer = projectLayer.render;
  431. const wmts1 = new WMTSLayer({
  432. url: "https://wmts.nlsc.gov.tw/wmts",
  433. activeLayer: {
  434. id: "EMAP96"
  435. },
  436. visible: false
  437. });
  438. const wmts2 = new WMTSLayer({
  439. url: "https://wmts.nlsc.gov.tw/wmts",
  440. activeLayer: {
  441. id: "PHOTO2"
  442. },
  443. visible: false
  444. });
  445. const wmts3 = new WMTSLayer({
  446. url: "https://wmts.nlsc.gov.tw/wmts",
  447. activeLayer: {
  448. id: "EMAP2"
  449. },
  450. visible: true
  451. });
  452. const mapGroupLayer = new GroupLayer({
  453. title: "電子地圖",
  454. visible: true,
  455. visibilityMode: "exclusive",
  456. layers: [wmts1, wmts2, wmts3],
  457. opacity: 0.75
  458. });
  459. webscene.add(mapGroupLayer);
  460. const view = new SceneView({
  461. container: "viewDiv",
  462. map: webscene,
  463. popup: {
  464. defaultPopupTemplateEnabled: true,
  465. dockEnabled: true,
  466. dockOptions: {
  467. breakpoint: false,
  468. buttonEnabled: false,
  469. position: "bottom-left",
  470. }
  471. },
  472. highlightOptions: {
  473. color: [255, 242, 0],
  474. fillOpacity: 0.4
  475. },
  476. });
  477. window.view = view;
  478. view.ui.empty("top-left");
  479. //view.ui.empty("manual");
  480. // view.ui.add(
  481. // new Expand({
  482. // view: view,
  483. // content: new BasemapGallery({
  484. // view: view
  485. // }),
  486. // autoCollapse: true,
  487. // group: "top-left"
  488. // }),
  489. // "top-left"
  490. // );
  491. var layerList = new LayerList({
  492. view: view,
  493. listItemCreatedFunction: defineActions
  494. });
  495. view.ui.add(
  496. new Expand({
  497. view: view,
  498. content: layerList,
  499. autoCollapse: true,
  500. group: "top-left",
  501. expandIconClass: "esri-icon-basemap",
  502. expandTooltip: "選擇底圖"
  503. }),
  504. "top-left"
  505. );
  506. view.ui.add(
  507. new Expand({
  508. view: view,
  509. content: new Legend({
  510. view: view
  511. }),
  512. autoCollapse: true,
  513. group: "top-left"
  514. }),
  515. "top-left"
  516. );
  517. view.ui.add(
  518. new Home({
  519. view: view,
  520. group: "top-left"
  521. }),
  522. "top-left"
  523. );
  524. //新增量測工具
  525. view.ui.add("topbar", "bottom-right");
  526. document
  527. .getElementById("distanceButton")
  528. .addEventListener("click", (event) => {
  529. setActiveWidget(null);
  530. if (!event.target.classList.contains("active")) {
  531. setActiveWidget("distance");
  532. } else {
  533. setActiveButton(null);
  534. }
  535. });
  536. document
  537. .getElementById("areaButton")
  538. .addEventListener("click", (event) => {
  539. setActiveWidget(null);
  540. if (!event.target.classList.contains("active")) {
  541. setActiveWidget("area");
  542. } else {
  543. setActiveButton(null);
  544. }
  545. });
  546. document
  547. .getElementById("clear")
  548. .addEventListener("click", (event) => {
  549. setActiveWidget(null);
  550. setActiveButton(null);
  551. });
  552. function setActiveWidget(type) {
  553. switch (type) {
  554. case "distance":
  555. activeWidget = new DirectLineMeasurement3D({
  556. view: view
  557. });
  558. // skip the initial 'new measurement' button
  559. activeWidget.viewModel.start().catch((error) => {
  560. if (promiseUtils.isAbortError(error)) {
  561. return; // don't display abort errors
  562. }
  563. throw error; // throw other errors since they are of interest
  564. });
  565. view.ui.add(activeWidget, "bottom-left");
  566. setActiveButton(document.getElementById("distanceButton"));
  567. break;
  568. case "area":
  569. activeWidget = new AreaMeasurement3D({
  570. view: view
  571. });
  572. // skip the initial 'new measurement' button
  573. activeWidget.viewModel.start().catch((error) => {
  574. if (promiseUtils.isAbortError(error)) {
  575. return; // don't display abort errors
  576. }
  577. throw error; // throw other errors since they are of interest
  578. });
  579. view.ui.add(activeWidget, "bottom-left");
  580. setActiveButton(document.getElementById("areaButton"));
  581. break;
  582. case null:
  583. if (activeWidget) {
  584. view.ui.remove(activeWidget);
  585. activeWidget.destroy();
  586. activeWidget = null;
  587. }
  588. break;
  589. }
  590. }
  591. function defineActions(event) {
  592. // The event object contains an item property.
  593. // is is a ListItem referencing the associated layer
  594. // and other properties. You can control the visibility of the
  595. // item, its title, and actions using this object.
  596. const item = event.item;
  597. // Adds a slider for updating a group layer's opacity
  598. if (item.title === "電子地圖") {
  599. const slider = new Slider({
  600. min: 0,
  601. max: 1,
  602. precision: 2,
  603. values: [1],
  604. visibleElements: {
  605. labels: true,
  606. rangeLabels: true
  607. }
  608. });
  609. item.panel = {
  610. content: slider,
  611. className: "esri-icon-sliders-horizontal",
  612. title: "修改地圖透明度"
  613. }
  614. slider.on("thumb-drag", (event) => {
  615. const {
  616. value
  617. } = event;
  618. item.layer.opacity = value;
  619. })
  620. }
  621. }
  622. function setActiveButton(selectedButton) {
  623. // focus the view to activate keyboard shortcuts for sketching
  624. view.focus();
  625. const elements = document.getElementById("topbar").getElementsByClassName("active");
  626. for (let i = 0; i < elements.length; i++) {
  627. elements[i].classList.remove("active");
  628. }
  629. if (selectedButton) {
  630. selectedButton.classList.add("active");
  631. }
  632. }
  633. view.ui.add(
  634. new Fullscreen({
  635. view: view,
  636. group: "top-left"
  637. }),
  638. "top-right"
  639. );
  640. view.ui.add(
  641. new Zoom({
  642. view: view
  643. }),
  644. "top-right"
  645. );
  646. view.ui.add(
  647. new NavigationToggle({
  648. view: view
  649. }),
  650. "top-right"
  651. );
  652. view.ui.add(
  653. new Compass({
  654. view: view
  655. }),
  656. "top-right"
  657. );
  658. $("#measureExpendDiv .esri-widget--button").click(function() {
  659. if (pMeasureExpand.expanded) {
  660. activeMeasureWidget.viewModel.newMeasurement();
  661. } else {
  662. activeMeasureWidget.viewModel.clearMeasurement();
  663. }
  664. });
  665. function zoomToLayer2(layer) {
  666. return layer.queryExtent().then((response) => {
  667. var zoom = (response.extent.height > response.extent.width ? response.extent.height : response.extent.width) / 474;
  668. view.goTo({
  669. target: response.extent,
  670. tilt: 0,
  671. heading: 0,
  672. //zoom: zoom
  673. }
  674. /*, {
  675. speedFactor: 6,
  676. easing: "linear"
  677. }*/
  678. ).catch((error) => {
  679. console.log("error");
  680. console.error(error);
  681. }).then(() => {
  682. console.log(view.zoom);
  683. view.goTo({
  684. center: view.center,
  685. zoom: view.zoom - 1
  686. }, {
  687. speedFactor: 30,
  688. easing: "linear"
  689. });
  690. });
  691. });
  692. }
  693. view.watch("scale", (newValue) => {
  694. if (newValue > 30000) {
  695. projectLayer.labelsVisible = true;
  696. projectLayer.renderer = simpleMakerRenderer;
  697. } else {
  698. projectLayer.labelsVisible = false;
  699. projectLayer.renderer = typeRenderer;
  700. }
  701. });
  702. view.when(function() {
  703. layerList.on("trigger-action", (event) => {
  704. // Capture the action id.
  705. const id = event.action.id;
  706. if (id === "increase-opacity") {
  707. // if the increase-opacity action is triggered, then
  708. // increase the opacity of the GroupLayer by 0.25
  709. if (mapGroupLayer.opacity < 1) {
  710. mapGroupLayer.opacity += 0.25;
  711. }
  712. } else if (id === "decrease-opacity") {
  713. // if the decrease-opacity action is triggered, then
  714. // decrease the opacity of the GroupLayer by 0.25
  715. if (mapGroupLayer.opacity > 0) {
  716. mapGroupLayer.opacity -= 0.25;
  717. }
  718. }
  719. });
  720. });
  721. // highlight is set on the layerView, so we need to detect when the layerView is ready
  722. view.whenLayerView(projectLayer).then((layerView) => {
  723. // creates the query that will be used to obtain the features needed for the highlight
  724. const queryStations = projectLayer.createQuery();
  725. // features that are passed in the highlight function need to have an `objectID`
  726. // if the query is built using `new Query()` then `queryStations.outFields = ["objectID"]` should be set
  727. $('#treeAjaxHTML').on("select_node.jstree", function(e, data) {
  728. if (data.node.text.includes("-")) {
  729. project_id = data.node.text.split("-")[0];
  730. projectLayer.definitionExpression = "計畫編號 = '" + project_id + "'";
  731. zoomToLayer(project_id);
  732. }
  733. });
  734. function zoomToLayer(project_id) {
  735. queryStations.where = `計畫編號='${project_id}'`;
  736. projectLayer.queryFeatures(queryStations).then((result) => {
  737. // if a feature is already highlighted, then remove the highlight
  738. if (highlightSelect) {
  739. highlightSelect.remove();
  740. }
  741. // the feature to be highlighted
  742. const feature = result.features[0];
  743. // use the objectID to highlight the feature
  744. highlightSelect = layerView.highlight(result.features);
  745. view.goTo({
  746. target: feature.geometry,
  747. tilt: 0,
  748. heading: 0,
  749. //zoom: zoom
  750. }
  751. /*, {
  752. speedFactor: 6,
  753. easing: "linear"
  754. }*/
  755. ).catch((error) => {
  756. console.log("error");
  757. console.error(error);
  758. })
  759. /*.then(() => {
  760. console.log(view.zoom);
  761. view.goTo({
  762. center: view.center,
  763. zoom: view.zoom - 1
  764. }, {
  765. speedFactor: 30,
  766. easing: "linear"
  767. });
  768. })*/
  769. ;
  770. });
  771. }
  772. });
  773. });
  774. var db_table = {};
  775. $.ajax({
  776. url: "./script/php/get_db_table.php",
  777. type: "GET",
  778. async: false,
  779. contentType: "application/json",
  780. dataType: "json"
  781. }).done(function(data) {
  782. db_table = data;
  783. }).error(function(error) {
  784. console.log(error);
  785. });
  786. db_table["notes"] = merge_object_by_key(db_table["notes"], "project_id", "notes");
  787. var notes_button_list = [...new Set([].concat(...Object.values(db_table["notes"])))];
  788. var search_data = {
  789. "category": get_value_list_by_key(db_table["category"], null, -1, "category_id").toString().split(","),
  790. "project": get_value_list_by_key(db_table["project"], null, -1, "project_id"),
  791. "type": get_value_list_by_key(db_table["type"], null, -1, "type_id").toString().split(","),
  792. "notes": notes_button_list
  793. };
  794. var filter_base_data = search_data;
  795. function get_value_list_by_key(obj_list, key_search, target_value, key_save) {
  796. output_list = [];
  797. obj_list.forEach(element => {
  798. if (target_value != -1) {
  799. target_value.forEach(e => {
  800. if (e.toString() == element[key_search].toString()) {
  801. output_list.push(element[key_save]);
  802. }
  803. });
  804. } else {
  805. output_list.push(element[key_save]);
  806. }
  807. });
  808. output_list = [...new Set(output_list)];
  809. return output_list;
  810. }
  811. function merge_object_by_key(obj, key, value) {
  812. output_object = {};
  813. while (obj.length > 0) {
  814. pop_out = obj.pop();
  815. if (output_object[pop_out[key]] == undefined) {
  816. output_object[pop_out[key]] = [pop_out[value]];
  817. } else {
  818. output_object[pop_out[key]].push(pop_out[value]);
  819. }
  820. }
  821. return output_object
  822. }
  823. </script>
  824. </head>
  825. <body>
  826. <script type="application/javascript">
  827. var test;
  828. var i = 0;
  829. var download;
  830. var fileName;
  831. var folder;
  832. var software;
  833. var userName = 'maabim';
  834. jQuery(window).load(function() {
  835. var url_href = window.location.href;
  836. var url = new URL(url_href);
  837. var type = url.searchParams.get("type");
  838. var projectId = url.searchParams.get("projectId");
  839. if (projectId != null) {
  840. var projectNode = $(".jstree-anchor").filter(function() {
  841. return $(this).text().includes(projectId);
  842. });
  843. let nodeId = projectNode[0].attributes.id.value;
  844. $('#treeAjaxHTML').jstree("select_node", nodeId);
  845. $("#treeAjaxHTML").jstree("close_all");
  846. }
  847. });
  848. //var typeId = node[0].attributes.id.value;
  849. </script>
  850. <section class="body">
  851. <!-- start: header -->
  852. <header class="header">
  853. <div class="logo-container">
  854. <div class="banner-txt">設計資料庫查詢系統</div>
  855. <div class="visible-xs toggle-sidebar-left" data-toggle-class="sidebar-left-opened" data-target="html" data-fire-event="sidebar-left-opened">
  856. <i class="fa fa-bars" aria-label="Toggle sidebar"></i>
  857. </div>
  858. </div>
  859. <!-- start: search & user box -->
  860. <div class="header-right">
  861. <span class="separator"></span>
  862. <ul class="notifications">
  863. <li>
  864. <a id="upload-btn" href="./Upload.php" class="notification-icon" data-toggle="tooltip" title="匯入工具" data-placement="bottom">
  865. <i class="fa fa-upload"></i>
  866. </a>
  867. <a href="/Front-Page/home.php" class="notification-icon" data-toggle="tooltip" title="綜合登入入口" data-placement="bottom">
  868. <i class="fa fa-home"></i>
  869. </a>
  870. </li>
  871. </ul>
  872. <span class="separator"></span>
  873. <div id="userbox" class="userbox">
  874. <a href="#" data-toggle="dropdown">
  875. <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>
  876. <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>
  877. </a>
  878. <div class="dropdown-menu">
  879. <ul class="list-unstyled">
  880. <li class="divider"></li>
  881. <li> <a role="menuitem" tabindex="-1" href="./script/php/Logout.php"><i class="fa fa-power-off"></i> Logout</a> </li>
  882. </ul>
  883. </div>
  884. </div>
  885. </div>
  886. <!-- end: search & user box -->
  887. </header>
  888. <!-- end: header -->
  889. <div class="inner-wrapper">
  890. <!-- start: sidebar -->
  891. <aside id="sidebar-left" class="sidebar-left">
  892. <div class="nano">
  893. <div class="nano-content">
  894. <nav id="menu" class="nav-main" role="navigation">
  895. <div class="widget-header clearfix">
  896. <h6 class="title pull-left mt-xs">資料庫文件</h6>
  897. </div>
  898. <div class="widget-content">
  899. <div class="jstree jstree-1 jstree-default" id="treeAjaxHTML"></div>
  900. </div>
  901. </nav>
  902. </div>
  903. </div>
  904. </aside>
  905. <!-- end: sidebar -->
  906. <section role="main" class="content-body">
  907. <header class="page-header">
  908. <ul>
  909. <li>
  910. <label id="header"></label>
  911. </li>
  912. <li class="right">
  913. <a class="mb-xs mt-xs mr-xs modal-with-move-anim btn btn-default" href="#advancedSearch"><i class="fa fa-search"></i> 進階搜尋</a>
  914. </li>
  915. </ul>
  916. </header>
  917. <div class="row">
  918. <div id="advancedSearch" class="zoom-anim-dialog modal-block modal-block-primary mfp-hide">
  919. <section class="panel">
  920. <header class="panel-heading">
  921. <h2 class="panel-title">進階搜尋</h2>
  922. </header>
  923. <div class="panel-body">
  924. <form class="form-horizontal form-bordered" method="get">
  925. <div class="form-group" id="category">
  926. <label class="col-md-3 control-label">工程類別:</label>
  927. <div class="multiselect col-md-6">
  928. <div class="selectBox">
  929. <select>
  930. <option>選擇工程</option>
  931. </select>
  932. <div class="overSelect"></div>
  933. </div>
  934. <div class="checkboxes form-inline" style="display: none; overflow-y:scroll; height:300px">
  935. <label for="category-any"><input type="checkbox" id="category-any" value="any" checked /> 全選</label>
  936. <!-- append option -->
  937. </div>
  938. </div>
  939. </div>
  940. <div class="form-group" id="project">
  941. <label class="col-md-3 control-label">專案類別:</label>
  942. <div class="multiselect col-md-6">
  943. <div class="selectBox">
  944. <select>
  945. <option>選擇專案</option>
  946. </select>
  947. <div class="overSelect"></div>
  948. </div>
  949. <div class="checkboxes form-inline" style="display: none; overflow-y:scroll; height:300px">
  950. <label for="project-any"><input type="checkbox" id="project-any" value="any" checked /> 全選</label>
  951. <!-- append option -->
  952. </div>
  953. </div>
  954. </div>
  955. <div class="form-group" id="type">
  956. <label class="col-md-3 control-label">文件類別:</label>
  957. <div class="multiselect col-md-6">
  958. <div class="selectBox">
  959. <select>
  960. <option>選擇文件</option>
  961. </select>
  962. <div class="overSelect"></div>
  963. </div>
  964. <div class="checkboxes form-inline" style="display: none; overflow-y:scroll; height:300px">
  965. <label for="type-any"><input type="checkbox" id="type-any" value="any" checked /> 全選</label>
  966. <!-- append option -->
  967. </div>
  968. </div>
  969. </div>
  970. <div class="form-group" id="notes" style="display: bllock;" hidden>
  971. <label class="col-md-3 control-label">設計圖類別:</label>
  972. <div class="multiselect col-md-6">
  973. <div class="selectBox">
  974. <select>
  975. <option>選擇設計圖</option>
  976. </select>
  977. <div class="overSelect"></div>
  978. </div>
  979. <div class="checkboxes form-inline" style="display: none; overflow-y:scroll; height:300px">
  980. <label for="notes-any"><input type="checkbox" id="notes-any" value="any" checked /> 全選</label>
  981. <!-- append option -->
  982. </div>
  983. </div>
  984. </div>
  985. <div class="form-group">
  986. <label class="col-md-3 control-label" for="search-word">文字搜尋:</label>
  987. <div class="col-md-6">
  988. <input type="text" class="form-control" placeholder="輸入關鍵字" id="search-word">
  989. </div>
  990. </div>
  991. </form>
  992. </div>
  993. <footer class="panel-footer">
  994. <div class="row">
  995. <div class="col-md-12 text-right">
  996. <div id="treeAjaxJSON" class="jstree jstree-4 jstree-default" role="tree" style="display: none;">
  997. <ul class="jstree-container-ul jstree-children">
  998. <li class="jstree-initial-node jstree-loading jstree-leaf jstree-last">
  999. <i class="jstree-icon jstree-ocl"></i>
  1000. <a class="jstree-anchor" href="#"><i class="jstree-icon jstree-themeicon-hidden"></i>Loading ...</a>
  1001. </li>
  1002. </ul>
  1003. </div>
  1004. <div class="progress progress-striped light active m-md" style="display: none;">
  1005. <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>
  1006. </div>
  1007. <div class="jstree jstree-4 jstree-default" id="loading" style="display: none;">
  1008. <ul class="jstree-container-ul">
  1009. <li class="jstree-loading">
  1010. <i class="jstree-icon jstree-ocl"></i>讀取中 ...
  1011. </li>
  1012. </ul>
  1013. </div>
  1014. <div id="advanced-search-button-group" style="display: block;">
  1015. <p id="warning-text" style="display: none; color: red;">警告! 篩選結果多於 1000 筆 </p>
  1016. <button class="btn btn-warning" id="keep-search-button" style="display: none;">仍要搜尋</button>
  1017. <button class="btn btn-primary" id="advanced-search-button" style="display: inline-block;">搜尋</button>
  1018. <button class="btn btn-default modal-dismiss">取消</button>
  1019. </div>
  1020. </div>
  1021. </div>
  1022. </footer>
  1023. </section>
  1024. </div>
  1025. <div class="col-md-6">
  1026. <section class="panel" id="search-filter-panel" style="display: none;">
  1027. <div class="panel-body">
  1028. <form class="form-horizontal form-bordered" id="search-filter" method="get" hidden>
  1029. <div class="form-group">
  1030. <label class="col-md-3 control-label">工程類別:</label>
  1031. <div class="col-md-7" id="f-category">
  1032. <!-- append option -->
  1033. </div>
  1034. </div>
  1035. <div class="form-group">
  1036. <label class="col-md-3 control-label">專案類別:</label>
  1037. <div class="col-md-7" id="f-project">
  1038. <!-- append option -->
  1039. </div>
  1040. </div>
  1041. <div class="form-group">
  1042. <label class="col-md-3 control-label">文件類別:</label>
  1043. <div class="col-md-7" id="f-type">
  1044. <!-- append option -->
  1045. </div>
  1046. </div>
  1047. <div class="form-group" id="filter_notes" style="display: none;">
  1048. <label class="col-md-3 control-label">設計圖類別:</label>
  1049. <div class="col-md-7" id="f-notes">
  1050. <!-- append option -->
  1051. </div>
  1052. </div>
  1053. </form>
  1054. <i class="text-center fa fa-sort-desc" id="filter-slide"></i>
  1055. </div>
  1056. </section>
  1057. <section class="panel">
  1058. <div class="panel-body">
  1059. <button id="reset" type="button" class="mb-xs mr-xs btn btn-default" style="float: right;"><i class="fa fa-reply"></i> 上一層</button>
  1060. <table style="width:99%;" class="table table-bordered table-striped" id="datatable-ajax">
  1061. <thead>
  1062. <tr>
  1063. <th id="SN">項次</th>
  1064. <th id="name">類別</th>
  1065. <th>關鍵字</th>
  1066. <th>版次</th>
  1067. <th>檔案數</th>
  1068. </tr>
  1069. </thead>
  1070. <tbody>
  1071. </tbody>
  1072. </table>
  1073. </div>
  1074. </section>
  1075. <section class="panel">
  1076. <div id="panel" class="panel-body" style="height: 210px;">
  1077. <div class="table-responsive" style="display:none;">
  1078. <table class="table table-bordered mb-none" id="tableDetail">
  1079. <tbody>
  1080. <tr>
  1081. <th>計畫編號</th>
  1082. <td id="plan_code"></td>
  1083. </tr>
  1084. <tr>
  1085. <th>計畫名稱</th>
  1086. <td id="plan_name"></td>
  1087. </tr>
  1088. <tr>
  1089. <th>圖名</th>
  1090. <td id="fileName"></td>
  1091. </tr>
  1092. <tr>
  1093. <th>版次</th>
  1094. <td id="version"></td>
  1095. </tr>
  1096. <tr>
  1097. <th>文件</th>
  1098. <td id="download"></td>
  1099. </tr>
  1100. </tbody>
  1101. </table>
  1102. </div>
  1103. </div>
  1104. </section>
  1105. </div>
  1106. <div class="col-md-6">
  1107. <div class="tabs">
  1108. <ul class="nav nav-tabs nav-justified">
  1109. <li class="active">
  1110. <a href="#arcgisTab" data-toggle="tab" class="text-center"><i class="fa fa-map-marker"></i> ArcGIS</a>
  1111. </li>
  1112. <li>
  1113. <a href="#pdfTab" data-toggle="tab" class="text-center"><i class="fa fa-file"></i> Pdf 預覽</a>
  1114. </li>
  1115. </ul>
  1116. <div class="tab-content">
  1117. <div id="arcgisTab" class="tab-pane active">
  1118. <div id="arcgis" class="panel-body" style="height: 730px;">
  1119. <div class="mapok" style="height:100%">
  1120. <div id="topbar" class="esri-component esri-widget">
  1121. <button id="distanceButton" class="action-button esri-icon-measure-line" type="button" title="Measure distance between two points"></button>
  1122. <button id="areaButton" class="action-button esri-icon-measure-area" type="button" title="Measure area"></button>
  1123. <button id="clear" class="action-button esri-icon-trash" title="Clear Measurements"></button>
  1124. </div>
  1125. <div id="viewDiv"></div>
  1126. <div id="measureExpendDiv"></div>
  1127. <div id="measureExpendDiv2"></div>
  1128. <div id="slidesDiv" class="esri-widget"></div>
  1129. <span style="display:none;" id="project-id"></span>
  1130. </div>
  1131. </div>
  1132. </div>
  1133. <div id="pdfTab" class="tab-pane">
  1134. <div id="pdfFile"></div>
  1135. </div>
  1136. </div>
  1137. </div>
  1138. </div>
  1139. </div>
  1140. </section>
  1141. </div>
  1142. </section>
  1143. </div>
  1144. <script>
  1145. var userName = "<?php echo $_SESSION['name'] ?>";
  1146. var role = "<?php echo ($groupName); ?>";
  1147. var right = <?php echo $right; ?>;
  1148. db_table["category"].forEach(element => {
  1149. option_id = "c" + element["category_id"] + "-l" + element["list_id"];
  1150. $("#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>");
  1151. filter_option_id = "f-c" + element["category_id"]
  1152. list_id = element["list_id"];
  1153. $("#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>");
  1154. });
  1155. db_table["project"].forEach(element => {
  1156. option_id = "p" + element["project_id"];
  1157. $("#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>");
  1158. filter_option_id = "f-" + option_id;
  1159. $("#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>");
  1160. });
  1161. db_table["type"].forEach(element => {
  1162. option_id = "t" + element["type_id"];
  1163. $("#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>");
  1164. filter_option_id = "f-" + option_id;
  1165. $("#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>");
  1166. });
  1167. for (i = 0; i < notes_button_list.length; i++) {
  1168. option_id = "n" + i;
  1169. $("#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>");
  1170. filter_option_id = "f-" + option_id;
  1171. $("#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>");
  1172. }
  1173. if (right < 2) {
  1174. $("#upload-btn").hide();
  1175. }
  1176. </script>
  1177. <!-- Vendor -->
  1178. <script src="assets/vendor/magnific-popup/magnific-popup.js"></script>
  1179. <!-- Examples -->
  1180. <script src='./script/js/search.js'></script>
  1181. <script src='./script/js/filter.js'></script>
  1182. <script src="assets/javascripts/ui-elements/examples.modals.js"></script>
  1183. </body>
  1184. </html>