datacenter.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574
  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" ref="left">
  10. <div class="forthis">
  11. <dv-border-box-13 backgroundColor="#09140e" 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="i-list-con h-65" v-show="showSearch == true">
  16. <div class="head-container">
  17. <el-input
  18. v-model="searchName"
  19. placeholder="请输入名称"
  20. @blur="searchByName()"
  21. clearable
  22. size="small"
  23. prefix-icon="el-icon-search"
  24. style="margin-bottom: 20px"
  25. />
  26. </div>
  27. </div>
  28. <div class="icon-con" :class="{on:iconCurrentIndex==item.resourceTable}"
  29. v-for="(item,index) in resourcesList"
  30. v-on:click="indentleftSetMarkers(item.type, searchName)">
  31. <!--v-on:click="indentleftSetMarkers(item.resourceTable)">-->
  32. <div class="iconfont icon icon-normal" :class="item.icon"></div>
  33. <div class="icon-text">
  34. <h6>{{ item.num }}</h6>
  35. <!--<h6>{{ item.count }}</h6>-->
  36. <h5>{{ item.name }}</h5>
  37. <!--<h5>{{ item.resourceName }}</h5>-->
  38. </div>
  39. </div>
  40. </div>
  41. </div>
  42. </dv-border-box-13>
  43. </div>
  44. </div>
  45. <!-- 地图 -->
  46. <!--<supermap ref="supermap" style="width: 100%;height: 100vh;" :mapDiv="'forestMap'" class="indexSupermapClass"-->
  47. <!--:mapSite="{doubleClickZoom:false}" :codes="['9fa5']" :isSideBySide="false"></supermap>-->
  48. <supermap ref="supermap"></supermap>
  49. <!-- <button @click="showEventInfo1" style="position: absolute; right: 50%;top: 45%;z-index: 1000;">弹层事件演示用按钮-->
  50. <!-- </button>-->
  51. <!-- 右侧 -->
  52. <div class="rightbar" ref="right" v-if="showSearch == true">
  53. <div class="forthis">
  54. <dv-border-box-13 backgroundColor="#09140e" style="padding-bottom: 1rem;">
  55. <img src="../assets/images/integrated/light.png" style="width: 100%; margin-top: .4rem;"/>
  56. <div class="this-title">
  57. <span>数据分布</span>
  58. <dv-decoration-3 style="width:150px;height:15px;margin-right: 1rem;"/>
  59. </div>
  60. <div class="i-list-con h-73">
  61. <div class="overflow-y" style="height: 39vh">
  62. <div class="d-l-con" :class="{on:listCurrentIndex==item.deptId}"
  63. v-for="(item,index) in deptGroupList"
  64. v-on:click="indentleftByDeptIdSetMarkers(item.deptId)">
  65. <div class="d-l-l-text">
  66. <i class="i-small"></i>
  67. <h4>{{ item.deptName }}</h4>
  68. </div>
  69. <div class="d-l-l-count">{{ item.count }}</div>
  70. </div>
  71. </div>
  72. <div class="overflow-y" style="height: 34vh;">
  73. <div id="data-chart" style="width: 100%;height:34vh;"></div>
  74. </div>
  75. </div>
  76. </dv-border-box-13>
  77. </div>
  78. </div>
  79. <vBottomMenu ref="bottomMenu"></vBottomMenu>
  80. </div>
  81. <eventLocation ref="eventLocation"></eventLocation>
  82. <TVWall ref="TVWall"></TVWall>
  83. </div>
  84. </template>
  85. <script>
  86. import {
  87. getResource,
  88. getResourcePoint,
  89. getResourcePointByDeptId
  90. } from '@/api/datacenter'
  91. import supermap from '@/components/supermap-2.5d' //超图
  92. import vheader from '@/components/v-header.vue' //一体化共用头部
  93. import vBottomMenu from '@/components/vBottomMenu.vue' //一体化公共底部菜单
  94. import eventLocation from '@/components/eventLocation.vue' //事件定位弹窗
  95. import TVWall from '@/components/TVWall.vue'
  96. import {initByCameras} from "@/api/forest"; //电视墙弹窗
  97. // import echarts from 'echarts'
  98. let echarts = require('echarts')
  99. export default {
  100. components: {
  101. supermap,
  102. vheader,
  103. vBottomMenu,
  104. eventLocation,
  105. TVWall
  106. },
  107. created() {
  108. /** ----------------------------------底部按钮公用组件开始------------------------------------- */
  109. window.showDialog = this.showDialog
  110. window.choseLayerSwitching = this.choseLayerSwitching
  111. window.choseLayerSwitchingList = this.choseLayerSwitchingList
  112. /** ----------------------------------底部按钮公用组件结束------------------------------------- */
  113. },
  114. mounted() {
  115. this.getResource()
  116. this.bottomMenuList() //获取底部公共组件消息和任务
  117. },
  118. data() {
  119. return {
  120. // 搜索框
  121. showSearch: false,
  122. // 搜索名称
  123. searchName: undefined,
  124. // 搜索类型
  125. searchType: undefined,
  126. iconCurrentIndex: '',
  127. listCurrentIndex: '',
  128. markersList: [],
  129. iframeBoo: true,
  130. open: false,
  131. iframeVue: null,
  132. activeName: 'info',
  133. radio: '1',
  134. //类型
  135. resourceTable: '',
  136. //左侧资源
  137. resourcesList: [],
  138. //右侧资源
  139. deptGroupList: [],
  140. source: [],
  141. }
  142. },
  143. methods: {
  144. // 根据名称筛选资源点位
  145. searchByName() {
  146. this.$modal.msgSuccess("正在查询,请稍后...");
  147. this.indentleftSetMarkers(this.searchType, this.searchName);
  148. },
  149. /** ----------------------------------底部按钮公用组件开始------------------------------------- */
  150. bottomMenuList() {
  151. this.$refs.bottomMenu.selectTaskList()//获取任务列表
  152. this.$refs.bottomMenu.selectMessageList()//获取消息列表
  153. },
  154. showDialog(click) {
  155. if (click == 'eventLocation') {
  156. this.$refs.eventLocation.showEventLocation()
  157. this.$refs.supermap.isEditableLayers = false
  158. this.$refs.bottomMenu.showChild = false
  159. } else if (click == 'editableLayers') {
  160. this.$refs.bottomMenu.showChild = false
  161. if (!this.$refs.supermap.isEditableLayers) {
  162. this.$refs.supermap.isEditableLayers = true
  163. } else {
  164. this.$refs.supermap.isEditableLayers = false
  165. }
  166. } else if (click == 'layerSwitching') {
  167. this.$refs.supermap.isEditableLayers = false
  168. if (!this.$refs.bottomMenu.showChild) {
  169. this.$refs.bottomMenu.showChild = true
  170. } else {
  171. this.$refs.bottomMenu.showChild = false
  172. }
  173. } else if (click == 'TVWall') {
  174. this.$refs.TVWall.showTVWall()
  175. this.$refs.supermap.isEditableLayers = false
  176. this.$refs.bottomMenu.showChild = false
  177. }
  178. },
  179. //选择图层
  180. choseLayerSwitching(url, isClear) {
  181. this.$refs.supermap.layerSwitching(url, isClear)
  182. },
  183. //选择图层(传递数组)
  184. choseLayerSwitchingList(urlList) {
  185. this.$refs.supermap.layerSwitchingList(urlList)
  186. },
  187. /** ----------------------------------底部按钮公用组件结束------------------------------------- */
  188. //数据分布chart
  189. dataChat() {
  190. // 基于准备好的dom,初始化echarts实例
  191. let myChart = echarts.init(document.getElementById('data-chart'))
  192. // 绘制图表
  193. const dfColor = ['#92E1FF', '#0097FB', '#30ECA6', '#FFC227', '#FF4848']
  194. myChart.setOption({
  195. dataset: {
  196. source: this.source
  197. },
  198. tooltip: {
  199. trigger: 'item'
  200. },
  201. dataZoom: [{
  202. show: true,
  203. type: 'slider',
  204. yAxisIndex: 0,
  205. left: 0,
  206. start: 0,
  207. end: this.source.length > 8 ? 8 : 100,
  208. width: 15
  209. }],
  210. grid: {
  211. top: '5%',
  212. left: '2%',
  213. // right: "4%",
  214. bottom: '-15%',
  215. width: '75%',
  216. containLabel: true
  217. },
  218. xAxis: {
  219. show: false,
  220. type: 'value'
  221. },
  222. yAxis: {
  223. type: 'category', // 不设置类目轴,抽离的dataset数据展示不出来
  224. inverse: true,
  225. axisLabel: {
  226. show: true,
  227. textStyle: {
  228. color: '#5deaff',
  229. fontSize: '12'
  230. }
  231. },
  232. splitLine: {
  233. show: false
  234. },
  235. axisTick: {
  236. show: false
  237. },
  238. axisLine: {
  239. show: false
  240. }
  241. },
  242. series: [{
  243. type: 'bar',
  244. animationCurve: 'easeOutBack',
  245. barWidth: 5,
  246. label: {
  247. show: true,
  248. position: 'right',
  249. offset: [0, 0],
  250. color: '#88dfd5',
  251. // fontSize: "12",
  252. style: {
  253. fill: '#fff'
  254. }
  255. },
  256. backgroundBar: {
  257. show: true,
  258. style: {
  259. fill: 'rgba(97,152,255,0.20)'
  260. }
  261. },
  262. barStyle: {
  263. stroke: 'rgba(41,244,236,1)'
  264. },
  265. gradient: {
  266. color: ['rgba(41,244,236,1)', 'rgba(41,244,236,0)']
  267. },
  268. itemStyle: {
  269. label: {
  270. show: true
  271. },
  272. labelLine: {
  273. show: false
  274. },
  275. color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [{
  276. offset: 0,
  277. color: 'rgba(41,244,236,0)'
  278. },
  279. {
  280. offset: 1,
  281. color: 'rgba(41,244,236,.5)'
  282. }
  283. ]),
  284. borderColor: '#a2f9f7',
  285. shadowBlur: 16,
  286. shadowColor: '#a2f9f7'
  287. }
  288. }]
  289. })
  290. },
  291. // 弹层方法
  292. showEventInfo1() {
  293. this.eventInfoVisible1 = true
  294. },
  295. showEventInfo2() {
  296. this.eventInfoVisible2 = true
  297. },
  298. getResource() {
  299. let that = this
  300. //获取左侧菜单列表
  301. getResource().then(res => {
  302. that.resourcesList = res.data
  303. console.log("that.resourcesList=", that.resourcesList)
  304. //截取data.resourceTable字段中“_”分隔符最后一个作为关键字,重新拼接成前端需要的图标:class,格式sj-icon-xxxx,将其set回原数组
  305. res.data.forEach(function(data, index) {
  306. that.$set(that.resourcesList[index], 'icon', 'sj' + '-' + 'icon' + '-' + data.type.replaceAll("_", "-"));
  307. if(index < 5){
  308. // that.fireControlViewPoint(data.type, 'undefined');
  309. that.indentleftSetMarkers(data.type, '所有');
  310. }
  311. })
  312. })
  313. },
  314. indentleftSetMarkers(resourceTable, name) {
  315. // 搜索框
  316. // if(name == 'undefined' && this.showSearch == false){
  317. // if(name == '所有' && this.showSearch == false){
  318. if(name == '所有'){
  319. name = undefined;
  320. }else {
  321. this.showSearch = true;
  322. }
  323. // 搜索类型
  324. this.searchType = resourceTable;
  325. this.iconCurrentIndex = resourceTable
  326. let that = this
  327. that.resourceTable = resourceTable
  328. that.markersList = []
  329. that.source = []
  330. //点击左侧地图落点
  331. getResourcePoint(resourceTable, name).then(res => {
  332. that.deptGroupList = res.data.deptGroupList
  333. if (res.data.deptGroupList != null && res.data.deptGroupList.length > 0) {
  334. for (let i = 0; i < res.data.deptGroupList.length; i++) {
  335. let aa = [res.data.deptGroupList[i].deptName, res.data.deptGroupList[i].count]
  336. that.source.push(aa)
  337. }
  338. }
  339. if (res.data.resourceList != null && res.data.resourceList.length > 0) {
  340. for (let i = 0; i < res.data.resourceList.length; i++) {
  341. let markersMap = {
  342. lng: 124.59,
  343. lat: 43.02,
  344. icon: 'marker',
  345. bindPopupHtml: '',
  346. parameter:'',
  347. click: '',
  348. keepBindPopup: false,
  349. isAggregation: false
  350. }
  351. that.markersList.push(this.getMarkersMap(resourceTable, markersMap, res.data.resourceList[i]));
  352. }
  353. }
  354. if(this.showSearch == true){
  355. this.dataChat();
  356. }
  357. that.$refs.supermap.clearM()
  358. that.$refs.supermap.setMarkers(that.markersList)
  359. })
  360. },
  361. indentleftByDeptIdSetMarkers(deptId) {
  362. this.listCurrentIndex = deptId
  363. let that = this
  364. //点击左侧地图落点
  365. getResourcePointByDeptId(that.resourceTable, deptId).then(res => {
  366. console.log("1===============dituluodian===============", res.data.resourceList);
  367. that.markersList = []
  368. if (res.data.resourceList != null && res.data.resourceList.length > 0) {
  369. for (let i = 0; i < res.data.resourceList.length; i++) {
  370. let markersMap = {
  371. lng: 124.59,
  372. lat: 43.02,
  373. icon: 'marker',
  374. bindPopupHtml: '',
  375. parameter:'',
  376. click: '',
  377. keepBindPopup: false,
  378. isAggregation: false
  379. }
  380. that.markersList.push(this.getMarkersMap(that.resourceTable, markersMap, res.data.resourceList[i]));
  381. }
  382. }
  383. that.$refs.supermap.clearM()
  384. that.$refs.supermap.setMarkers(that.markersList)
  385. })
  386. },
  387. getMarkersMap(resourceTable, markersMap, item){
  388. if (resourceTable == 'centerdata_t_environment_key_enterprise') { //重点企业
  389. markersMap.icon = 'sj-icon-map-centerdata-t-environment-key-enterprise'
  390. markersMap.lng = (item.longitude?item.longitude:"")
  391. markersMap.lat = (item.latitude?item.latitude:"")
  392. markersMap.bindPopupHtml = '<div class="map-tip">' +
  393. '<span>' +
  394. ' <div class="d-l-con">' +
  395. ' <div class="d-l-l-text">' +
  396. ' <h4>经纬度:' + (item.longitude?item.longitude:"") + ',' + (item.latitude?item.latitude:"") + '</h4>' +
  397. ' </div>' +
  398. ' </div>' +
  399. ' </span>' +
  400. '<span>' +
  401. ' <div class="d-l-con">' +
  402. ' <div class="d-l-l-text">' +
  403. ' <h4>企业名称:' + (item.name?item.name:"") +
  404. '</h4>' +
  405. ' </div>' +
  406. ' </div>' +
  407. ' </span>' +
  408. '<span>' +
  409. ' <div class="d-l-con">' +
  410. ' <div class="d-l-l-text">' +
  411. ' <h4>地址:' + (item.address?item.address:"") +
  412. '</h4>' +
  413. ' </div>' +
  414. ' </div>' +
  415. ' </span>' +
  416. '<span>' +
  417. ' <div class="d-l-con">' +
  418. ' <div class="d-l-l-text">' +
  419. ' <h4>联系人:' + (item.contacts?item.contacts:"") +
  420. '</h4>' +
  421. ' </div>' +
  422. ' </div>' +
  423. ' </span>' +
  424. '<span>' +
  425. ' <div class="d-l-con">' +
  426. ' <div class="d-l-l-text">' +
  427. ' <h4>联系人电话:' + (item.contacts_phone?item.contacts_phone:"") +
  428. '</h4>' +
  429. ' </div>' +
  430. ' </div>' +
  431. ' </span>' +
  432. '<span>' +
  433. ' <div class="d-l-con">' +
  434. ' <div class="d-l-l-text">' +
  435. ' <h4>企业联系人:' + (item.contacts?item.contacts:"") +
  436. '</h4>' +
  437. ' </div>' +
  438. ' </div>' +
  439. ' </span>' +
  440. '<span>' +
  441. ' <div class="d-l-con">' +
  442. ' <div class="d-l-l-text">' +
  443. ' <h4>联系电话:' + (item.contacts_phone?item.contacts_phone:"") +
  444. '</h4>' +
  445. ' </div>' +
  446. ' </div>' +
  447. ' </span></div>'
  448. } else if (resourceTable == 'centerdata_t_environment_prohibition_area') { //禁烧区
  449. markersMap.icon = 'sj-icon-map-centerdata-t-environment-prohibition-area'
  450. markersMap.lng = (item.longitude?item.longitude:"")
  451. markersMap.lat = (item.latitude?item.latitude:"")
  452. markersMap.bindPopupHtml = '<div class="map-tip">' +
  453. '<span>' +
  454. ' <div class="d-l-con">' +
  455. ' <div class="d-l-l-text">' +
  456. ' <h4>经纬度:' + (item.longitude?item.longitude:"") + ',' + (item.latitude?item.latitude:"") + '</h4>' +
  457. ' </div>' +
  458. ' </div>' +
  459. ' </span>' +
  460. '<span>' +
  461. ' <div class="d-l-con">' +
  462. ' <div class="d-l-l-text">' +
  463. ' <h4>禁烧区名称:' + (item.name?item.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>地址:' + (item.address?item.address:"") + '</h4>' +
  471. ' </div>' +
  472. ' </div>' +
  473. ' </span>' +
  474. '<span>' +
  475. ' <div class="d-l-con">' +
  476. ' <div class="d-l-l-text">' +
  477. ' <h4>区域负责人:' + (item.principal?item.principal:"") + '</h4>' +
  478. ' </div>' +
  479. ' </div>' +
  480. ' </span>' +
  481. '<span>' +
  482. ' <div class="d-l-con">' +
  483. ' <div class="d-l-l-text">' +
  484. ' <h4>联系电话:' + (item.contactsPhone?item.contactsPhone:"") + '</h4>' +
  485. ' </div>' +
  486. ' </div>' +
  487. ' </span></div>'
  488. } else if (resourceTable == 'centerdata_t_environment_source_pollution') { //污染源
  489. markersMap.icon = 'sj-icon-map-centerdata-t-environment-source-pollution'
  490. markersMap.lng = (item.longitude?item.longitude:"")
  491. markersMap.lat = (item.latitude?item.latitude:"")
  492. markersMap.bindPopupHtml = '<div class="map-tip">' +
  493. '<span>' +
  494. ' <div class="d-l-con">' +
  495. ' <div class="d-l-l-text">' +
  496. ' <h4>经纬度:' + (item.longitude?item.longitude:"") + ',' + (item.latitude?item.latitude:"") + '</h4>' +
  497. ' </div>' +
  498. ' </div>' +
  499. ' </span>' +
  500. '<span>' +
  501. ' <div class="d-l-con">' +
  502. ' <div class="d-l-l-text">' +
  503. ' <h4>污染源名称:' + (item.name?item.name:"") +
  504. '</h4>' +
  505. ' </div>' +
  506. ' </div>' +
  507. ' </span>' +
  508. '<span>' +
  509. ' <div class="d-l-con">' +
  510. ' <div class="d-l-l-text">' +
  511. ' <h4>地址:' + (item.address?item.address:"") +
  512. '</h4>' +
  513. ' </div>' +
  514. ' </div>' +
  515. ' </span>' +
  516. '<span>' +
  517. '</div>'
  518. } else if (resourceTable == 'centerdata_t_environment_sewage_outlet') { //排污口
  519. markersMap.icon = 'sj-icon-map-centerdata_t_environment_sewage_outlet'
  520. markersMap.lng = (item.longitude?item.longitude:"")
  521. markersMap.lat = (item.latitude?item.latitude:"")
  522. markersMap.icon = 'sj-icon-map-centerdata_t_environment_sewage_outlet'
  523. markersMap.click = 'sewageOutletClick'
  524. markersMap.parameter = res.data.resourceList[i]
  525. markersMap.bindPopupHtml = '<div class="map-tip">' +
  526. '<span>' +
  527. ' <div class="d-l-con">' +
  528. ' <div class="d-l-l-text">' +
  529. ' <h4>经纬度:' + (item.longitude?item.longitude:"") + ',' + (item.latitude?item.latitude:"") + '</h4>' +
  530. ' </div>' +
  531. ' </div>' +
  532. ' </span>' +
  533. '<span>' +
  534. ' <div class="d-l-con">' +
  535. ' <div class="d-l-l-text">' +
  536. ' <h4>排污口名称:' + (item.name?item.name:"") +
  537. '</h4>' +
  538. ' </div>' +
  539. ' </div>' +
  540. ' </span>' +
  541. '<span>' +
  542. ' <div class="d-l-con">' +
  543. ' <div class="d-l-l-text">' +
  544. ' <h4>地址:' + (item.address?item.address:"") +
  545. '</h4>' +
  546. ' </div>' +
  547. ' </div>' +
  548. ' </span>' +
  549. '<span>' +
  550. '</div>'
  551. }
  552. return markersMap;
  553. }
  554. }
  555. }
  556. </script>
  557. <style rel="stylesheet/scss" lang="scss" scoped>
  558. @import '@/assets/styles/base.scss';
  559. </style>