datacenter.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523
  1. <!--信息中心-->
  2. <template>
  3. <div class="visual-con">
  4. <!--头部-->
  5. <vheader></vheader>
  6. <!--主体-->
  7. <div class="visual-body">
  8. <!-- 左侧 -->
  9. <div class="leftbar w-10" :class="indentleft" ref="left">
  10. <div class="forthis">
  11. <dv-border-box-13 backgroundColor="rgba(19, 13, 5, 0.9)" :color="['#d5811d', '#ebd033']" style="padding-bottom: 1rem;">
  12. <img src="../assets/images/integrated/light.png" style="width: 100%; margin-top: .4rem;"/>
  13. <div class="i-list-con h-78">
  14. <div class="d-l-con-icon">
  15. <div class="icon-con" :class="{on:iconCurrentIndex==item.resourceTable}"
  16. v-for="(item,index) in resourcesList"
  17. v-on:click="indentleftSetMarkers(item.key)">
  18. <div class="iconfont icon icon-normal" :class="item.icon"></div>
  19. <div class="icon-text">
  20. <h6 v-if=" item.count.length > 10">{{ item.count.substring(0,10) }}<br>{{item.count.substring(10)}}</h6>
  21. <h6 v-else>{{ item.count}}</h6>
  22. <h5>{{ item.name }}</h5>
  23. </div>
  24. </div>
  25. </div>
  26. </div>
  27. </dv-border-box-13>
  28. </div>
  29. </div>
  30. <!-- 地图 -->
  31. <supermap ref="supermap" style="width: 100%;height: 100vh;" :mapDiv="'forestMap'" class="indexSupermapClass"
  32. :mapSite="{doubleClickZoom:false}" :codes="['9fa5']" :isSideBySide="false" @showPointDetails="showPointDetails"></supermap>
  33. <!-- <button @click="showEventInfo1" style="position: absolute; right: 50%;top: 45%;z-index: 1000;">弹层事件演示用按钮-->
  34. <!-- </button>-->
  35. <!-- 右侧 -->
  36. <div class="rightbar" :class="indentright" ref="right">
  37. <div class="forthis">
  38. <dv-border-box-13 backgroundColor="rgba(19, 13, 5, 0.9)" :color="['#d5811d', '#ebd033']" style="padding-bottom: 1rem;">
  39. <img src="../assets/images/integrated/light.png" style="width: 100%; margin-top: .4rem;"/>
  40. <div class="this-title">
  41. <span>数据分布</span>
  42. <dv-decoration-3 style="width:150px;height:15px;margin-right: 1rem;" :color="['#935713', '#ebd033']"/>
  43. </div>
  44. <div class="i-list-con h-73">
  45. <div class="overflow-y" style="height: 39vh">
  46. <div class="d-l-con" :class="{on:listCurrentIndex==item.deptId}"
  47. v-for="(item,index) in deptGroupList"
  48. v-on:click="indentleftByDeptIdSetMarkers(item.deptId)">
  49. <div class="d-l-l-text">
  50. <i class="i-small"></i>
  51. <h4>{{ item.deptName }}</h4>
  52. </div>
  53. <div class="d-l-l-count">{{ item.eventCount }}</div>
  54. </div>
  55. </div>
  56. <div class="overflow-y" style="height: 34vh;">
  57. <div id="data-chart" style="width: 100%;height:34vh;"></div>
  58. </div>
  59. </div>
  60. </dv-border-box-13>
  61. </div>
  62. </div>
  63. <vBottomMenu ref="bottomMenu"></vBottomMenu>
  64. <!--<el-tooltip :content="indentText" placement="top" :disabled="indentdisabled">-->
  65. <!--<div class="mascot" ref="mascot" :class="indentStyle" @click="indent"><img-->
  66. <!--src="@/assets/images/mascot.png"/>-->
  67. <!--</div>-->
  68. <!--</el-tooltip>-->
  69. </div>
  70. <pointDetails ref="pointDetails"></pointDetails>
  71. <eventLocation ref="eventLocation"></eventLocation>
  72. <TVWall ref="TVWall"></TVWall>
  73. </div>
  74. </template>
  75. <script>
  76. import {
  77. getResource,
  78. getFindAllType,
  79. getFindAllZhanList
  80. } from '@/api/datacenter'
  81. import supermap from '@/components/supermap' //超图
  82. import vheader from '@/components/v-header.vue' //一体化共用头部
  83. import vBottomMenu from '@/components/vBottomMenu.vue' //一体化公共底部菜单
  84. import eventLocation from '@/components/eventLocation.vue' //事件定位弹窗
  85. import TVWall from '@/components/TVWall.vue' //电视墙弹窗
  86. import pointDetails from './pointDetails.vue' //点位详情页面
  87. // import echarts from 'echarts'
  88. let echarts = require('echarts')
  89. export default {
  90. components: {
  91. supermap,
  92. vheader,
  93. vBottomMenu,
  94. eventLocation,
  95. TVWall,
  96. pointDetails
  97. },
  98. created() {
  99. /** ----------------------------------底部按钮公用组件开始------------------------------------- */
  100. window.showDialog = this.showDialog
  101. window.choseLayerSwitching = this.choseLayerSwitching
  102. window.choseLayerSwitchingList = this.choseLayerSwitchingList
  103. /** ----------------------------------底部按钮公用组件结束------------------------------------- */
  104. },
  105. mounted() {
  106. this.getResource();
  107. this.bottomMenuList() //获取底部公共组件消息和任务
  108. },
  109. data() {
  110. return {
  111. iconCurrentIndex: '',
  112. listCurrentIndex: '',
  113. markersList: [],
  114. iframeBoo: true,
  115. open: false,
  116. iframeVue: null,
  117. activeName: 'info',
  118. radio: '1',
  119. //类型
  120. resourceTable: '',
  121. //左侧资源
  122. resourcesList: [],
  123. // resourcesMap: {},
  124. //右侧资源
  125. deptGroupList: [],
  126. supermapDianList: [],//点击左侧数据表获取到的点位数据
  127. source: [],
  128. //左右缩进
  129. indentStyle: '',
  130. indentleft: '',
  131. indentright: '',
  132. indentText: '收起左右栏',
  133. indentdisabled: false,
  134. }
  135. },
  136. methods: {
  137. /** ----------------------------------底部按钮公用组件开始------------------------------------- */
  138. bottomMenuList() {
  139. this.$refs.bottomMenu.selectTaskList()//获取任务列表
  140. this.$refs.bottomMenu.selectMessageList()//获取消息列表
  141. },
  142. showDialog(click) {
  143. if (click == 'eventLocation') {
  144. this.$refs.eventLocation.showEventLocation()
  145. this.$refs.supermap.isEditableLayers = false
  146. this.$refs.bottomMenu.showChild = false
  147. this.$refs.bottomMenu.showBanChild = false
  148. this.$refs.bottomMenu.showChangChild = false
  149. } else if (click == 'editableLayers') {
  150. this.$refs.bottomMenu.showChild = false
  151. this.$refs.bottomMenu.showBanChild = false
  152. this.$refs.bottomMenu.showChangChild = false
  153. if (!this.$refs.supermap.isEditableLayers) {
  154. this.$refs.supermap.isEditableLayers = true
  155. } else {
  156. this.$refs.supermap.isEditableLayers = false
  157. }
  158. } else if (click == 'layerSwitching') {
  159. this.$refs.supermap.isEditableLayers = false
  160. this.$refs.bottomMenu.showBanChild = false
  161. this.$refs.bottomMenu.showChangChild = false
  162. if (!this.$refs.bottomMenu.showChild) {
  163. this.$refs.bottomMenu.showChild = true
  164. } else {
  165. this.$refs.bottomMenu.showChild = false
  166. }
  167. } else if (click == 'TVWall') {
  168. this.$refs.TVWall.showTVWall()
  169. this.$refs.supermap.isEditableLayers = false
  170. this.$refs.bottomMenu.showChild = false
  171. this.$refs.bottomMenu.showBanChild = false
  172. this.$refs.bottomMenu.showChangChild = false
  173. } else if (click == 'forestban') {
  174. this.$refs.supermap.isEditableLayers = false
  175. this.$refs.bottomMenu.showChild = false
  176. this.$refs.bottomMenu.showChangChild = false
  177. if (!this.$refs.bottomMenu.showBanChild) {
  178. this.$refs.bottomMenu.showBanChild = true
  179. } else {
  180. this.$refs.bottomMenu.showBanChild = false
  181. }
  182. } else if (click == 'forestchang') {
  183. this.$refs.supermap.isEditableLayers = false
  184. this.$refs.bottomMenu.showBanChild = false
  185. this.$refs.bottomMenu.showChild = false
  186. if (!this.$refs.bottomMenu.showChangChild) {
  187. this.$refs.bottomMenu.showChangChild = true
  188. } else {
  189. this.$refs.bottomMenu.showChangChild = false
  190. }
  191. }
  192. },
  193. //选择图层
  194. choseLayerSwitching(url, isClear) {
  195. this.$refs.supermap.layerSwitching(url, isClear)
  196. },
  197. //选择图层(传递数组)
  198. choseLayerSwitchingList(urlList) {
  199. this.$refs.supermap.layerSwitchingList(urlList)
  200. },
  201. /** ----------------------------------底部按钮公用组件结束------------------------------------- */
  202. //数据分布chart
  203. dataChat() {
  204. // 基于准备好的dom,初始化echarts实例
  205. let myChart = echarts.init(document.getElementById('data-chart'))
  206. // 绘制图表
  207. const dfColor = ['#92E1FF', '#0097FB', '#30ECA6', '#FFC227', '#FF4848']
  208. myChart.setOption({
  209. dataset: {
  210. source: this.source
  211. },
  212. tooltip: {
  213. trigger: 'item'
  214. },
  215. grid: {
  216. top: '5%',
  217. left: '2%',
  218. // right: "4%",
  219. bottom: '-5%',
  220. width: '75%',
  221. containLabel: true
  222. },
  223. xAxis: {
  224. show: false,
  225. type: 'value'
  226. },
  227. yAxis: {
  228. type: 'category', // 不设置类目轴,抽离的dataset数据展示不出来
  229. inverse: true,
  230. axisLabel: {
  231. show: true,
  232. textStyle: {
  233. color: '#5deaff',
  234. fontSize: '12'
  235. }
  236. },
  237. splitLine: {
  238. show: false
  239. },
  240. axisTick: {
  241. show: false
  242. },
  243. axisLine: {
  244. show: false
  245. }
  246. },
  247. series: [{
  248. type: 'bar',
  249. animationCurve: 'easeOutBack',
  250. barWidth: 5,
  251. label: {
  252. show: true,
  253. position: 'right',
  254. offset: [0, 0],
  255. color: '#88dfd5',
  256. // fontSize: "12",
  257. style: {
  258. fill: '#fff'
  259. }
  260. },
  261. backgroundBar: {
  262. show: true,
  263. style: {
  264. fill: 'rgba(97,152,255,0.20)'
  265. }
  266. },
  267. barStyle: {
  268. stroke: 'rgba(41,244,236,1)'
  269. },
  270. gradient: {
  271. color: ['rgba(41,244,236,1)', 'rgba(41,244,236,0)']
  272. },
  273. itemStyle: {
  274. label: {
  275. show: true
  276. },
  277. labelLine: {
  278. show: false
  279. },
  280. color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [{
  281. offset: 0,
  282. color: 'rgba(41,244,236,0)'
  283. },
  284. {
  285. offset: 1,
  286. color: 'rgba(41,244,236,.5)'
  287. }
  288. ]),
  289. borderColor: '#a2f9f7',
  290. shadowBlur: 16,
  291. shadowColor: '#a2f9f7'
  292. }
  293. }]
  294. })
  295. },
  296. //吉祥物收起左右框
  297. indent() {
  298. let list = document.getElementsByClassName('el-tooltip__popper')
  299. list[list.length - 1].style.display = 'none'
  300. if (this.indentStyle == '') {
  301. this.indentStyle = 'indent-style'
  302. this.indentleft = 'indent-left'
  303. this.indentright = 'indent-right'
  304. this.indentText = '展开左右栏'
  305. } else if (this.indentText == '展开左右栏') {
  306. this.indentStyle = ''
  307. this.indentleft = ''
  308. this.indentright = ''
  309. this.indentText = '收起左右栏'
  310. }
  311. },
  312. // 弹层方法
  313. // 弹层方法
  314. showEventInfo1() {
  315. this.eventInfoVisible1 = true
  316. },
  317. showEventInfo2() {
  318. this.eventInfoVisible2 = true
  319. },
  320. showPointDetails(pointParam){
  321. //事件信息弹出
  322. this.$refs.pointDetails.showPointDetails(pointParam);
  323. },
  324. getResource() {
  325. let that = this
  326. //获取左侧菜单列表
  327. getResource().then(res => {
  328. const resourcesMap = res.data;
  329. // const resourcesMap = [];
  330. // let data = res.data;
  331. // console.log("data=",data)
  332. // for(let key in data){
  333. // if(key == 'getNumByVarieties' ||
  334. // key == 'getLivestockNumByVarieties' ||
  335. // key == 'enterpriseStat' ||
  336. // key == 'getInformation' ||
  337. // key == 'getSupervise' ||
  338. // key == 'grainFourSeasons'
  339. // ){
  340. // resourcesMap.push({key: data[key]});
  341. // }
  342. // }
  343. for(let key in resourcesMap){
  344. const map = {};
  345. map.count=resourcesMap[key];
  346. if(key == 'buzhu'){map.name="补助次数";}
  347. if(key == 'gengdi'){map.name="耕地面积";map.count=resourcesMap[key]+"㎡";}
  348. if(key == 'hezuoshe'){map.name="合作社数量";}//有经纬度
  349. if(key == 'huafei'){map.name="化肥库存";map.count=resourcesMap[key]+"吨";}
  350. if(key == 'nongji'){map.name="农机站数量";}//有经纬度
  351. if(key == 'nongju'){map.name="农具库存";map.count=resourcesMap[key]+"个";}
  352. if(key == 'xubao'){map.name="畜保站数量";}//有经纬度
  353. if(key == 'yangzhi'){map.name="养殖及粪污处理点";}//有经纬度
  354. if(key == 'zhibao'){map.name="植保数量";}//有经纬度
  355. if(key == 'zhongzhi'){map.name="种植产量";map.count=resourcesMap[key]+"吨";}
  356. if(key == 'zhongzi'){map.name="种子库存";map.count=resourcesMap[key]+"吨";}
  357. // 备案畜禽规模养殖场统计 /agricultureBigData/getNumByVarieties
  358. // 种畜禽养殖场统计 /agricultureBigData/getLivestockNumByVarieties
  359. // 企业分布统计 /agricultureBigData/enterpriseStat
  360. // 农药信息统计 /agricultureBigData/getInformation
  361. // 农资监管统计 /agricultureBigData/getSupervise
  362. // 粮食四季变化 /agricultureBigData/grainFourSeasons
  363. if(key == 'getNumByVarieties'){map.name="备案养殖场";map.count=resourcesMap[key]+"";}
  364. if(key == 'getLivestockNumByVarieties'){map.name="种畜禽养殖场";map.count=resourcesMap[key]+"";}
  365. if(key == 'enterpriseStat'){map.name="企业数量";map.count=resourcesMap[key]+"";}
  366. if(key == 'getInformation'){map.name="农药数量";map.count=resourcesMap[key]+"L";}
  367. if(key == 'getSupervise'){map.name="农资监管数量";map.count=resourcesMap[key]+"";}
  368. if(key == 'grainFourSeasons'){map.name="粮食数量";map.count=resourcesMap[key]+"吨";}
  369. map.icon='sj-icon-'+key;
  370. map.key=key;
  371. if(key == 'getNumByVarieties' ||
  372. key == 'getLivestockNumByVarieties' ||
  373. key == 'enterpriseStat' ||
  374. key == 'getInformation' ||
  375. key == 'getSupervise' ||
  376. key == 'grainFourSeasons'
  377. ){
  378. // that.resourcesList.push(map);
  379. }
  380. that.resourcesList.push(map);
  381. }
  382. })
  383. },
  384. indentleftSetMarkers(type) {
  385. let that = this
  386. that.resourceTable=type;
  387. getFindAllType(type).then(res => {
  388. that.deptGroupList = res.data.dept;
  389. that.supermapDianList = res.data.list;
  390. that.source = [];
  391. that.markersList = [];
  392. //点击左侧右侧数据展示及横向柱状图
  393. if (res.data != null && res.data.dept.length > 0) {
  394. for (let i = 0; i < res.data.dept.length; i++) {
  395. let aa = [res.data.dept[i].deptName, res.data.dept[i].eventCount];
  396. that.source.push(aa);
  397. }
  398. }
  399. this.dataChat();
  400. if (res.data != null && res.data.list.length > 0) {
  401. if(type=='hezuoshe'||type=='nongji'||type=='zhibao'||type=='xubao'||type=='yangzhi'){
  402. for (let i = 0; i < res.data.list.length; i++) {
  403. let markersMap = {
  404. lng: res.data.list[i].longitude,
  405. lat: res.data.list[i].latitude,
  406. icon: 'marker',
  407. bindPopupHtml: '' +
  408. '<div class="map-tip">' +
  409. ' <span>' +
  410. ' <div class="d-l-con">' +
  411. ' <div class="d-l-l-text">' +
  412. ' <h4>经纬度:' + res.data.list[i].longitude + ',' + res.data.list[i].latitude + '</h4>' +
  413. ' </div>' +
  414. ' </div>' +
  415. ' </span>' +
  416. ' <span>' +
  417. ' <div class="d-l-con">' +
  418. ' <div class="d-l-l-text">' +
  419. ' <h4>地址:' + res.data.list[i].address + '</h4>' +
  420. ' </div>' +
  421. ' </div>' +
  422. ' </span>' +
  423. ' <span>' +
  424. ' <div class="d-l-con">' +
  425. ' <div class="d-l-l-text">' +
  426. ' <h4>名称:' + res.data.list[i].name +'</h4>' +
  427. ' </div>' +
  428. ' </div>' +
  429. ' </span>' +
  430. '</div>',
  431. click: 'showPointDetails',
  432. parameter: {id:res.data.list[i].id,type:type},
  433. keepBindPopup: false,
  434. isAggregation: false
  435. }
  436. that.markersList.push(markersMap)
  437. }
  438. }else{
  439. that.markersList = [];
  440. }
  441. }
  442. that.$refs.supermap.clearM(false);
  443. that.$refs.supermap.setMarkers(that.markersList);
  444. });
  445. },
  446. indentleftByDeptIdSetMarkers(deptId) {
  447. this.listCurrentIndex = deptId
  448. let that = this;
  449. let type = that.resourceTable;
  450. that.markersList = [];
  451. //点击右侧地图落点
  452. if(type=='hezuoshe'||type=='nongji'||type=='zhibao'||type=='xubao'||type=='yangzhi'){
  453. getFindAllZhanList(type,deptId).then(res => {
  454. if (res.data != null && res.data.length > 0) {
  455. for (let i = 0; i < res.data.length; i++) {
  456. let markersMap = {
  457. lng: res.data[i].longitude,
  458. lat: res.data[i].latitude,
  459. icon: 'marker',
  460. bindPopupHtml: '' +
  461. '<div class="map-tip">' +
  462. ' <span>' +
  463. ' <div class="d-l-con">' +
  464. ' <div class="d-l-l-text">' +
  465. ' <h4>经纬度:' + res.data[i].longitude + ',' + res.data[i].latitude + '</h4>' +
  466. ' </div>' +
  467. ' </div>' +
  468. ' </span>' +
  469. ' <span>' +
  470. ' <div class="d-l-con">' +
  471. ' <div class="d-l-l-text">' +
  472. ' <h4>地址:' + res.data[i].address + '</h4>' +
  473. ' </div>' +
  474. ' </div>' +
  475. ' </span>' +
  476. ' <span>' +
  477. ' <div class="d-l-con">' +
  478. ' <div class="d-l-l-text">' +
  479. ' <h4>名称:' + res.data[i].name +'</h4>' +
  480. ' </div>' +
  481. ' </div>' +
  482. ' </span>' +
  483. '</div>',
  484. click: 'showPointDetails',
  485. parameter: {id:res.data[i].id,type:type},
  486. keepBindPopup: false,
  487. isAggregation: false
  488. }
  489. that.markersList.push(markersMap)
  490. }
  491. }else{
  492. that.markersList = [];
  493. }
  494. that.$refs.supermap.clearM(false)
  495. that.$refs.supermap.setMarkers(that.markersList)
  496. })
  497. }
  498. that.$refs.supermap.clearM(false)
  499. }
  500. }
  501. }
  502. </script>
  503. <style rel="stylesheet/scss" lang="scss" scoped>
  504. @import '@/assets/styles/base.scss';
  505. </style>