datacenter.vue 18 KB

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