monitor.vue 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830
  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. <!-- <el-tooltip :content="indentText" placement="top" :disabled="indentdisabled">-->
  139. <!-- <div class="mascot" ref="mascot" :class="indentStyle" @click="indent"><img-->
  140. <!-- src="@/assets/images/mascot.png"/></div>-->
  141. <!-- </el-tooltip>-->
  142. </div>
  143. <eventLocation ref="eventLocation"></eventLocation>
  144. <TVWall ref="TVWall"></TVWall>
  145. <el-dialog :title="cameraTitle" :visible.sync="cameraVisible" v-if="cameraVisible" customClass="videoCustomWidth"
  146. @close="cancelEventLocationShow()">
  147. <div style="width:1020px;height:625px;position:relative;">
  148. <!--视频窗口展示---海康-->
  149. <div id="playWnd" class="playWnd" style="left: 0px; top: 0px;"></div>
  150. </div>
  151. </el-dialog>
  152. </div>
  153. </template>
  154. <script>
  155. import {
  156. selectDeviceType,
  157. selectCameraByDeptId,
  158. selectKeyAreaList,
  159. getRegionalFlag
  160. } from '@/api/monitor'
  161. import supermap from '@/components/supermap' //超图
  162. import { treeselect } from '@/api/system/dept'
  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. created() {
  187. /** ----------------------------------摄像头预览开始------------------------------------- */
  188. const DHWsInstance = DHWs.getInstance()
  189. this.ws = DHWsInstance
  190. /** ----------------------------------摄像头预览结束------------------------------------- */
  191. /** ----------------------------------底部按钮公用组件开始------------------------------------- */
  192. window.showDialog = this.showDialog
  193. window.choseLayerSwitching = this.choseLayerSwitching
  194. window.choseLayerSwitchingList = this.choseLayerSwitchingList
  195. /** ----------------------------------底部按钮公用组件结束------------------------------------- */
  196. },
  197. mounted() {
  198. this.selectDeviceType(-1)
  199. this.selectKeyAreaList()
  200. this.bottomMenuList() //获取底部公共组件消息和任务
  201. this.getTreeselect()
  202. },
  203. data() {
  204. return {
  205. iconCurrentIndex1: '-1',
  206. listCurrentIndex1: '-1',
  207. listCurrentIndex2: '-1',
  208. listCurrentIndex3: '-1',
  209. graphicsList:[],//重点区域
  210. /** ----------------------------------摄像头预览开始------------------------------------- */
  211. //大华
  212. activePanel: 'key1',
  213. isLogin: false,
  214. cameraParams: [],
  215. ws: null,
  216. //海康
  217. cameraTitle: '',
  218. cameraVisible: false,
  219. initCount: 0,
  220. pubKey: '',
  221. oWebControl: null,
  222. /** ----------------------------------摄像头预览结束------------------------------------- */
  223. // 部门名称
  224. deptName: undefined,
  225. // 部门树选项
  226. deptOptions: undefined,
  227. defaultProps: {
  228. children: 'children',
  229. label: 'label'
  230. },
  231. visuForestCloudMapDeviceBOList: [],
  232. visuForestCloudCameraBOList: [],
  233. cameraMarkersList: [],
  234. sourceData: [],
  235. keyAreaList: [],//重点区域
  236. iframeBoo: true,
  237. open: false,
  238. iframeVue: null,
  239. activeName: 'info',
  240. radio: '1',
  241. region: [],
  242. //左右缩进
  243. indentStyle: '',
  244. indentleft: '',
  245. indentright: '',
  246. indentText: '收起左右栏',
  247. indentdisabled: false,
  248. domId: 'dom1',
  249. }
  250. },
  251. watch: {
  252. // 根据名称筛选部门树
  253. deptName(val) {
  254. this.$refs.tree.filter(val)
  255. }
  256. },
  257. methods: {
  258. /** 部门树*/
  259. // 查询部门下拉树结构
  260. getTreeselect() {
  261. treeselect().then(response => {
  262. console.log(response.data)
  263. this.deptOptions = response.data
  264. })
  265. },
  266. // 筛选节点
  267. filterNode(value, data) {
  268. if (!value) return true
  269. return data.label.indexOf(value) !== -1
  270. },
  271. // 节点单击事件
  272. handleNodeClick(data) {
  273. // this.findCameraByDept(data.id)
  274. this.selectCameraByDeptId(data.id);
  275. },
  276. selectKeyAreaList() {
  277. this.keyAreaList=[]
  278. //获取重点区域列表
  279. let that = this
  280. selectKeyAreaList().then(res => {
  281. that.keyAreaList = res.data
  282. })
  283. },
  284. getRegionalFlag(id){
  285. //获取重点区域
  286. this.listCurrentIndex3=id
  287. let that = this
  288. getRegionalFlag(id).then(res => {
  289. that.graphicsList=[]
  290. //地图标记
  291. if (res.data != null && res.data.length > 0) {
  292. for (let i = 0; i < res.data.length; i++) {
  293. let latlng = {
  294. lat: res.data[i].lat,
  295. lng: res.data[i].lng
  296. }
  297. that.graphicsList.push(latlng)
  298. }
  299. setTimeout(() => {
  300. that.$refs.supermap.clearG()
  301. that.$refs.supermap.setGraphicsList(this.graphicsList, 'red')
  302. }, 1000)
  303. } else {
  304. that.$refs.supermap.clearG()
  305. }
  306. })
  307. },
  308. /** ----------------------------------底部按钮公用组件开始------------------------------------- */
  309. bottomMenuList() {
  310. this.$refs.bottomMenu.selectTaskList()//获取任务列表
  311. this.$refs.bottomMenu.selectMessageList()//获取消息列表
  312. },
  313. showDialog(click) {
  314. if (click == 'eventLocation') {
  315. this.$refs.eventLocation.showEventLocation()
  316. this.$refs.supermap.isEditableLayers = false
  317. this.$refs.bottomMenu.showChild = false
  318. this.$refs.bottomMenu.showBanChild = false
  319. this.$refs.bottomMenu.showChangChild = false
  320. } else if (click == 'editableLayers') {
  321. this.$refs.bottomMenu.showChild = false
  322. this.$refs.bottomMenu.showBanChild = false
  323. this.$refs.bottomMenu.showChangChild = false
  324. if (!this.$refs.supermap.isEditableLayers) {
  325. this.$refs.supermap.isEditableLayers = true
  326. } else {
  327. this.$refs.supermap.isEditableLayers = false
  328. }
  329. } else if (click == 'layerSwitching') {
  330. this.$refs.supermap.isEditableLayers = false
  331. this.$refs.bottomMenu.showBanChild = false
  332. this.$refs.bottomMenu.showChangChild = false
  333. if (!this.$refs.bottomMenu.showChild) {
  334. this.$refs.bottomMenu.showChild = true
  335. } else {
  336. this.$refs.bottomMenu.showChild = false
  337. }
  338. } else if (click == 'TVWall') {
  339. this.$refs.TVWall.showTVWall()
  340. this.$refs.supermap.isEditableLayers = false
  341. this.$refs.bottomMenu.showChild = false
  342. this.$refs.bottomMenu.showBanChild = false
  343. this.$refs.bottomMenu.showChangChild = false
  344. } else if (click == 'forestban') {
  345. this.$refs.supermap.isEditableLayers = false
  346. this.$refs.bottomMenu.showChild = false
  347. this.$refs.bottomMenu.showChangChild = false
  348. if (!this.$refs.bottomMenu.showBanChild) {
  349. this.$refs.bottomMenu.showBanChild = true
  350. } else {
  351. this.$refs.bottomMenu.showBanChild = false
  352. }
  353. } else if (click == 'forestchang') {
  354. this.$refs.supermap.isEditableLayers = false
  355. this.$refs.bottomMenu.showBanChild = false
  356. this.$refs.bottomMenu.showChild = false
  357. if (!this.$refs.bottomMenu.showChangChild) {
  358. this.$refs.bottomMenu.showChangChild = true
  359. } else {
  360. this.$refs.bottomMenu.showChangChild = false
  361. }
  362. }
  363. },
  364. //选择图层
  365. choseLayerSwitching(url, isClear) {
  366. this.$refs.supermap.layerSwitching(url, isClear)
  367. },
  368. //选择图层(传递数组)
  369. choseLayerSwitchingList(urlList) {
  370. this.$refs.supermap.layerSwitchingList(urlList)
  371. },
  372. /** ----------------------------------底部按钮公用组件结束------------------------------------- */
  373. selectDeviceType(index) {
  374. this.iconCurrentIndex1 = index
  375. //获取左侧动态感知设备
  376. let that = this
  377. selectDeviceType().then(res => {
  378. that.cameraMarkersList=[]
  379. that.visuForestCloudMapDeviceBOList = res.data.visuForestCloudMapDeviceBOList
  380. that.region = res.data.visuForestCloudTodaySjfbBOList
  381. if (res.data.visuForestCloudTodaySjfbBOList != null && res.data.visuForestCloudTodaySjfbBOList
  382. .length > 0) {
  383. for (let i = 0; i < res.data.visuForestCloudTodaySjfbBOList.length; i++) {
  384. let aa = []
  385. aa.push(res.data.visuForestCloudTodaySjfbBOList[i].deptName)
  386. aa.push(Number(res.data.visuForestCloudTodaySjfbBOList[i].deptCount))
  387. this.sourceData.push(aa)
  388. }
  389. }
  390. that.visuForestCloudCameraBOList = res.data.visuForestCloudCameraBOList
  391. // this.cameraChat()
  392. if (res.data.visuForestCloudCameraBOList != null && res.data.visuForestCloudCameraBOList
  393. .length > 0) {
  394. for (let i = 0; i < res.data.visuForestCloudCameraBOList.length; i++) {
  395. let markersMap = {
  396. lng: 124.59,
  397. lat: 43.02,
  398. icon: 'camera',
  399. bindPopupHtml: '',
  400. click: 'preview',
  401. parameter: '',
  402. keepBindPopup: false,
  403. isAggregation: false
  404. }
  405. if (res.data.visuForestCloudCameraBOList[i].channelCode != null) {
  406. markersMap.parameter = {code:res.data.visuForestCloudCameraBOList[i].cameraCode,
  407. type:res.data.visuForestCloudCameraBOList[i].cameraFactory}
  408. } else {
  409. markersMap.parameter = []
  410. }
  411. markersMap.lng = res.data.visuForestCloudCameraBOList[i].longitude
  412. markersMap.lat = res.data.visuForestCloudCameraBOList[i].latitude
  413. markersMap.radius = res.data.visuForestCloudCameraBOList[i].cameraRadius
  414. markersMap.bindPopupHtml = '<div class="map-tip">' +
  415. '<span>' +
  416. ' <div class="d-l-con">' +
  417. ' <div class="d-l-l-text">' +
  418. ' <h4>经纬度:' + res.data.visuForestCloudCameraBOList[i].longitude +
  419. ',' + res.data.visuForestCloudCameraBOList[i].latitude + '</h4>' +
  420. ' </div>' +
  421. ' </div>' +
  422. ' </span>' +
  423. '<span>' +
  424. ' <div class="d-l-con">' +
  425. ' <div class="d-l-l-text">' +
  426. ' <h4>摄像头名称:' + res.data.visuForestCloudCameraBOList[i]
  427. .cameraName + '</h4>' +
  428. ' </div>' +
  429. ' </div>' +
  430. ' </span>' +
  431. '<span>' +
  432. ' <div class="d-l-con">' +
  433. ' <div class="d-l-l-text">' +
  434. ' <h4>摄像头类型:' + (res.data.visuForestCloudCameraBOList[i].cameraFactory=="1"?"大华":"海康") + '</h4>' +
  435. ' </div>' +
  436. ' </div>' +
  437. ' </span>' +
  438. '<span>' +
  439. ' <div class="d-l-con">' +
  440. ' <div class="d-l-l-text">' +
  441. ' <h4>摄像头半径:' + res.data.visuForestCloudCameraBOList[i]
  442. .cameraRadius + '米</h4>' +
  443. ' </div>' +
  444. ' </div>' +
  445. ' </span>' +
  446. '</div>'
  447. this.cameraMarkersList.push(markersMap)
  448. // cameraAccount: "1"
  449. // cameraCode: "1000010"
  450. // cameraFactory: "2"
  451. // cameraIp: "1"
  452. // cameraName: "2"
  453. // cameraPasword: "2"
  454. // cameraPort: 2
  455. // cameraRadius: 20
  456. // cameraRegion: "3"
  457. // dataDeptId: null
  458. // dataStatus: null
  459. // eventType: null
  460. // height: "11"
  461. // id: "0d165fc362514f79b12a899ea66295fd"
  462. // latitude: "49.325625"
  463. // longitude: "125.3333"
  464. }
  465. setTimeout(() => {
  466. that.$refs.supermap.clearM(true)
  467. that.$refs.supermap.clearM(false)
  468. that.$refs.supermap.setMarkersRadius(this.cameraMarkersList)
  469. }, 1000)
  470. }else{
  471. setTimeout(() => {
  472. that.$refs.supermap.clearM(true)
  473. that.$refs.supermap.clearM(false)
  474. }, 1000)
  475. }
  476. })
  477. },
  478. dropLocation(lat, lng, index) {
  479. this.listCurrentIndex2 = index
  480. this.$refs.supermap.dropLocation(lat, lng)
  481. },
  482. selectCameraByDeptId(depId) {
  483. this.listCurrentIndex1 = depId
  484. let that = this
  485. that.cameraMarkersList = []
  486. that.visuForestCloudCameraBOList = []
  487. selectCameraByDeptId(depId).then(res => {
  488. //根据设备类型查看列表
  489. that.visuForestCloudCameraBOList = res.data
  490. if (res.data != null && res.data.length > 0) {
  491. for (let i = 0; i < res.data.length; i++) {
  492. let markersMap = {
  493. lng: 124.59,
  494. lat: 43.02,
  495. icon: 'camera',
  496. bindPopupHtml: '',
  497. click: 'preview',
  498. parameter: '',
  499. keepBindPopup: false,
  500. isAggregation: false
  501. }
  502. if (res.data[i].channelCode != null) {
  503. markersMap.parameter = {code:res.data[i].cameraCode,
  504. type:res.data[i].cameraFactory}
  505. } else {
  506. markersMap.parameter = []
  507. }
  508. markersMap.lng = res.data[i].longitude
  509. markersMap.lat = res.data[i].latitude
  510. markersMap.radius = res.data[i].cameraRadius
  511. markersMap.bindPopupHtml = '<div class="map-tip">' +
  512. '<span>' +
  513. ' <div class="d-l-con">' +
  514. ' <div class="d-l-l-text">' +
  515. ' <h4>经纬度:' + res.data[i].longitude + ',' + res.data[i].latitude +
  516. '</h4>' +
  517. ' </div>' +
  518. ' </div>' +
  519. ' </span>' +
  520. '<span>' +
  521. ' <div class="d-l-con">' +
  522. ' <div class="d-l-l-text">' +
  523. ' <h4>摄像头名称:' + res.data[i].cameraName + '</h4>' +
  524. ' </div>' +
  525. ' </div>' +
  526. ' </span>' +
  527. '<span>' +
  528. ' <div class="d-l-con">' +
  529. ' <div class="d-l-l-text">' +
  530. ' <h4>摄像头类型:' + (res.data[i].cameraFactory=="1"?"大华":"海康") + '</h4>' +
  531. ' </div>' +
  532. ' </div>' +
  533. ' </span>' +
  534. '<span>' +
  535. ' <div class="d-l-con">' +
  536. ' <div class="d-l-l-text">' +
  537. ' <h4>摄像头半径:' + res.data[i]
  538. .cameraRadius + '米</h4>' +
  539. ' </div>' +
  540. ' </div>' +
  541. ' </span>' +
  542. '</div>'
  543. this.cameraMarkersList.push(markersMap)
  544. // cameraAccount: "1"
  545. // cameraCode: "1000010"
  546. // cameraFactory: "2"
  547. // cameraIp: "1"
  548. // cameraName: "2"
  549. // cameraPasword: "2"
  550. // cameraPort: 2
  551. // cameraRadius: 20
  552. // cameraRegion: "3"
  553. // dataDeptId: null
  554. // dataStatus: null
  555. // eventType: null
  556. // height: "11"
  557. // id: "0d165fc362514f79b12a899ea66295fd"
  558. // latitude: "49.325625"
  559. // longitude: "125.3333"
  560. }
  561. setTimeout(() => {
  562. that.$refs.supermap.clearM(true)
  563. that.$refs.supermap.clearM(false)
  564. that.$refs.supermap.setMarkersRadius(this.cameraMarkersList)
  565. }, 1000)
  566. }
  567. })
  568. },
  569. //吉祥物收起左右框
  570. indent() {
  571. let list = document.getElementsByClassName('el-tooltip__popper')
  572. list[list.length - 1].style.display = 'none'
  573. if (this.indentStyle == '') {
  574. this.indentStyle = 'indent-style'
  575. this.indentleft = 'indent-left'
  576. this.indentright = 'indent-right'
  577. this.indentText = '展开左右栏'
  578. } else if (this.indentText == '展开左右栏') {
  579. this.indentStyle = ''
  580. this.indentleft = ''
  581. this.indentright = ''
  582. this.indentText = '收起左右栏'
  583. }
  584. },
  585. /** ----------------------------------摄像头预览开始------------------------------------- */
  586. alertLogin: function() {
  587. this.$modal.msg('登录中....')
  588. },
  589. alertLoginSuccess: function() {
  590. this.$modal.msgSuccess('登录成功!')
  591. },
  592. alertLoginFailed: function() {
  593. this.$modal.msgError('登陆失败!')
  594. },
  595. alertReinstall: function() {
  596. this.$modal.msgWarning('请重新安装客户端')
  597. },
  598. cancelEventLocationShow() {
  599. if (this.oWebControl != null) {
  600. this.oWebControl.JS_HideWnd() // 先让窗口隐藏,规避可能的插件窗口滞后于浏览器消失问题
  601. this.oWebControl.JS_Disconnect().then(function() { // 断开与插件服务连接成功
  602. },
  603. function() { // 断开与插件服务连接失败
  604. })
  605. }
  606. },
  607. /** 预览按钮操作 */
  608. preview(cameraParam) {
  609. if(cameraParam.type=='1'){
  610. getDahuaVideoServer().then(newResponse => {
  611. console.log(newResponse)
  612. this.ws.detectConnectQt().then(res => {
  613. if (res) { // 连接客户端成功
  614. this.alertLogin()
  615. this.ws.login({
  616. loginIp: newResponse.loginIp,
  617. loginPort: newResponse.loginPort,
  618. userName: newResponse.userName,
  619. userPwd: newResponse.userPwd,
  620. token: '',
  621. https: 1
  622. })
  623. this.ws.on('loginState', (res) => {
  624. this.isLogin = res
  625. console.log('---res-----', res)
  626. if (res) {
  627. this.alertLoginSuccess()
  628. this.activePanel = 'key2'
  629. this.realTimeVideoDialog(cameraParam.code)
  630. } else {
  631. this.alertLoginFailed()
  632. }
  633. })
  634. } else { // 连接客户端失败
  635. this.alertReinstall()
  636. }
  637. })
  638. })
  639. }else if(cameraParam.type=='0'){
  640. let that = this
  641. that.cameraVisible = true
  642. getHaiKangVideoServer({cameraCode:cameraParam.code}).then(newResponse => {
  643. that.cameraTitle = '摄像头-'+newResponse.data.cameraName
  644. that.initPlugin(newResponse.data.appkey,newResponse.data.loginIp,newResponse.data.secret,newResponse.data.loginPort)
  645. setTimeout(function() {
  646. that.playhk(newResponse.data.channelCode)
  647. }, 5000)
  648. })
  649. }
  650. },
  651. realTimeVideoDialog(cameraParams) { // 调用弹窗实时播放接口
  652. if (!this.isLogin) {
  653. this.$Message.info('正在登陆客户端,请稍等......')
  654. return false
  655. }
  656. const params = [cameraParams];
  657. this.ws.openVideo(params)
  658. },
  659. /** ----------------------------------摄像头预览结束------------------------------------- */
  660. /** ----------------------------------海康摄像头预览开始------------------------------------- */
  661. // 创建播放实例
  662. initPlugin(newappkey,newloginIp,newsecret,newloginPort) {
  663. let that=this
  664. that.oWebControl = new WebControl({
  665. szPluginContainer: 'playWnd', // 指定容器id
  666. iServicePortStart: 15900, // 指定起止端口号,建议使用该值
  667. iServicePortEnd: 15909,
  668. szClassId: '23BF3B0A-2C56-4D97-9C03-0CB103AA8F11', // 用于IE10使用ActiveX的clsid
  669. cbConnectSuccess: function() { // 创建WebControl实例成功
  670. that.oWebControl.JS_StartService('window', { // WebControl实例创建成功后需要启动服务
  671. dllPath: './VideoPluginConnect.dll' // 值"./VideoPluginConnect.dll"写死
  672. }).then(function() { // 启动插件服务成功
  673. that.oWebControl.JS_SetWindowControlCallback({ // 设置消息回调
  674. cbIntegrationCallBack: cbIntegrationCallBack
  675. })
  676. that.oWebControl.JS_CreateWnd('playWnd', 1020, 600).then(function() { //JS_CreateWnd创建视频播放窗口,宽高可设定
  677. that.init(newappkey,newloginIp,newsecret,newloginPort) // 创建播放实例成功后初始化
  678. })
  679. }, function() { // 启动插件服务失败
  680. })
  681. },
  682. cbConnectError: function() { // 创建WebControl实例失败
  683. that.oWebControl = null
  684. $('#playWnd').html('插件未启动,正在尝试启动,请稍候...<a href="./hk/VideoWebPlugin.exe">点击下载插件</a>')
  685. WebControl.JS_WakeUp('VideoWebPlugin://') // 程序未启动时执行error函数,采用wakeup来启动程序
  686. initCount++
  687. if (initCount < 3) {
  688. setTimeout(function() {
  689. that.initPlugin(newappkey,newloginIp,newsecret,newloginPort)
  690. }, 3000)
  691. } else {
  692. $('#playWnd').html('插件启动失败,请检查插件是否安装!<a href="./hk/VideoWebPlugin.exe">点击下载插件</a>')
  693. }
  694. },
  695. cbConnectClose: function(bNormalClose) {
  696. // 异常断开:bNormalClose = false
  697. // JS_Disconnect正常断开:bNormalClose = true
  698. console.log('cbConnectClose')
  699. that.oWebControl = null
  700. }
  701. })
  702. },
  703. //播放海康摄像头
  704. playhk(channelCode) {
  705. var cameraIndexCode = channelCode //获取输入的监控点编号值,必填
  706. var streamMode = 0 //主子码流标识:0-主码流,1-子码流
  707. var transMode = 1 //传输协议:0-UDP,1-TCP
  708. var gpuMode = 0 //是否启用GPU硬解,0-不启用,1-启用
  709. var wndId = -1 //播放窗口序号(在2x2以上布局下可指定播放窗口)
  710. cameraIndexCode = cameraIndexCode.replace(/(^\s*)/g, '')
  711. cameraIndexCode = cameraIndexCode.replace(/(\s*$)/g, '')
  712. this.oWebControl.JS_RequestInterface({
  713. funcName: 'startPreview',
  714. argument: JSON.stringify({
  715. cameraIndexCode: cameraIndexCode, //监控点编号
  716. streamMode: streamMode, //主子码流标识
  717. transMode: transMode, //传输协议
  718. gpuMode: gpuMode, //是否开启GPU硬解
  719. wndId: wndId //可指定播放窗口
  720. })
  721. })
  722. },
  723. //初始化
  724. init(newappkey,newloginIp,newsecret,newloginPort) {
  725. let that = this
  726. that.getPubKey(function() {
  727. ////////////////////////////////// 请自行修改以下变量值 ////////////////////////////////////
  728. var appkey = newappkey //综合安防管理平台提供的appkey,必填
  729. var secret = that.setEncrypt(newsecret) //综合安防管理平台提供的secret,必填
  730. var ip = newloginIp //综合安防管理平台IP地址,必填
  731. var playMode = 0 //初始播放模式:0-预览,1-回放
  732. var port = Number(newloginPort) //综合安防管理平台端口,若启用HTTPS协议,默认443
  733. var snapDir = 'D:\\SnapDir' //抓图存储路径
  734. var videoDir = 'D:\\VideoDir' //紧急录像或录像剪辑存储路径
  735. var layout = '1x1' //playMode指定模式的布局
  736. var enableHTTPS = 1 //是否启用HTTPS协议与综合安防管理平台交互,这里总是填1
  737. var encryptedFields = 'secret' //加密字段,默认加密领域为secret
  738. var showToolbar = 1 //是否显示工具栏,0-不显示,非0-显示
  739. var showSmart = 1 //是否显示智能信息(如配置移动侦测后画面上的线框),0-不显示,非0-显示
  740. var buttonIDs = '0,16,256,257,258,259,260,512,513,514,515,516,517,768,769' //自定义工具条按钮
  741. ////////////////////////////////// 请自行修改以上变量值 ////////////////////////////////////
  742. that.oWebControl.JS_RequestInterface({
  743. funcName: 'init',
  744. argument: JSON.stringify({
  745. appkey: appkey, //API网关提供的appkey
  746. secret: secret, //API网关提供的secret
  747. ip: ip, //API网关IP地址
  748. playMode: playMode, //播放模式(决定显示预览还是回放界面)
  749. port: port, //端口
  750. snapDir: snapDir, //抓图存储路径
  751. videoDir: videoDir, //紧急录像或录像剪辑存储路径
  752. layout: layout, //布局
  753. enableHTTPS: enableHTTPS, //是否启用HTTPS协议
  754. encryptedFields: encryptedFields, //加密字段
  755. showToolbar: showToolbar, //是否显示工具栏
  756. showSmart: showSmart, //是否显示智能信息
  757. buttonIDs: buttonIDs //自定义工具条按钮
  758. })
  759. }).then(function(oData) {
  760. that.oWebControl.JS_Resize(1020, 600) // 初始化后resize一次,规避firefox下首次显示窗口后插件窗口未与DIV窗口重合问题
  761. })
  762. })
  763. },
  764. //获取公钥
  765. getPubKey(callback) {
  766. let that = this
  767. that.oWebControl.JS_RequestInterface({
  768. funcName: 'getRSAPubKey',
  769. argument: JSON.stringify({
  770. keyLength: 1024
  771. })
  772. }).then(function(oData) {
  773. console.log(oData)
  774. if (oData.responseMsg.data) {
  775. that.pubKey = oData.responseMsg.data
  776. callback()
  777. }
  778. })
  779. },
  780. //RSA加密
  781. setEncrypt(value) {
  782. var encrypt = new JSEncrypt()
  783. encrypt.setPublicKey(this.pubKey)
  784. return encrypt.encrypt(value)
  785. },
  786. /** ----------------------------------海康摄像头预览结束------------------------------------- */
  787. }
  788. }
  789. // 推送消息
  790. function cbIntegrationCallBack(oData) {
  791. console.log(JSON.stringify(oData.responseMsg))
  792. }
  793. </script>
  794. <style rel="stylesheet/scss" lang="scss" scoped>
  795. @import '@/assets/styles/base.scss';
  796. .playWnd {
  797. margin: 4px 0 0 8px;
  798. width: 1020px; /*播放容器的宽和高设定*/
  799. height: 600px;
  800. border: 1px solid red;
  801. }
  802. </style>