amapnow.vue 61 KB

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