map.html 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835
  1. <!DOCTYPE html">
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
  6. <title>吉林省产业技术创新联盟管理平台-联盟地图</title>
  7. <style type="text/css">
  8. ::-webkit-scrollbar {
  9. width: 8px;
  10. height: 5px;
  11. }
  12. ::-webkit-scrollbar-track {
  13. -webkit-box-shadow: inset 0 0 6px rgba(198, 196, 231, 0.9);
  14. border-radius: 10px;
  15. }
  16. ::-webkit-scrollbar-thumb {
  17. border-radius: 10px;
  18. background: rgba(79, 148, 251, 0.4); ::
  19. -webkit-box-shadow: inset 0 0 6px rgba(79, 148, 251, 0.9);
  20. }
  21. ::-webkit-scrollbar-thumb:window-inactive {
  22. background: rgba(79, 148, 251, 0.9);
  23. }
  24. body, html {
  25. width: 100%;
  26. height: 100%;
  27. margin: 0;
  28. font-family: "微软雅黑";
  29. }
  30. p {
  31. margin-left: 5px;
  32. font-size: 14px;
  33. }
  34. * {
  35. list-style: none;
  36. padding: 0;
  37. margin: 0;
  38. text-decoration: none;
  39. }
  40. li {
  41. padding: 5px 0 0 15px;
  42. font-size: 16px;
  43. }
  44. li a {
  45. color: #151515;
  46. }
  47. li a:hover {
  48. color: #3385ff;
  49. }
  50. #txt {
  51. width: 199px;
  52. font-family: "Microsoft Yahei", "微软雅黑", Tahoma, Arial, Helvetica,
  53. STHeiti;
  54. height: 26px;
  55. line-height: 26px;
  56. border: none;
  57. outline: none;
  58. margin: 6px 0 0 15px;
  59. font-size: 16px;
  60. float: left;
  61. }
  62. #go {
  63. position: relative;
  64. width: 39px;
  65. height: 27px;
  66. border-left: 1px solid #ccc;
  67. margin-top: 6px;
  68. }
  69. #go #go_box {
  70. display: none;
  71. position: absolute;
  72. left: -2px;
  73. top: 25px;
  74. z-index: 3;
  75. width: 40px;
  76. height: 32px;
  77. line-height: 37px;
  78. text-align: center;
  79. background: url(${contextPath}/img/tishi.gif) no-repeat;
  80. font-size: 12px;
  81. color: white;
  82. }
  83. #go #goto_box {
  84. display: none;
  85. position: absolute;
  86. left: -330px;
  87. top: -5px;
  88. z-index: 5;
  89. width: 368px;
  90. height: 320px;
  91. line-height: 37px;
  92. text-align: center;
  93. background: white;
  94. font-size: 12px;
  95. color: white;
  96. }
  97. #da {
  98. position: relative;
  99. width: 54px;
  100. height: 38px;
  101. background: #3385ff;
  102. }
  103. #da:hover {
  104. background: #1d6ee7;
  105. }
  106. #da #da_box {
  107. display: none;
  108. position: absolute;
  109. left: 10px;
  110. top: 31px;
  111. z-index: 2;
  112. width: 40px;
  113. height: 32px;
  114. line-height: 37px;
  115. text-align: center;
  116. background: url(${contextPath}/img/tishi.gif) no-repeat;
  117. font-size: 12px;
  118. color: white;
  119. }
  120. .map1 {
  121. padding: 5px 0 0 12px;
  122. }
  123. .jing1 {
  124. padding: 10px 0 0 20px;
  125. }
  126. #map {
  127. position: relative;
  128. width: 385px;
  129. height: 38px;
  130. border: 1px solid #f3f1ee;
  131. background: white;
  132. }
  133. /* display:block; position:absolute; left:-1px; top:39px; z-index:1; */
  134. #map #map_box {
  135. position: absolute;
  136. left: -1px;
  137. top: 39px;
  138. z-index: 1; /* background:rgba(243,232,213,0.8); */
  139. }
  140. .BMap_bubble_content {
  141. color: #17b0e3 !important;
  142. font-size: 16px !important;
  143. font-family: "Microsoft Yahei", "微软雅黑", Tahoma, Arial, Helvetica,
  144. STHeiti;
  145. }
  146. .BMapLib_nav_tab li {
  147. font-size: 12px;
  148. }
  149. tbody {
  150. font-size: 12px;
  151. }
  152. /*新下拉*/
  153. *, *::after, *::before {
  154. margin: 0;
  155. padding: 0;
  156. box-sizing: border-box;
  157. }
  158. body {
  159. height: 100vh;
  160. font-family: "Open Sans", sans serif;
  161. -webkit-font-smoothing: antialiased;
  162. -moz-osx-font-smoothing: grayscale;
  163. }
  164. .title {
  165. color: #fff;
  166. text-transform: uppercase;
  167. text-align: center;
  168. padding-bottom: 20px;
  169. }
  170. .contenedor-acordeon {
  171. width: 210px;
  172. overflow: hidden;
  173. }
  174. .acordeon {
  175. width: 100%;
  176. overflow: hidden;
  177. border-top: 1px solid #fff;
  178. }
  179. .acordeon__head {
  180. background: #3889D4;
  181. display: flex;
  182. justify-content: space-between;
  183. align-items: center;
  184. padding: 10px 25px 10px 10px;
  185. }
  186. .acordeon__head:hover {
  187. cursor: pointer;
  188. }
  189. .acordeon__head--logo {
  190. width: 8%;
  191. }
  192. .acordeon__head--title {
  193. display: inline-block;
  194. text-transform: uppercase;
  195. font-size: 15px;
  196. color: #fff;
  197. }
  198. .acordeon__body {
  199. height: 0;
  200. transition: height .4s ease-in-out;
  201. box-shadow: 0 0 6px rgba(0, 0, 0, 0.2) inset;
  202. }
  203. .acordeon__body__menu {
  204. list-style: none;
  205. background: #fff;
  206. }
  207. .acordeon__body__menu li {
  208. padding: 10px 0 10px 15px;
  209. }
  210. .acordeon__body__menu li:hover {
  211. background: rgb(188, 215, 254);
  212. }
  213. .acordeon__body__menu li a {
  214. display: block;
  215. color: #000;
  216. text-decoration: none;
  217. font-size: 12px;
  218. line-height: 10px;
  219. }
  220. .active {
  221. height: 56px;
  222. }
  223. #result li {
  224. font-size: 12px;
  225. }
  226. #result li div span {
  227. font-family: "微软雅黑";
  228. color: #000000 !important;
  229. }
  230. #result li div div>b {
  231. display: none;
  232. }
  233. /*坐标点的信息框*/
  234. .BMap_bubble_content {
  235. color: #000000 !important;
  236. font-size: 14px !important;
  237. font-family: "Microsoft Yahei", "微软雅黑", Tahoma, Arial, Helvetica,
  238. STHeiti;
  239. }
  240. </style>
  241. <link rel="stylesheet" href="${contextPath}/mapApply/nav.css">
  242. <link rel="stylesheet"
  243. href="${contextPath}/css/bootstrap/bootstrap.min.css">
  244. <script type="text/javascript">
  245. function daO(){
  246. var da_box=document.getElementById("da_box");
  247. da_box.style.display="block";
  248. }
  249. function daT(){
  250. var da_box=document.getElementById("da_box");
  251. da_box.style.display="none";
  252. }
  253. </script>
  254. </head>
  255. <body>
  256. <div
  257. style="width: 100%; height: 100%; position: fixed; margin: 0px; padding: 0px;">
  258. <div id="allmap"
  259. style="width: 100%; height: 100%; position: fixed; margin: 0px; padding: 0px;"></div>
  260. <div class=""
  261. style="position: absolute; top: 20px; left: 20px; margin: 0px;">
  262. <div style="position: fixed; right: 0; width: 400px;">
  263. <div style="float: right;">
  264. <input placeholder="请输入要查询的地点" id="searchInput"
  265. style="float: left; border: none; width: 345px; height: 37.5px;" />
  266. <div id="da" style="float: left; margin-bottom: 8%;"
  267. onmouseover="daO()" onmouseout="daT()" onclick="toSearch()">
  268. <img src="${contextPath}/img/jing.gif" alt="" class="jing1" />
  269. <div id="da_box">搜索</div>
  270. </div>
  271. </div>
  272. <div id="result"
  273. style="float: left; width: 90%; height: 85vh; overflow-y: auto;">
  274. <div id="resultContext"></div>
  275. <div id="pagination" class="pagination" style="position: absolute;"></div>
  276. <!-- <nav aria-label="Page navigation">
  277. <ul class="pagination" id="navList"></ul>
  278. </nav> -->
  279. </div>
  280. </div>
  281. <input id="Dtype" type="hidden" /> <input id="Xtype" type="hidden" />
  282. <div class="contenedor-acordeon" id="acordeon-content">
  283. <div class="acordeon">
  284. <div class="acordeon__head" onclick="firstMenu(1)">
  285. <p class="acordeon__head--title">政府部门</p>
  286. <img src="down.png" />
  287. </div>
  288. <div class="acordeon__body">
  289. <div class="acordeon__body__menu">
  290. <li onclick="secMenu(1)"><a href="#">科技厅</a></li>
  291. <li onclick="secMenu(2)"><a href="#">各地科技局</a></li>
  292. </div>
  293. </div>
  294. </div>
  295. <div class="acordeon">
  296. <div class="acordeon__head" onclick="firstMenu(2)">
  297. <p class="acordeon__head--title">高等院校</p>
  298. <img src="down.png" />
  299. </div>
  300. <div class="acordeon__body">
  301. <div class="acordeon__body__menu">
  302. <li onclick="secMenu(1)"><a href="#">大学</a></li>
  303. <li onclick="secMenu(2)"><a href="#">大专</a></li>
  304. <li onclick="secMenu(3)"><a href="#">技校</a></li>
  305. </div>
  306. </div>
  307. </div>
  308. <div class="acordeon">
  309. <div class="acordeon__head" onclick="firstMenu(3)">
  310. <p class="acordeon__head--title">科研机构</p>
  311. <img src="down.png" />
  312. </div>
  313. <div class="acordeon__body">
  314. <div class="acordeon__body__menu">
  315. <li onclick="secMenu(1)"><a href="#">科研机构(市直)</a></li>
  316. <li onclick="secMenu(2)"><a href="#">科研机构(省直)</a></li>
  317. <li onclick="secMenu(3)"><a href="#">科技金融机构 </a></li>
  318. <li onclick="secMenu(4)"><a href="#">科技中介</a></li>
  319. <li onclick="secMenu(5)"><a href="#">技术大市场 </a></li>
  320. </div>
  321. </div>
  322. </div>
  323. <div class="acordeon">
  324. <div class="acordeon__head" onclick="firstMenu(4)">
  325. <p class="acordeon__head--title">企业集团</p>
  326. <img src="down.png" />
  327. </div>
  328. <div class="acordeon__body">
  329. <div class="acordeon__body__menu">
  330. <li onclick="secMenu(1)"><a href="#">高企</a></li>
  331. <li onclick="secMenu(2)"><a href="#">科技企业 </a></li>
  332. </div>
  333. </div>
  334. </div>
  335. <div class="acordeon">
  336. <div class="acordeon__head" onclick="firstMenu(5)">
  337. <p class="acordeon__head--title">科技认证</p>
  338. <img src="down.png" />
  339. </div>
  340. <div class="acordeon__body">
  341. <div class="acordeon__body__menu">
  342. <li onclick="secMenu(1)"><a href="#">创业中心</a></li>
  343. <li onclick="secMenu(2)"><a href="#">孵化众创 </a></li>
  344. <li onclick="secMenu(3)"><a href="#">院士工作站 </a></li>
  345. <li onclick="secMenu(4)"><a href="#">技术合同登记点 </a></li>
  346. <li onclick="secMenu(5)"><a href="#">企业技术中心 </a></li>
  347. <li onclick="secMenu(6)"><a href="#">专家大院 </a></li>
  348. <li onclick="secMenu(7)"><a href="#">星众空间 </a></li>
  349. <li onclick="secMenu(8)"><a href="#">测试中心 </a></li>
  350. <li onclick="secMenu(9)"><a href="#">产业基地</a></li>
  351. <li onclick="secMenu(10)"><a href="#">创新联盟 </a></li>
  352. </div>
  353. </div>
  354. </div>
  355. <div class="acordeon">
  356. <div class="acordeon__head" onclick="firstMenu(6)">
  357. <p class="acordeon__head--title">重大项目</p>
  358. <img src="down.png" />
  359. </div>
  360. <div class="acordeon__body">
  361. <div class="acordeon__body__menu">
  362. <li onclick="secMenu(1)"><a href="#">承接单位</a></li>
  363. <li onclick="secMenu(2)"><a href="#">负责人</a></li>
  364. <li onclick="secMenu(3)"><a href="#">技术成果/在研</a></li>
  365. </div>
  366. </div>
  367. </div>
  368. </div>
  369. </div>
  370. </div>
  371. <script src="${contextPath}/mapApply/nav.js" type="text/javascript"></script>
  372. <script src="${contextPath}/js/jquery.min.js" type="text/javascript"></script>
  373. <script src="${contextPath}/js/bootstrap.min.js" type="text/javascript"></script>
  374. <script type="text/javascript"
  375. src="http://api.map.baidu.com/api?v=2.0&ak=hBMSWzhG6vGdgnwa2Y6LwkFXjkGu0lpr"></script>
  376. <script type="text/javascript"
  377. src="http://api.map.baidu.com/library/SearchInfoWindow/1.5/src/SearchInfoWindow_min.js"></script>
  378. <link rel="stylesheet"
  379. href="http://api.map.baidu.com/library/SearchInfoWindow/1.5/src/SearchInfoWindow_min.css" />
  380. <script type="text/javascript">
  381. function firstMenu (type){
  382. $("#Dtype").val(type)
  383. $("#Xtype").val('');
  384. var menuBody = document.querySelectorAll(".acordeon__body");
  385. for(var i=0;i<menuBody.length;i++) {
  386. menuBody[i].style.height = 0;
  387. }
  388. var thisMenuBody = menuBody[type-1];
  389. var menu = thisMenuBody.firstElementChild;
  390. if(thisMenuBody.clientHeight){
  391. thisMenuBody.style.height = 0;
  392. }else{
  393. var altoMenu = menu.clientHeight;
  394. thisMenuBody.style.height = altoMenu + "px";
  395. }
  396. }
  397. function secMenu(type) {
  398. $("#Xtype").val(type);
  399. toSearch('not clean');
  400. }
  401. //监控侧菜单
  402. /* var acordeon = document.getElementById("acordeon-content"),
  403. acordeonBody = [...document.querySelectorAll(".acordeon__body")];
  404. function openMenu(element){
  405. var parent = element.target.parentNode,
  406. lastChild = parent.lastElementChild,
  407. menu = lastChild.firstElementChild;
  408. console.log(element);
  409. console.log(lastChild)
  410. console.log(menu)
  411. acordeonBody.map(el => el.style.height = 0);
  412. if(lastChild.clientHeight){
  413. lastChild.style.height = 0;
  414. }else{
  415. var altoMenu = menu.clientHeight;
  416. lastChild.style.height = altoMenu + "px";
  417. }
  418. }
  419. function getTarget(e){
  420. if(e.target.tagName === "DIV"){
  421. openMenu(e);
  422. }
  423. }
  424. acordeon.addEventListener("click", getTarget);
  425. //侧菜单事件绑定
  426. menuEvent()
  427. function menuEvent(){
  428. var Dtype = $(".acordeon__head");
  429. var Xtype = $(".acordeon__body__menu")
  430. var _this =this;
  431. var Dtype = document.querySelectorAll('.acordeon__head');
  432. var Xtype = document.querySelectorAll('.acordeon__body__menu li');
  433. for(var i=0; i<Dtype.length;i++){
  434. $(Dtype[i]).on("click",{Dtype:i+1},function(e){
  435. $("#Dtype").val(e.handleObj.data.Dtype)
  436. $("#Xtype").val('');
  437. toSearch('not clean');
  438. })
  439. }
  440. for(var i=0; i<Xtype.length;i++){
  441. $(Xtype[i]).on("click",{Xtype:i+1},function(e){
  442. $("#Xtype").val(e.handleObj.data.Xtype)
  443. toSearch('not clean');
  444. })
  445. }
  446. } */
  447. // 百度地图API功能
  448. var map = new BMap.Map("allmap", {enableMapClick:false});// 创建Map实例
  449. var point = new BMap.Point(125.296419,43.833421);
  450. map.setMapStyle({style:'googlelite'});
  451. map.centerAndZoom(point,12);
  452. //map.setCurrentCity("长春"); // 设置地图显示的城市 此项是必须设置的
  453. /* var navigationControl = new BMap.NavigationControl({
  454. // 靠左上角位置
  455. anchor: BMAP_ANCHOR_TOP_RIGHT,
  456. // LARGE类型
  457. type: BMAP_NAVIGATION_CONTROL_LARGE,
  458. // 启用显示定位
  459. enableGeolocation: true
  460. });
  461. map.addControl(navigationControl); */
  462. // 添加定位控件
  463. var geolocationControl = new BMap.GeolocationControl();
  464. geolocationControl.addEventListener("locationSuccess", function(e){
  465. // 定位成功事件
  466. var address = '';
  467. address += e.addressComponent.province;
  468. address += e.addressComponent.city;
  469. address += e.addressComponent.district;
  470. address += e.addressComponent.street;
  471. address += e.addressComponent.streetNumber;
  472. alert("当前定位地址为:" + address);
  473. });
  474. geolocationControl.addEventListener("locationError",function(e){
  475. // 定位失败事件
  476. alert(e.message);
  477. });
  478. map.addControl(geolocationControl);
  479. function myFun(result){
  480. var cityName = result.name;
  481. map.setCenter(cityName);
  482. }
  483. var myCity = new BMap.LocalCity();
  484. myCity.get(myFun);
  485. map.enableScrollWheelZoom(true); //开启鼠标滚轮缩放
  486. /*
  487. var geolocation = new BMap.Geolocation();
  488. geolocation.getCurrentPosition(function(r){
  489. if(this.getStatus() == BMAP_STATUS_SUCCESS){
  490. var mk = new BMap.Marker(r.point);
  491. map.addOverlay(mk);
  492. map.panTo(r.point);
  493. alert('您的位置:\n'+r.point.lng+',\n'+r.point.lat);
  494. }
  495. else {
  496. alert('failed\n'+this.getStatus());
  497. }
  498. },{enableHighAccuracy: true})
  499. */
  500. function getOrganizationByCode(infotype){
  501. $.ajax({
  502. url: "${contextPath}/mapApply/getOrganizationByCode",
  503. dataType: 'json',
  504. data: {
  505. code:infotype
  506. },
  507. type: 'post',
  508. success: function(data){
  509. // alert(data.code);
  510. map.clearOverlays();
  511. if(data.length > 0){
  512. map.centerAndZoom(new BMap.Point(data[0].longitude, data[0].latitude),12);
  513. for(i=0; i < data.length; i++){
  514. var marker = new BMap.Marker(new BMap.Point(data[i].longitude, data[i].latitude)); // 创建标注
  515. map.addOverlay(marker); // 将标注添加到地图中
  516. addClickHandler(data[i], marker);
  517. }
  518. }
  519. }
  520. });
  521. }
  522. /* 下边我注释掉 */
  523. /* function getOrganizationByAlliance(infotype){
  524. $.ajax({
  525. url: "${contextPath}/mapApply/getOrganizationByAlliance",
  526. dataType: 'json',
  527. data: {
  528. code:infotype
  529. },
  530. type: 'post',
  531. success: function(data){
  532. // alert(data.code);
  533. map.clearOverlays();
  534. if(data.length > 0){
  535. map.centerAndZoom(new BMap.Point(data[0].longitude, data[0].latitude),12);
  536. for(i=0; i < data.length; i++){
  537. var marker = new BMap.Marker(new BMap.Point(data[i].longitude, data[i].latitude)); // 创建标注
  538. map.addOverlay(marker); // 将标注添加到地图中
  539. addClickHandler(data[i].mapInfo, marker);
  540. }
  541. }
  542. }
  543. });
  544. } */
  545. function addClickHandler(data,marker){
  546. var searchInfoWindow = null;
  547. searchInfoWindow = new BMapLib.SearchInfoWindow(map, data.mapInfo, {
  548. title : data.name, //标题
  549. width : 290, //宽度
  550. height : 105, //高度
  551. panel : "panel", //检索结果面板
  552. enableAutoPan : true, //自动平移
  553. searchTypes :[
  554. BMAPLIB_TAB_SEARCH, //周边检索
  555. BMAPLIB_TAB_TO_HERE, //到这里去
  556. BMAPLIB_TAB_FROM_HERE //从这里出发
  557. ]
  558. });
  559. marker.enableDragging(); //marker可拖拽
  560. marker.addEventListener("click", function(e){
  561. searchInfoWindow.open(marker);
  562. })
  563. map.addOverlay(marker);
  564. }
  565. /*var content = '<div style="margin:0;line-height:20px;padding:2px;">' +
  566. '<img src="../img/baidu.jpg" alt="" style="float:right;zoom:1;overflow:hidden;width:100px;height:100px;margin-left:3px;"/>' +
  567. '地址:长春市朝阳区前进大街与繁荣路交汇<br/>电话:(010)59928888<br/>简介:科技厅简介科技厅简介' +
  568. '</div>';*/
  569. //创建检索信息窗口对象
  570. //在地图中添加marker
  571. /* var opts = {
  572. enableMessage:true//设置允许信息窗发送短息
  573. }; */
  574. /* function openInfo(content,e){
  575. var p = e.target;
  576. var point = new BMap.Point(p.getPosition().lng, p.getPosition().lat);
  577. var infoWindow = new BMap.InfoWindow(content,opts); // 创建信息窗口对象
  578. // map.openInfoWindow(infoWindow,point); //开启信息窗口
  579. }
  580. showAlliance();
  581. <%if(""!=msg!""){%>
  582. alert('${msg}');
  583. <%}%> */
  584. //坐标点
  585. var points = [
  586. /* {point:new BMap.Point(125.297027,43.847097),title:"力旺广场",description: '这里是力旺广场',address:'力旺'},
  587. {point:new BMap.Point(125.302855,43.873426),title:"万达广场",description: '这里是万达广场',address:'万达'}, */
  588. ];
  589. var infoList = [];
  590. function turnPoint(points){
  591. //添加gps marker和label
  592. var changePoint = new BMap.Marker(points.point);
  593. //添加info框
  594. var info = new BMap.InfoWindow(points.description);
  595. changePoint.addEventListener("click", function() {
  596. // 调用了marker对象的openInfoWindow方法
  597. this.openInfoWindow(info);
  598. });
  599. infoList.push(changePoint);
  600. map.addOverlay(changePoint); //添加GPS marker
  601. var changeLabel = new BMap.Label(points.title,{offset:new BMap.Size(20,0)});
  602. changeLabel.setStyle({
  603. display: "inline-table"
  604. });
  605. changePoint.setLabel(changeLabel); //添加GPS label
  606. }
  607. setTimeout(function(){
  608. if(points.length>0){
  609. var convertor = new BMap.Convertor();
  610. for(var i=0;i<points.length;i++){
  611. turnPoint(points[i]);
  612. }
  613. }
  614. }, 1000);
  615. //查询
  616. $("#searchInput").keydown(function(e){
  617. if (e.keyCode == 13) {
  618. toSearch();
  619. }
  620. })
  621. var limit = 13;
  622. function toSearch(info){
  623. if(!info){
  624. $("#Dtype").val('');
  625. $("#Xtype").val('');
  626. }
  627. var info = $("#searchInput").val();
  628. var result = search();
  629. var totalRow = result.totalRow;
  630. if(totalRow > 0) {
  631. new myPagination({
  632. id: 'pagination',
  633. curPage:1, //初始页码
  634. pageTotal: Math.ceil(totalRow/limit), //总页数
  635. pageAmount: limit, //每页多少条
  636. dataTotal: totalRow, //总共多少条数据
  637. pageSize: 5, //可选,分页个数
  638. showPageTotalFlag:false, //是否显示数据统计
  639. showSkipInputFlag:false, //是否支持跳转
  640. getPage: function (page) {
  641. //获取当前页数
  642. console.log(page);
  643. //请求下一页数据,进行替换
  644. search(page);
  645. }
  646. })
  647. } else {
  648. $("#pagination").html('');
  649. }
  650. }
  651. function search(page){
  652. var _this = this;
  653. var totalRow = 0;
  654. var Dtype=$("#Dtype").val()|| '',
  655. Xtype=$("#Xtype").val()|| '';
  656. $.ajax({
  657. url: '${contextPath}/admin/enterprise/getMapEnterpriseList',
  658. data:{
  659. name:$("#searchInput").val() || '',
  660. code: '',
  661. pageNumber: page || 1,
  662. Dtype: Dtype,
  663. Xtype: Xtype,
  664. },
  665. async: false,
  666. cache: false,
  667. dataType: "json",
  668. success: function(data) {
  669. if(data.dateList && data.dateList.length > 0) {
  670. totalRow=data.totalPage;
  671. points = [];
  672. if(data.dateList.length > 0){
  673. for(var i = 0; i < data.dateList.length; i++){
  674. if(!data.dateList[i].longitude){
  675. continue;
  676. }
  677. _this.points.push({
  678. point: new BMap.Point(data.dateList[i].longitude,data.dateList[i].latitude),
  679. title: data.dateList[i].name || 'no title',
  680. address: data.dateList[i].addr || 'no address',
  681. description: data.dateList[i].introduction || 'no description'
  682. })
  683. }
  684. $("#resultContext").html(_this.resultList(points));
  685. _this.map.clearOverlays();
  686. var convertor = new BMap.Convertor();
  687. for(var i=0;i<_this.points.length;i++){
  688. _this.turnPoint(_this.points[i]);
  689. }
  690. }
  691. } else {
  692. $("#resultContext").html('<div style="background: #cf8312;">没有搜索到信息</div>');
  693. _this.map.clearOverlays();
  694. }
  695. },
  696. error:function(error){
  697. console.log(error)
  698. }
  699. });
  700. return {totalRow:totalRow}
  701. }
  702. function resultList(data){
  703. var html = '<div style="font: 12px arial, sans-serif;">\n'+
  704. '<div style="background: rgb(255, 255, 255);">\n'+
  705. '<ol style="list-style: none; padding: 0px; margin: 0px;">' +'<br/>';
  706. for(var i=0;i<data.length;i++) {
  707. html+=returnLi(data[i],i);
  708. }
  709. html += '</ol>\n'+
  710. '</div>\n'+
  711. '<div style="white-space: nowrap; text-align: right; background: rgb(229, 236, 249); margin-top: 5px; padding: 2px; overflow: hidden; zoom: 1;">\n'+
  712. '<div style="float: left; margin-right: 5px;">\n'+
  713. '<p style="margin:0;padding:0;white-space:nowrap">\n'+
  714. '</p>\n'+
  715. '</div>\n'+
  716. '</div>\n'+'<br/>';
  717. return html;
  718. }
  719. function returnLi(data,index){
  720. var url = data.detailUrl ? data.detailUrl : "#",
  721. title = data.title ? data.title : 'none',
  722. address = data.address ? data.address : 'none';
  723. var li = '<li onclick="toOpenInfo('+index+')" style="margin: 10px 0px; padding: 0px 5px 5px 0px; cursor: pointer; overflow: hidden; line-height: 17px;">\n'+
  724. '<span style="background:url(http://api.map.baidu.com/images/markers.png) -23px -275px no-repeat;width:19px;height:25px;cursor:pointer;float:left;*zoom:1;overflow:hidden;margin:2px 3px 0 5px;*margin-right:0px;display:inline;">&nbsp;</span>\n'+
  725. '<div style="zoom: 1; overflow: hidden; padding: 0px 5px;">\n'+
  726. '<div style="line-height:20px;font-size:12px;">'+
  727. '<a target="_blank" href="'+url+'" style="margin-left:5px;font-size:12px;color:#3d6dcc;font-weight:normal;text-decoration:none;">\n '+title+'</a>\n'+
  728. '</div>\n'+
  729. '<div style="padding:2px 0;line-height:18px;*zoom:1;overflow:hidden;">\n'+
  730. '<span style="float:left;*zoom:1;overflow:hidden;padding-right:5px;*margin-right:-3px;">地址:</span>\n'+
  731. '<span style="color:#000000;display:block;zoom:1;overflow:hidden;">\n '+address+'</span>\n'+
  732. '</div>\n';
  733. if(data.phoneNumber){
  734. li+='<div style="padding:2px 0;line-height:18px;*zoom:1;overflow:hidden;">\n'+
  735. '<span style="float:left;font-weight:bold;*zoom:1;overflow:hidden;padding-right:5px;*margin-right:-3px;">电话:</span>\n'+
  736. '<span style="color:#000000;">\n'+data.phoneNumber+'</span>\n'+
  737. '</div>\n';
  738. }
  739. li+='</div>\n'+
  740. '</li>';
  741. return li;
  742. }
  743. function toOpenInfo(index){
  744. //添加info框
  745. var info = new BMap.InfoWindow(points[index].description);
  746. map.openInfoWindow(info,points[index].point);
  747. }
  748. </script>
  749. </body>
  750. </html>