amapnow.vue 67 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144
  1. <template>
  2. <div class="map-wrap">
  3. <div id="container" tabindex="0"></div>
  4. <div id="mask"></div>
  5. <div class="yun-wrap">
  6. <img class="yun yun1" src="../assets/img/云1.png" alt />
  7. </div>
  8. <div class="yun-wrap">
  9. <img class="yun yun2" src="../assets/img/云2.png" alt />
  10. </div>
  11. <div class="yun-wrap">
  12. <img class="yun yun3" src="../assets/img/云3.png" alt />
  13. </div>
  14. <el-dialog title="查看图片" :modal="false" :visible.sync="imgDialogVisible" width="40%">
  15. <img width="100%" style="height:580px" :src="dialogImageUrl" alt />
  16. </el-dialog>
  17. </div>
  18. </template>
  19. <script>
  20. import AMapLoader from '@amap/amap-jsapi-loader';
  21. import { mapMutations, mapState, mapGetters } from 'vuex';
  22. import {
  23. smallClassMap,
  24. smallClassMapFile,
  25. rightScrollData,
  26. forestSample,
  27. alarmDataApi,
  28. financeBasePlant,
  29. financeBaseDetail,
  30. farmInfo,
  31. smallClassDetail,
  32. treePlant,
  33. smallClassCount,
  34. projectList
  35. } from '@/service/index.js';
  36. import axios from 'axios';
  37. export default {
  38. name: 'Mapview',
  39. data() {
  40. return {
  41. imgDialogVisible: false,
  42. dialogImageUrl: null,
  43. AMap: null,
  44. map: null,
  45. lngLat: [106.628201, 26.646694],
  46. adName: '贵州省',
  47. mapLevel: 'province',
  48. adcode: '贵州省',
  49. parentId: '520000',
  50. province: '',
  51. zoom: 8,
  52. districtExplorer: null,
  53. tipMarker: null,
  54. $tipMarkerContent: null,
  55. currentAreaNode: null,
  56. cityMarkerArr: [],
  57. eventMarker: null,
  58. baseMarker: null,
  59. streetMarkerArr: [],
  60. leftPage: 'forest',
  61. putPolygonData: [],
  62. //乡镇边界
  63. townPolygons: [],
  64. // 基地详情
  65. baseMarkers: [],
  66. // 小班详情
  67. smallMarkers: [],
  68. // 时间详情
  69. eventMarkers: [],
  70. // 林场
  71. treesMarkerArr: [],
  72. // 小班边界
  73. smallClassMapArr: [],
  74. // 作物
  75. economicsArr: [],
  76. // 基地定位
  77. baseMarkerArr: [],
  78. // 时间信息
  79. eventMarkersArr: [],
  80. // 样地、小班
  81. forestMarkerArr: [],
  82. // 样地号
  83. smallClassNArr: [],
  84. // 森林资源小班边界
  85. smallClassPolygonArr: [],
  86. // 林木结构小班边界
  87. treesPolygonArr: [],
  88. treeCompMarkers: [],
  89. townPolygonArr: [],
  90. economicsArr: [],
  91. selectData: {},
  92. districtData: {},
  93. streetData: {},
  94. projectMarkerArr: [],
  95. projectSmallClassArr: [],
  96. sampleData: {},
  97. // 项目小班边界
  98. smallClassProject:[],
  99. };
  100. },
  101. watch: {
  102. '$store.state.addr.parentId': {
  103. handler(val) {
  104. // 加载小班边界
  105. // this.getSmallClass();
  106. if (this.projectMarkerArr) {
  107. this.map.remove(this.projectMarkerArr);
  108. }
  109. // if (this.smallClassPolygonArr) {
  110. // this.map.remove(this.smallClassPolygonArr);
  111. // }
  112. // if (this.treesPolygonArr) {
  113. // this.map.remove(this.treesPolygonArr);
  114. // }
  115. this.getProjectList();
  116. // this.parentId = val;
  117. console.log(val);
  118. console.log(this.$store.state.addr.changeParentId);
  119. this.parentId = val;
  120. this.switch2AreaNode(this.parentId);
  121. console.log(this.$store.state.addr.mapLevel);
  122. if (this.$store.state.addr.mapLevel != 'street') {
  123. if (this.townPolygons) {
  124. this.map.remove(this.townPolygons);
  125. }
  126. if (this.townPolygonArr) {
  127. this.map.remove(this.townPolygonArr);
  128. }
  129. }
  130. }
  131. },
  132. '$store.state.addr.selectStreet'(val) {
  133. if (val.label && val.value && val.areaId) {
  134. this.map.remove(this.polygon);
  135. let labelTown = val.label;
  136. this.map.setCity(labelTown);
  137. }
  138. },
  139. '$store.state.addr.page': {
  140. handler(val) {
  141. this.leftPage = val;
  142. if (!this.parentId) {
  143. this.parentId = '520000';
  144. this.$store.state.addr.parentName = '贵州省';
  145. }
  146. if (this.parentId) {
  147. // this.getSmallClass(val);
  148. this.mapPolygon();
  149. }
  150. if (val == 'treeSpecies') {
  151. this.addTreeSpeciesPolygon();
  152. }
  153. if (val == 'forest' || val == 'treeSpecies') {
  154. this.getProjectList();
  155. }
  156. if (val != 'forest') {
  157. this.map.remove(this.forestMarkerArr);
  158. this.map.remove(this.smallClassNArr);
  159. // this.map.remove(this.smallClassPolygonArr);
  160. if (this.projectMarkerArr) {
  161. this.map.remove(this.projectMarkerArr);
  162. }
  163. }
  164. if (val != 'treeSpecies') {
  165. this.map.remove(this.forestMarkerArr);
  166. this.map.remove(this.treesPolygonArr);
  167. if (this.projectMarkerArr) {
  168. this.map.remove(this.projectMarkerArr);
  169. }
  170. }
  171. if (val != 'economics') {
  172. this.map.remove(this.economicsArr);
  173. this.map.remove(this.baseMarkerArr);
  174. }
  175. if (val != 'event') {
  176. this.map.remove(this.eventMarkersArr);
  177. }
  178. }
  179. },
  180. '$store.state.addr.smallClassSearch': {
  181. handler: function (val, oldVal) {
  182. let _this = this;
  183. if (val) {
  184. if (val.longitude && val.latitude) {
  185. this.sampleData = val;
  186. if (_this.smallMarkers) {
  187. _this.map.remove(_this.smallMarkers);
  188. }
  189. if (this.smallClassProject) {
  190. this.map.remove(this.smallClassProject);
  191. }
  192. let lanLatArr = [val.longitude, val.latitude];
  193. let imgList = [];
  194. if (val.imageList.length > 0) {
  195. val.imageList.forEach((element) => {
  196. imgList.push(`<img id="markerLabel" src="${element.image}"/>`);
  197. });
  198. } else {
  199. imgList.push('暂无图片');
  200. }
  201. this.imgClick();
  202. let smallLabel =
  203. "<div class='info-details'>" +
  204. "<h5 class='marker-title'>" +
  205. val.countyName +
  206. '-' +
  207. val.smallNumber +
  208. '</h5>' +
  209. "<div class='marker-content'>" +
  210. '<div>' +
  211. '<p>小班号:' +
  212. val.smallNumber +
  213. '</p>' +
  214. '<p>样地数:' +
  215. val.sampleCount +
  216. '</p>' +
  217. '<p>小班蓄积量:' +
  218. val.smallClassStock +
  219. '(立方米)' +
  220. '</p>' +
  221. '<p>小班占地面积:' +
  222. val.landArea +
  223. '(亩)' +
  224. '</p>' +
  225. '<p>小班树种组成:' +
  226. val.treeComp +
  227. '</p>' +
  228. '<p>地类:' +
  229. val.landType +
  230. '</p>' +
  231. '<p>林地权属:' +
  232. val.landOwner +
  233. '</p>' +
  234. '<p>林木权属:' +
  235. val.forestOwner +
  236. '</p>' +
  237. '<p>林种:' +
  238. val.forestClass +
  239. '</p>' +
  240. '<p>树种结构:' +
  241. val.treeStruct +
  242. '</p>' +
  243. '</div>' +
  244. '<div>' +
  245. '<p>起源:' +
  246. val.origin +
  247. '</p>' +
  248. '<p>优势树种:' +
  249. val.superTree +
  250. '</p>' +
  251. '<p>主要灌木名称:' +
  252. val.shrubName +
  253. '</p>' +
  254. '<p>地貌:' +
  255. val.landForm +
  256. '</p>' +
  257. '<p>海拔:' +
  258. val.altitude +
  259. '</p>' +
  260. '<p>坡位:' +
  261. val.slopePosit +
  262. '</p>' +
  263. '<p>坡向:' +
  264. val.slopeDirect +
  265. '</p>' +
  266. '<p>坡形:' +
  267. val.slopeForm +
  268. '</p>' +
  269. '<p>坡度:' +
  270. val.slope +
  271. '</p>' +
  272. '<p>森林健康度:' +
  273. val.forestHealth +
  274. '</p>' +
  275. '</div>' +
  276. '</div>' +
  277. '<div class="imgList">' +
  278. "<span class='marker-span'>图片:</span>" +
  279. '<div class="marker-imgs">' +
  280. imgList +
  281. '</div>' +
  282. '</div>' +
  283. '</div>';
  284. this.smallMarker = new AMap.Marker({
  285. map: this.map,
  286. position: lanLatArr,
  287. icon: require('@/assets/img/small-marker.png'),
  288. anchor: 'bottom-center',
  289. offset: new AMap.Pixel(0, 0),
  290. zIndex: 9999
  291. });
  292. this.smallMarker.setLabel({
  293. direction: 'right',
  294. offset: new AMap.Pixel(-230, -160), //设置文本标注偏移量
  295. content: smallLabel //设置文本标注内容
  296. });
  297. this.smallMarker.on('click', (e) => {
  298. this.smallMarker.setLabel({
  299. direction: 'right',
  300. offset: new AMap.Pixel(-230, -160), //设置文本标注偏移量
  301. content: smallLabel //设置文本标注内容
  302. });
  303. });
  304. this.smallMarkers.push(_this.smallMarker);
  305. if (val.countyCode) {
  306. // this.switch2AreaNode(val.countyCode.substring(0, 6));
  307. let selectCity = '';
  308. switch (val.cityName) {
  309. case '黔西南州':
  310. selectCity = '黔西南布依族苗族自治州';
  311. break;
  312. case '黔东南州':
  313. selectCity = '黔东南苗族侗族自治州';
  314. break;
  315. case '黔南州':
  316. selectCity = '黔南布依族苗族自治州';
  317. break;
  318. }
  319. this.$store.dispatch('searchArea', {
  320. parentId: val.cityCode.substring(0, 6),
  321. name: selectCity,
  322. mapLevel: 'city'
  323. });
  324. if (val.cityCode) {
  325. this.changeSelectCity({
  326. value: val.cityCode,
  327. label: selectCity,
  328. areaId: val.cityId
  329. });
  330. }
  331. if (val.countyCode) {
  332. this.changeSelectDistrict({
  333. value: val.countyCode,
  334. label: val.countyName,
  335. areaId: val.countyId
  336. });
  337. }
  338. }
  339. if (this.projectMarkerArr) {
  340. this.map.remove(this.projectMarkerArr);
  341. }
  342. this.getProjectList();
  343. if (val.mapInfo) {
  344. let polyData = JSON.parse(val.mapInfo);
  345. let smallClassPolygon = new AMap.Polygon({
  346. map: _this.map,
  347. path: polyData.features[0].geometry.coordinates,
  348. strokeOpacity: 1,
  349. fillOpacity: 0.5,
  350. strokeColor: 'red',
  351. strokeWeight: 2,
  352. zIndex: 999,
  353. cursor: 'pointer',
  354. fillColor: 'red'
  355. });
  356. this.smallClassProject.push(smallClassPolygon);
  357. }
  358. }
  359. }
  360. }
  361. },
  362. '$store.state.addr.eventData': {
  363. deep: true,
  364. immediate: true,
  365. handler: function (val, oldVal) {
  366. let _this = this;
  367. if (val) {
  368. if (val.longitude && val.latitude) {
  369. if (_this.eventMarkers) {
  370. _this.map.remove(_this.eventMarkers);
  371. }
  372. let lanLatArr = [val.longitude, val.latitude];
  373. let baseIcon = '';
  374. let fireIcon = require('@/assets/img/fire.png');
  375. let cutTreeIcon = require('@/assets/img/cutTree.png');
  376. let insectpestIcon = require('@/assets/img/insectpest.png');
  377. let stealIcon = require('@/assets/img/steal.png');
  378. if (val.eventType == 1) {
  379. val.eventContLabel = '火灾';
  380. baseIcon = fireIcon;
  381. } else if (val.eventType == 2) {
  382. val.eventContLabel = '砍伐';
  383. baseIcon = cutTreeIcon;
  384. } else if (val.eventType == 3) {
  385. val.eventContLabel = '病虫害';
  386. baseIcon = insectpestIcon;
  387. } else if (val.eventType == 4) {
  388. val.eventContLabel = '偷盗林木';
  389. baseIcon = stealIcon;
  390. }
  391. let treeSmallLabel =
  392. "<div class='info-small'>" +
  393. "<h5 class='marker-title'>历史事件" +
  394. '</h5>' +
  395. "<div class='marker-content'>" +
  396. '<p>事件类型:' +
  397. val.eventContLabel +
  398. '</p>' +
  399. '<p>上报时间:' +
  400. val.createTime +
  401. '</p>' +
  402. '<p>上报人:' +
  403. val.createBy +
  404. '</p>' +
  405. '<p>位置:' +
  406. val.cityName +
  407. val.countyName +
  408. val.townName +
  409. val.villageName +
  410. '</p>' +
  411. '</div>' +
  412. '</div>';
  413. this.eventMarker = new AMap.Marker({
  414. map: this.map,
  415. position: lanLatArr,
  416. icon: baseIcon,
  417. anchor: 'bottom-center',
  418. offset: new AMap.Pixel(0, 0),
  419. zIndex: 9999
  420. });
  421. this.eventMarker.setLabel({
  422. direction: 'top',
  423. offset: new AMap.Pixel(-10, 0), //设置文本标注偏移量
  424. content: treeSmallLabel //设置文本标注内容
  425. });
  426. this.eventMarkers.push(this.eventMarker);
  427. // this.map.add(this.eventMarker);
  428. }
  429. }
  430. }
  431. },
  432. '$store.state.addr.baseDetail': {
  433. deep: true,
  434. immediate: true,
  435. handler: function (val, oldVal) {
  436. let _this = this;
  437. if (val) {
  438. if (val.baseLongitude && val.baseLatitude && !val.name) {
  439. let lanLatArr = [val.baseLongitude, val.baseLatitude];
  440. let treeSmallLabel =
  441. "<div class='info-small'>" +
  442. "<h5 class='marker-title'>" +
  443. val.baseName +
  444. '</h5>' +
  445. "<div class='marker-content'>" +
  446. '<p>基地名称:' +
  447. val.baseName +
  448. '</p>' +
  449. '<p>种植/养殖/加工作物:' +
  450. val.cropName +
  451. '</p>' +
  452. '<p>占地面积:' +
  453. val.baseArea +
  454. '亩' +
  455. '</p>' +
  456. '<p>位置:' +
  457. val.cityName +
  458. val.countyName +
  459. val.townName +
  460. '</p>' +
  461. '</div>' +
  462. '</div>';
  463. this.baseMarker = new AMap.Marker({
  464. map: this.map,
  465. position: lanLatArr,
  466. icon: require('@/assets/img/small-marker.png'),
  467. anchor: 'bottom-center',
  468. offset: new AMap.Pixel(0, 0),
  469. zIndex: 9999
  470. });
  471. this.baseMarker.setLabel({
  472. direction: 'top',
  473. offset: new AMap.Pixel(0, 0), //设置文本标注偏移量
  474. content: treeSmallLabel //设置文本标注内容
  475. });
  476. this.baseMarkers.push(_this.baseMarker);
  477. } else if (val.name == false && _this.baseMarker) {
  478. this.map.on('rightclick', function (e) {
  479. _this.map.remove(_this.baseMarkers);
  480. });
  481. }
  482. }
  483. }
  484. },
  485. '$store.state.addr.mapLevel': {
  486. handler(val) {
  487. if (val === 'street') {
  488. // this.getSmallClass();
  489. }
  490. }
  491. },
  492. '$store.state.addr.smallClassMap': {
  493. handler(val) {
  494. console.log(val);
  495. if (val) {
  496. if (this.projectSmallClassArr) {
  497. this.map.remove(this.projectSmallClassArr);
  498. }
  499. let capitals = { animations: 'scaless' };
  500. val.forEach((element) => {
  501. let lnglat = new AMap.LngLat(element.longitude, element.latitude);
  502. var projectSmallClass = new AMap.Text({
  503. map: this.map,
  504. text: ' ',
  505. textAlign: 'center',
  506. verticalAlign: 'middle', //middle 、bottom
  507. draggable: true,
  508. cursor: 'pointer',
  509. angle: 2,
  510. style: {
  511. width: '1px',
  512. height: '1px',
  513. 'border-radius': '50%',
  514. 'border-width': 0,
  515. 'text-align': 'center',
  516. 'font-size': '12px',
  517. color: 'blue',
  518. 'background-color': 'red',
  519. // '-moz-box-shadow': '0px 0px 20px 2px '+capitals[i].color,
  520. // 'box-shadow': '0px 0px 20px 2px '+capitals[i].color,
  521. animation:
  522. capitals.animations +
  523. '1s infinite cubic-bezier(0, 0, 0.49, 1.02)'
  524. // 'animation': 'myfirst 1s infinite'
  525. },
  526. position: lnglat
  527. });
  528. this.projectSmallClassArr.push(projectSmallClass);
  529. });
  530. }
  531. }
  532. }
  533. },
  534. computed: {
  535. ...mapGetters(['vuexCityList', 'vuexDistrictList', 'vuexStreetList']),
  536. ...mapState(['selectCity', 'selectDistrict', 'selectStreet'])
  537. },
  538. created() {
  539. this.getTreePlant();
  540. },
  541. mounted() {
  542. this.initAMap();
  543. // 加载小班边界
  544. // this.getSmallClass();
  545. },
  546. methods: {
  547. ...mapMutations([
  548. 'changeSelectCity',
  549. 'changeSelectDistrict',
  550. 'changeSelectStreet',
  551. 'changeSelectAddr'
  552. ]),
  553. initAMap() {
  554. window._AMapSecurityConfig = {
  555. securityJsCode: 'e6666dfe93e7d3c6f3a5dc35cad6befb' // 密钥
  556. };
  557. let _this = this;
  558. AMapLoader.load({
  559. key: 'f79d862df9288710e3dce6591af9dff1', //设置您的key
  560. version: '2.0',
  561. plugins: [
  562. 'AMap.ToolBar',
  563. 'AMap.Driving',
  564. 'AMap.DistrictSearch',
  565. 'AMap.MapboxVectorTileLayer'
  566. ],
  567. Loca: {
  568. version: '2.0'
  569. },
  570. AMapUI: {
  571. version: '1.1',
  572. plugins: ['overlay/SimpleMarker']
  573. },
  574. features: ['road', 'bg', 'building']
  575. }).then((AMap) => {
  576. _this.AMap = AMap;
  577. _this.map = new AMap.Map('container', {
  578. viewMode: '3D',
  579. zoom: _this.zoom,
  580. center: _this.lngLat,
  581. pitch: 45,
  582. terrain: true,
  583. features: ['road', 'bg', 'building'],
  584. layers: [new AMap.TileLayer.Satellite()]
  585. });
  586. AMapUI.load(
  587. ['ui/geo/DistrictExplorer', 'ui/geo/DistrictCluster', 'lib/$'],
  588. function (DistrictExplorer, DistrictCluster, $) {
  589. window.DistrictCluster = DistrictCluster;
  590. _this.loadMapData(DistrictExplorer, $);
  591. }
  592. );
  593. _this.map.on('rightclick', function (e) {
  594. if (_this.smallMarkers.length > 0) {
  595. _this.map.remove(_this.smallMarkers);
  596. }
  597. if (_this.smallClassPolygonArr) {
  598. _this.map.remove(_this.smallClassPolygonArr);
  599. }
  600. if (_this.treeCompMarkers.length > 0) {
  601. _this.map.remove(_this.treeCompMarkers);
  602. }
  603. });
  604. let wms = new AMap.TileLayer.WMTS({
  605. url: 'http://t4.tianditu.gov.cn/img_w/wmts',
  606. blend: false,
  607. tileSize: 256,
  608. params: {
  609. Layer: 'img',
  610. Version: '1.0.0',
  611. Format: 'tiles',
  612. TileMatrixSet: 'w',
  613. STYLE: 'default',
  614. tk: '064688075f565aa463866b915c378e00'
  615. }
  616. });
  617. wms.setMap(_this.map);
  618. this.map.on('mousewheel', (e) => {
  619. var zoom = this.map.getZoom(); //获取当前地图级别
  620. if (
  621. zoom > '10.5' &&
  622. zoom < '11' &&
  623. this.$store.state.addr.mapLevel == 'street'
  624. ) {
  625. if (this.districtData.value) {
  626. let districtCode = this.districtData.value.substring(0, 6);
  627. this.$store.dispatch('searchArea', {
  628. parentId: districtCode,
  629. name: this.districtData.label,
  630. mapLevel: 'district'
  631. });
  632. }
  633. }
  634. if (
  635. zoom > '9' &&
  636. zoom < '9.5' &&
  637. this.$store.state.addr.mapLevel == 'district'
  638. ) {
  639. if (this.selectData.value) {
  640. let districtCode = this.selectData.value.substring(0, 6);
  641. this.$store.dispatch('searchArea', {
  642. parentId: districtCode,
  643. name: this.selectData.label,
  644. mapLevel: 'city'
  645. });
  646. }
  647. }
  648. if (
  649. zoom > '7.6' &&
  650. zoom < '7.9' &&
  651. this.$store.state.addr.mapLevel == 'city'
  652. ) {
  653. this.$store.dispatch('searchArea', {
  654. parentId: '520000',
  655. name: '贵州省',
  656. mapLevel: 'province'
  657. });
  658. }
  659. });
  660. });
  661. },
  662. loadMapData(DistrictExplorer, $) {
  663. let that = this;
  664. //创建一个实例
  665. that.districtExplorer = window.districtExplorer = new DistrictExplorer({
  666. eventSupport: true, //打开事件支持
  667. bubble: true,
  668. map: that.map
  669. });
  670. //当前聚焦的区域
  671. this.$tipMarkerContent = $('<div class="tipMarker top"></div>');
  672. // eslint-disable-next-line no-undef
  673. this.tipMarker = new AMap.Marker({
  674. content: this.$tipMarkerContent.get(0),
  675. offset: new AMap.Pixel(0, 0),
  676. bubble: true
  677. });
  678. //监听feature的hover事件
  679. this.districtExplorer.on(
  680. 'featureMouseout featureMouseover',
  681. (e, feature) => {
  682. this.toggleHoverFeature(
  683. feature,
  684. e.type === 'featureMouseover',
  685. e.originalEvent ? e.originalEvent.lnglat : null
  686. );
  687. }
  688. );
  689. //监听鼠标在feature上滑动
  690. this.districtExplorer.on('featureMousemove', (e) => {
  691. //更新提示位置
  692. this.tipMarker.setPosition(e.originalEvent.lnglat);
  693. });
  694. let adName = that.adName; //贵州省
  695. let mapLevel = that.mapLevel;
  696. let adcode = '520000';
  697. //feature被点击
  698. this.districtExplorer.on('featureClick', (e, feature) => {
  699. const props = feature.properties;
  700. if (props.subFeatureIndex != null) {
  701. adName = props.name;
  702. adcode = props.adcode;
  703. mapLevel = props.level;
  704. // for (let item of this.forestFarmData) {
  705. // if (props.name == item.cityName || props.name == item.countyName) {
  706. mapLevel = props.level;
  707. adName = props.name;
  708. this.$store.dispatch('searchArea', {
  709. parentId: props.adcode,
  710. name: props.name,
  711. mapLevel: props.level
  712. });
  713. let valCode = props.adcode + '000000';
  714. let areaId = '';
  715. this.vuexCityList.forEach((item) => {
  716. if (valCode == item.areaCode) {
  717. areaId = item.areaId;
  718. }
  719. });
  720. this.vuexDistrictList.forEach((item) => {
  721. if (valCode == item.areaCode) {
  722. areaId = item.areaId;
  723. }
  724. });
  725. if (props.level == 'city') {
  726. this.changeSelectCity({
  727. value: valCode,
  728. label: props.name,
  729. areaId: areaId
  730. });
  731. } else if (props.level == 'district') {
  732. this.changeSelectDistrict({
  733. value: valCode,
  734. label: props.name,
  735. areaId: areaId
  736. });
  737. }
  738. console.log(props.name);
  739. this.switch2AreaNode(adcode);
  740. this.map.remove(this.treesMarkerArr);
  741. // }
  742. // }
  743. }
  744. if (this.projectMarkerArr) {
  745. this.map.remove(this.projectMarkerArr);
  746. }
  747. });
  748. this.switch2AreaNode(adcode);
  749. this.getProjectList();
  750. },
  751. //根据Hover状态设置相关样式
  752. toggleHoverFeature(feature, isHover, position) {
  753. if (feature.properties.subFeatureIndex != null) {
  754. this.tipMarker.setMap(isHover ? this.map : null);
  755. if (!feature) {
  756. return;
  757. }
  758. const props = feature.properties;
  759. if (isHover) {
  760. //更新提示内容
  761. this.$tipMarkerContent.html(props.name);
  762. //更新位置
  763. this.tipMarker.setPosition(position || props.center);
  764. }
  765. //更新相关多边形的样式
  766. const polys = this.districtExplorer.findFeaturePolygonsByAdcode(
  767. props.adcode
  768. );
  769. polys.forEach((elemnt) => {
  770. elemnt.setOptions({
  771. fillColor: '#0dbc79',
  772. fillOpacity: isHover ? 0.5 : 0
  773. });
  774. });
  775. }
  776. },
  777. //绘制某个区域的边界
  778. renderAreaPolygons(areaNode) {
  779. // 加载小班边界
  780. // this.getSmallClass();
  781. let _this = this;
  782. //更新地图视野
  783. if (this.$store.state.addr.mapLevel != 'street') {
  784. this.map.setBounds(areaNode.getBounds(), null, null, false);
  785. }
  786. // 加载相关标识
  787. this.mapPolygon();
  788. //清除已有的绘制内容
  789. this.districtExplorer.clearFeaturePolygons();
  790. // 清除已绘制的省市县名称
  791. this.map.remove(this.cityMarkerArr);
  792. //绘制子区域
  793. this.districtExplorer.renderSubFeatures(areaNode, () => {
  794. return {
  795. cursor: 'default',
  796. bubble: true,
  797. strokeColor: 'yellow', //线颜色
  798. strokeOpacity: 1, //线透明度
  799. strokeWeight: 2, //线宽
  800. fillOpacity: 0 //填充透明度
  801. };
  802. });
  803. //绘制父区域
  804. this.districtExplorer.renderParentFeature(areaNode, {
  805. cursor: 'default',
  806. bubble: true,
  807. strokeColor: '#00eeff', //线颜色
  808. strokeOpacity: 1, //线透明度
  809. strokeWeight: 2, //线宽
  810. fillOpacity: 0 //填充透明度
  811. });
  812. // 绘制父级蒙版
  813. let areaPolygon = areaNode.getParentFeature();
  814. let outer = [
  815. new AMap.LngLat(-360, 90, true),
  816. new AMap.LngLat(-360, -90, true),
  817. new AMap.LngLat(360, -90, true),
  818. new AMap.LngLat(360, 90, true)
  819. ];
  820. let areaPolygonArr = [];
  821. areaPolygon.geometry.coordinates.forEach((element) => {
  822. areaPolygonArr.push(element[0]);
  823. });
  824. if (this.polygon) {
  825. this.map.remove(this.polygon);
  826. }
  827. if (_this.streetMarkerArr) {
  828. this.map.remove(_this.streetMarkerArr);
  829. }
  830. let holes = areaPolygonArr;
  831. let pathArray = [outer];
  832. pathArray.push.apply(pathArray, holes);
  833. this.polygon = new AMap.Polygon({
  834. pathL: pathArray,
  835. map: this.map,
  836. strokeColor: '#00eeff',
  837. strokeWeight: 1,
  838. fillColor: '#0c1b05', // 遮罩背景色
  839. fillOpacity: 0.8,
  840. height: 10000
  841. });
  842. this.polygon.setPath(pathArray);
  843. // if (areaPolygon.properties.level != 'district') {
  844. // this.setMarker();
  845. // } else {
  846. // this.map.remove(this.treesMarkerArr);
  847. // }
  848. //查询乡镇 标识
  849. if (areaPolygon.properties.level == 'district') {
  850. if (this.$store.state.addr.mapLevel != 'street') {
  851. this.getrjx(areaPolygon.properties.name);
  852. }
  853. AMap.plugin(['AMap.DistrictSearch'], function () {
  854. let district = new AMap.DistrictSearch({
  855. // 返回行政区边界坐标等具体信息
  856. extensions: 'all',
  857. // 设置查询行政区级别为 区 (district)
  858. level: areaPolygon.properties.level,
  859. // 显示下级行政区级数,1表示返回下一级行政区
  860. subdistrict: 1
  861. });
  862. let areaCode = areaPolygon.properties.name;
  863. district.search(areaCode, function (status, result) {
  864. let streetArr = result.districtList[0].districtList;
  865. for (let elementLs in streetArr) {
  866. _this.streetMarker = new AMap.Text({
  867. //c城市指示标
  868. text: streetArr[elementLs].name,
  869. zIndex: 1,
  870. map: _this.map,
  871. anchor: 'center', // 设置文本标记锚点
  872. style: {
  873. padding: '0px 6px',
  874. color: '#fff',
  875. border: 'none',
  876. fontSize: '12px',
  877. 'background-color': '#E6810C'
  878. },
  879. position: [
  880. streetArr[elementLs].center.lng,
  881. streetArr[elementLs].center.lat
  882. ]
  883. });
  884. _this.streetMarkerArr.push(_this.streetMarker);
  885. }
  886. });
  887. });
  888. }
  889. // 添加城市标识
  890. let cityArr = areaNode.getSubFeatures();
  891. if (cityArr) {
  892. for (let i = 0; i < cityArr.length; i++) {
  893. this.cityMarker = new AMap.Text({
  894. //c城市指示标
  895. text: cityArr[i].properties.name,
  896. zIndex: 1,
  897. map: this.map,
  898. anchor: 'center', // 设置文本标记锚点
  899. style: {
  900. padding: '0px 6px',
  901. color: '#fff',
  902. border: 'none',
  903. fontSize: '12px',
  904. 'background-color': '#E6810C'
  905. },
  906. position: cityArr[i].properties.centroid
  907. });
  908. this.cityMarkerArr.push(this.cityMarker);
  909. }
  910. }
  911. },
  912. //切换区域后刷新显示内容
  913. refreshAreaNode(areaNode) {
  914. this.districtExplorer.setHoverFeature(null);
  915. this.renderAreaPolygons(areaNode);
  916. },
  917. //切换区域
  918. switch2AreaNode(adcode, mapLevel, selectStreet, page, callback) {
  919. // if (
  920. // this.currentAreaNode &&
  921. // '' + this.currentAreaNode.getAdcode() === '' + adcode
  922. // ) {
  923. // return;
  924. // }
  925. this.loadAreaNode(adcode, (error, areaNode) => {
  926. if (error) {
  927. if (callback) {
  928. callback(error);
  929. }
  930. return;
  931. }
  932. this.currentAreaNode = areaNode;
  933. //设置当前使用的定位用节点
  934. this.districtExplorer.setAreaNodesForLocating([this.currentAreaNode]);
  935. this.refreshAreaNode(areaNode);
  936. if (callback) {
  937. callback(null, areaNode);
  938. }
  939. });
  940. },
  941. // 加载区域
  942. loadAreaNode(adcode, callback) {
  943. this.districtExplorer.loadAreaNode(adcode, (error, areaNode) => {
  944. if (error) {
  945. if (callback) {
  946. callback(error);
  947. }
  948. window.console.error(error);
  949. return;
  950. }
  951. if (callback) {
  952. callback(null, areaNode);
  953. }
  954. });
  955. },
  956. // 加载林场
  957. // setMarker() {
  958. // this.forestFarmData = [];
  959. // if (this.treesMarkerArr.length > 0) {
  960. // this.map.remove(this.treesMarkerArr);
  961. // }
  962. // farmInfo().then((res) => {
  963. // this.forestFarmData = res.rows;
  964. // let parentMarker = require('@/assets/img/pre-marker.png');
  965. // this.forestFarmData.forEach((item) => {
  966. // let selectCity = this.$store.state.addr.selectCity.label;
  967. // switch (this.$store.state.addr.selectCity.label) {
  968. // case '黔西南州':
  969. // selectCity = '黔西南布依族苗族自治州';
  970. // break;
  971. // case '黔东南州':
  972. // selectCity = '黔东南苗族侗族自治州';
  973. // break;
  974. // case '黔南州':
  975. // selectCity = '黔南布依族苗族自治州';
  976. // break;
  977. // }
  978. // if (this.$store.state.addr.selectCity.label) {
  979. // if (selectCity == item.cityName) {
  980. // let lngLat = [item.longitude, item.latitude];
  981. // this.treesMarker = new AMap.Marker({
  982. // map: this.map,
  983. // position: lngLat,
  984. // icon: parentMarker,
  985. // anchor: 'bottom-center',
  986. // offset: new AMap.Pixel(0, 0)
  987. // });
  988. // this.treesMarker.setLabel({
  989. // direction: 'bottom',
  990. // offset: new AMap.Pixel(0, 0), //设置文本标注偏移量
  991. // content: `<div>${item.forestName}</div>` //设置文本标注内容
  992. // });
  993. // this.treesMarkerArr.push(this.treesMarker);
  994. // }
  995. // } else {
  996. // let lngLat = [item.longitude, item.latitude];
  997. // this.treesMarker = new AMap.Marker({
  998. // map: this.map,
  999. // position: lngLat,
  1000. // icon: parentMarker,
  1001. // anchor: 'bottom-center',
  1002. // offset: new AMap.Pixel(0, 0)
  1003. // });
  1004. // this.treesMarker.setLabel({
  1005. // direction: 'bottom',
  1006. // offset: new AMap.Pixel(0, 0), //设置文本标注偏移量
  1007. // content: `<div>${item.forestName}</div>` //设置文本标注内容
  1008. // });
  1009. // this.treesMarkerArr.push(this.treesMarker);
  1010. // }
  1011. // });
  1012. // });
  1013. // },
  1014. // 按区域统计小班
  1015. // getSmallClassCount() {
  1016. // let _this = this;
  1017. // let params = {
  1018. // cityId: this.$store.state.addr.selectCity.areaId,
  1019. // countyId: this.$store.state.addr.selectDistrict.areaId,
  1020. // townId: this.$store.state.addr.selectStreet.areaId
  1021. // };
  1022. // smallClassCount(params).then((res) => {
  1023. // if (res.code == 200) {
  1024. // let infoIcon = new AMap.Icon({
  1025. // size: new AMap.Size(20, 25), // 图标尺寸
  1026. // image: require('@/assets/img/infoMarker.png'),
  1027. // imageSize: new AMap.Size(20, 25) // 根据所设置的大小拉伸或压缩图片
  1028. // });
  1029. // res.data.forEach((element) => {
  1030. // if (element.longitude && element.latitude) {
  1031. // let infoContent = `<div id='infoStyle' class='infoLabel'><h3>${element.areaName}</h3><div class='content-sty'><p class='infoClass'>小班数量:${element.classNumber}个</p><p class='infoClass'>蓄积量:${element.smallClassStock}立方米</p><p class='infoClass'>占地面积:${element.landArea}亩</p></div></div>`;
  1032. // let lnglat = new AMap.LngLat(element.longitude, element.latitude);
  1033. // var projectMarker = new AMap.Marker({
  1034. // map: this.map,
  1035. // position: lnglat,
  1036. // offset: new AMap.Pixel(0, -30),
  1037. // icon: infoIcon,
  1038. // zIndex: 999,
  1039. // topWhenClick: true
  1040. // });
  1041. // projectMarker.on('click', function (e) {
  1042. // // console.log(e);
  1043. // projectMarker.setLabel({
  1044. // direction: 'top',
  1045. // offset: new AMap.Pixel(0, 0), //设置文本标注偏移量
  1046. // content: infoContent //设置文本标注内容
  1047. // });
  1048. // });
  1049. // projectMarker.on('mouseout', function (e) {
  1050. // projectMarker.setLabel({
  1051. // content: null //设置文本标注内容
  1052. // });
  1053. // });
  1054. // this.projectMarkerArr.push(projectMarker);
  1055. // }
  1056. // });
  1057. // }
  1058. // });
  1059. // },
  1060. // 查询项目列表
  1061. getProjectList() {
  1062. let params = {
  1063. cityId: this.$store.state.addr.selectCity.areaId,
  1064. countyId: this.$store.state.addr.selectDistrict.areaId,
  1065. townId: this.$store.state.addr.selectStreet.areaId
  1066. };
  1067. projectList(params).then((res) => {
  1068. if (res.code == 200) {
  1069. let infoIcon = new AMap.Icon({
  1070. size: new AMap.Size(20, 25), // 图标尺寸
  1071. image: require('@/assets/img/infoMarker.png'),
  1072. imageSize: new AMap.Size(20, 25) // 根据所设置的大小拉伸或压缩图片
  1073. });
  1074. res.rows.forEach((element) => {
  1075. if (element.longitude && element.latitude) {
  1076. let lnglat = new AMap.LngLat(element.longitude, element.latitude);
  1077. var projectMarker = new AMap.Marker({
  1078. map: this.map,
  1079. position: lnglat,
  1080. offset: new AMap.Pixel(0, -30),
  1081. icon: infoIcon,
  1082. zIndex: 999,
  1083. topWhenClick: true
  1084. });
  1085. this.projectMarkerArr.push(projectMarker);
  1086. }
  1087. });
  1088. }
  1089. });
  1090. },
  1091. // 加载乡镇边界
  1092. getrjx(cityName) {
  1093. console.log(cityName);
  1094. if (cityName == '榕江县') {
  1095. axios.get('/static/rongjangintown.json').then((res) => {
  1096. this.putPolygonData = res.data.features;
  1097. this.putPolygon();
  1098. });
  1099. } else if (cityName == '清镇市') {
  1100. axios.get('/static/qingzhenzhen.json').then((res) => {
  1101. this.putPolygonData = res.data.features;
  1102. this.putPolygon();
  1103. });
  1104. }
  1105. },
  1106. // 绘制乡镇边界
  1107. putPolygon() {
  1108. let that = this;
  1109. this.putPolygonData.forEach((element) => {
  1110. this.boundaryPolygon = new AMap.Polygon({
  1111. map: that.map,
  1112. path: element.geometry.coordinates,
  1113. strokeOpacity: 1,
  1114. fillOpacity: 0,
  1115. strokeColor: 'yellow',
  1116. strokeWeight: 1,
  1117. zIndex: 999,
  1118. cursor: 'pointer'
  1119. });
  1120. that.townPolygons.push(this.boundaryPolygon);
  1121. this.boundaryPolygon.on('click', (e) => {
  1122. let centerLanLatArr = [e.lnglat.lng, e.lnglat.lat];
  1123. that.map.remove(that.townPolygons);
  1124. // that.districtExplorer.clearFeaturePolygons();
  1125. let valCode = element.properties.XIANG;
  1126. let areaId = '';
  1127. let label = element.properties.XIANG_NAME;
  1128. this.vuexStreetList.forEach((item) => {
  1129. if (valCode == item.areaCode) {
  1130. areaId = item.areaId;
  1131. }
  1132. });
  1133. this.changeSelectStreet({
  1134. value: valCode,
  1135. label: label,
  1136. areaId: areaId
  1137. });
  1138. this.changeSelectAddr('street');
  1139. this.$store.dispatch('searchArea', {
  1140. parentId: valCode,
  1141. name: label,
  1142. mapLevel: 'street'
  1143. });
  1144. let townPolygon = new AMap.Polygon({
  1145. map: that.map,
  1146. path: element.geometry.coordinates,
  1147. strokeColor: 'yellow',
  1148. strokeWeight: 3,
  1149. fillOpacity: 0
  1150. });
  1151. this.townPolygonArr.push(townPolygon);
  1152. that.map.setZoomAndCenter(14, centerLanLatArr, false, 13);
  1153. });
  1154. that.boundaryPolygon.on('rightclick', function (e) {
  1155. if (that.smallMarkers || that.baseMarkers || that.eventMarkers) {
  1156. that.map.remove(that.smallMarkers);
  1157. that.map.remove(that.baseMarkers);
  1158. that.map.remove(that.eventMarkers);
  1159. }
  1160. });
  1161. });
  1162. },
  1163. // async getSmallClass() {
  1164. // let that = this;
  1165. // that.smallClassMapArr = [];
  1166. // let params = {
  1167. // // cityId: that.$store.state.addr.selectCity.areaId,
  1168. // // countyId: that.$store.state.addr.selectDistrict.areaId,
  1169. // townId: this.$store.state.addr.selectStreet.areaId
  1170. // };
  1171. // if (that.smallClassPolygonArr.length > 0) {
  1172. // that.map.remove(that.smallClassPolygonArr);
  1173. // }
  1174. // if (that.treesPolygonArr.length > 0) {
  1175. // that.map.remove(that.treesPolygonArr);
  1176. // }
  1177. // // let pageData = {
  1178. // // pageNum: 0,
  1179. // // pageSize: 25
  1180. // // };
  1181. // let mapLevel = that.$store.state.addr.mapLevel;
  1182. // let res = await smallClassMap({ ...params });
  1183. // if (mapLevel == 'street') {
  1184. // res.rows.forEach((item) => {
  1185. // if (that.leftPage === 'forest') {
  1186. // this.addForestPolygon(item);
  1187. // } else if (this.leftPage === 'treeSpecies') {
  1188. // this.addTreeSpeciesPolygon(item);
  1189. // }
  1190. // });
  1191. // }
  1192. // // if (res.code == 200 && res.total > 25) {
  1193. // // const total = res.total;
  1194. // // const totalPage = Math.ceil(total / pageData.pageSize);
  1195. // // const render = (page, mapLevel) => {
  1196. // // if (page >= totalPage) return;
  1197. // // requestAnimationFrame(() => {
  1198. // // render(page + 1, mapLevel);
  1199. // // pageData.pageNum = page;
  1200. // // smallClassMap({ ...params, ...pageData }).then((response) => {
  1201. // // if (response.code == 200) {
  1202. // // response.rows.forEach((item) => {
  1203. // // // if (item.smallId != null) {
  1204. // // // }
  1205. // // // this.smallClassMapArr.push(item);
  1206. // // if (that.leftPage === 'forest') {
  1207. // // this.addForestPolygon(item);
  1208. // // } else if (this.leftPage === 'treeSpecies') {
  1209. // // this.addTreeSpeciesPolygon(item);
  1210. // // }
  1211. // // });
  1212. // // }
  1213. // // });
  1214. // // });
  1215. // // };
  1216. // // render(pageData.pageNum, mapLevel);
  1217. // // } else {
  1218. // // res.rows.forEach((item) => {
  1219. // // if (that.leftPage === 'forest') {
  1220. // // this.addForestPolygon(item);
  1221. // // } else if (this.leftPage === 'treeSpecies') {
  1222. // // this.addTreeSpeciesPolygon(item);
  1223. // // }
  1224. // // });
  1225. // // }
  1226. // },
  1227. mapPolygon() {
  1228. // if (this.smallClassMapArr) {
  1229. // if (this.leftPage === 'forest') {
  1230. // // this.addForestPolygon(this.smallClassMapArr);
  1231. // if (
  1232. // // this.$store.state.addr.mapLevel == 'district' ||
  1233. // this.$store.state.addr.mapLevel == 'street'
  1234. // ) {
  1235. // this.getForestSample(this.leftPage);
  1236. // }
  1237. // } else if (this.leftPage === 'treeSpecies') {
  1238. // // this.addTreeSpeciesPolygon();
  1239. // if (
  1240. // // this.$store.state.addr.mapLevel == 'district' ||
  1241. // this.$store.state.addr.mapLevel == 'street'
  1242. // ) {
  1243. // this.getRightScrollData(this.leftPage);
  1244. // }
  1245. // } else
  1246. if (this.leftPage === 'economics') {
  1247. this.getEconomics();
  1248. } else if (this.leftPage === 'event') {
  1249. this.getEven();
  1250. }
  1251. // }
  1252. },
  1253. // 地图上绘制小班边界
  1254. // addForestPolygon(item) {
  1255. // let that = this;
  1256. // if (item) {
  1257. // // console.log(item);
  1258. // // smallClassMapArr.forEach((item) => {
  1259. // let polyData = JSON.parse(item.mapInfo);
  1260. // for (let elementLs in polyData.features) {
  1261. // let smallClassPolygon = new AMap.Polygon({
  1262. // map: that.map,
  1263. // path: polyData.features[elementLs].geometry.coordinates,
  1264. // strokeOpacity: 1,
  1265. // fillOpacity: 0,
  1266. // strokeColor: 'red',
  1267. // strokeWeight: 2,
  1268. // zIndex: 999,
  1269. // cursor: 'pointer',
  1270. // fillColor: ''
  1271. // });
  1272. // this.smallClassPolygonArr.push(smallClassPolygon);
  1273. // smallClassPolygon.on('click', (e) => {
  1274. // let imgList = [];
  1275. // if (item.imageList.length > 0) {
  1276. // item.imageList.forEach((element) => {
  1277. // imgList.push(`<img id="markerLabel" src="${element.image}"/>`);
  1278. // });
  1279. // } else {
  1280. // imgList.push('暂无图片');
  1281. // }
  1282. // this.imgClick();
  1283. // let smallLabel =
  1284. // "<div class='info-details'>" +
  1285. // "<h5 class='marker-title'>" +
  1286. // item.countyName +
  1287. // '-' +
  1288. // item.smallNumber +
  1289. // '</h5>' +
  1290. // "<div class='marker-content'>" +
  1291. // '<div>' +
  1292. // '<p>小班号:' +
  1293. // item.smallNumber +
  1294. // '</p>' +
  1295. // '<p>样地数:' +
  1296. // item.sampleCount +
  1297. // '</p>' +
  1298. // '<p>小班蓄积量:' +
  1299. // item.smallClassStock +
  1300. // '(立方米)' +
  1301. // '</p>' +
  1302. // '<p>小班占地面积:' +
  1303. // item.landArea +
  1304. // '(亩)' +
  1305. // '</p>' +
  1306. // '<p>小班树种组成:' +
  1307. // item.treeComp +
  1308. // '</p>' +
  1309. // '<p>地类:' +
  1310. // item.landType +
  1311. // '</p>' +
  1312. // '<p>林地权属:' +
  1313. // item.landOwner +
  1314. // '</p>' +
  1315. // '<p>林木权属:' +
  1316. // item.forestOwner +
  1317. // '</p>' +
  1318. // '<p>林种:' +
  1319. // item.forestClass +
  1320. // '</p>' +
  1321. // '<p>树种结构:' +
  1322. // item.treeStruct +
  1323. // '</p>' +
  1324. // '</div>' +
  1325. // '<div>' +
  1326. // '<p>起源:' +
  1327. // item.origin +
  1328. // '</p>' +
  1329. // '<p>优势树种:' +
  1330. // item.superTree +
  1331. // '</p>' +
  1332. // '<p>主要灌木名称:' +
  1333. // item.shrubName +
  1334. // '</p>' +
  1335. // '<p>地貌:' +
  1336. // item.landForm +
  1337. // '</p>' +
  1338. // '<p>海拔:' +
  1339. // item.altitude +
  1340. // '</p>' +
  1341. // '<p>坡位:' +
  1342. // item.slopePosit +
  1343. // '</p>' +
  1344. // '<p>坡向:' +
  1345. // item.slopeDirect +
  1346. // '</p>' +
  1347. // '<p>坡形:' +
  1348. // item.slopeForm +
  1349. // '</p>' +
  1350. // '<p>坡度:' +
  1351. // item.slope +
  1352. // '</p>' +
  1353. // '<p>森林健康度:' +
  1354. // item.forestHealth +
  1355. // '</p>' +
  1356. // '</div>' +
  1357. // '</div>' +
  1358. // '<div class="imgList">' +
  1359. // "<span class='marker-span'>图片:</span>" +
  1360. // '<div class="marker-imgs">' +
  1361. // imgList +
  1362. // '</div>' +
  1363. // '</div>' +
  1364. // '</div>';
  1365. // that.smallMarker = new AMap.Marker({
  1366. // map: that.map,
  1367. // position: lanLatArr,
  1368. // icon: require('@/assets/img/small-marker.png'),
  1369. // anchor: 'bottom-center',
  1370. // offset: new AMap.Pixel(-5, -6)
  1371. // });
  1372. // that.smallMarker.setLabel({
  1373. // direction: 'right',
  1374. // offset: new AMap.Pixel(-230, -160), //设置文本标注偏移量
  1375. // content: smallLabel //设置文本标注内容
  1376. // });
  1377. // // that.smallMarker.setMap(that.map);
  1378. // that.smallMarkers.push(that.smallMarker);
  1379. // smallClassPolygon.setOptions({
  1380. // fillOpacity: 0.7,
  1381. // fillColor: 'yellow'
  1382. // });
  1383. // });
  1384. // smallClassPolygon.on('mouseout', () => {
  1385. // smallClassPolygon.setOptions({
  1386. // fillOpacity: 0,
  1387. // fillColor: '#ccebc5'
  1388. // });
  1389. // });
  1390. // }
  1391. // if (item.longitude && item.latitude) {
  1392. // var lanLatArr = [];
  1393. // lanLatArr = [item.longitude, item.latitude];
  1394. // if (
  1395. // this.$store.state.addr.mapLevel == 'district' ||
  1396. // this.$store.state.addr.mapLevel == 'street'
  1397. // ) {
  1398. // this.smallClassN = new AMap.Text({
  1399. // map: this.map,
  1400. // position: lanLatArr,
  1401. // text: item.smallNumber,
  1402. // anchor: 'bottom-center',
  1403. // offset: new AMap.Pixel(0, 8),
  1404. // style: {
  1405. // 'background-color': 'transparent',
  1406. // border: 'none',
  1407. // color: '#05dfff',
  1408. // fontSize: '12px'
  1409. // }
  1410. // });
  1411. // this.smallClassNArr.push(this.smallClassN);
  1412. // }
  1413. // }
  1414. // // this.map.add(that.smallClassPolygon);
  1415. // // });
  1416. // }
  1417. // },
  1418. // 小班点击获取详情图放大
  1419. imgClick() {
  1420. document.getElementsByTagName('div')[0].addEventListener('click', (e) => {
  1421. if (e.target.id === 'markerLabel') {
  1422. this.imgDialogVisible = true;
  1423. this.dialogImageUrl = e.target.currentSrc;
  1424. }
  1425. });
  1426. },
  1427. // 获取样地数据
  1428. getForestSample() {
  1429. console.log(this.sampleData);
  1430. let sampleMarker = require('@/assets/img/sample-marker.png');
  1431. let iconMeta = [28, 28];
  1432. this.setMarkers(this.sampleData, sampleMarker, iconMeta, page);
  1433. },
  1434. // 添加地图标注(样地、树种)
  1435. setMarkers(res, sampleMarker, iconMeta, page) {
  1436. let _this = this;
  1437. if (this.forestMarker) {
  1438. this.forestMarker.setMap(null);
  1439. this.forestMarker = null;
  1440. }
  1441. this.markerData = res;
  1442. let iconMarker = sampleMarker;
  1443. let iconMetaSet = iconMeta;
  1444. let sampleIcon = new AMap.Icon({
  1445. size: new AMap.Size(iconMetaSet[0], iconMetaSet[1]), // 图标尺寸
  1446. image: iconMarker,
  1447. imageSize: new AMap.Size(iconMetaSet[0], iconMetaSet[1]) // 根据所设置的大小拉伸或压缩图片
  1448. });
  1449. this.markerData.rows.forEach((item) => {
  1450. let lngLat = [item.longitude, item.latitude];
  1451. if (item.longitude && item.latitude) {
  1452. this.forestMarker = new AMap.Marker({
  1453. map: _this.map,
  1454. position: lngLat,
  1455. icon: sampleIcon,
  1456. anchor: 'bottom-center',
  1457. offset: new AMap.Pixel(0, -18)
  1458. });
  1459. if (page === 'forest') {
  1460. this.forestMarker.setLabel({
  1461. direction: 'right',
  1462. offset: new AMap.Pixel(-8, 0), //设置文本标注偏移量
  1463. content: `<div style="color:#05dfff">${item.smallNumber}-${item.sampleNumber}</div>` //设置文本标注内容
  1464. });
  1465. let clickLabel =
  1466. "<div class='info-small'>" +
  1467. "<h5 class='marker-title'>" +
  1468. item.smallNumber +
  1469. '-' +
  1470. item.sampleNumber +
  1471. '</h5>' +
  1472. "<div class='marker-content'>" +
  1473. '<p>样地号:' +
  1474. item.sampleNumber +
  1475. '</p>' +
  1476. '<p>所属小班:' +
  1477. item.smallNumber +
  1478. '</p>' +
  1479. '<p>样地蓄积:' +
  1480. item.landStock +
  1481. '</p>' +
  1482. '<p>样地株数:' +
  1483. item.landNumber +
  1484. '</p>' +
  1485. '</div>' +
  1486. '</div>';
  1487. let lastMarker = new AMap.Marker({
  1488. position: lngLat,
  1489. icon: sampleIcon,
  1490. anchor: 'bottom-center',
  1491. offset: new AMap.Pixel(0, -18)
  1492. });
  1493. lastMarker.setLabel({
  1494. zIndex: 120,
  1495. direction: 'top',
  1496. offset: new AMap.Pixel(-4, 0), //设置文本标注偏移量
  1497. content: clickLabel //设置文本标注内容
  1498. });
  1499. this.forestMarker.on('click', function (e) {
  1500. _this.map.add(lastMarker);
  1501. });
  1502. this.forestMarker.on('mouseout', function (e) {
  1503. _this.map.remove(lastMarker);
  1504. });
  1505. } else if (page === 'treeSpecies') {
  1506. this.forestMarker.setLabel({
  1507. direction: 'top',
  1508. offset: new AMap.Pixel(0, 8), //设置文本标注偏移量
  1509. content: `<div class="label-treecomp">${item.treeComp}<span class="smallH">${item.smallNumber}</span></div>` //设置文本标注内容
  1510. });
  1511. }
  1512. // this.map.add(this.forestMarker);
  1513. // forestMarker
  1514. this.forestMarkerArr.push(this.forestMarker);
  1515. }
  1516. });
  1517. },
  1518. addTreeSpeciesPolygon() {
  1519. let that = this;
  1520. let item = this.sampleData;
  1521. // that.smallClassMapArr.forEach((item) => {
  1522. let polyData = JSON.parse(item.mapInfo);
  1523. for (let elementLs in polyData.features) {
  1524. let polygonColor = '';
  1525. this.treePlant.forEach((tree) => {
  1526. if (tree.plantName == item.superTree && item.superTree == '硬阔') {
  1527. polygonColor = '#00da85';
  1528. } else if (
  1529. tree.plantName == item.superTree &&
  1530. item.superTree == '软阔'
  1531. ) {
  1532. polygonColor = '#009bfd';
  1533. } else if (
  1534. tree.plantName == item.superTree &&
  1535. item.superTree == '杉木'
  1536. ) {
  1537. polygonColor = '#eca62d';
  1538. } else if (
  1539. tree.plantName == item.superTree &&
  1540. item.superTree == '马尾松'
  1541. ) {
  1542. polygonColor = '#b82dec';
  1543. }
  1544. });
  1545. let polygon = new AMap.Polygon({
  1546. map: that.map,
  1547. path: polyData.features[elementLs].geometry.coordinates,
  1548. strokeOpacity: 1,
  1549. fillOpacity: 0.6,
  1550. strokeColor: 'red',
  1551. strokeWeight: 2,
  1552. zIndex: 999,
  1553. cursor: 'pointer',
  1554. fillColor: polygonColor
  1555. });
  1556. this.treesPolygonArr.push(polygon);
  1557. if (item.longitude && item.latitude) {
  1558. var lanLatArr = [];
  1559. polygon.on('click', (e) => {
  1560. lanLatArr = [item.longitude, item.latitude];
  1561. let treeSmallLabel =
  1562. "<div class='info-small'>" +
  1563. "<h5 class='marker-title'>小班" +
  1564. item.smallNumber +
  1565. '</h5>' +
  1566. "<div class='marker-content'>" +
  1567. '<p>树种组成:' +
  1568. item.treeComp +
  1569. '</p>' +
  1570. '<p>树种结构:' +
  1571. item.treeStruct +
  1572. '</p>' +
  1573. '<p>优势树种:' +
  1574. item.superTree +
  1575. '</p>' +
  1576. '<p>优势树种平均胸径:' +
  1577. item.superTreeDbh +
  1578. '厘米' +
  1579. '</p>' +
  1580. '<p>优势树种平均高:' +
  1581. item.superTreeHigh +
  1582. '米' +
  1583. '</p>' +
  1584. '<p>位置:' +
  1585. item.countyName +
  1586. item.townName +
  1587. item.villageName +
  1588. '</p>' +
  1589. '</div>' +
  1590. '</div>';
  1591. that.smallMarker = new AMap.Marker({
  1592. map: that.map,
  1593. position: lanLatArr,
  1594. icon: require('@/assets/img/small-marker.png'),
  1595. anchor: 'bottom-center',
  1596. offset: new AMap.Pixel(0, 0)
  1597. });
  1598. that.smallMarker.setLabel({
  1599. direction: 'top',
  1600. offset: new AMap.Pixel(-10, 0), //设置文本标注偏移量
  1601. content: treeSmallLabel //设置文本标注内容
  1602. });
  1603. that.treeCompMarkers.push(that.smallMarker);
  1604. });
  1605. polygon.on('mouseout', (e) => {
  1606. this.map.remove(that.smallMarker);
  1607. });
  1608. }
  1609. }
  1610. // });
  1611. },
  1612. // 获取小班列表
  1613. getRightScrollData(page) {
  1614. rightScrollData({
  1615. // cityId: this.$store.state.addr.selectCity.areaId,
  1616. // countyId: this.$store.state.addr.selectDistrict.areaId,
  1617. townId: this.$store.state.addr.selectStreet.areaId
  1618. }).then((res) => {
  1619. let sampleMarker = require('@/assets/img/sanjiaod.png');
  1620. let iconMeta = [16, 10];
  1621. this.setMarkers(res, sampleMarker, iconMeta, page);
  1622. });
  1623. },
  1624. // 事件信息
  1625. getEven() {
  1626. let _this = this;
  1627. alarmDataApi().then((res) => {
  1628. res.data.forEach((item) => {
  1629. let lanLatArr = [item.longitude, item.latitude];
  1630. let baseIcon = '';
  1631. let fireIcon = require('@/assets/img/fire.png');
  1632. let cutTreeIcon = require('@/assets/img/cutTree.png');
  1633. let insectpestIcon = require('@/assets/img/insectpest.png');
  1634. let stealIcon = require('@/assets/img/steal.png');
  1635. if (item.eventType == 1) {
  1636. item.eventContLabel = '火灾';
  1637. baseIcon = fireIcon;
  1638. } else if (item.eventType == 2) {
  1639. item.eventContLabel = '砍伐';
  1640. baseIcon = cutTreeIcon;
  1641. } else if (item.eventType == 3) {
  1642. item.eventContLabel = '病虫害';
  1643. baseIcon = insectpestIcon;
  1644. } else if (item.eventType == 4) {
  1645. item.eventContLabel = '偷盗林木';
  1646. baseIcon = stealIcon;
  1647. }
  1648. _this.smallMarker = new AMap.Marker({
  1649. map: _this.map,
  1650. position: lanLatArr,
  1651. icon: baseIcon,
  1652. anchor: 'bottom-center',
  1653. offset: new AMap.Pixel(0, 0),
  1654. zIndex: 999
  1655. });
  1656. _this.eventMarkersArr.push(_this.smallMarker);
  1657. _this.smallMarker.on('click', function (e) {
  1658. let treeSmallLabel =
  1659. "<div class='info-small'>" +
  1660. "<h5 class='marker-title'>最新事件" +
  1661. '</h5>' +
  1662. "<div class='marker-content'>" +
  1663. '<p>事件类型:' +
  1664. item.eventContLabel +
  1665. '</p>' +
  1666. '<p>上报时间:' +
  1667. item.createTime +
  1668. '</p>' +
  1669. '<p>上报人:' +
  1670. item.createBy +
  1671. '</p>' +
  1672. '<p>位置:' +
  1673. item.cityName +
  1674. item.countyName +
  1675. item.townName +
  1676. item.villageName +
  1677. '</p>' +
  1678. '</div>' +
  1679. '</div>';
  1680. _this.eventMarker = new AMap.Marker({
  1681. position: lanLatArr,
  1682. icon: baseIcon,
  1683. anchor: 'bottom-center',
  1684. offset: new AMap.Pixel(0, 0),
  1685. zIndex: 999
  1686. });
  1687. _this.eventMarker.setLabel({
  1688. direction: 'top',
  1689. offset: new AMap.Pixel(-10, 0), //设置文本标注偏移量
  1690. content: treeSmallLabel //设置文本标注内容
  1691. });
  1692. _this.map.add(_this.eventMarker);
  1693. });
  1694. _this.smallMarker.on('mouseout', function (e) {
  1695. if (!_this.eventMarker) {
  1696. return;
  1697. } else {
  1698. _this.map.remove(_this.eventMarker);
  1699. }
  1700. });
  1701. });
  1702. });
  1703. },
  1704. // 林业经济
  1705. getEconomics() {
  1706. let _this = this;
  1707. financeBasePlant({
  1708. cityId: this.$store.state.addr.selectCity.areaId,
  1709. countyId: this.$store.state.addr.selectDistrict.areaId
  1710. // townId: this.$store.state.addr.selectStreet.areaId
  1711. }).then((res) => {
  1712. let economicsList = [];
  1713. let baseList = [];
  1714. res.rows.forEach((element) => {
  1715. economicsList.push({
  1716. longitude: element.cateLongitude,
  1717. latitude: element.cateLatitude,
  1718. icon: element.image
  1719. });
  1720. baseList.push({
  1721. baseId: element.baseId,
  1722. baseName: element.baseName,
  1723. longitude: element.baseLongitude,
  1724. latitude: element.baseLatitude
  1725. });
  1726. });
  1727. economicsList.forEach((item) => {
  1728. let lanLatArr = [item.longitude, item.latitude];
  1729. let beeIcon = item.icon;
  1730. let iconMeta = [82, 26];
  1731. let sampleIcon = new AMap.Icon({
  1732. size: new AMap.Size(iconMeta[0], iconMeta[1]), // 图标尺寸
  1733. image: beeIcon,
  1734. imageSize: new AMap.Size(iconMeta[0], iconMeta[1]) // 根据所设置的大小拉伸或压缩图片
  1735. });
  1736. this.smallMarker = new AMap.Marker({
  1737. map: _this.map,
  1738. position: lanLatArr,
  1739. icon: sampleIcon,
  1740. anchor: 'bottom-center',
  1741. offset: new AMap.Pixel(0, 0)
  1742. });
  1743. this.economicsArr.push(this.smallMarker);
  1744. // this.smallMarker.setMap(this.map);
  1745. });
  1746. baseList.forEach((element) => {
  1747. let lanLatArr = [element.longitude, element.latitude];
  1748. let baseIcon = require('@/assets/img/postion.png');
  1749. let iconMeta = [20, 29];
  1750. let sampleIcon = new AMap.Icon({
  1751. size: new AMap.Size(iconMeta[0], iconMeta[1]), // 图标尺寸
  1752. image: baseIcon,
  1753. imageSize: new AMap.Size(iconMeta[0], iconMeta[1]) // 根据所设置的大小拉伸或压缩图片
  1754. });
  1755. this.baseMarker = new AMap.Marker({
  1756. map: this.map,
  1757. position: lanLatArr,
  1758. icon: sampleIcon,
  1759. anchor: 'bottom-center',
  1760. offset: new AMap.Pixel(0, 0)
  1761. });
  1762. this.baseMarker.setLabel({
  1763. direction: 'right',
  1764. offset: new AMap.Pixel(0, 0), //设置文本标注偏移量
  1765. content: `<div>${element.baseName}</div>` //设置文本标注内容
  1766. });
  1767. this.baseMarkerArr.push(this.baseMarker);
  1768. this.baseMarker.on('click', function (e) {
  1769. financeBaseDetail({ baseId: element.baseId }).then((res) => {
  1770. if (res.code == 200) {
  1771. let treeSmallLabel =
  1772. "<div class='info-small'>" +
  1773. "<h5 class='marker-title'>" +
  1774. res.data.baseName +
  1775. '</h5>' +
  1776. "<div class='marker-content'>" +
  1777. '<p>基地名称:' +
  1778. res.data.baseName +
  1779. '</p>' +
  1780. '<p>种植/养殖/加工作物:' +
  1781. res.data.cropName +
  1782. '</p>' +
  1783. '<p>占地面积:' +
  1784. res.data.baseArea +
  1785. '亩' +
  1786. '</p>' +
  1787. '<p>位置:' +
  1788. res.data.cityName +
  1789. res.data.countyName +
  1790. res.data.townName +
  1791. '</p>' +
  1792. '</div>' +
  1793. '</div>';
  1794. _this.baseMarker.setLabel({
  1795. direction: 'top',
  1796. offset: new AMap.Pixel(0, 0), //设置文本标注偏移量
  1797. content: treeSmallLabel //设置文本标注内容
  1798. });
  1799. }
  1800. });
  1801. });
  1802. this.baseMarker.on('mouseout', function (e) {
  1803. _this.baseMarker.setLabel({
  1804. direction: 'right',
  1805. offset: new AMap.Pixel(0, 0), //设置文本标注偏移量
  1806. content: `<div>${element.baseName}</div>` //设置文本标注内容
  1807. });
  1808. });
  1809. });
  1810. });
  1811. },
  1812. getTreePlant() {
  1813. treePlant().then((res) => {
  1814. this.treePlant = res.rows;
  1815. });
  1816. }
  1817. }
  1818. };
  1819. </script>
  1820. <style lang='scss' scoped>
  1821. #container {
  1822. width: 100%;
  1823. height: 100vh;
  1824. /deep/ .tdt-pane {
  1825. z-index: auto;
  1826. }
  1827. }
  1828. /deep/ .amap-marker-content {
  1829. .tipMarker {
  1830. color: #555;
  1831. background-color: rgba(255, 254, 239, 0.8);
  1832. border: 1px solid #7e7e7e;
  1833. padding: 2px 6px;
  1834. font-size: 12px;
  1835. white-space: nowrap;
  1836. display: inline-block;
  1837. &:before,
  1838. &:after {
  1839. content: '';
  1840. display: block;
  1841. position: absolute;
  1842. margin: auto;
  1843. width: 0;
  1844. height: 0;
  1845. border: solid transparent;
  1846. border-width: 5px 5px;
  1847. }
  1848. &.top {
  1849. transform: translate(-50%, -110%);
  1850. &:before,
  1851. &:after {
  1852. bottom: -9px;
  1853. left: 0;
  1854. right: 0;
  1855. border-top-color: rgba(255, 254, 239, 0.8);
  1856. }
  1857. &:before {
  1858. bottom: -10px;
  1859. border-top-color: #7e7e7e;
  1860. }
  1861. }
  1862. }
  1863. }
  1864. /deep/ .amap-logo,
  1865. .amap-copyright {
  1866. display: block !important;
  1867. visibility: inherit !important;
  1868. }
  1869. /deep/ .amap-icon img {
  1870. max-width: 3rem !important;
  1871. max-height: 3rem !important;
  1872. }
  1873. /deep/ .info-small {
  1874. background-image: url('../assets/img/small-label.png');
  1875. background-repeat: no-repeat;
  1876. background-size: 100% 100%;
  1877. width: 18rem;
  1878. // height: 10rem;
  1879. color: #fff;
  1880. .marker-title {
  1881. margin: 0 auto;
  1882. line-height: 30px;
  1883. }
  1884. .marker-content {
  1885. padding: 0 20px 10px 20px;
  1886. p {
  1887. text-align: left;
  1888. font-size: 12px;
  1889. margin: 0;
  1890. line-height: 28px;
  1891. }
  1892. }
  1893. }
  1894. /deep/ .info-details {
  1895. background-image: url('../assets/img/small-label.png');
  1896. background-repeat: no-repeat;
  1897. background-size: 100% 100%;
  1898. width: 26rem;
  1899. padding-bottom: 13px;
  1900. // height: 10rem;
  1901. color: #fff;
  1902. .marker-title {
  1903. margin: 0 auto;
  1904. line-height: 50px;
  1905. }
  1906. .marker-content {
  1907. display: flex;
  1908. justify-content: space-between;
  1909. padding: 0 20px 0 20px;
  1910. .marker-span {
  1911. display: block;
  1912. }
  1913. p {
  1914. text-align: left;
  1915. font-size: 12px;
  1916. margin: 0;
  1917. line-height: 18px;
  1918. }
  1919. }
  1920. .imgList {
  1921. display: block;
  1922. text-align: left;
  1923. padding: 0 20px;
  1924. .marker-span {
  1925. display: block;
  1926. }
  1927. .marker-imgs {
  1928. display: block;
  1929. line-height: 18px !important;
  1930. width: 376px;
  1931. overflow: auto;
  1932. img {
  1933. width: 40px;
  1934. height: 40px;
  1935. margin: 0 4px;
  1936. cursor: pointer;
  1937. }
  1938. }
  1939. .marker-imgs::-webkit-scrollbar {
  1940. background: transparent;
  1941. opacity: 0.6px;
  1942. width: 10px;
  1943. height: 8px;
  1944. }
  1945. .marker-imgs::-webkit-scrollbar-thumb {
  1946. background: rgba($color: #07a2eb8e, $alpha: 0.6);
  1947. border-radius: 20px;
  1948. -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  1949. }
  1950. .marker-imgs::-webkit-scrollbar-track {
  1951. /*滚动条里面轨道*/
  1952. -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  1953. border-radius: 10px;
  1954. background: transparent;
  1955. }
  1956. }
  1957. }
  1958. /deep/ .amap-marker-label {
  1959. border: 0;
  1960. background-color: transparent;
  1961. }
  1962. #mask {
  1963. width: 100%;
  1964. height: 100vh;
  1965. box-shadow: inset 0px 0px 10vw 8vw rgba(0, 10, 34, 0.54);
  1966. position: fixed;
  1967. left: 0;
  1968. right: 0;
  1969. bottom: 0;
  1970. top: 0;
  1971. pointer-events: none;
  1972. }
  1973. @keyframes imageAnimation_32630606 {
  1974. 0% {
  1975. // opacity: 0;
  1976. transform: none;
  1977. }
  1978. 34% {
  1979. // opacity: 1;
  1980. transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg) scaleX(1) scaleY(1)
  1981. translate3d(34vw, 0px, 0px);
  1982. }
  1983. 67% {
  1984. // opacity: 1;
  1985. transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg) scaleX(1) scaleY(1)
  1986. translate3d(67vw, 0px, 0px);
  1987. }
  1988. 100% {
  1989. // opacity: 0;
  1990. transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg) scaleX(1) scaleY(1)
  1991. translate3d(160vw, 0px, 0px);
  1992. }
  1993. }
  1994. .yun-wrap {
  1995. position: fixed;
  1996. left: 0;
  1997. top: 350px;
  1998. width: 100vw;
  1999. pointer-events: none;
  2000. }
  2001. .yun {
  2002. position: fixed;
  2003. left: -500px;
  2004. animation-name: imageAnimation_32630606;
  2005. animation-iteration-count: infinite;
  2006. animation-timing-function: linear;
  2007. animation-duration: 110s;
  2008. animation-delay: 0s;
  2009. -webkit-user-drag: none;
  2010. filter: none;
  2011. pointer-events: none;
  2012. }
  2013. .yun2 {
  2014. bottom: 20px;
  2015. animation-duration: 90s;
  2016. animation-delay: 10s;
  2017. }
  2018. .yun3 {
  2019. top: 100px;
  2020. animation-duration: 120s;
  2021. animation-delay: 15s;
  2022. }
  2023. /deep/ .label-treecomp {
  2024. position: relative;
  2025. background-color: #05dfff;
  2026. color: #fff;
  2027. padding: 6px 10px;
  2028. border-radius: 8px;
  2029. font-size: 14px;
  2030. text-align: center;
  2031. &::before {
  2032. position: absolute;
  2033. top: 26px;
  2034. left: 42%;
  2035. content: '';
  2036. width: 0px;
  2037. height: 0px;
  2038. border: 6px solid transparent;
  2039. border-top-color: #05dfff;
  2040. }
  2041. .smallH {
  2042. position: absolute;
  2043. top: 34px;
  2044. z-index: 99;
  2045. display: block;
  2046. color: #05dfff;
  2047. text-align: center;
  2048. font-size: 14px;
  2049. // left: 38%;
  2050. left: 0;
  2051. width: 100%;
  2052. }
  2053. }
  2054. /deep/ .infoLabel {
  2055. background-image: url('../assets/img/project_bac.png');
  2056. background-repeat: no-repeat;
  2057. background-size: 100% 100%;
  2058. min-width: 140px;
  2059. min-height: 63px;
  2060. position: relative;
  2061. h3 {
  2062. position: absolute;
  2063. top: 0;
  2064. left: 0;
  2065. line-height: 20px;
  2066. padding-left: 10px;
  2067. margin: 0;
  2068. }
  2069. .content-sty {
  2070. padding: 33px 10px 1px 10px;
  2071. .infoClass {
  2072. text-align: center;
  2073. background-image: url('../assets/img/project_tit.png');
  2074. background-repeat: no-repeat;
  2075. background-size: 100% 100%;
  2076. padding: 4px 10px;
  2077. margin-bottom: 6px;
  2078. margin-top: 0;
  2079. color: #ffaa00;
  2080. }
  2081. }
  2082. }
  2083. .iconContent {
  2084. position: absolute;
  2085. width: 14px;
  2086. height: 14px;
  2087. background-color: #ffff00;
  2088. border-radius: 50%;
  2089. top: 150px;
  2090. left: 100px;
  2091. }
  2092. .iconContent:before {
  2093. content: '';
  2094. display: block;
  2095. width: 14px;
  2096. height: 14px;
  2097. border-radius: 50%;
  2098. opacity: 0.7;
  2099. background-color: #ffff00;
  2100. animation: scaless 1s infinite cubic-bezier(0, 0, 0.49, 1.02);
  2101. }
  2102. @keyframes scaless {
  2103. 0% {
  2104. transform: scale(1);
  2105. }
  2106. 50%,
  2107. 75% {
  2108. transform: scale(3);
  2109. }
  2110. 78%,
  2111. 100% {
  2112. opacity: 0;
  2113. }
  2114. }
  2115. </style>