animal.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485
  1. <template>
  2. <div class="visual-con">
  3. <!--头部-->
  4. <vheader></vheader>
  5. <!--主体-->
  6. <div class="visual-body">
  7. <!-- 左侧 -->
  8. <div class="leftbar w-6" :class="indentleft" ref="left">
  9. <div class="forthis">
  10. <dv-border-box-13 backgroundColor="rgba(12, 19, 38, .90)" style="padding-bottom: 1rem;">
  11. <img src="../assets/images/integrated/light.png" style="width: 100%; margin-top: .4rem;"/>
  12. <div class="i-list-con h-78">
  13. <div class="d-l-con-icon">
  14. <div class="icon-con m-btm-no icon-animal-con" :class="animalcount" @click="getInit()">
  15. <!-- -->
  16. <!--<div class="icon icon-dot"></div>-->
  17. <div class="icon-text animal-text">
  18. <h6>9</h6>
  19. <h5>总数</h5>
  20. </div>
  21. </div>
  22. </div>
  23. <div class="d-l-con-icon">
  24. <div class="icon-con icon-animal-con" :class="{on:iconCurrentIndex1==item.type}"
  25. v-for="(item,index) in animalDwfb" @click="selectForestAnimalListByType(item.type)">
  26. <div class="iconfont icon icon-normal icon-animal">
  27. <img :src="item.src">
  28. </div>
  29. <div class="icon-text icon-animal-text">
  30. <h5>{{ item.name }}</h5>
  31. </div>
  32. </div>
  33. </div>
  34. </div>
  35. </dv-border-box-13>
  36. </div>
  37. </div>
  38. <!-- 地图 -->
  39. <supermap ref="supermap" style="width: 100%;height: 100vh;" :mapDiv="'animalMap'" class="indexSupermapClass"
  40. :mapSite="{doubleClickZoom:false}" :codes="['9fa5']" :isSideBySide="false"></supermap>
  41. <!-- <button @click="showEventInfo1" style="position: absolute; right: 50%;top: 45%;z-index: 1000;">弹层事件演示用按钮-->
  42. <!-- </button>-->
  43. <!-- 右侧 -->
  44. <div class="rightbar" :class="indentright" ref="right">
  45. <div class="forthis">
  46. <dv-border-box-13 backgroundColor="rgba(12, 19, 38, .90)" style="padding-bottom: 1rem;">
  47. <img src="../assets/images/integrated/light.png" style="width: 100%; margin-top: .4rem;"/>
  48. <div class="this-title">
  49. <span>事件分布</span>
  50. <dv-decoration-3 style="width:150px;height:15px;margin-right: 1rem;"/>
  51. </div>
  52. <div class="i-list-con h-73">
  53. <div class="d-l-con-icon">
  54. <div class="h-19 overflow-y w100">
  55. <div class="d-l-con" v-for="(item,index) in animalSjfb">
  56. <div class="d-l-l-text">
  57. <i class="i-small"></i>
  58. <h4>{{ item.deptName }}</h4>
  59. </div>
  60. <div class="d-l-l-count">{{ item.count }}</div>
  61. </div>
  62. </div>
  63. </div>
  64. <div class="d-l-con">
  65. <div id="animal-chart" style="width: 100%;height:26.2vh;"></div>
  66. </div>
  67. <div class="d-l-con d-evnet-list-con" :class="{on:listCurrentIndex1==index}"
  68. v-for="(item,index) in animalSjlb"
  69. @click="dropLocation(item.latitude,item.longitude,index)">
  70. <img src="@/assets/images/visual/img-sample.png" class="event-list-img animal-img">
  71. <div class="event-list-text">
  72. <h3>{{ item.eventTitle }}</h3>
  73. <h4><span>摄像头</span><span>新上报</span><span>{{ item.reportTime }}</span>
  74. </h4>
  75. </div>
  76. </div>
  77. </div>
  78. </dv-border-box-13>
  79. </div>
  80. </div>
  81. <vBottomMenu ref="bottomMenu"></vBottomMenu>
  82. <!-- <el-tooltip :content="indentText" placement="top" :disabled="indentdisabled">-->
  83. <!-- <div class="mascot" ref="mascot" :class="indentStyle" @click="indent"><img-->
  84. <!-- src="@/assets/images/mascot.png"/>-->
  85. <!-- </div>-->
  86. <!-- </el-tooltip>-->
  87. </div>
  88. <eventLocation ref="eventLocation"></eventLocation>
  89. <TVWall ref="TVWall"></TVWall>
  90. </div>
  91. </template>
  92. <script>
  93. import {
  94. getInit,
  95. selectForestAnimalListByType
  96. } from '@/api/animal'
  97. import supermap from '@/components/supermap' //超图
  98. import vheader from '@/components/v-header.vue' //一体化共用头部
  99. import vBottomMenu from '@/components/vBottomMenu.vue' //一体化公共底部菜单
  100. import eventLocation from '@/components/eventLocation.vue' //事件定位弹窗
  101. import TVWall from '@/components/TVWall.vue' //电视墙弹窗
  102. let echarts = require('echarts')
  103. export default {
  104. components: {
  105. supermap,
  106. vheader,
  107. vBottomMenu,
  108. eventLocation,
  109. TVWall
  110. },
  111. data() {
  112. return {
  113. animalcount: '',
  114. iconCurrentIndex1: '',
  115. listCurrentIndex1: '',
  116. //左右缩进
  117. indentStyle: '',
  118. indentleft: '',
  119. indentright: '',
  120. indentText: '收起左右栏',
  121. indentdisabled: false,
  122. //虚拟数据
  123. animalDwfb: [{
  124. name: '虎',
  125. src: require('../assets/images/dwbh/hu-1.png'),
  126. type: 'forest_animal_hu'
  127. }, {
  128. name: '豹',
  129. src: require('../assets/images/dwbh/bao-1.png'),
  130. type: 'forest_animal_bao'
  131. }, {
  132. name: '蛇',
  133. src: require('../assets/images/dwbh/she-1.png'),
  134. type: 'forest_animal_she'
  135. }, {
  136. name: '鹰',
  137. src: require('../assets/images/dwbh/ying-1.png'),
  138. type: 'forest_animal_ying'
  139. }, {
  140. name: '兔',
  141. src: require('../assets/images/dwbh/tuzi-1.png'),
  142. type: 'forest_animal_tu'
  143. }, {
  144. name: '狐狸',
  145. src: require('../assets/images/dwbh/huli-1.png'),
  146. type: 'forest_animal_huli'
  147. }, {
  148. name: '狗熊',
  149. src: require('../assets/images/dwbh/gouxiong-1.png'),
  150. type: 'forest_animal_gouxiong'
  151. }, {
  152. name: '野鸡',
  153. src: require('../assets/images/dwbh/yeji-1.png'),
  154. type: 'forest_animal_yeji'
  155. }, {
  156. name: '狍子',
  157. src: require('../assets/images/dwbh/paozi-1.png'),
  158. type: 'forest_animal_paozi'
  159. }],
  160. animalSjfb: [],
  161. animalSjlb: [],
  162. markersList: [] //点位列表
  163. }
  164. },
  165. created() {
  166. /** ----------------------------------底部按钮公用组件开始------------------------------------- */
  167. window.showDialog = this.showDialog
  168. window.choseLayerSwitching = this.choseLayerSwitching
  169. window.choseLayerSwitchingList = this.choseLayerSwitchingList
  170. /** ----------------------------------底部按钮公用组件结束------------------------------------- */
  171. },
  172. mounted() {
  173. this.getInit()
  174. },
  175. methods: {
  176. /** ----------------------------------底部按钮公用组件开始------------------------------------- */
  177. showDialog(click) {
  178. if (click == 'eventLocation') {
  179. this.$refs.eventLocation.showEventLocation()
  180. this.$refs.supermap.isEditableLayers = false
  181. this.$refs.bottomMenu.showChild = false
  182. this.$refs.bottomMenu.showBanChild = false
  183. this.$refs.bottomMenu.showChangChild = false
  184. } else if (click == 'editableLayers') {
  185. this.$refs.bottomMenu.showChild = false
  186. this.$refs.bottomMenu.showBanChild = false
  187. this.$refs.bottomMenu.showChangChild = false
  188. if (!this.$refs.supermap.isEditableLayers) {
  189. this.$refs.supermap.isEditableLayers = true
  190. } else {
  191. this.$refs.supermap.isEditableLayers = false
  192. }
  193. } else if (click == 'layerSwitching') {
  194. this.$refs.supermap.isEditableLayers = false
  195. this.$refs.bottomMenu.showBanChild = false
  196. this.$refs.bottomMenu.showChangChild = false
  197. if (!this.$refs.bottomMenu.showChild) {
  198. this.$refs.bottomMenu.showChild = true
  199. } else {
  200. this.$refs.bottomMenu.showChild = false
  201. }
  202. } else if (click == 'TVWall') {
  203. this.$refs.TVWall.showTVWall()
  204. this.$refs.supermap.isEditableLayers = false
  205. this.$refs.bottomMenu.showChild = false
  206. this.$refs.bottomMenu.showBanChild = false
  207. this.$refs.bottomMenu.showChangChild = false
  208. } else if (click == 'forestban') {
  209. this.$refs.supermap.isEditableLayers = false
  210. this.$refs.bottomMenu.showChild = false
  211. this.$refs.bottomMenu.showChangChild = false
  212. if (!this.$refs.bottomMenu.showBanChild) {
  213. this.$refs.bottomMenu.showBanChild = true
  214. } else {
  215. this.$refs.bottomMenu.showBanChild = false
  216. }
  217. } else if (click == 'forestchang') {
  218. this.$refs.supermap.isEditableLayers = false
  219. this.$refs.bottomMenu.showBanChild = false
  220. this.$refs.bottomMenu.showChild = false
  221. if (!this.$refs.bottomMenu.showChangChild) {
  222. this.$refs.bottomMenu.showChangChild = true
  223. } else {
  224. this.$refs.bottomMenu.showChangChild = false
  225. }
  226. }
  227. },
  228. //选择图层
  229. choseLayerSwitching(url, isClear) {
  230. this.$refs.supermap.layerSwitching(url, isClear)
  231. },
  232. //选择图层(传递数组)
  233. choseLayerSwitchingList(urlList) {
  234. this.$refs.supermap.layerSwitchingList(urlList)
  235. },
  236. /** ----------------------------------底部按钮公用组件结束------------------------------------- */
  237. dropLocation(lat, lng, index) {
  238. this.listCurrentIndex1 = index
  239. this.$refs.supermap.dropLocation(lat, lng)
  240. },
  241. //初始化
  242. getInit() {
  243. this.iconCurrentIndex1 = ''
  244. this.animalcount = 'on'
  245. let that = this
  246. //获取左侧菜单列表
  247. getInit().then(res => {
  248. this.animalSjfb = res.data.visuForestAnimalBOList
  249. this.animalSjlb = res.data.visuForestVgdEventBOList
  250. that.markersList = []
  251. if (res.data.visuForestVgdEventBOList != null && res.data.visuForestVgdEventBOList.length >
  252. 0) {
  253. for (let i = 0; i < res.data.visuForestVgdEventBOList.length; i++) {
  254. let markersMap = {
  255. lng: 124.59,
  256. lat: 43.02,
  257. icon: 'marker',
  258. bindPopupHtml: '',
  259. click: '',
  260. parameter: '',
  261. keepBindPopup: false,
  262. isAggregation: false
  263. }
  264. if (res.data.visuForestVgdEventBOList.length > 50) {
  265. markersMap.isAggregation = true
  266. }
  267. markersMap.lng = res.data.visuForestVgdEventBOList[i].longitude
  268. markersMap.lat = res.data.visuForestVgdEventBOList[i].latitude
  269. markersMap.bindPopupHtml = '<div class="map-tip">' +
  270. '<span>' +
  271. ' <div class="d-l-con">' +
  272. ' <div class="d-l-l-text">' +
  273. ' <h4>经纬度:' + res.data.visuForestVgdEventBOList[i].longitude +
  274. ',' + res.data.visuForestVgdEventBOList[i]
  275. .latitude + '</h4>' +
  276. ' </div>' +
  277. ' </div>' +
  278. ' </span>' +
  279. '<span>' +
  280. ' <div class="d-l-con">' +
  281. ' <div class="d-l-l-text">' +
  282. ' <h4>事件名称:' + res.data.visuForestVgdEventBOList[i].eventTitle +
  283. '</h4>' +
  284. ' </div>' +
  285. ' </div>' +
  286. ' </span>' +
  287. '<span>' +
  288. ' <div class="d-l-con">' +
  289. ' <div class="d-l-l-text">' +
  290. ' <h4>事件时间:' + res.data.visuForestVgdEventBOList[i].reportTime +
  291. '</h4>' +
  292. ' </div>' +
  293. ' </div>' +
  294. ' </span>' +
  295. '</div>'
  296. that.markersList.push(markersMap)
  297. }
  298. setTimeout(() => {
  299. that.$refs.supermap.clearM(false)
  300. that.$refs.supermap.clearM(true)
  301. that.$refs.supermap.setMarkers(that.markersList)
  302. }, 1000)
  303. } else {
  304. setTimeout(() => {
  305. that.$refs.supermap.clearM(false)
  306. that.$refs.supermap.clearM(true)
  307. }, 1000)
  308. }
  309. })
  310. },
  311. selectForestAnimalListByType(type) {
  312. this.iconCurrentIndex1 = type
  313. this.animalcount = ''
  314. let that = this
  315. //获取左侧菜单列表
  316. selectForestAnimalListByType(type).then(res => {
  317. this.animalSjfb = res.data.visuForestAnimalBOList
  318. this.animalSjlb = res.data.visuForestVgdEventBOList
  319. that.markersList = []
  320. if (res.data.visuForestVgdEventBOList != null && res.data.visuForestVgdEventBOList.length >
  321. 0) {
  322. for (let i = 0; i < res.data.visuForestVgdEventBOList.length; i++) {
  323. let markersMap = {
  324. lng: 124.59,
  325. lat: 43.02,
  326. icon: 'marker',
  327. bindPopupHtml: '',
  328. click: '',
  329. parameter: '',
  330. keepBindPopup: false,
  331. isAggregation: false
  332. }
  333. if (res.data.visuForestVgdEventBOList.length > 50) {
  334. markersMap.isAggregation = true
  335. }
  336. markersMap.lng = res.data.visuForestVgdEventBOList[i].longitude
  337. markersMap.lat = res.data.visuForestVgdEventBOList[i].latitude
  338. markersMap.bindPopupHtml = '<div class="map-tip">' +
  339. '<span>' +
  340. ' <div class="d-l-con">' +
  341. ' <div class="d-l-l-text">' +
  342. ' <h4>经纬度:' + res.data.visuForestVgdEventBOList[i].longitude +
  343. ',' + res.data.visuForestVgdEventBOList[i]
  344. .latitude + '</h4>' +
  345. ' </div>' +
  346. ' </div>' +
  347. ' </span>' +
  348. '<span>' +
  349. ' <div class="d-l-con">' +
  350. ' <div class="d-l-l-text">' +
  351. ' <h4>事件名称:' + res.data.visuForestVgdEventBOList[i].eventTitle +
  352. '</h4>' +
  353. ' </div>' +
  354. ' </div>' +
  355. ' </span>' +
  356. '<span>' +
  357. ' <div class="d-l-con">' +
  358. ' <div class="d-l-l-text">' +
  359. ' <h4>事件时间:' + res.data.visuForestVgdEventBOList[i].reportTime +
  360. '</h4>' +
  361. ' </div>' +
  362. ' </div>' +
  363. ' </span>' +
  364. '</div>'
  365. that.markersList.push(markersMap)
  366. }
  367. setTimeout(() => {
  368. that.$refs.supermap.clearM(false)
  369. that.$refs.supermap.clearM(true)
  370. that.$refs.supermap.setMarkers(that.markersList)
  371. }, 1000)
  372. } else {
  373. setTimeout(() => {
  374. that.$refs.supermap.clearM(false)
  375. that.$refs.supermap.clearM(true)
  376. }, 1000)
  377. }
  378. })
  379. },
  380. //事件chart
  381. eventChart() {
  382. // 基于准备好的dom,初始化echarts实例
  383. let myChart = echarts.init(document.getElementById('animal-chart'))
  384. myChart.setOption({
  385. color: ['#2EACFF', '#FFA61C', '#2EC054', '#8C64D7'],
  386. tooltip: {
  387. trigger: 'item',
  388. formatter: '{a} <br/>{b} : {c} ({d}%)'
  389. },
  390. toolbox: {
  391. show: true
  392. },
  393. series: [{
  394. name: '事件分类',
  395. type: 'pie',
  396. roseType: true,
  397. radius: [30, 70],
  398. label: {
  399. show: true,
  400. formatter: '{b}\n{c} '
  401. },
  402. data: this.eventChartData
  403. }]
  404. })
  405. },
  406. //吉祥物收起左右框
  407. indent() {
  408. let list = document.getElementsByClassName('el-tooltip__popper')
  409. list[list.length - 1].style.display = 'none'
  410. if (this.indentStyle == '') {
  411. this.indentStyle = 'indent-style'
  412. this.indentleft = 'indent-left'
  413. this.indentright = 'indent-right'
  414. this.indentText = '展开左右栏'
  415. } else if (this.indentText == '展开左右栏') {
  416. this.indentStyle = ''
  417. this.indentleft = ''
  418. this.indentright = ''
  419. this.indentText = '收起左右栏'
  420. }
  421. }
  422. }
  423. }
  424. </script>
  425. <style rel="stylesheet/scss" lang="scss" scoped>
  426. @import '@/assets/styles/base.scss';
  427. //动物保护
  428. .icon-animal-con {
  429. width: 100%;
  430. display: block !important;
  431. }
  432. .icon-animal {
  433. display: block;
  434. margin: 2px auto;
  435. background: none !important;
  436. }
  437. .icon-animal-text {
  438. display: block !important;
  439. text-align: center !important;
  440. padding: 0.5rem 0.5rem 0rem 0.5rem;
  441. }
  442. .animal-text {
  443. background: #f5ad1b;
  444. border: 0.2px solid rgba(19, 64, 64, 0.7);
  445. height: 3.2rem;
  446. width: 4rem;
  447. text-align: center;
  448. margin: 0px auto;
  449. border-radius: 0.5rem;
  450. color: #fff !important;
  451. }
  452. .animal-text h6 {
  453. color: #fff !important;
  454. }
  455. .w100 {
  456. width: 100% !important;
  457. }
  458. .animal-img {
  459. height: 3rem !important;
  460. }
  461. .w-6 {
  462. width: 6rem !important;
  463. }
  464. </style>