datacenter.vue 21 KB

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