areaShow.html 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. <!DOCTYPE html>
  2. <html lang="en"
  3. xmlns:th="http://www.thymeleaf.org"
  4. xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout">
  5. <head>
  6. <meta charset="UTF-8">
  7. <title>地图展示</title>
  8. <link rel="stylesheet" type="text/css" th:href="@{/h-ui/static/h-ui/css/H-ui.min.css}" />
  9. <link rel="stylesheet" type="text/css" th:href="@{/h-ui/static/h-ui.admin/css/H-ui.admin.css}" />
  10. <link rel="stylesheet" type="text/css" th:href="@{/h-ui/lib/Hui-iconfont/1.0.8/iconfont.css}" />
  11. <link rel="stylesheet" type="text/css" th:href="@{/h-ui/extend/iconfont/iconfont.css}" />
  12. <link rel="stylesheet" type="text/css" th:href="@{/h-ui/static/h-ui.admin/skin/blue/skin.css}" id="skin" />
  13. <link rel="stylesheet" type="text/css" th:href="@{/h-ui/static/h-ui.admin/css/style.css}" />
  14. <link th:href="@{/h-ui/lib/lightbox2/2.8.1/css/lightbox.css}" rel="stylesheet" type="text/css" >
  15. <link rel="stylesheet" type="text/css" th:href="@{/h-ui/lib/select2/select2.min.css}"/>
  16. <link rel="stylesheet" type="text/css" th:href="@{/h-ui/lib/webuploader/0.1.5/webuploader.css}"/>
  17. <link rel="stylesheet" th:href="@{/h-ui/lib/kindeditor-4.1.7/themes/default/default.css}" />
  18. <link rel="stylesheet" th:href="@{/h-ui/lib/kindeditor-4.1.7/plugins/code/prettify.css}" />
  19. <link rel="stylesheet" type="text/css" th:href="@{/h-ui/static/zoom.css}" />
  20. <link rel="stylesheet" type="text/css" th:href="'http://'+*{areaShowIp}+'/skymapapi/leaflet/leaflet.css'">
  21. <link rel="stylesheet" type="text/css"
  22. th:href="'http://'+*{areaShowIp}+'/skymapapi/leaflet/plugin/leafletpm/leaflet.pm.css'">
  23. <link rel="stylesheet" type="text/css"
  24. th:href="'http://'+*{areaShowIp}+'/skymapapi/leaflet/plugin/grouplayer/leaflet.groupedlayercontrol.css'">
  25. <link rel="stylesheet" type="text/css" th:href="'http://'+*{areaShowIp}+'/skymapapi/assets/bootstrap.css'">
  26. <link rel="stylesheet" type="text/css" th:href="'http://'+*{areaShowIp}+'/skymapapi/demo/industry.css'">
  27. <link rel="stylesheet" type="text/css" th:href="'http://'+*{areaShowIp}+'/skymapapi/demo/industrypark.css'">
  28. <script type="text/javascript" th:src="'http://'+*{areaShowIp}+'/skymapapi/assets/jquery-2.1.1.min.js'"></script>
  29. <script th:src="'http://'+*{areaShowIp}+'/skymapapi/assets/bootstrap.min.js'"></script>
  30. <script type="text/javascript" th:src="'http://'+*{areaShowIp}+'/skymapapi/require.js'"
  31. th:attr="data-main='http://'+*{areaShowIp}+'/skymapapi/release/industrymap.1.1.0.js'"></script>
  32. <style>
  33. .breadcrumb > li + li:before {
  34. color: #CCCCCC;
  35. content: "> ";
  36. padding: 0;
  37. }
  38. .main {
  39. padding-bottom: 0;
  40. }
  41. .breadcrumb {
  42. padding: 0 30px
  43. }
  44. </style>
  45. </head>
  46. <body layout:fragment="content">
  47. <nav class="breadcrumb">
  48. <i class="Hui-iconfont">&#xe67f;</i>
  49. 首页
  50. <span class="c-gray en">&gt;</span>区域展示
  51. <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px"
  52. href="javascript:location.replace(location.href);" title="刷新">
  53. <i class="Hui-iconfont">&#xe68f;</i>
  54. </a>
  55. </nav>
  56. <!-- 主体内容 -->
  57. <div class="main">
  58. <div>
  59. <!--区域展示-->
  60. <div class="centerContent">
  61. <div id="content">
  62. <div id="right">
  63. <div id="map" style="margin: 0px 10px">
  64. <div id="selectArea" th:if="${is_government}">
  65. <select id="streetChoice"
  66. onchange="locateToArea(this.options[this.options.selectedIndex].value)">
  67. <option value='0'><label>--选择街道--</label></option>
  68. <option th:each="item : ${streets}" th:value="${item.name}" th:text="${item.name}">
  69. </select>
  70. <select id="parkChoice"
  71. onchange="locateToIndustryPark(this.options[this.options.selectedIndex].value)">
  72. <option value='0'><label>--选择工业园--</label></option>
  73. </select>
  74. </div>
  75. <div id="selectArea" th:if="${is_street}">
  76. <select id="parkChoice"
  77. onchange="locateToIndustryPark(this.options[this.options.selectedIndex].value)">
  78. <option value='0'><label>--选择工业园--</label></option>
  79. <option th:each="item : ${buildInfos}" th:value="${item.name}" th:text="${item.name}">
  80. </select>
  81. </div>
  82. </div>
  83. <div id="infoDiv">
  84. <label id="infoDivTitle"></label>
  85. <span class="closeBtn" onclick="closeInfoDiv()">&times;</span>
  86. <table id="infoTable"></table>
  87. </div>
  88. </div>
  89. </div>
  90. <script>
  91. var local = window.location;
  92. var contextPath = local.pathname.split("/")[1];
  93. var pagePath = local.protocol + "//" + local.host + "/" + contextPath;
  94. $("li[role='presentation']").removeClass();
  95. $("#area_show").parent().attr("class", "active");
  96. //创建地图,页面初始化时即刻执行,调用API时必须设置
  97. function loadCallBack() {
  98. var options = {
  99. mapdom: "map",
  100. ipaddress: "[[${areaShowIp}]]:[[${areaShowPort}]]",
  101. mapfilter: "安达科技园",//初始化时如果传值为空字符串,表示为政府用户,工业园用户可以传值如“安达科技园”或者“枫桥工业园”等工业园名称
  102. clickMapHandler: function () {
  103. },
  104. listCompanyHandler: callbackCompanyList,
  105. spatialQueryHandler: function (data) {
  106. console(data);
  107. }
  108. };
  109. ImageSkyMap.creatMap(options);
  110. var is_build = [[${is_build}]];
  111. if (is_build) {
  112. locateToIndustryPark('[[${build_name}]]')
  113. }
  114. }
  115. //输入区域板块名称,执行地图局部定位
  116. //同时查询并输出乡镇街道范围内的工业园数量及面积等信息
  117. function locateToArea(towname) {
  118. if (towname == 0) {
  119. document.getElementById("infoDiv").style.display = "none";
  120. return;
  121. }
  122. document.getElementById("infoDiv").style.display = "block";
  123. $(".compay_li").removeClass("active");
  124. $(".area_li").removeClass("active");
  125. $(".search_li").removeClass("active");
  126. ImageSkyMap.areaLocate(towname, function (data) {
  127. //返回乡镇街道范围内的工业园数量及面积等信息
  128. initStreetInfo(towname);
  129. //初始化乡镇街道范围内的工业园列表
  130. $("#parkChoice option:not(:first)").remove();
  131. $.ajax({
  132. type: "GET",
  133. dataType: "json",
  134. url: pagePath + "/area/findBuildByStreetName",
  135. data: {
  136. "name": towname
  137. },
  138. success: function (result) {
  139. if (result.success) {
  140. $.each(result.obj, function (idx, obj) {
  141. $("#parkChoice").append("<option value='" + obj.name + "'>" + obj.name + "</option>");
  142. });
  143. } else {
  144. alert(result.message);
  145. }
  146. }
  147. });
  148. });
  149. }
  150. //输入工业区名称,执行地图局部定位
  151. function locateToIndustryPark(parkName) {
  152. if (parkName == 0) {
  153. document.getElementById("infoDiv").style.display = "none";
  154. return;
  155. }
  156. document.getElementById("infoDiv").style.display = "block";
  157. $(".compay_li").removeClass("active");
  158. $(".area_li").removeClass("active");
  159. $(".search_li").removeClass("active");
  160. ImageSkyMap.industryParkLocate(parkName, function (data) {
  161. initBuildInfo(parkName);
  162. });
  163. }
  164. //单击工业园地块或者厂房,执行查询的回调函数
  165. //返回查询到的企业列表
  166. function callbackCompanyList(data) {
  167. if (data) {
  168. if (data.length == 0) {
  169. document.getElementById("infoDiv").style.display = "none";
  170. return;
  171. }
  172. document.getElementById("infoDiv").style.display = "block";
  173. $("#infoTable").empty();
  174. $("#infoDivTitle").html("企业列表");
  175. var tr_head = $("<tr id='qylb'></tr>");
  176. $("#infoTable").append(tr_head);
  177. var td = $("<td>序号</td>");
  178. td.appendTo(tr_head);
  179. td = $("<td>企业名称</td>");
  180. td.appendTo(tr_head);
  181. var tr_body = null;
  182. var td_body = null;
  183. for (var i = 0, li = data.length; i < li; i++) {
  184. tr_body = $("<tr id='" + data[i].id + "'></tr>");
  185. $("#infoTable").append(tr_body);
  186. td_body = $("<td>" + data[i].id + "</td>");
  187. td_body.appendTo(tr_body);
  188. td_body = $("<td><a id='" + data[i].oid + "'href='javascript:void(0)' onclick='locateCompanyOfList(this)'>" + data[i].name + "</a></td>");
  189. td_body.appendTo(tr_body);
  190. }
  191. }
  192. }
  193. function locateCompanyOfList(obj) {
  194. if (obj != null) {
  195. ImageSkyMap.locateCompanyformList(obj);
  196. }
  197. }
  198. $(document).ready(function () {
  199. resizeWindw();
  200. });
  201. window.onresize = function () {
  202. resizeWindw();
  203. };
  204. function resizeWindw() {
  205. var clitHeight = $(window).height();
  206. var cliWidth = $(window).width();
  207. $("#sidebarNav").height(clitHeight - $("#sysNav").height() - 2);
  208. $("#map").css({
  209. // "position": "absolute",
  210. // "left": "64px",
  211. // "top": $("#sysNav").height() + 120,
  212. // "right": "20px",
  213. "height": clitHeight - $("#sysNav").height() - $("#foot").height() - $(".head").height() - 110
  214. });
  215. }
  216. function centerRelation(obj) {
  217. var windowWidth = $(window).width();
  218. var windowHeight = $(window).height();
  219. var popHeight = $(obj).height();
  220. var popWidth = $(obj).width();
  221. $(obj).css({
  222. "position": "absolute",
  223. "top": (windowHeight - popHeight) / 2 + $(document).scrollTop(),
  224. "left": (windowWidth - popWidth) / 2,
  225. "z-index": 10000
  226. });
  227. }
  228. function initStreetInfo(name) {
  229. $.ajax({
  230. type: "GET",
  231. dataType: "json",
  232. url: pagePath + "/area/getStreetInfoByName",
  233. data: {
  234. "name": name
  235. },
  236. success: function (result) {
  237. if (result.success) {
  238. $("#infoTable").empty();
  239. $("#infoDivTitle").html(name);
  240. var tr = $("<tr id='gyysl'></tr>");
  241. $("#infoTable").append(tr);
  242. var td = $("<td>工业园数量</td>");
  243. td.appendTo(tr);
  244. td = $("<td>" + result.obj.buildNum + "</td>");
  245. td.appendTo(tr);
  246. tr = $("<tr id='qysl'></tr>");
  247. $("#infoTable").append(tr);
  248. td = $("<td>企业数量</td>");
  249. td.appendTo(tr);
  250. td = $("<td>" + result.obj.companyNum + "</td>");
  251. td.appendTo(tr);
  252. } else {
  253. alert(result.message);
  254. }
  255. }
  256. });
  257. }
  258. function initBuildInfo(name) {
  259. $.ajax({
  260. type: "GET",
  261. dataType: "json",
  262. url: pagePath + "/area/getBuildInfoByName",
  263. data: {
  264. "name": name
  265. },
  266. success: function (result) {
  267. if (result.success) {
  268. $("#infoTable").empty();
  269. $("#infoDivTitle").html(name);
  270. var tr = $("<tr id='xzqmj'></tr>");
  271. $("#infoTable").append(tr);
  272. var td = $("<td>工业园面积</td>");
  273. td.appendTo(tr);
  274. td = $("<td>" + result.obj.area + "k㎡</td>");
  275. td.appendTo(tr);
  276. tr = $("<tr id='qysl'></tr>");
  277. $("#infoTable").append(tr);
  278. td = $("<td>企业数量</td>");
  279. td.appendTo(tr);
  280. td = $("<td>" + result.obj.companyNum + "</td>");
  281. td.appendTo(tr);
  282. //可租用面积从外部定义
  283. tr = $("<tr id='qysl'></tr>");
  284. $("#infoTable").append(tr);
  285. td = $("<td>可租用面积</td>");
  286. td.appendTo(tr);
  287. td = $("<td>" + result.obj.restArea + "</td>");
  288. td.appendTo(tr);
  289. tr = $("<tr id='qysl'></tr>");
  290. $("#infoTable").append(tr);
  291. td = $("<td>已租用面积</td>");
  292. td.appendTo(tr);
  293. td = $("<td>" + result.obj.useArea + "</td>");
  294. td.appendTo(tr);
  295. } else {
  296. alert(result.message);
  297. }
  298. }
  299. });
  300. }
  301. </script>
  302. </div>
  303. </div>
  304. </div>
  305. </body>
  306. </html>
  307. <style>
  308. .nav-pills > li.active > a {
  309. background-color: #fff;
  310. border-top: 2px solid #EE6723;
  311. color: #F6B242;
  312. }
  313. </style>