datacenter.vue 17 KB

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