monitor.vue 43 KB

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