monitor.vue 40 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025
  1. <!--监控中心-->
  2. <template>
  3. <div class="visual-con">
  4. <!--头部-->
  5. <vheader></vheader>
  6. <!--主体-->
  7. <div class="visual-body">
  8. <!-- 左侧 -->
  9. <div class="leftbar" :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="this-title">
  14. <span>事态感知</span>
  15. <dv-decoration-3 style="width:150px;height:15px;margin-right: 1rem;"/>
  16. </div>
  17. <div class="i-list-con h-73">
  18. <div class="d-l-con-icon">
  19. <div class="icon-con w-33 m-btm-no" :class="{on:iconCurrentIndex1==index}"
  20. v-for="(item,index) in visuForestCloudMapDeviceBOList"
  21. v-on:click="selectDeviceType(index)">
  22. <!-- -->
  23. <div class="icon icon-dot"></div>
  24. <div class="icon-text">
  25. <h6>{{ item.deviceCount }}</h6>
  26. <h5>{{ item.deviceName }}</h5>
  27. </div>
  28. </div>
  29. <div class="icon-con w-33 m-btm-no">
  30. <div class="icon icon-dot"></div>
  31. <div class="icon-text">
  32. <h6>0</h6>
  33. <h5>传感器</h5>
  34. </div>
  35. </div>
  36. <div class="icon-con w-33 m-btm-no">
  37. <div class="icon icon-dot"></div>
  38. <div class="icon-text">
  39. <h6>0</h6>
  40. <h5>大喇叭</h5>
  41. </div>
  42. </div>
  43. </div>
  44. <!--<div class="overflow-y" style="height: 33vh;">-->
  45. <!--<el-collapse accordion>-->
  46. <!--<el-collapse-item v-for="(item,index) in region" :key="index">-->
  47. <!--&lt;!&ndash; deptId &ndash;&gt;-->
  48. <!--<template slot="title">-->
  49. <!--<div class="d-l-con sj-collapse" :class="{on:listCurrentIndex1==item.deptId}"-->
  50. <!--v-on:click="selectCameraByDeptId(item.deptId)">-->
  51. <!--<div class="d-l-l-text">-->
  52. <!--<h4 class="collapse-title">{{ item.deptName }}</h4>-->
  53. <!--</div>-->
  54. <!--<div class="d-l-l-count">{{ item.deptCount }}</div>-->
  55. <!--</div>-->
  56. <!--</template>-->
  57. <!--</el-collapse-item>-->
  58. <!--</el-collapse>-->
  59. <!--</div>-->
  60. <!--&lt;!&ndash; 横向柱状 echart &ndash;&gt;-->
  61. <!--<div class="overflow-y" style="height: 33vh;">-->
  62. <!--<div id="camera-chart" style="width: 100%;height:33vh;"></div>-->
  63. <!--</div>-->
  64. <div class="overflow-y" style="height: 70vh;">
  65. <div class="i-list-con h-65">
  66. <div class="head-container">
  67. <el-input
  68. v-model="deptName"
  69. placeholder="请输入部门名称"
  70. clearable
  71. size="small"
  72. prefix-icon="el-icon-search"
  73. style="margin-bottom: 20px"
  74. />
  75. </div>
  76. <div class="head-container tree-scrollbar" style="height: 700px;overflow-y:auto;">
  77. <el-tree
  78. :data="deptOptions"
  79. :props="defaultProps"
  80. :expand-on-click-node="false"
  81. :filter-node-method="filterNode"
  82. ref="tree"
  83. node-key="id"
  84. :default-expanded-keys="[100]"
  85. @node-click="handleNodeClick"
  86. />
  87. </div>
  88. </div>
  89. </div>
  90. </div>
  91. </dv-border-box-13>
  92. </div>
  93. </div>
  94. <!-- 地图 -->
  95. <supermap ref="supermap" style="width: 100%;height: 100vh;" :mapDiv="'forestMap'" class="indexSupermapClass"
  96. :mapSite="{doubleClickZoom:false}" :codes="['9fa5']" :isSideBySide="false" @preview="preview">
  97. </supermap>
  98. <!-- 右侧 -->
  99. <div class="rightbar" :class="indentright" ref="right">
  100. <div class="forthis">
  101. <dv-border-box-13 backgroundColor="rgba(12, 19, 38, .90)" style="padding-bottom: 1rem;">
  102. <img src="../assets/images/integrated/light.png" style="width: 100%; margin-top: .4rem;"/>
  103. <div class="this-title">
  104. <span>列表</span>
  105. <dv-decoration-3 style="width:150px;height:15px;margin-right: 1rem;"/>
  106. </div>
  107. <div class="i-list-con h-43">
  108. <div class="d-l-con" v-for="(item,index) in visuForestCloudCameraBOList"
  109. :class="{on:listCurrentIndex2 == index}"
  110. v-on:click="dropLocation(item.latitude,item.longitude,index)">
  111. <div class="d-l-l-text">
  112. <i class="iconfont sj-icon-jkzx icon-sxt"></i>
  113. <h4>{{ item.cameraName }}</h4>
  114. </div>
  115. </div>
  116. </div>
  117. </dv-border-box-13>
  118. </div>
  119. <div class="forthis">
  120. <dv-border-box-13 backgroundColor="rgba(12, 19, 38, .90)" style="padding-bottom: 1rem;">
  121. <img src="../assets/images/integrated/light.png" style="width: 100%; margin-top: .4rem;"/>
  122. <div class="this-title">
  123. <span>重点区域</span>
  124. <dv-decoration-3 style="width:150px;height:15px;margin-right: 1rem;"/>
  125. </div>
  126. <div class="i-list-con h-25">
  127. <div class="d-l-con" v-for="(item,index) in keyAreaList" :class="{on:listCurrentIndex3 == index}" @click="getRegionalFlag(item.id)">
  128. <div class="d-l-l-text">
  129. <i class="i-small"></i>
  130. <h4>{{ item.areaName }}</h4>
  131. </div>
  132. </div>
  133. </div>
  134. </dv-border-box-13>
  135. </div>
  136. </div>
  137. <vBottomMenu ref="bottomMenu"></vBottomMenu>
  138. <!-- <div class="mascot" ref="mascot" :class="indentStyle" @click="indent"><img-->
  139. <!-- src="@/assets/images/mascot.png"/></div>-->
  140. <!-- </el-tooltip>-->
  141. </div>
  142. <eventLocation ref="eventLocation"></eventLocation>
  143. <TVWall ref="TVWall"></TVWall>
  144. <el-dialog :title="cameraTitle" :visible.sync="cameraVisible" v-if="cameraVisible" customClass="videoCustomWidth"
  145. @close="cancelEventLocationShow()">
  146. <div style="width:1020px;height:625px;position:relative;">
  147. <!--视频窗口展示---海康-->
  148. <div id="playWnd" class="playWnd" style="left: 0px; top: 0px;"></div>
  149. </div>
  150. </el-dialog>
  151. </div>
  152. </template>
  153. <script>
  154. import {
  155. selectDeviceType,
  156. selectCameraByDeptId,
  157. selectKeyAreaList,
  158. getRegionalFlag,
  159. findCameraByDept
  160. } from '@/api/monitor'
  161. import { treeselect } from '@/api/system/dept'
  162. import supermap from '@/components/supermap' //超图
  163. import vheader from '@/components/v-header.vue' //一体化共用头部
  164. import vBottomMenu from '@/components/vBottomMenu.vue' //一体化公共底部菜单
  165. import eventLocation from '@/components/eventLocation.vue' //事件定位弹窗
  166. import TVWall from '@/components/TVWall.vue' //电视墙弹窗
  167. /** ----------------------------------摄像头预览开始------------------------------------- */
  168. import {
  169. getDahuaVideoServer
  170. } from '@/api/dahua/dahua'
  171. import {
  172. getHaiKangVideoServer
  173. } from '@/api/haikang/haikang'
  174. import DHWs from '@/dahua/lib/DHWs'
  175. /** ----------------------------------摄像头预览结束------------------------------------- */
  176. // import echarts from 'echarts'
  177. let echarts = require('echarts')
  178. export default {
  179. components: {
  180. supermap,
  181. vheader,
  182. vBottomMenu,
  183. eventLocation,
  184. TVWall
  185. },
  186. watch: {
  187. // 根据名称筛选部门树
  188. deptName(val) {
  189. this.$refs.tree.filter(val)
  190. }
  191. },
  192. created() {
  193. /** ----------------------------------摄像头预览开始------------------------------------- */
  194. const DHWsInstance = DHWs.getInstance()
  195. this.ws = DHWsInstance
  196. /** ----------------------------------摄像头预览结束------------------------------------- */
  197. /** ----------------------------------底部按钮公用组件开始------------------------------------- */
  198. window.showDialog = this.showDialog
  199. window.choseLayerSwitching = this.choseLayerSwitching
  200. window.choseLayerSwitchingList = this.choseLayerSwitchingList
  201. window.choseLayerSwitchingList_Data = this.choseLayerSwitchingList_Data
  202. /** ----------------------------------底部按钮公用组件结束------------------------------------- */
  203. },
  204. mounted() {
  205. this.selectDeviceType(-1)
  206. this.selectKeyAreaList()
  207. this.bottomMenuList() //获取底部公共组件消息和任务
  208. this.getTreeselect()
  209. },
  210. data() {
  211. return {
  212. iconCurrentIndex1: '-1',
  213. listCurrentIndex1: '-1',
  214. listCurrentIndex2: '-1',
  215. listCurrentIndex3: '-1',
  216. graphicsList:[],//重点区域
  217. /** ----------------------------------摄像头预览开始------------------------------------- */
  218. //大华
  219. activePanel: 'key1',
  220. isLogin: false,
  221. cameraParams: [],
  222. ws: null,
  223. //海康
  224. cameraTitle: '',
  225. cameraVisible: false,
  226. initCount: 0,
  227. pubKey: '',
  228. oWebControl: null,
  229. /** ----------------------------------摄像头预览结束------------------------------------- */
  230. visuForestCloudMapDeviceBOList: [],
  231. visuForestCloudCameraBOList: [],
  232. cameraMarkersList: [],
  233. sourceData: [],
  234. keyAreaList: [],//重点区域
  235. iframeBoo: true,
  236. open: false,
  237. iframeVue: null,
  238. activeName: 'info',
  239. radio: '1',
  240. region: [],
  241. //左右缩进
  242. indentStyle: '',
  243. indentleft: '',
  244. indentright: '',
  245. indentText: '收起左右栏',
  246. indentdisabled: false,
  247. domId: 'dom1',
  248. // 部门名称
  249. deptName: undefined,
  250. // 部门树选项
  251. deptOptions: undefined,
  252. defaultProps: {
  253. children: 'children',
  254. label: 'label'
  255. },
  256. }
  257. },
  258. methods: {
  259. /** 部门树*/
  260. // 查询部门下拉树结构
  261. getTreeselect() {
  262. treeselect().then(response => {
  263. console.log(response.data)
  264. this.deptOptions = response.data
  265. })
  266. },
  267. // 筛选节点
  268. filterNode(value, data) {
  269. if (!value) return true
  270. return data.label.indexOf(value) !== -1
  271. },
  272. // 节点单击事件
  273. handleNodeClick(data) {
  274. // this.findCameraByDept(data.id)
  275. this.selectCameraByDeptId(data.id);
  276. },
  277. findCameraByDept(deptId) {
  278. findCameraByDept(deptId).then(res => {
  279. let that = this;
  280. //根据设备类型查看列表
  281. this.cameraMarkersList = [];
  282. that.visuForestCloudCameraBOList = res.data
  283. if (res.data != null && res.data.length > 0) {
  284. this.cameraMarkersList.push({
  285. lng: res.data[0].deptLongitude,
  286. lat: res.data[0].deptLatitude,
  287. icon: 'marker',
  288. bindPopupHtml: '',
  289. click: '',
  290. keepBindPopup: false,
  291. isAggregation: true,
  292. radius:0
  293. })
  294. for (let i = 0; i < res.data.length; i++) {
  295. let markersMap = {
  296. lng: 124.59,
  297. lat: 43.02,
  298. icon: 'camera',
  299. bindPopupHtml: '',
  300. click: 'preview',
  301. parameter: '',
  302. keepBindPopup: false,
  303. isAggregation: false
  304. }
  305. if (res.data[i].channelCode != null) {
  306. markersMap.parameter = {code:res.data[i].cameraCode,
  307. type:res.data[i].cameraFactory}
  308. } else {
  309. markersMap.parameter = []
  310. }
  311. markersMap.lng = res.data[i].longitude
  312. markersMap.lat = res.data[i].latitude
  313. markersMap.radius = res.data[i].cameraRadius
  314. markersMap.bindPopupHtml = '<div class="map-tip">' +
  315. '<span>' +
  316. ' <div class="d-l-con">' +
  317. ' <div class="d-l-l-text">' +
  318. ' <h4>经纬度:' + res.data[i].longitude + ',' + res.data[i].latitude +
  319. '</h4>' +
  320. ' </div>' +
  321. ' </div>' +
  322. ' </span>' +
  323. '<span>' +
  324. ' <div class="d-l-con">' +
  325. ' <div class="d-l-l-text">' +
  326. ' <h4>摄像头名称:' + res.data[i].cameraName + '</h4>' +
  327. ' </div>' +
  328. ' </div>' +
  329. ' </span>' +
  330. '<span>' +
  331. ' <div class="d-l-con">' +
  332. ' <div class="d-l-l-text">' +
  333. ' <h4>摄像头类型:' + (res.data[i].cameraFactory=="1"?"大华":"海康") + '</h4>' +
  334. ' </div>' +
  335. ' </div>' +
  336. ' </span>' +
  337. '<span>' +
  338. ' <div class="d-l-con">' +
  339. ' <div class="d-l-l-text">' +
  340. ' <h4>摄像头半径:' + res.data[i].cameraRadius + '米</h4>' +
  341. ' </div>' +
  342. ' </div>' +
  343. ' </span>' +
  344. '</div>'
  345. this.cameraMarkersList.push(markersMap)
  346. }
  347. setTimeout(() => {
  348. that.$refs.supermap.clearM(true)
  349. that.$refs.supermap.clearM(false)
  350. that.$refs.supermap.setMarkersRadius(this.cameraMarkersList)
  351. }, 1000)
  352. }else{
  353. setTimeout(() => {
  354. that.$refs.supermap.clearM(false)
  355. that.$refs.supermap.clearM(false)
  356. that.$refs.supermap.setMarkersRadius(this.cameraMarkersList)
  357. }, 1000)
  358. }
  359. })
  360. },
  361. /** 部门树*/
  362. selectKeyAreaList() {
  363. this.keyAreaList=[]
  364. //获取重点区域列表
  365. let that = this
  366. selectKeyAreaList().then(res => {
  367. that.keyAreaList = res.data
  368. })
  369. },
  370. getRegionalFlag(id){
  371. //获取重点区域
  372. this.listCurrentIndex3=id
  373. let that = this
  374. getRegionalFlag(id).then(res => {
  375. that.graphicsList=[]
  376. //地图标记
  377. if (res.data != null && res.data.length > 0) {
  378. for (let i = 0; i < res.data.length; i++) {
  379. let latlng = {
  380. lat: res.data[i].lat,
  381. lng: res.data[i].lng
  382. }
  383. that.graphicsList.push(latlng)
  384. }
  385. setTimeout(() => {
  386. that.$refs.supermap.clearG()
  387. that.$refs.supermap.setGraphicsList(this.graphicsList, 'red')
  388. }, 1000)
  389. } else {
  390. that.$refs.supermap.clearG()
  391. }
  392. })
  393. },
  394. /** ----------------------------------底部按钮公用组件开始------------------------------------- */
  395. bottomMenuList() {
  396. this.$refs.bottomMenu.selectTaskList()//获取任务列表
  397. this.$refs.bottomMenu.selectMessageList()//获取消息列表
  398. this.$refs.bottomMenu.linBanTreeselect()//查询林班层级树结构
  399. this.$refs.bottomMenu.deptTreeselect()//查询林场部门树结构
  400. },
  401. showDialog(click) {
  402. if (click == 'eventLocation') {
  403. this.$refs.eventLocation.showEventLocation()
  404. this.$refs.supermap.isEditableLayers = false
  405. this.$refs.bottomMenu.showChild = false
  406. this.$refs.bottomMenu.showBanChild = false
  407. this.$refs.bottomMenu.showChangChild = false
  408. } else if (click == 'editableLayers') {
  409. this.$refs.bottomMenu.showChild = false
  410. this.$refs.bottomMenu.showBanChild = false
  411. this.$refs.bottomMenu.showChangChild = false
  412. if (!this.$refs.supermap.isEditableLayers) {
  413. this.$refs.supermap.isEditableLayers = true
  414. } else {
  415. this.$refs.supermap.isEditableLayers = false
  416. }
  417. } else if (click == 'layerSwitching') {
  418. this.$refs.supermap.isEditableLayers = false
  419. this.$refs.bottomMenu.showBanChild = false
  420. this.$refs.bottomMenu.showChangChild = false
  421. if (!this.$refs.bottomMenu.showChild) {
  422. this.$refs.bottomMenu.showChild = true
  423. } else {
  424. this.$refs.bottomMenu.showChild = false
  425. }
  426. } else if (click == 'TVWall') {
  427. this.$refs.TVWall.showTVWall()
  428. this.$refs.supermap.isEditableLayers = false
  429. this.$refs.bottomMenu.showChild = false
  430. this.$refs.bottomMenu.showBanChild = false
  431. this.$refs.bottomMenu.showChangChild = false
  432. } else if (click == 'forestban') {
  433. this.$refs.supermap.isEditableLayers = false
  434. this.$refs.bottomMenu.showChild = false
  435. this.$refs.bottomMenu.showChangChild = false
  436. if (!this.$refs.bottomMenu.showBanChild) {
  437. this.$refs.bottomMenu.showBanChild = true
  438. } else {
  439. this.$refs.bottomMenu.showBanChild = false
  440. }
  441. } else if (click == 'forestchang') {
  442. this.$refs.supermap.isEditableLayers = false
  443. this.$refs.bottomMenu.showBanChild = false
  444. this.$refs.bottomMenu.showChild = false
  445. if (!this.$refs.bottomMenu.showChangChild) {
  446. this.$refs.bottomMenu.showChangChild = true
  447. } else {
  448. this.$refs.bottomMenu.showChangChild = false
  449. }
  450. }
  451. },
  452. //选择图层
  453. choseLayerSwitching(url, isClear) {
  454. this.$refs.supermap.layerSwitching(url, isClear)
  455. },
  456. //选择图层(传递数组)
  457. choseLayerSwitchingList(urlList) {
  458. this.$refs.supermap.layerSwitchingList(urlList)
  459. },
  460. //选择图层(传递数组) 带数据
  461. choseLayerSwitchingList_Data(urlList) {
  462. this.$refs.supermap.layerSwitchingList_Data(urlList)
  463. },
  464. /** ----------------------------------底部按钮公用组件结束------------------------------------- */
  465. // cameraChat() {
  466. // // 基于准备好的dom,初始化echarts实例
  467. // let myChart = echarts.init(document.getElementById('camera-chart'))
  468. // // 绘制图表
  469. // const dfColor = ['#92E1FF', '#0097FB', '#30ECA6', '#FFC227', '#FF4848']
  470. // myChart.setOption({
  471. // dataset: {
  472. // source: this.sourceData
  473. // },
  474. // tooltip: {
  475. // trigger: 'item'
  476. //
  477. // },
  478. // grid: {
  479. // top: '5%',
  480. // left: '5%',
  481. // // right: "4%",
  482. // bottom: '0%',
  483. // width: '75%',
  484. // containLabel: true
  485. // },
  486. // dataZoom: [{
  487. // show:true,
  488. // type: 'slider',
  489. // yAxisIndex:0,
  490. // left:10,
  491. // start: 0,
  492. // end: this.sourceData.length > 10 ? 40 : 100,
  493. // width:15
  494. // }],
  495. // xAxis: {
  496. // show: false,
  497. // type: 'value',
  498. // left:10
  499. // },
  500. // yAxis: {
  501. // type: 'category', // 不设置类目轴,抽离的dataset数据展示不出来
  502. // inverse: true,
  503. // axisLabel: {
  504. // show: true,
  505. // textStyle: {
  506. // color: '#5deaff',
  507. // fontSize: '12'
  508. // }
  509. // },
  510. // splitLine: {
  511. // show: false
  512. // },
  513. // axisTick: {
  514. // show: false
  515. // },
  516. // axisLine: {
  517. // show: false
  518. // }
  519. // },
  520. //
  521. // series: [{
  522. //
  523. // type: 'bar',
  524. // animationCurve: 'easeOutBack',
  525. // barWidth: 5,
  526. // label: {
  527. // show: true,
  528. // position: 'right',
  529. // offset: [0, 0],
  530. // color: '#88dfd5',
  531. // // fontSize: "12",
  532. // style: {
  533. // fill: '#fff'
  534. // }
  535. // },
  536. // backgroundBar: {
  537. // show: true,
  538. // style: {
  539. // fill: 'rgba(97,152,255,0.20)'
  540. // }
  541. // },
  542. // barStyle: {
  543. // stroke: 'rgba(41,244,236,1)'
  544. // },
  545. // gradient: {
  546. // color: ['rgba(41,244,236,1)', 'rgba(41,244,236,0)']
  547. // },
  548. // itemStyle: {
  549. // label: {
  550. // show: true
  551. // },
  552. // labelLine: {
  553. // show: false
  554. // },
  555. // color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [{
  556. // offset: 0,
  557. // color: 'rgba(41,244,236,0)'
  558. // },
  559. // {
  560. // offset: 1,
  561. // color: 'rgba(41,244,236,.5)'
  562. // }
  563. // ]),
  564. // borderColor: '#a2f9f7',
  565. // shadowBlur: 16,
  566. // shadowColor: '#a2f9f7'
  567. // }
  568. // }]
  569. // })
  570. // },
  571. selectDeviceType(index) {
  572. this.iconCurrentIndex1 = index
  573. //获取左侧动态感知设备
  574. let that = this
  575. selectDeviceType().then(res => {
  576. that.cameraMarkersList=[]
  577. that.visuForestCloudMapDeviceBOList = res.data.visuForestCloudMapDeviceBOList
  578. that.region = res.data.visuForestCloudTodaySjfbBOList
  579. if (res.data.visuForestCloudTodaySjfbBOList != null && res.data.visuForestCloudTodaySjfbBOList
  580. .length > 0) {
  581. for (let i = 0; i < res.data.visuForestCloudTodaySjfbBOList.length; i++) {
  582. let aa = []
  583. aa.push(res.data.visuForestCloudTodaySjfbBOList[i].deptName)
  584. aa.push(Number(res.data.visuForestCloudTodaySjfbBOList[i].deptCount))
  585. this.sourceData.push(aa)
  586. }
  587. }
  588. that.visuForestCloudCameraBOList = res.data.visuForestCloudCameraBOList
  589. // this.cameraChat()
  590. if (res.data.visuForestCloudCameraBOList != null && res.data.visuForestCloudCameraBOList
  591. .length > 0) {
  592. for (let i = 0; i < res.data.visuForestCloudCameraBOList.length; i++) {
  593. let markersMap = {
  594. lng: 124.59,
  595. lat: 43.02,
  596. icon: 'camera',
  597. bindPopupHtml: '',
  598. click: 'preview',
  599. parameter: '',
  600. keepBindPopup: false,
  601. isAggregation: false
  602. }
  603. if (res.data.visuForestCloudCameraBOList[i].channelCode != null) {
  604. markersMap.parameter = {code:res.data.visuForestCloudCameraBOList[i].cameraCode,
  605. type:res.data.visuForestCloudCameraBOList[i].cameraFactory}
  606. } else {
  607. markersMap.parameter = []
  608. }
  609. markersMap.lng = res.data.visuForestCloudCameraBOList[i].longitude
  610. markersMap.lat = res.data.visuForestCloudCameraBOList[i].latitude
  611. markersMap.radius = res.data.visuForestCloudCameraBOList[i].cameraRadius
  612. markersMap.bindPopupHtml = '<div class="map-tip">' +
  613. '<span>' +
  614. ' <div class="d-l-con">' +
  615. ' <div class="d-l-l-text">' +
  616. ' <h4>经纬度:' + res.data.visuForestCloudCameraBOList[i].longitude +
  617. ',' + res.data.visuForestCloudCameraBOList[i].latitude + '</h4>' +
  618. ' </div>' +
  619. ' </div>' +
  620. ' </span>' +
  621. '<span>' +
  622. ' <div class="d-l-con">' +
  623. ' <div class="d-l-l-text">' +
  624. ' <h4>摄像头名称:' + res.data.visuForestCloudCameraBOList[i]
  625. .cameraName + '</h4>' +
  626. ' </div>' +
  627. ' </div>' +
  628. ' </span>' +
  629. '<span>' +
  630. ' <div class="d-l-con">' +
  631. ' <div class="d-l-l-text">' +
  632. ' <h4>摄像头类型:' + (res.data.visuForestCloudCameraBOList[i].cameraFactory=="1"?"大华":"海康") + '</h4>' +
  633. ' </div>' +
  634. ' </div>' +
  635. ' </span>' +
  636. '<span>' +
  637. ' <div class="d-l-con">' +
  638. ' <div class="d-l-l-text">' +
  639. ' <h4>摄像头半径:' + res.data.visuForestCloudCameraBOList[i]
  640. .cameraRadius + '米</h4>' +
  641. ' </div>' +
  642. ' </div>' +
  643. ' </span>' +
  644. '</div>'
  645. this.cameraMarkersList.push(markersMap)
  646. // cameraAccount: "1"
  647. // cameraCode: "1000010"
  648. // cameraFactory: "2"
  649. // cameraIp: "1"
  650. // cameraName: "2"
  651. // cameraPasword: "2"
  652. // cameraPort: 2
  653. // cameraRadius: 20
  654. // cameraRegion: "3"
  655. // dataDeptId: null
  656. // dataStatus: null
  657. // eventType: null
  658. // height: "11"
  659. // id: "0d165fc362514f79b12a899ea66295fd"
  660. // latitude: "49.325625"
  661. // longitude: "125.3333"
  662. }
  663. setTimeout(() => {
  664. that.$refs.supermap.clearM(true)
  665. that.$refs.supermap.clearM(false)
  666. that.$refs.supermap.setMarkersRadius(this.cameraMarkersList)
  667. }, 1000)
  668. }
  669. })
  670. },
  671. dropLocation(lat, lng, index) {
  672. this.listCurrentIndex2 = index
  673. this.$refs.supermap.dropLocation(lat, lng)
  674. },
  675. selectCameraByDeptId(depId) {
  676. this.listCurrentIndex1 = depId
  677. let that = this
  678. that.cameraMarkersList = []
  679. that.visuForestCloudCameraBOList = []
  680. selectCameraByDeptId(depId).then(res => {
  681. //根据设备类型查看列表
  682. that.visuForestCloudCameraBOList = res.data
  683. if (res.data != null && res.data.length > 0) {
  684. for (let i = 0; i < res.data.length; i++) {
  685. let markersMap = {
  686. lng: 124.59,
  687. lat: 43.02,
  688. icon: 'camera',
  689. bindPopupHtml: '',
  690. click: 'preview',
  691. parameter: '',
  692. keepBindPopup: false,
  693. isAggregation: false
  694. }
  695. if (res.data[i].channelCode != null) {
  696. markersMap.parameter = {code:res.data[i].cameraCode,
  697. type:res.data[i].cameraFactory}
  698. } else {
  699. markersMap.parameter = []
  700. }
  701. markersMap.lng = res.data[i].longitude
  702. markersMap.lat = res.data[i].latitude
  703. markersMap.radius = res.data[i].cameraRadius
  704. markersMap.bindPopupHtml = '<div class="map-tip">' +
  705. '<span>' +
  706. ' <div class="d-l-con">' +
  707. ' <div class="d-l-l-text">' +
  708. ' <h4>经纬度:' + res.data[i].longitude + ',' + res.data[i].latitude +
  709. '</h4>' +
  710. ' </div>' +
  711. ' </div>' +
  712. ' </span>' +
  713. '<span>' +
  714. ' <div class="d-l-con">' +
  715. ' <div class="d-l-l-text">' +
  716. ' <h4>摄像头名称:' + res.data[i].cameraName + '</h4>' +
  717. ' </div>' +
  718. ' </div>' +
  719. ' </span>' +
  720. '<span>' +
  721. ' <div class="d-l-con">' +
  722. ' <div class="d-l-l-text">' +
  723. ' <h4>摄像头类型:' + (res.data[i].cameraFactory=="1"?"大华":"海康") + '</h4>' +
  724. ' </div>' +
  725. ' </div>' +
  726. ' </span>' +
  727. '<span>' +
  728. ' <div class="d-l-con">' +
  729. ' <div class="d-l-l-text">' +
  730. ' <h4>摄像头半径:' + res.data[i]
  731. .cameraRadius + '米</h4>' +
  732. ' </div>' +
  733. ' </div>' +
  734. ' </span>' +
  735. '</div>'
  736. this.cameraMarkersList.push(markersMap)
  737. // cameraAccount: "1"
  738. // cameraCode: "1000010"
  739. // cameraFactory: "2"
  740. // cameraIp: "1"
  741. // cameraName: "2"
  742. // cameraPasword: "2"
  743. // cameraPort: 2
  744. // cameraRadius: 20
  745. // cameraRegion: "3"
  746. // dataDeptId: null
  747. // dataStatus: null
  748. // eventType: null
  749. // height: "11"
  750. // id: "0d165fc362514f79b12a899ea66295fd"
  751. // latitude: "49.325625"
  752. // longitude: "125.3333"
  753. }
  754. setTimeout(() => {
  755. that.$refs.supermap.clearM(true)
  756. that.$refs.supermap.clearM(false)
  757. that.$refs.supermap.setMarkersRadius(this.cameraMarkersList)
  758. }, 1000)
  759. }
  760. })
  761. },
  762. //吉祥物收起左右框
  763. indent() {
  764. let list = document.getElementsByClassName('el-tooltip__popper')
  765. list[list.length - 1].style.display = 'none'
  766. if (this.indentStyle == '') {
  767. this.indentStyle = 'indent-style'
  768. this.indentleft = 'indent-left'
  769. this.indentright = 'indent-right'
  770. this.indentText = '展开左右栏'
  771. } else if (this.indentText == '展开左右栏') {
  772. this.indentStyle = ''
  773. this.indentleft = ''
  774. this.indentright = ''
  775. this.indentText = '收起左右栏'
  776. }
  777. },
  778. /** ----------------------------------摄像头预览开始------------------------------------- */
  779. alertLogin: function() {
  780. this.$modal.msg('登录中....')
  781. },
  782. alertLoginSuccess: function() {
  783. this.$modal.msgSuccess('登录成功!')
  784. },
  785. alertLoginFailed: function() {
  786. this.$modal.msgError('登陆失败!')
  787. },
  788. alertReinstall: function() {
  789. this.$modal.msgWarning('请重新安装客户端')
  790. },
  791. cancelEventLocationShow() {
  792. if (this.oWebControl != null) {
  793. this.oWebControl.JS_HideWnd() // 先让窗口隐藏,规避可能的插件窗口滞后于浏览器消失问题
  794. this.oWebControl.JS_Disconnect().then(function() { // 断开与插件服务连接成功
  795. },
  796. function() { // 断开与插件服务连接失败
  797. })
  798. }
  799. },
  800. /** 预览按钮操作 */
  801. preview(cameraParam) {
  802. if(cameraParam.type=='1'){
  803. getDahuaVideoServer().then(newResponse => {
  804. console.log(newResponse)
  805. this.ws.detectConnectQt().then(res => {
  806. if (res) { // 连接客户端成功
  807. this.alertLogin()
  808. this.ws.login({
  809. loginIp: newResponse.loginIp,
  810. loginPort: newResponse.loginPort,
  811. userName: newResponse.userName,
  812. userPwd: newResponse.userPwd,
  813. token: '',
  814. https: 1
  815. })
  816. this.ws.on('loginState', (res) => {
  817. this.isLogin = res
  818. console.log('---res-----', res)
  819. if (res) {
  820. this.alertLoginSuccess()
  821. this.activePanel = 'key2'
  822. this.realTimeVideoDialog(cameraParam.code)
  823. } else {
  824. this.alertLoginFailed()
  825. }
  826. })
  827. } else { // 连接客户端失败
  828. this.alertReinstall()
  829. }
  830. })
  831. })
  832. }else if(cameraParam.type=='0'){
  833. let that = this
  834. that.cameraVisible = true
  835. getHaiKangVideoServer({cameraCode:cameraParam.code}).then(newResponse => {
  836. that.cameraTitle = '摄像头-'+newResponse.data.cameraName
  837. that.initPlugin(newResponse.data.appkey,newResponse.data.loginIp,newResponse.data.secret,newResponse.data.loginPort)
  838. setTimeout(function() {
  839. that.playhk(newResponse.data.channelCode)
  840. }, 5000)
  841. })
  842. }
  843. },
  844. realTimeVideoDialog(cameraParams) { // 调用弹窗实时播放接口
  845. if (!this.isLogin) {
  846. this.$Message.info('正在登陆客户端,请稍等......')
  847. return false
  848. }
  849. const params = [cameraParams];
  850. this.ws.openVideo(params)
  851. },
  852. /** ----------------------------------摄像头预览结束------------------------------------- */
  853. /** ----------------------------------海康摄像头预览开始------------------------------------- */
  854. // 创建播放实例
  855. initPlugin(newappkey,newloginIp,newsecret,newloginPort) {
  856. let that=this
  857. that.oWebControl = new WebControl({
  858. szPluginContainer: 'playWnd', // 指定容器id
  859. iServicePortStart: 15900, // 指定起止端口号,建议使用该值
  860. iServicePortEnd: 15909,
  861. szClassId: '23BF3B0A-2C56-4D97-9C03-0CB103AA8F11', // 用于IE10使用ActiveX的clsid
  862. cbConnectSuccess: function() { // 创建WebControl实例成功
  863. that.oWebControl.JS_StartService('window', { // WebControl实例创建成功后需要启动服务
  864. dllPath: './VideoPluginConnect.dll' // 值"./VideoPluginConnect.dll"写死
  865. }).then(function() { // 启动插件服务成功
  866. that.oWebControl.JS_SetWindowControlCallback({ // 设置消息回调
  867. cbIntegrationCallBack: cbIntegrationCallBack
  868. })
  869. that.oWebControl.JS_CreateWnd('playWnd', 1020, 600).then(function() { //JS_CreateWnd创建视频播放窗口,宽高可设定
  870. that.init(newappkey,newloginIp,newsecret,newloginPort) // 创建播放实例成功后初始化
  871. })
  872. }, function() { // 启动插件服务失败
  873. })
  874. },
  875. cbConnectError: function() { // 创建WebControl实例失败
  876. that.oWebControl = null
  877. $('#playWnd').html('插件未启动,正在尝试启动,请稍候...<a href="./hk/VideoWebPlugin.exe">点击下载插件</a>')
  878. WebControl.JS_WakeUp('VideoWebPlugin://') // 程序未启动时执行error函数,采用wakeup来启动程序
  879. initCount++
  880. if (initCount < 3) {
  881. setTimeout(function() {
  882. that.initPlugin(newappkey,newloginIp,newsecret,newloginPort)
  883. }, 3000)
  884. } else {
  885. $('#playWnd').html('插件启动失败,请检查插件是否安装!<a href="./hk/VideoWebPlugin.exe">点击下载插件</a>')
  886. }
  887. },
  888. cbConnectClose: function(bNormalClose) {
  889. // 异常断开:bNormalClose = false
  890. // JS_Disconnect正常断开:bNormalClose = true
  891. console.log('cbConnectClose')
  892. that.oWebControl = null
  893. }
  894. })
  895. },
  896. //播放海康摄像头
  897. playhk(channelCode) {
  898. var cameraIndexCode = channelCode //获取输入的监控点编号值,必填
  899. var streamMode = 0 //主子码流标识:0-主码流,1-子码流
  900. var transMode = 1 //传输协议:0-UDP,1-TCP
  901. var gpuMode = 0 //是否启用GPU硬解,0-不启用,1-启用
  902. var wndId = -1 //播放窗口序号(在2x2以上布局下可指定播放窗口)
  903. cameraIndexCode = cameraIndexCode.replace(/(^\s*)/g, '')
  904. cameraIndexCode = cameraIndexCode.replace(/(\s*$)/g, '')
  905. this.oWebControl.JS_RequestInterface({
  906. funcName: 'startPreview',
  907. argument: JSON.stringify({
  908. cameraIndexCode: cameraIndexCode, //监控点编号
  909. streamMode: streamMode, //主子码流标识
  910. transMode: transMode, //传输协议
  911. gpuMode: gpuMode, //是否开启GPU硬解
  912. wndId: wndId //可指定播放窗口
  913. })
  914. })
  915. },
  916. //初始化
  917. init(newappkey,newloginIp,newsecret,newloginPort) {
  918. let that = this
  919. that.getPubKey(function() {
  920. ////////////////////////////////// 请自行修改以下变量值 ////////////////////////////////////
  921. var appkey = newappkey //综合安防管理平台提供的appkey,必填
  922. var secret = that.setEncrypt(newsecret) //综合安防管理平台提供的secret,必填
  923. var ip = newloginIp //综合安防管理平台IP地址,必填
  924. var playMode = 0 //初始播放模式:0-预览,1-回放
  925. var port = Number(newloginPort) //综合安防管理平台端口,若启用HTTPS协议,默认443
  926. var snapDir = 'D:\\SnapDir' //抓图存储路径
  927. var videoDir = 'D:\\VideoDir' //紧急录像或录像剪辑存储路径
  928. var layout = '1x1' //playMode指定模式的布局
  929. var enableHTTPS = 1 //是否启用HTTPS协议与综合安防管理平台交互,这里总是填1
  930. var encryptedFields = 'secret' //加密字段,默认加密领域为secret
  931. var showToolbar = 1 //是否显示工具栏,0-不显示,非0-显示
  932. var showSmart = 1 //是否显示智能信息(如配置移动侦测后画面上的线框),0-不显示,非0-显示
  933. var buttonIDs = '0,16,256,257,258,259,260,512,513,514,515,516,517,768,769' //自定义工具条按钮
  934. ////////////////////////////////// 请自行修改以上变量值 ////////////////////////////////////
  935. that.oWebControl.JS_RequestInterface({
  936. funcName: 'init',
  937. argument: JSON.stringify({
  938. appkey: appkey, //API网关提供的appkey
  939. secret: secret, //API网关提供的secret
  940. ip: ip, //API网关IP地址
  941. playMode: playMode, //播放模式(决定显示预览还是回放界面)
  942. port: port, //端口
  943. snapDir: snapDir, //抓图存储路径
  944. videoDir: videoDir, //紧急录像或录像剪辑存储路径
  945. layout: layout, //布局
  946. enableHTTPS: enableHTTPS, //是否启用HTTPS协议
  947. encryptedFields: encryptedFields, //加密字段
  948. showToolbar: showToolbar, //是否显示工具栏
  949. showSmart: showSmart, //是否显示智能信息
  950. buttonIDs: buttonIDs //自定义工具条按钮
  951. })
  952. }).then(function(oData) {
  953. that.oWebControl.JS_Resize(1020, 600) // 初始化后resize一次,规避firefox下首次显示窗口后插件窗口未与DIV窗口重合问题
  954. })
  955. })
  956. },
  957. //获取公钥
  958. getPubKey(callback) {
  959. let that = this
  960. that.oWebControl.JS_RequestInterface({
  961. funcName: 'getRSAPubKey',
  962. argument: JSON.stringify({
  963. keyLength: 1024
  964. })
  965. }).then(function(oData) {
  966. console.log(oData)
  967. if (oData.responseMsg.data) {
  968. that.pubKey = oData.responseMsg.data
  969. callback()
  970. }
  971. })
  972. },
  973. //RSA加密
  974. setEncrypt(value) {
  975. var encrypt = new JSEncrypt()
  976. encrypt.setPublicKey(this.pubKey)
  977. return encrypt.encrypt(value)
  978. },
  979. /** ----------------------------------海康摄像头预览结束------------------------------------- */
  980. }
  981. }
  982. // 推送消息
  983. function cbIntegrationCallBack(oData) {
  984. console.log(JSON.stringify(oData.responseMsg))
  985. }
  986. </script>
  987. <style rel="stylesheet/scss" lang="scss" scoped>
  988. @import '@/assets/styles/base.scss';
  989. .playWnd {
  990. margin: 4px 0 0 8px;
  991. width: 1020px; /*播放容器的宽和高设定*/
  992. height: 600px;
  993. border: 1px solid red;
  994. }
  995. </style>