monitor.vue 40 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022
  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. <!-- deptId -->
  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: 33vh;">
  65. <div class="i-list-con h-43">
  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. },
  276. findCameraByDept(deptId) {
  277. findCameraByDept(deptId).then(res => {
  278. let that = this;
  279. //根据设备类型查看列表
  280. this.cameraMarkersList = [];
  281. that.visuForestCloudCameraBOList = res.data
  282. if (res.data != null && res.data.length > 0) {
  283. this.cameraMarkersList.push({
  284. lng: res.data[0].deptLongitude,
  285. lat: res.data[0].deptLatitude,
  286. icon: 'marker',
  287. bindPopupHtml: '',
  288. click: '',
  289. keepBindPopup: false,
  290. isAggregation: true,
  291. radius:0
  292. })
  293. for (let i = 0; i < res.data.length; i++) {
  294. let markersMap = {
  295. lng: 124.59,
  296. lat: 43.02,
  297. icon: 'camera',
  298. bindPopupHtml: '',
  299. click: 'preview',
  300. parameter: '',
  301. keepBindPopup: false,
  302. isAggregation: false
  303. }
  304. if (res.data[i].channelCode != null) {
  305. markersMap.parameter = {code:res.data[i].cameraCode,
  306. type:res.data[i].cameraFactory}
  307. } else {
  308. markersMap.parameter = []
  309. }
  310. markersMap.lng = res.data[i].longitude
  311. markersMap.lat = res.data[i].latitude
  312. markersMap.radius = res.data[i].cameraRadius
  313. markersMap.bindPopupHtml = '<div class="map-tip">' +
  314. '<span>' +
  315. ' <div class="d-l-con">' +
  316. ' <div class="d-l-l-text">' +
  317. ' <h4>经纬度:' + res.data[i].longitude + ',' + res.data[i].latitude +
  318. '</h4>' +
  319. ' </div>' +
  320. ' </div>' +
  321. ' </span>' +
  322. '<span>' +
  323. ' <div class="d-l-con">' +
  324. ' <div class="d-l-l-text">' +
  325. ' <h4>摄像头名称:' + res.data[i].cameraName + '</h4>' +
  326. ' </div>' +
  327. ' </div>' +
  328. ' </span>' +
  329. '<span>' +
  330. ' <div class="d-l-con">' +
  331. ' <div class="d-l-l-text">' +
  332. ' <h4>摄像头类型:' + (res.data[i].cameraFactory=="1"?"大华":"海康") + '</h4>' +
  333. ' </div>' +
  334. ' </div>' +
  335. ' </span>' +
  336. '<span>' +
  337. ' <div class="d-l-con">' +
  338. ' <div class="d-l-l-text">' +
  339. ' <h4>摄像头半径:' + res.data[i].cameraRadius + '米</h4>' +
  340. ' </div>' +
  341. ' </div>' +
  342. ' </span>' +
  343. '</div>'
  344. this.cameraMarkersList.push(markersMap)
  345. }
  346. setTimeout(() => {
  347. that.$refs.supermap.clearM(true)
  348. that.$refs.supermap.clearM(false)
  349. that.$refs.supermap.setMarkersRadius(this.cameraMarkersList)
  350. }, 1000)
  351. }else{
  352. setTimeout(() => {
  353. that.$refs.supermap.clearM(false)
  354. that.$refs.supermap.clearM(false)
  355. that.$refs.supermap.setMarkersRadius(this.cameraMarkersList)
  356. }, 1000)
  357. }
  358. })
  359. },
  360. /** 部门树*/
  361. selectKeyAreaList() {
  362. this.keyAreaList=[]
  363. //获取重点区域列表
  364. let that = this
  365. selectKeyAreaList().then(res => {
  366. that.keyAreaList = res.data
  367. })
  368. },
  369. getRegionalFlag(id){
  370. //获取重点区域
  371. this.listCurrentIndex3=id
  372. let that = this
  373. getRegionalFlag(id).then(res => {
  374. that.graphicsList=[]
  375. //地图标记
  376. if (res.data != null && res.data.length > 0) {
  377. for (let i = 0; i < res.data.length; i++) {
  378. let latlng = {
  379. lat: res.data[i].lat,
  380. lng: res.data[i].lng
  381. }
  382. that.graphicsList.push(latlng)
  383. }
  384. setTimeout(() => {
  385. that.$refs.supermap.clearG()
  386. that.$refs.supermap.setGraphicsList(this.graphicsList, 'red')
  387. }, 1000)
  388. } else {
  389. that.$refs.supermap.clearG()
  390. }
  391. })
  392. },
  393. /** ----------------------------------底部按钮公用组件开始------------------------------------- */
  394. bottomMenuList() {
  395. this.$refs.bottomMenu.selectTaskList()//获取任务列表
  396. this.$refs.bottomMenu.selectMessageList()//获取消息列表
  397. },
  398. showDialog(click) {
  399. if (click == 'eventLocation') {
  400. this.$refs.eventLocation.showEventLocation()
  401. this.$refs.supermap.isEditableLayers = false
  402. this.$refs.bottomMenu.showChild = false
  403. this.$refs.bottomMenu.showBanChild = false
  404. this.$refs.bottomMenu.showChangChild = false
  405. } else if (click == 'editableLayers') {
  406. this.$refs.bottomMenu.showChild = false
  407. this.$refs.bottomMenu.showBanChild = false
  408. this.$refs.bottomMenu.showChangChild = false
  409. if (!this.$refs.supermap.isEditableLayers) {
  410. this.$refs.supermap.isEditableLayers = true
  411. } else {
  412. this.$refs.supermap.isEditableLayers = false
  413. }
  414. } else if (click == 'layerSwitching') {
  415. this.$refs.supermap.isEditableLayers = false
  416. this.$refs.bottomMenu.showBanChild = false
  417. this.$refs.bottomMenu.showChangChild = false
  418. if (!this.$refs.bottomMenu.showChild) {
  419. this.$refs.bottomMenu.showChild = true
  420. } else {
  421. this.$refs.bottomMenu.showChild = false
  422. }
  423. } else if (click == 'TVWall') {
  424. this.$refs.TVWall.showTVWall()
  425. this.$refs.supermap.isEditableLayers = false
  426. this.$refs.bottomMenu.showChild = false
  427. this.$refs.bottomMenu.showBanChild = false
  428. this.$refs.bottomMenu.showChangChild = false
  429. } else if (click == 'forestban') {
  430. this.$refs.supermap.isEditableLayers = false
  431. this.$refs.bottomMenu.showChild = false
  432. this.$refs.bottomMenu.showChangChild = false
  433. if (!this.$refs.bottomMenu.showBanChild) {
  434. this.$refs.bottomMenu.showBanChild = true
  435. } else {
  436. this.$refs.bottomMenu.showBanChild = false
  437. }
  438. } else if (click == 'forestchang') {
  439. this.$refs.supermap.isEditableLayers = false
  440. this.$refs.bottomMenu.showBanChild = false
  441. this.$refs.bottomMenu.showChild = false
  442. if (!this.$refs.bottomMenu.showChangChild) {
  443. this.$refs.bottomMenu.showChangChild = true
  444. } else {
  445. this.$refs.bottomMenu.showChangChild = false
  446. }
  447. }
  448. },
  449. //选择图层
  450. choseLayerSwitching(url, isClear) {
  451. this.$refs.supermap.layerSwitching(url, isClear)
  452. },
  453. //选择图层(传递数组)
  454. choseLayerSwitchingList(urlList) {
  455. this.$refs.supermap.layerSwitchingList(urlList)
  456. },
  457. //选择图层(传递数组) 带数据
  458. choseLayerSwitchingList_Data(urlList) {
  459. this.$refs.supermap.layerSwitchingList_Data(urlList)
  460. },
  461. /** ----------------------------------底部按钮公用组件结束------------------------------------- */
  462. // cameraChat() {
  463. // // 基于准备好的dom,初始化echarts实例
  464. // let myChart = echarts.init(document.getElementById('camera-chart'))
  465. // // 绘制图表
  466. // const dfColor = ['#92E1FF', '#0097FB', '#30ECA6', '#FFC227', '#FF4848']
  467. // myChart.setOption({
  468. // dataset: {
  469. // source: this.sourceData
  470. // },
  471. // tooltip: {
  472. // trigger: 'item'
  473. //
  474. // },
  475. // grid: {
  476. // top: '5%',
  477. // left: '5%',
  478. // // right: "4%",
  479. // bottom: '0%',
  480. // width: '75%',
  481. // containLabel: true
  482. // },
  483. // dataZoom: [{
  484. // show:true,
  485. // type: 'slider',
  486. // yAxisIndex:0,
  487. // left:10,
  488. // start: 0,
  489. // end: this.sourceData.length > 10 ? 40 : 100,
  490. // width:15
  491. // }],
  492. // xAxis: {
  493. // show: false,
  494. // type: 'value',
  495. // left:10
  496. // },
  497. // yAxis: {
  498. // type: 'category', // 不设置类目轴,抽离的dataset数据展示不出来
  499. // inverse: true,
  500. // axisLabel: {
  501. // show: true,
  502. // textStyle: {
  503. // color: '#5deaff',
  504. // fontSize: '12'
  505. // }
  506. // },
  507. // splitLine: {
  508. // show: false
  509. // },
  510. // axisTick: {
  511. // show: false
  512. // },
  513. // axisLine: {
  514. // show: false
  515. // }
  516. // },
  517. //
  518. // series: [{
  519. //
  520. // type: 'bar',
  521. // animationCurve: 'easeOutBack',
  522. // barWidth: 5,
  523. // label: {
  524. // show: true,
  525. // position: 'right',
  526. // offset: [0, 0],
  527. // color: '#88dfd5',
  528. // // fontSize: "12",
  529. // style: {
  530. // fill: '#fff'
  531. // }
  532. // },
  533. // backgroundBar: {
  534. // show: true,
  535. // style: {
  536. // fill: 'rgba(97,152,255,0.20)'
  537. // }
  538. // },
  539. // barStyle: {
  540. // stroke: 'rgba(41,244,236,1)'
  541. // },
  542. // gradient: {
  543. // color: ['rgba(41,244,236,1)', 'rgba(41,244,236,0)']
  544. // },
  545. // itemStyle: {
  546. // label: {
  547. // show: true
  548. // },
  549. // labelLine: {
  550. // show: false
  551. // },
  552. // color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [{
  553. // offset: 0,
  554. // color: 'rgba(41,244,236,0)'
  555. // },
  556. // {
  557. // offset: 1,
  558. // color: 'rgba(41,244,236,.5)'
  559. // }
  560. // ]),
  561. // borderColor: '#a2f9f7',
  562. // shadowBlur: 16,
  563. // shadowColor: '#a2f9f7'
  564. // }
  565. // }]
  566. // })
  567. // },
  568. selectDeviceType(index) {
  569. this.iconCurrentIndex1 = index
  570. //获取左侧动态感知设备
  571. let that = this
  572. selectDeviceType().then(res => {
  573. that.cameraMarkersList=[]
  574. that.visuForestCloudMapDeviceBOList = res.data.visuForestCloudMapDeviceBOList
  575. that.region = res.data.visuForestCloudTodaySjfbBOList
  576. if (res.data.visuForestCloudTodaySjfbBOList != null && res.data.visuForestCloudTodaySjfbBOList
  577. .length > 0) {
  578. for (let i = 0; i < res.data.visuForestCloudTodaySjfbBOList.length; i++) {
  579. let aa = []
  580. aa.push(res.data.visuForestCloudTodaySjfbBOList[i].deptName)
  581. aa.push(Number(res.data.visuForestCloudTodaySjfbBOList[i].deptCount))
  582. this.sourceData.push(aa)
  583. }
  584. }
  585. that.visuForestCloudCameraBOList = res.data.visuForestCloudCameraBOList
  586. // this.cameraChat()
  587. if (res.data.visuForestCloudCameraBOList != null && res.data.visuForestCloudCameraBOList
  588. .length > 0) {
  589. for (let i = 0; i < res.data.visuForestCloudCameraBOList.length; i++) {
  590. let markersMap = {
  591. lng: 124.59,
  592. lat: 43.02,
  593. icon: 'camera',
  594. bindPopupHtml: '',
  595. click: 'preview',
  596. parameter: '',
  597. keepBindPopup: false,
  598. isAggregation: false
  599. }
  600. if (res.data.visuForestCloudCameraBOList[i].channelCode != null) {
  601. markersMap.parameter = {code:res.data.visuForestCloudCameraBOList[i].cameraCode,
  602. type:res.data.visuForestCloudCameraBOList[i].cameraFactory}
  603. } else {
  604. markersMap.parameter = []
  605. }
  606. markersMap.lng = res.data.visuForestCloudCameraBOList[i].longitude
  607. markersMap.lat = res.data.visuForestCloudCameraBOList[i].latitude
  608. markersMap.radius = res.data.visuForestCloudCameraBOList[i].cameraRadius
  609. markersMap.bindPopupHtml = '<div class="map-tip">' +
  610. '<span>' +
  611. ' <div class="d-l-con">' +
  612. ' <div class="d-l-l-text">' +
  613. ' <h4>经纬度:' + res.data.visuForestCloudCameraBOList[i].longitude +
  614. ',' + res.data.visuForestCloudCameraBOList[i].latitude + '</h4>' +
  615. ' </div>' +
  616. ' </div>' +
  617. ' </span>' +
  618. '<span>' +
  619. ' <div class="d-l-con">' +
  620. ' <div class="d-l-l-text">' +
  621. ' <h4>摄像头名称:' + res.data.visuForestCloudCameraBOList[i]
  622. .cameraName + '</h4>' +
  623. ' </div>' +
  624. ' </div>' +
  625. ' </span>' +
  626. '<span>' +
  627. ' <div class="d-l-con">' +
  628. ' <div class="d-l-l-text">' +
  629. ' <h4>摄像头类型:' + (res.data.visuForestCloudCameraBOList[i].cameraFactory=="1"?"大华":"海康") + '</h4>' +
  630. ' </div>' +
  631. ' </div>' +
  632. ' </span>' +
  633. '<span>' +
  634. ' <div class="d-l-con">' +
  635. ' <div class="d-l-l-text">' +
  636. ' <h4>摄像头半径:' + res.data.visuForestCloudCameraBOList[i]
  637. .cameraRadius + '米</h4>' +
  638. ' </div>' +
  639. ' </div>' +
  640. ' </span>' +
  641. '</div>'
  642. this.cameraMarkersList.push(markersMap)
  643. // cameraAccount: "1"
  644. // cameraCode: "1000010"
  645. // cameraFactory: "2"
  646. // cameraIp: "1"
  647. // cameraName: "2"
  648. // cameraPasword: "2"
  649. // cameraPort: 2
  650. // cameraRadius: 20
  651. // cameraRegion: "3"
  652. // dataDeptId: null
  653. // dataStatus: null
  654. // eventType: null
  655. // height: "11"
  656. // id: "0d165fc362514f79b12a899ea66295fd"
  657. // latitude: "49.325625"
  658. // longitude: "125.3333"
  659. }
  660. setTimeout(() => {
  661. that.$refs.supermap.clearM(true)
  662. that.$refs.supermap.clearM(false)
  663. that.$refs.supermap.setMarkersRadius(this.cameraMarkersList)
  664. }, 1000)
  665. }
  666. })
  667. },
  668. dropLocation(lat, lng, index) {
  669. this.listCurrentIndex2 = index
  670. this.$refs.supermap.dropLocation(lat, lng)
  671. },
  672. selectCameraByDeptId(depId) {
  673. this.listCurrentIndex1 = depId
  674. let that = this
  675. that.cameraMarkersList = []
  676. that.visuForestCloudCameraBOList = []
  677. selectCameraByDeptId(depId).then(res => {
  678. //根据设备类型查看列表
  679. that.visuForestCloudCameraBOList = res.data
  680. if (res.data != null && res.data.length > 0) {
  681. for (let i = 0; i < res.data.length; i++) {
  682. let markersMap = {
  683. lng: 124.59,
  684. lat: 43.02,
  685. icon: 'camera',
  686. bindPopupHtml: '',
  687. click: 'preview',
  688. parameter: '',
  689. keepBindPopup: false,
  690. isAggregation: false
  691. }
  692. if (res.data[i].channelCode != null) {
  693. markersMap.parameter = {code:res.data[i].cameraCode,
  694. type:res.data[i].cameraFactory}
  695. } else {
  696. markersMap.parameter = []
  697. }
  698. markersMap.lng = res.data[i].longitude
  699. markersMap.lat = res.data[i].latitude
  700. markersMap.radius = res.data[i].cameraRadius
  701. markersMap.bindPopupHtml = '<div class="map-tip">' +
  702. '<span>' +
  703. ' <div class="d-l-con">' +
  704. ' <div class="d-l-l-text">' +
  705. ' <h4>经纬度:' + res.data[i].longitude + ',' + res.data[i].latitude +
  706. '</h4>' +
  707. ' </div>' +
  708. ' </div>' +
  709. ' </span>' +
  710. '<span>' +
  711. ' <div class="d-l-con">' +
  712. ' <div class="d-l-l-text">' +
  713. ' <h4>摄像头名称:' + res.data[i].cameraName + '</h4>' +
  714. ' </div>' +
  715. ' </div>' +
  716. ' </span>' +
  717. '<span>' +
  718. ' <div class="d-l-con">' +
  719. ' <div class="d-l-l-text">' +
  720. ' <h4>摄像头类型:' + (res.data[i].cameraFactory=="1"?"大华":"海康") + '</h4>' +
  721. ' </div>' +
  722. ' </div>' +
  723. ' </span>' +
  724. '<span>' +
  725. ' <div class="d-l-con">' +
  726. ' <div class="d-l-l-text">' +
  727. ' <h4>摄像头半径:' + res.data[i]
  728. .cameraRadius + '米</h4>' +
  729. ' </div>' +
  730. ' </div>' +
  731. ' </span>' +
  732. '</div>'
  733. this.cameraMarkersList.push(markersMap)
  734. // cameraAccount: "1"
  735. // cameraCode: "1000010"
  736. // cameraFactory: "2"
  737. // cameraIp: "1"
  738. // cameraName: "2"
  739. // cameraPasword: "2"
  740. // cameraPort: 2
  741. // cameraRadius: 20
  742. // cameraRegion: "3"
  743. // dataDeptId: null
  744. // dataStatus: null
  745. // eventType: null
  746. // height: "11"
  747. // id: "0d165fc362514f79b12a899ea66295fd"
  748. // latitude: "49.325625"
  749. // longitude: "125.3333"
  750. }
  751. setTimeout(() => {
  752. that.$refs.supermap.clearM(true)
  753. that.$refs.supermap.clearM(false)
  754. that.$refs.supermap.setMarkersRadius(this.cameraMarkersList)
  755. }, 1000)
  756. }
  757. })
  758. },
  759. //吉祥物收起左右框
  760. indent() {
  761. let list = document.getElementsByClassName('el-tooltip__popper')
  762. list[list.length - 1].style.display = 'none'
  763. if (this.indentStyle == '') {
  764. this.indentStyle = 'indent-style'
  765. this.indentleft = 'indent-left'
  766. this.indentright = 'indent-right'
  767. this.indentText = '展开左右栏'
  768. } else if (this.indentText == '展开左右栏') {
  769. this.indentStyle = ''
  770. this.indentleft = ''
  771. this.indentright = ''
  772. this.indentText = '收起左右栏'
  773. }
  774. },
  775. /** ----------------------------------摄像头预览开始------------------------------------- */
  776. alertLogin: function() {
  777. this.$modal.msg('登录中....')
  778. },
  779. alertLoginSuccess: function() {
  780. this.$modal.msgSuccess('登录成功!')
  781. },
  782. alertLoginFailed: function() {
  783. this.$modal.msgError('登陆失败!')
  784. },
  785. alertReinstall: function() {
  786. this.$modal.msgWarning('请重新安装客户端')
  787. },
  788. cancelEventLocationShow() {
  789. if (this.oWebControl != null) {
  790. this.oWebControl.JS_HideWnd() // 先让窗口隐藏,规避可能的插件窗口滞后于浏览器消失问题
  791. this.oWebControl.JS_Disconnect().then(function() { // 断开与插件服务连接成功
  792. },
  793. function() { // 断开与插件服务连接失败
  794. })
  795. }
  796. },
  797. /** 预览按钮操作 */
  798. preview(cameraParam) {
  799. if(cameraParam.type=='1'){
  800. getDahuaVideoServer().then(newResponse => {
  801. console.log(newResponse)
  802. this.ws.detectConnectQt().then(res => {
  803. if (res) { // 连接客户端成功
  804. this.alertLogin()
  805. this.ws.login({
  806. loginIp: newResponse.loginIp,
  807. loginPort: newResponse.loginPort,
  808. userName: newResponse.userName,
  809. userPwd: newResponse.userPwd,
  810. token: '',
  811. https: 1
  812. })
  813. this.ws.on('loginState', (res) => {
  814. this.isLogin = res
  815. console.log('---res-----', res)
  816. if (res) {
  817. this.alertLoginSuccess()
  818. this.activePanel = 'key2'
  819. this.realTimeVideoDialog(cameraParam.code)
  820. } else {
  821. this.alertLoginFailed()
  822. }
  823. })
  824. } else { // 连接客户端失败
  825. this.alertReinstall()
  826. }
  827. })
  828. })
  829. }else if(cameraParam.type=='0'){
  830. let that = this
  831. that.cameraVisible = true
  832. getHaiKangVideoServer({cameraCode:cameraParam.code}).then(newResponse => {
  833. that.cameraTitle = '摄像头-'+newResponse.data.cameraName
  834. that.initPlugin(newResponse.data.appkey,newResponse.data.loginIp,newResponse.data.secret,newResponse.data.loginPort)
  835. setTimeout(function() {
  836. that.playhk(newResponse.data.channelCode)
  837. }, 5000)
  838. })
  839. }
  840. },
  841. realTimeVideoDialog(cameraParams) { // 调用弹窗实时播放接口
  842. if (!this.isLogin) {
  843. this.$Message.info('正在登陆客户端,请稍等......')
  844. return false
  845. }
  846. const params = [cameraParams];
  847. this.ws.openVideo(params)
  848. },
  849. /** ----------------------------------摄像头预览结束------------------------------------- */
  850. /** ----------------------------------海康摄像头预览开始------------------------------------- */
  851. // 创建播放实例
  852. initPlugin(newappkey,newloginIp,newsecret,newloginPort) {
  853. let that=this
  854. that.oWebControl = new WebControl({
  855. szPluginContainer: 'playWnd', // 指定容器id
  856. iServicePortStart: 15900, // 指定起止端口号,建议使用该值
  857. iServicePortEnd: 15909,
  858. szClassId: '23BF3B0A-2C56-4D97-9C03-0CB103AA8F11', // 用于IE10使用ActiveX的clsid
  859. cbConnectSuccess: function() { // 创建WebControl实例成功
  860. that.oWebControl.JS_StartService('window', { // WebControl实例创建成功后需要启动服务
  861. dllPath: './VideoPluginConnect.dll' // 值"./VideoPluginConnect.dll"写死
  862. }).then(function() { // 启动插件服务成功
  863. that.oWebControl.JS_SetWindowControlCallback({ // 设置消息回调
  864. cbIntegrationCallBack: cbIntegrationCallBack
  865. })
  866. that.oWebControl.JS_CreateWnd('playWnd', 1020, 600).then(function() { //JS_CreateWnd创建视频播放窗口,宽高可设定
  867. that.init(newappkey,newloginIp,newsecret,newloginPort) // 创建播放实例成功后初始化
  868. })
  869. }, function() { // 启动插件服务失败
  870. })
  871. },
  872. cbConnectError: function() { // 创建WebControl实例失败
  873. that.oWebControl = null
  874. $('#playWnd').html('插件未启动,正在尝试启动,请稍候...<a href="./hk/VideoWebPlugin.exe">点击下载插件</a>')
  875. WebControl.JS_WakeUp('VideoWebPlugin://') // 程序未启动时执行error函数,采用wakeup来启动程序
  876. initCount++
  877. if (initCount < 3) {
  878. setTimeout(function() {
  879. that.initPlugin(newappkey,newloginIp,newsecret,newloginPort)
  880. }, 3000)
  881. } else {
  882. $('#playWnd').html('插件启动失败,请检查插件是否安装!<a href="./hk/VideoWebPlugin.exe">点击下载插件</a>')
  883. }
  884. },
  885. cbConnectClose: function(bNormalClose) {
  886. // 异常断开:bNormalClose = false
  887. // JS_Disconnect正常断开:bNormalClose = true
  888. console.log('cbConnectClose')
  889. that.oWebControl = null
  890. }
  891. })
  892. },
  893. //播放海康摄像头
  894. playhk(channelCode) {
  895. var cameraIndexCode = channelCode //获取输入的监控点编号值,必填
  896. var streamMode = 0 //主子码流标识:0-主码流,1-子码流
  897. var transMode = 1 //传输协议:0-UDP,1-TCP
  898. var gpuMode = 0 //是否启用GPU硬解,0-不启用,1-启用
  899. var wndId = -1 //播放窗口序号(在2x2以上布局下可指定播放窗口)
  900. cameraIndexCode = cameraIndexCode.replace(/(^\s*)/g, '')
  901. cameraIndexCode = cameraIndexCode.replace(/(\s*$)/g, '')
  902. this.oWebControl.JS_RequestInterface({
  903. funcName: 'startPreview',
  904. argument: JSON.stringify({
  905. cameraIndexCode: cameraIndexCode, //监控点编号
  906. streamMode: streamMode, //主子码流标识
  907. transMode: transMode, //传输协议
  908. gpuMode: gpuMode, //是否开启GPU硬解
  909. wndId: wndId //可指定播放窗口
  910. })
  911. })
  912. },
  913. //初始化
  914. init(newappkey,newloginIp,newsecret,newloginPort) {
  915. let that = this
  916. that.getPubKey(function() {
  917. ////////////////////////////////// 请自行修改以下变量值 ////////////////////////////////////
  918. var appkey = newappkey //综合安防管理平台提供的appkey,必填
  919. var secret = that.setEncrypt(newsecret) //综合安防管理平台提供的secret,必填
  920. var ip = newloginIp //综合安防管理平台IP地址,必填
  921. var playMode = 0 //初始播放模式:0-预览,1-回放
  922. var port = Number(newloginPort) //综合安防管理平台端口,若启用HTTPS协议,默认443
  923. var snapDir = 'D:\\SnapDir' //抓图存储路径
  924. var videoDir = 'D:\\VideoDir' //紧急录像或录像剪辑存储路径
  925. var layout = '1x1' //playMode指定模式的布局
  926. var enableHTTPS = 1 //是否启用HTTPS协议与综合安防管理平台交互,这里总是填1
  927. var encryptedFields = 'secret' //加密字段,默认加密领域为secret
  928. var showToolbar = 1 //是否显示工具栏,0-不显示,非0-显示
  929. var showSmart = 1 //是否显示智能信息(如配置移动侦测后画面上的线框),0-不显示,非0-显示
  930. var buttonIDs = '0,16,256,257,258,259,260,512,513,514,515,516,517,768,769' //自定义工具条按钮
  931. ////////////////////////////////// 请自行修改以上变量值 ////////////////////////////////////
  932. that.oWebControl.JS_RequestInterface({
  933. funcName: 'init',
  934. argument: JSON.stringify({
  935. appkey: appkey, //API网关提供的appkey
  936. secret: secret, //API网关提供的secret
  937. ip: ip, //API网关IP地址
  938. playMode: playMode, //播放模式(决定显示预览还是回放界面)
  939. port: port, //端口
  940. snapDir: snapDir, //抓图存储路径
  941. videoDir: videoDir, //紧急录像或录像剪辑存储路径
  942. layout: layout, //布局
  943. enableHTTPS: enableHTTPS, //是否启用HTTPS协议
  944. encryptedFields: encryptedFields, //加密字段
  945. showToolbar: showToolbar, //是否显示工具栏
  946. showSmart: showSmart, //是否显示智能信息
  947. buttonIDs: buttonIDs //自定义工具条按钮
  948. })
  949. }).then(function(oData) {
  950. that.oWebControl.JS_Resize(1020, 600) // 初始化后resize一次,规避firefox下首次显示窗口后插件窗口未与DIV窗口重合问题
  951. })
  952. })
  953. },
  954. //获取公钥
  955. getPubKey(callback) {
  956. let that = this
  957. that.oWebControl.JS_RequestInterface({
  958. funcName: 'getRSAPubKey',
  959. argument: JSON.stringify({
  960. keyLength: 1024
  961. })
  962. }).then(function(oData) {
  963. console.log(oData)
  964. if (oData.responseMsg.data) {
  965. that.pubKey = oData.responseMsg.data
  966. callback()
  967. }
  968. })
  969. },
  970. //RSA加密
  971. setEncrypt(value) {
  972. var encrypt = new JSEncrypt()
  973. encrypt.setPublicKey(this.pubKey)
  974. return encrypt.encrypt(value)
  975. },
  976. /** ----------------------------------海康摄像头预览结束------------------------------------- */
  977. }
  978. }
  979. // 推送消息
  980. function cbIntegrationCallBack(oData) {
  981. console.log(JSON.stringify(oData.responseMsg))
  982. }
  983. </script>
  984. <style rel="stylesheet/scss" lang="scss" scoped>
  985. @import '@/assets/styles/base.scss';
  986. .playWnd {
  987. margin: 4px 0 0 8px;
  988. width: 1020px; /*播放容器的宽和高设定*/
  989. height: 600px;
  990. border: 1px solid red;
  991. }
  992. </style>