datacenter.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568
  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="i-list-con h-65" v-show="showSearch == true">
  15. <div class="head-container">
  16. <el-input
  17. v-model="searchName"
  18. placeholder="请输入名称"
  19. @blur="searchByName()"
  20. clearable
  21. size="small"
  22. prefix-icon="el-icon-search"
  23. style="margin-bottom: 20px"
  24. />
  25. </div>
  26. </div>
  27. <div class="d-l-con-icon">
  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" @sewageOutletClick="sewageOutletClick"></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. setTimeout(() => {
  358. that.$refs.supermap.clearM()
  359. that.$refs.supermap.setMarkers(that.markersList)
  360. }, 3000)
  361. })
  362. },
  363. indentleftByDeptIdSetMarkers(deptId) {
  364. this.listCurrentIndex = deptId
  365. let that = this
  366. //点击左侧地图落点
  367. getResourcePointByDeptId(that.resourceTable, deptId).then(res => {
  368. console.log("1===============dituluodian===============", res.data.resourceList);
  369. that.markersList = []
  370. if (res.data.resourceList != null && res.data.resourceList.length > 0) {
  371. for (let i = 0; i < res.data.resourceList.length; i++) {
  372. let markersMap = {
  373. lng: 124.59,
  374. lat: 43.02,
  375. icon: 'marker',
  376. bindPopupHtml: '',
  377. parameter:'',
  378. click: '',
  379. keepBindPopup: false,
  380. isAggregation: false
  381. }
  382. that.markersList.push(this.getMarkersMap(that.resourceTable, markersMap, res.data.resourceList[i]));
  383. }
  384. }
  385. setTimeout(() => {
  386. that.$refs.supermap.clearM()
  387. that.$refs.supermap.setMarkers(that.markersList)
  388. }, 3000)
  389. })
  390. },
  391. getMarkersMap(resourceTable, markersMap, item){
  392. if (resourceTable == 'centerdata_t_environment_key_enterprise') { //重点企业
  393. markersMap.icon = 'sj-icon-map-centerdata-t-environment-key-enterprise'
  394. markersMap.lng = (item.longitude?item.longitude:"")
  395. markersMap.lat = (item.latitude?item.latitude:"")
  396. markersMap.click = 'sewageOutletClick'
  397. markersMap.parameter = item
  398. markersMap.bindPopupHtml = '<div class="map-tip">' +
  399. '<span>' +
  400. ' <div class="d-l-con">' +
  401. ' <div class="d-l-l-text">' +
  402. ' <h4>经纬度:' + (item.longitude?item.longitude:"") + ',' + (item.latitude?item.latitude:"") + '</h4>' +
  403. ' </div>' +
  404. ' </div>' +
  405. ' </span>' +
  406. '<span>' +
  407. ' <div class="d-l-con">' +
  408. ' <div class="d-l-l-text">' +
  409. ' <h4>企业名称:' + (item.name?item.name:"") +
  410. '</h4>' +
  411. ' </div>' +
  412. ' </div>' +
  413. ' </span>' +
  414. '<span>' +
  415. ' <div class="d-l-con">' +
  416. ' <div class="d-l-l-text">' +
  417. ' <h4>地址:' + (item.address?item.address:"") +
  418. '</h4>' +
  419. ' </div>' +
  420. ' </div>' +
  421. ' </span>' +
  422. '<span>' +
  423. ' <div class="d-l-con">' +
  424. ' <div class="d-l-l-text">' +
  425. ' <h4>企业联系人:' + (item.contacts?item.contacts:"") +
  426. '</h4>' +
  427. ' </div>' +
  428. ' </div>' +
  429. ' </span>' +
  430. '<span>' +
  431. ' <div class="d-l-con">' +
  432. ' <div class="d-l-l-text">' +
  433. ' <h4>联系电话:' + (item.contacts_phone?item.contacts_phone:"") +
  434. '</h4>' +
  435. ' </div>' +
  436. ' </div>' +
  437. ' </span></div>'
  438. } else if (resourceTable == 'centerdata_t_environment_source_pollution') { //污染源
  439. markersMap.icon = 'sj-icon-map-centerdata-t-environment-source-pollution'
  440. markersMap.lng = (item.longitude?item.longitude:"")
  441. markersMap.lat = (item.latitude?item.latitude:"")
  442. markersMap.bindPopupHtml = '<div class="map-tip">' +
  443. '<span>' +
  444. ' <div class="d-l-con">' +
  445. ' <div class="d-l-l-text">' +
  446. ' <h4>经纬度:' + (item.longitude?item.longitude:"") + ',' + (item.latitude?item.latitude:"") + '</h4>' +
  447. ' </div>' +
  448. ' </div>' +
  449. ' </span>' +
  450. '<span>' +
  451. ' <div class="d-l-con">' +
  452. ' <div class="d-l-l-text">' +
  453. ' <h4>污染源名称:' + (item.name?item.name:"") +
  454. '</h4>' +
  455. ' </div>' +
  456. ' </div>' +
  457. ' </span>' +
  458. '<span>' +
  459. ' <div class="d-l-con">' +
  460. ' <div class="d-l-l-text">' +
  461. ' <h4>地址:' + (item.address?item.address:"") +
  462. '</h4>' +
  463. ' </div>' +
  464. ' </div>' +
  465. ' </span>' +
  466. '<span>' +
  467. '</div>'
  468. } else if (resourceTable == 'centerdata_t_environment_sewage_outlet') { //排污口
  469. markersMap.icon = 'sj-icon-map-centerdata_t_environment_sewage_outlet'
  470. markersMap.lng = (item.longitude?item.longitude:"")
  471. markersMap.lat = (item.latitude?item.latitude:"")
  472. markersMap.click = 'sewageOutletClick'
  473. markersMap.parameter = item
  474. markersMap.bindPopupHtml = '<div class="map-tip">' +
  475. '<span>' +
  476. ' <div class="d-l-con">' +
  477. ' <div class="d-l-l-text">' +
  478. ' <h4>经纬度:' + (item.longitude?item.longitude:"") + ',' + (item.latitude?item.latitude:"") + '</h4>' +
  479. ' </div>' +
  480. ' </div>' +
  481. ' </span>' +
  482. '<span>' +
  483. ' <div class="d-l-con">' +
  484. ' <div class="d-l-l-text">' +
  485. ' <h4>排污口名称:' + (item.name?item.name:"") +
  486. '</h4>' +
  487. ' </div>' +
  488. ' </div>' +
  489. ' </span>' +
  490. '<span>' +
  491. ' <div class="d-l-con">' +
  492. ' <div class="d-l-l-text">' +
  493. ' <h4>地址:' + (item.address?item.address:"") +
  494. '</h4>' +
  495. ' </div>' +
  496. ' </div>' +
  497. ' </span>' +
  498. '<span>' +
  499. '</div>'
  500. }
  501. return markersMap;
  502. },
  503. sewageOutletClick(data) {
  504. const params = Object.assign({})
  505. params.longitude = data.longitude;
  506. params.latitude = data.latitude;
  507. const treeLabels = [{
  508. "id": null,
  509. "labelCode": "999",
  510. "labelName": "电视墙",
  511. "cameraType": null,
  512. "parentLabelCode": ""
  513. }];
  514. const labelChannels = [];
  515. for (let i in data.cameraList){
  516. treeLabels.push({
  517. "id": null,
  518. "labelCode": data.cameraList[i].cameraCode,
  519. "labelName": data.cameraList[i].cameraName,
  520. "cameraType": "1",
  521. "parentLabelCode": "999"
  522. })
  523. labelChannels.push({
  524. "labelCode": data.cameraList[i].cameraCode,
  525. "channelDates": [
  526. {
  527. "channelCode": data.cameraList[i].cameraCode,
  528. "channelName": data.cameraList[i].cameraName,
  529. "channelSn": null,
  530. "cameraType": "1",
  531. "online": "1",
  532. "cameraCode": "1"
  533. }
  534. ]
  535. })
  536. }
  537. const dianshiqiang = [
  538. {
  539. "switchTab": "2",
  540. "treeLabels": treeLabels,
  541. "labelChannels": labelChannels
  542. }
  543. ]
  544. if(data.cameraList.length > 0){
  545. this.$refs.TVWall.showTVWall1(data.longitude, data.latitude, dianshiqiang);
  546. }
  547. },
  548. }
  549. }
  550. </script>
  551. <style rel="stylesheet/scss" lang="scss" scoped>
  552. @import '@/assets/styles/base.scss';
  553. </style>