eventLocation.vue 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035
  1. <template>
  2. <div>
  3. <el-dialog title="事件定位" :visible.sync="eventLocationVisible" v-if="eventLocationVisible" width="80%"
  4. @close="cancelEventLocationShow()">
  5. <div class="event-info">
  6. <div class="event-info-con">
  7. <div class="e-location-left">
  8. <el-tabs v-model="activeName" @tab-click="handleClick">
  9. <el-tab-pane label="周边点位" name="monitor">
  10. <div class="forthis">
  11. <div class="i-list-con overflow-y" style="height: 50vh;">
  12. <span v-for="(item,index) in cameraList"
  13. v-on:click="dropLocation(item.latitude,item.longitude)">
  14. <div class="d-l-con" @click="">
  15. <div class="d-l-l-text">
  16. <i class="iconfont sj-icon-jkzx icon-sxt"></i>
  17. <h4>{{ item.cameraName }}</h4>
  18. </div>
  19. </div>
  20. </span>
  21. </div>
  22. </div>
  23. </el-tab-pane>
  24. <el-tab-pane label="周边事件" name="event">
  25. <div class="forthis">
  26. <div class="i-list-con overflow-y" style="height: 50vh;">
  27. <div class="d-l-con padding-box nowrap" v-for="(item,index) in eventList"
  28. @click="dropLocation(item.latitude,item.longitude)">
  29. <div class="bgt-img">
  30. <img v-if="item.picturePath!=null&&item.picturePath!=''" :src="item.picturePath"
  31. style="width: 93px;height: 64px"/>
  32. <img v-else src="../assets/images/integrated/event-img-sub.png"
  33. style="width: 93px;height: 64px"/>
  34. </div>
  35. <div class="bgt-info">
  36. <div v-if="item.eventStatusValue=='forest_event_status_1'&&item.urgeCount==0"
  37. class="event-state-sb">
  38. <i class="el-icon-caret-left"></i>
  39. <div class="event-list-state-sb">
  40. 新上报
  41. </div>
  42. </div>
  43. <div v-if="item.eventStatusValue=='forest_event_status_1'&&item.urgeCount>0"
  44. class="event-state-cb">
  45. <i class="el-icon-caret-left"></i>
  46. <div class="event-list-state-cb">
  47. 催办
  48. </div>
  49. </div>
  50. <div v-if="item.eventStatusValue=='forest_event_status_2'" class="event-state-qs">
  51. <i class="el-icon-caret-left"></i>
  52. <div class="event-list-state-qs">
  53. 签收
  54. </div>
  55. </div>
  56. <div v-if="item.eventStatusValue=='forest_event_status_3'" class="event-state-wb">
  57. <i class="el-icon-caret-left"></i>
  58. <div class="event-list-state-wb">
  59. 误报
  60. </div>
  61. </div>
  62. <div v-if="item.eventStatusValue=='forest_event_status_4'" class="event-state-cf">
  63. <i class="el-icon-caret-left"></i>
  64. <div class="event-list-state-cf">
  65. 重复
  66. </div>
  67. </div>
  68. <div v-if="item.eventStatusValue=='forest_event_status_5'" class="event-state-bj">
  69. <i class="el-icon-caret-left"></i>
  70. <div class="event-list-state-bj">
  71. 办结
  72. </div>
  73. </div>
  74. <div v-if="item.eventStatusValue=='forest_event_status_6'" class="event-state-gd">
  75. <i class="el-icon-caret-left"></i>
  76. <div class="event-list-state-gd">
  77. 归档
  78. </div>
  79. </div>
  80. <div v-if="item.eventStatusValue=='forest_event_status_7'" class="event-state-qr">
  81. <i class="el-icon-caret-left"></i>
  82. <div class="event-list-state-qr">
  83. 确认
  84. </div>
  85. </div>
  86. <div class="bgt-info-name">{{ item.reportor }} {{ item.eventName }}</div>
  87. <div class="bgt-info-place">
  88. <ul>
  89. <li>{{ item.createTime }}</li>
  90. </ul>
  91. </div>
  92. </div>
  93. </div>
  94. </div>
  95. </div>
  96. </el-tab-pane>
  97. </el-tabs>
  98. </div>
  99. <div class="e-location-right" style="height: 57.8vh;">
  100. <div class="event-info-top">
  101. <el-form>
  102. <div class="event-info-top-grp">
  103. <el-input placeholder="输入经度" type="number" v-model="longitude" class="m-l-none">
  104. </el-input>
  105. <el-input placeholder="输入纬度" type="number" v-model="latitude">
  106. </el-input>
  107. <el-button type="success" size="mini" @click="getNearEvent()">定位</el-button>
  108. </div>
  109. </el-form>
  110. </div>
  111. <!-- 地图 -->
  112. <eventLocationSupermap ref="eventLocationSupermap" style="width: 100%;height: 51vh;"
  113. :mapDiv="'eventLocationMap'" :mapSite="{doubleClickZoom:false,zoom:8}"
  114. :codes="['9fa5']"
  115. :isSideBySide="false" @preview="preview"
  116. @showEventDialog="showEventDialog"></eventLocationSupermap>
  117. </div>
  118. </div>
  119. </div>
  120. </el-dialog>
  121. <!--事件弹层-->
  122. <div class="event-info">
  123. <eventdetailsdialog ref="eventdetailsdialog" :calendarDay="this.getCurrentDataStr"></eventdetailsdialog>
  124. </div>
  125. <el-dialog :title="cameraTitle" :visible.sync="cameraVisible" v-if="cameraVisible" customClass="videoCustomWidth"
  126. @close="cancelEventLocationShow()">
  127. <div style="width:1020px;height:625px;position:relative;">
  128. <!--视频窗口展示---海康-->
  129. <div id="playWnd" class="playWnd" style="left: 0px; top: 0px;"></div>
  130. </div>
  131. </el-dialog>
  132. </div>
  133. </template>
  134. <script>
  135. import {
  136. getNearEvent,
  137. getNearCamera
  138. } from '@/api/event'
  139. import {
  140. getHaiKangVideoServer
  141. } from '@/api/haikang/haikang'
  142. import vBottomMenu from '@/components/vBottomMenu.vue' //一体化公共底部菜单
  143. import eventLocationSupermap from '@/components/supermap' //超图
  144. import eventdetailsdialog from '@/views/eventdetailsdialog.vue' //事件详情弹窗
  145. /** ----------------------------------摄像头预览开始------------------------------------- */
  146. import {
  147. getDahuaVideoServer
  148. } from '@/api/dahua/dahua'
  149. import DHWs from '@/dahua/lib/DHWs'
  150. /** ----------------------------------摄像头预览结束------------------------------------- */
  151. export default {
  152. dicts: ['event_source'],
  153. components: {
  154. eventLocationSupermap,
  155. eventdetailsdialog,
  156. vBottomMenu
  157. },
  158. data() {
  159. return {
  160. /** ----------------------------------摄像头预览开始------------------------------------- */
  161. activePanel: 'key1',
  162. isLogin: false,
  163. cameraParams: [],
  164. ws: null,
  165. /** ----------------------------------摄像头预览结束------------------------------------- */
  166. //海康
  167. cameraTitle: '',
  168. cameraVisible: false,
  169. initCount: 0,
  170. pubKey: '',
  171. oWebControl: null,
  172. /** ----------------------------------事件弹窗开始------------------------------------- */
  173. eventInfoVisibleActiveName: 'info',
  174. eventInfoVisible_notProcessed: false,
  175. eventInfoVisible_Processed: false,
  176. listEventPic: [], //事件图片
  177. url: '',
  178. id: '',
  179. eventType: '',
  180. deptName: '',
  181. eventStatus: '',
  182. cameraId: '',
  183. createTime: '',
  184. reportAddress: '',
  185. eventCode: null,
  186. eventSource: '',
  187. //事件详情弹出显隐
  188. eventTypeShow: false,
  189. listEventDept: [], //涉事单位List,
  190. listLog: [], //处理过程List,
  191. listoperateDept: [],
  192. optionsNotProcessed: [{
  193. value: 'wyc',
  194. label: '无异常'
  195. }, {
  196. value: 'qr',
  197. label: '确认'
  198. }],
  199. listeventType: [],
  200. updateEventStatusForm: {
  201. id: '',
  202. eventStatus: '',
  203. eventCode: '',
  204. deptId: '',
  205. deptName: '',
  206. eventType: '',
  207. zt: ''
  208. },
  209. /** ----------------------------------事件弹窗结束-未处理------------------------------------- */
  210. aniu: true,
  211. showZt: true,
  212. zt: null,
  213. fireReport: false,
  214. optionsProcessed: [{
  215. value: 'bj',
  216. label: '办结'
  217. }, {
  218. value: 'zy',
  219. label: '支援'
  220. },
  221. {
  222. value: 'gd',
  223. label: '归档'
  224. }
  225. ],
  226. // 弹出层 基本信息
  227. information: [{
  228. name: '标题',
  229. id: '',
  230. content: '前段发现警情信息'
  231. },
  232. {
  233. name: '时间',
  234. id: '',
  235. content: '2022-02-14 14:30'
  236. },
  237. {
  238. name: '来源',
  239. id: '',
  240. content: '摄像头'
  241. },
  242. {
  243. name: '坐标',
  244. id: '',
  245. content: '125.78945646'
  246. },
  247. {
  248. name: '纬度',
  249. id: '',
  250. content: '43.987424'
  251. },
  252. {
  253. name: '上报人',
  254. id: '',
  255. content: '党校监控点位'
  256. },
  257. {
  258. name: '详细信息',
  259. id: '',
  260. content: '这里发现病虫害,需要立刻支援'
  261. }
  262. ],
  263. eventLocationVisible: false,
  264. longitude: '',
  265. latitude: '',
  266. activeName: 'event',
  267. eventList: [],
  268. markersList: [],
  269. cameraList: [],
  270. cameraMarkersList: []
  271. }
  272. },
  273. created() {
  274. /** ----------------------------------摄像头预览开始------------------------------------- */
  275. const DHWsInstance = DHWs.getInstance()
  276. this.ws = DHWsInstance
  277. /** ----------------------------------摄像头预览结束------------------------------------- */
  278. },
  279. methods: {
  280. getCurrentDataStr() {
  281. let date = new Date()
  282. let y = date.getFullYear()
  283. let m = date.getMonth() + 1
  284. m = m < 10 ? '0' + m : m
  285. let d = date.getDate()
  286. d = d < 10 ? '0' + d : d
  287. return y + '-' + m + '-' + d
  288. },
  289. cancelEventLocationShow() {
  290. if (this.oWebControl != null) {
  291. this.oWebControl.JS_HideWnd() // 先让窗口隐藏,规避可能的插件窗口滞后于浏览器消失问题
  292. this.oWebControl.JS_Disconnect().then(function() { // 断开与插件服务连接成功
  293. },
  294. function() { // 断开与插件服务连接失败
  295. })
  296. }
  297. },
  298. showEventDialog(eventCode) {
  299. //事件信息弹出
  300. this.$refs.eventdetailsdialog.showEventDialog(eventCode)
  301. },
  302. getNearEvent() {
  303. if (this.longitude == null || this.longitude == '' || this.latitude == null || this.latitude == '') {
  304. this.$modal.msgError('请输入经纬度!')
  305. return
  306. }
  307. this.activeName = 'event'
  308. let marker = [{
  309. lng: this.longitude,
  310. lat: this.latitude,
  311. icon: 'marker',
  312. bindPopupHtml: '搜索点位',
  313. click: '',
  314. parameter: '',
  315. keepBindPopup: false,
  316. isAggregation: false
  317. }]
  318. let that = this
  319. getNearEvent(that.longitude, that.latitude,'').then(res => {
  320. that.markersList = []
  321. that.eventList = res.data
  322. if (that.eventList != null && that.eventList.length > 0) {
  323. for (let i = 0; i < that.eventList.length; i++) {
  324. let markersMap = {
  325. lng: 124.59,
  326. lat: 43.02,
  327. icon: 'marker',
  328. bindPopupHtml: '',
  329. click: '',
  330. parameter: '',
  331. keepBindPopup: false,
  332. isAggregation: false
  333. }
  334. if (that.eventList.length > 200) {
  335. markersMap.isAggregation = true
  336. }
  337. if (that.eventList[i].eventStatusValue == 'forest_event_status_1') {
  338. markersMap.click = 'showEventDialog'
  339. markersMap.icon = 'sj-icon-map-xinshangbao'
  340. }
  341. if (that.eventList[i].eventStatusValue == 'forest_event_status_1' && that.eventList[i].urgeCount > 0) {
  342. markersMap.click = 'showEventDialog'
  343. markersMap.icon = 'sj-icon-map-cuiban'
  344. } else if (that.eventList[i].eventStatusValue == 'forest_event_status_2') {
  345. markersMap.click = 'showEventDialog'
  346. markersMap.icon = 'sj-icon-map-qianshou'
  347. markersMap.isAggregation = false
  348. } else if (that.eventList[i].eventStatusValue == 'forest_event_status_5') {
  349. markersMap.click = 'showEventDialog'
  350. markersMap.icon = 'sj-icon-map-banjie'
  351. markersMap.isAggregation = false
  352. } else if (that.eventList[i].eventStatusValue == 'forest_event_status_6') {
  353. markersMap.click = 'showEventDialog'
  354. markersMap.icon = 'sj-icon-map-guidang'
  355. } else if (that.eventList[i].eventStatusValue == 'forest_event_status_7') {
  356. markersMap.click = 'showEventDialog'
  357. markersMap.icon = 'sj-icon-map-queren'
  358. }
  359. markersMap.parameter = that.eventList[i].eventCode
  360. markersMap.lng = that.eventList[i].longitude
  361. markersMap.lat = that.eventList[i].latitude
  362. markersMap.bindPopupHtml = '<div class="map-tip">' +
  363. '<span>' +
  364. ' <div class="d-l-con">' +
  365. ' <div class="d-l-l-text">' +
  366. ' <h4>经纬度:' + that.eventList[i].longitude + ',' + that.eventList[i].latitude + '</h4>' +
  367. ' </div>' +
  368. ' </div>' +
  369. ' </span>' +
  370. '<span>' +
  371. ' <div class="d-l-con">' +
  372. ' <div class="d-l-l-text">' +
  373. ' <h4>事件名称:' + that.eventList[i].eventName + '</h4>' +
  374. ' </div>' +
  375. ' </div>' +
  376. ' </span>' +
  377. '<span>' +
  378. ' <div class="d-l-con">' +
  379. ' <div class="d-l-l-text">' +
  380. ' <h4>事件时间:' + that.eventList[i].createTime + '</h4>' +
  381. ' </div>' +
  382. ' </div>' +
  383. ' </span>'
  384. if(that.eventList[i].pictureType=='image'&&that.eventList[i].picturePath != null && that.eventList[i].picturePath != ''){
  385. markersMap.bindPopupHtml += '<span>' +
  386. ' <div class="d-l-con">' +
  387. ' <div class="d-l-l-text">' +
  388. '<img src="' + that.eventList[i].picturePath + '" style="width: 150px;height: 100px"/>' +
  389. ' </div>' +
  390. ' </div>' +
  391. ' </span>'
  392. }
  393. markersMap.bindPopupHtml += '</div>'
  394. that.markersList.push(markersMap)
  395. }
  396. setTimeout(() => {
  397. that.$refs.eventLocationSupermap.clearM(false)
  398. that.$refs.eventLocationSupermap.clearM(true)
  399. that.$refs.eventLocationSupermap.setMarkers(that.markersList)
  400. that.$refs.eventLocationSupermap.setMarkers(marker)
  401. }, 1000)
  402. } else {
  403. setTimeout(() => {
  404. that.$refs.eventLocationSupermap.clearM(false)
  405. that.$refs.eventLocationSupermap.clearM(true)
  406. that.$refs.eventLocationSupermap.setMarkers(marker)
  407. }, 1000)
  408. }
  409. })
  410. },
  411. handleClick(tab, event) {
  412. let that = this
  413. that.$refs.eventLocationSupermap.controlLevel(8)
  414. let marker = [{
  415. lng: that.longitude,
  416. lat: that.latitude,
  417. icon: 'marker',
  418. bindPopupHtml: '定位',
  419. click: '',
  420. parameter: '',
  421. keepBindPopup: false,
  422. isAggregation: false
  423. }]
  424. if (tab.name == 'monitor') {
  425. if (that.longitude == null || that.longitude == '' || that.latitude == null || that.latitude == '') {
  426. that.$modal.msgError('请输入经纬度!')
  427. return
  428. }
  429. that.cameraMarkersList = []
  430. that.cameraList = []
  431. getNearCamera(that.longitude, that.latitude).then(res => {
  432. //根据设备类型查看列表
  433. that.cameraList = res.data
  434. if (res.data != null && res.data.length > 0) {
  435. for (let i = 0; i < res.data.length; i++) {
  436. let markersMap = {
  437. lng: 124.59,
  438. lat: 43.02,
  439. icon: 'camera',
  440. bindPopupHtml: '',
  441. click: 'preview',
  442. keepBindPopup: false,
  443. isAggregation: false
  444. }
  445. if (res.data[i].cameraCode != null) {
  446. markersMap.parameter = {
  447. code: res.data[i].cameraCode,
  448. type: res.data[i].cameraFactory
  449. }
  450. } else {
  451. markersMap.parameter = []
  452. }
  453. if (res.data.length > 50) {
  454. markersMap.isAggregation = true
  455. }
  456. markersMap.lng = res.data[i].longitude
  457. markersMap.lat = res.data[i].latitude
  458. markersMap.radius = res.data[i].cameraRadius
  459. markersMap.bindPopupHtml = '<div class="map-tip">' +
  460. '<span>' +
  461. ' <div class="d-l-con">' +
  462. ' <div class="d-l-l-text">' +
  463. ' <h4>经纬度:' + res.data[i].longitude +
  464. ',' + res.data[i].latitude + '</h4>' +
  465. ' </div>' +
  466. ' </div>' +
  467. ' </span>' +
  468. '<span>' +
  469. ' <div class="d-l-con">' +
  470. ' <div class="d-l-l-text">' +
  471. ' <h4>摄像头名称:' + res.data[i]
  472. .cameraName + '</h4>' +
  473. ' </div>' +
  474. ' </div>' +
  475. ' </span>' +
  476. '<span>' +
  477. ' <div class="d-l-con">' +
  478. ' <div class="d-l-l-text">' +
  479. ' <h4>网络运营商:' + (res.data[i].operatorType == "1" ? "联通" : (res.data[i].operatorType == "2" ? "移动":"电信")) + '</h4>' +
  480. ' </div>' +
  481. ' </div>' +
  482. ' </span>' +
  483. '<span>' +
  484. ' <div class="d-l-con">' +
  485. ' <div class="d-l-l-text">' +
  486. ' <h4>摄像头半径:' + res.data[i]
  487. .cameraRadius + '米</h4>' +
  488. ' </div>' +
  489. ' </div>' +
  490. ' </span>' +
  491. '</div>'
  492. that.cameraMarkersList.push(markersMap)
  493. }
  494. setTimeout(() => {
  495. that.$refs.eventLocationSupermap.clearM(true)
  496. that.$refs.eventLocationSupermap.clearM(false)
  497. that.$refs.eventLocationSupermap.setMarkersRadius(that.cameraMarkersList)
  498. that.$refs.eventLocationSupermap.setMarkers(marker)
  499. }, 1000)
  500. } else {
  501. setTimeout(() => {
  502. that.$refs.eventLocationSupermap.clearM(true)
  503. that.$refs.eventLocationSupermap.clearM(false)
  504. that.$refs.eventLocationSupermap.setMarkers(marker)
  505. }, 1000)
  506. }
  507. })
  508. } else {
  509. that.getNearEvent()
  510. }
  511. },
  512. dropLocation(lat, lng) {
  513. this.$refs.eventLocationSupermap.dropLocation(lat, lng)
  514. },
  515. showEventLocation() {
  516. this.eventLocationVisible = true
  517. },
  518. /** ----------------------------------摄像头预览开始------------------------------------- */
  519. alertLogin: function() {
  520. this.$modal.msg('登录中....')
  521. },
  522. alertLoginSuccess: function() {
  523. this.$modal.msgSuccess('登录成功!')
  524. },
  525. alertLoginFailed: function() {
  526. this.$modal.msgError('登陆失败!')
  527. },
  528. alertReinstall: function() {
  529. this.$modal.msgWarning('请重新安装客户端')
  530. },
  531. cancelEventLocationShow() {
  532. if (this.oWebControl != null) {
  533. this.oWebControl.JS_HideWnd() // 先让窗口隐藏,规避可能的插件窗口滞后于浏览器消失问题
  534. this.oWebControl.JS_Disconnect().then(function() { // 断开与插件服务连接成功
  535. },
  536. function() { // 断开与插件服务连接失败
  537. })
  538. }
  539. },
  540. /** 预览按钮操作 */
  541. preview(cameraParam) {
  542. if (cameraParam.type == '1') {
  543. getDahuaVideoServer().then(newResponse => {
  544. console.log(newResponse)
  545. this.ws.detectConnectQt().then(res => {
  546. if (res) { // 连接客户端成功
  547. this.alertLogin()
  548. this.ws.login({
  549. loginIp: newResponse.loginIp,
  550. loginPort: newResponse.loginPort,
  551. userName: newResponse.userName,
  552. userPwd: newResponse.userPwd,
  553. token: '',
  554. https: 0
  555. })
  556. this.ws.on('loginState', (res) => {
  557. this.isLogin = res
  558. console.log('---res-----', res)
  559. if (res) {
  560. this.alertLoginSuccess()
  561. this.activePanel = 'key2'
  562. this.realTimeVideoDialog(cameraParam.code)
  563. } else {
  564. this.alertLoginFailed()
  565. }
  566. })
  567. } else { // 连接客户端失败
  568. this.alertReinstall()
  569. }
  570. })
  571. })
  572. } else if (cameraParam.type == '0') {
  573. let that = this
  574. that.cameraVisible = true
  575. getHaiKangVideoServer({ cameraCode: cameraParam.code }).then(newResponse => {
  576. that.cameraTitle = '摄像头-' + newResponse.data.cameraName
  577. that.initPlugin(newResponse.data.appkey, newResponse.data.loginIp, newResponse.data.secret, newResponse.data.loginPort)
  578. setTimeout(function() {
  579. that.playhk(newResponse.data.channelCode)
  580. }, 5000)
  581. })
  582. }
  583. },
  584. realTimeVideoDialog(cameraParams) { // 调用弹窗实时播放接口
  585. if (!this.isLogin) {
  586. this.$Message.info('正在登陆客户端,请稍等......')
  587. return false
  588. }
  589. const params = [cameraParams]
  590. this.ws.openVideo(params)
  591. },
  592. /** ----------------------------------摄像头预览结束------------------------------------- */
  593. /** ----------------------------------海康摄像头预览开始------------------------------------- */
  594. // 创建播放实例
  595. initPlugin(newappkey, newloginIp, newsecret, newloginPort) {
  596. let that = this
  597. that.oWebControl = new WebControl({
  598. szPluginContainer: 'playWnd', // 指定容器id
  599. iServicePortStart: 15900, // 指定起止端口号,建议使用该值
  600. iServicePortEnd: 15909,
  601. szClassId: '23BF3B0A-2C56-4D97-9C03-0CB103AA8F11', // 用于IE10使用ActiveX的clsid
  602. cbConnectSuccess: function() { // 创建WebControl实例成功
  603. that.oWebControl.JS_StartService('window', { // WebControl实例创建成功后需要启动服务
  604. dllPath: './VideoPluginConnect.dll' // 值"./VideoPluginConnect.dll"写死
  605. }).then(function() { // 启动插件服务成功
  606. that.oWebControl.JS_SetWindowControlCallback({ // 设置消息回调
  607. cbIntegrationCallBack: cbIntegrationCallBack
  608. })
  609. that.oWebControl.JS_CreateWnd('playWnd', 1020, 600).then(function() { //JS_CreateWnd创建视频播放窗口,宽高可设定
  610. that.init(newappkey, newloginIp, newsecret, newloginPort) // 创建播放实例成功后初始化
  611. })
  612. }, function() { // 启动插件服务失败
  613. })
  614. },
  615. cbConnectError: function() { // 创建WebControl实例失败
  616. that.oWebControl = null
  617. $('#playWnd').html('插件未启动,正在尝试启动,请稍候...<a href="./hk/VideoWebPlugin.exe">点击下载插件</a>')
  618. WebControl.JS_WakeUp('VideoWebPlugin://') // 程序未启动时执行error函数,采用wakeup来启动程序
  619. initCount++
  620. if (initCount < 3) {
  621. setTimeout(function() {
  622. that.initPlugin(newappkey, newloginIp, newsecret, newloginPort)
  623. }, 3000)
  624. } else {
  625. $('#playWnd').html('插件启动失败,请检查插件是否安装!<a href="./hk/VideoWebPlugin.exe">点击下载插件</a>')
  626. }
  627. },
  628. cbConnectClose: function(bNormalClose) {
  629. // 异常断开:bNormalClose = false
  630. // JS_Disconnect正常断开:bNormalClose = true
  631. console.log('cbConnectClose')
  632. that.oWebControl = null
  633. }
  634. })
  635. },
  636. //播放海康摄像头
  637. playhk(channelCode) {
  638. var cameraIndexCode = channelCode //获取输入的监控点编号值,必填
  639. var streamMode = 0 //主子码流标识:0-主码流,1-子码流
  640. var transMode = 1 //传输协议:0-UDP,1-TCP
  641. var gpuMode = 0 //是否启用GPU硬解,0-不启用,1-启用
  642. var wndId = -1 //播放窗口序号(在2x2以上布局下可指定播放窗口)
  643. cameraIndexCode = cameraIndexCode.replace(/(^\s*)/g, '')
  644. cameraIndexCode = cameraIndexCode.replace(/(\s*$)/g, '')
  645. this.oWebControl.JS_RequestInterface({
  646. funcName: 'startPreview',
  647. argument: JSON.stringify({
  648. cameraIndexCode: cameraIndexCode, //监控点编号
  649. streamMode: streamMode, //主子码流标识
  650. transMode: transMode, //传输协议
  651. gpuMode: gpuMode, //是否开启GPU硬解
  652. wndId: wndId //可指定播放窗口
  653. })
  654. })
  655. },
  656. //初始化
  657. init(newappkey, newloginIp, newsecret, newloginPort) {
  658. let that = this
  659. that.getPubKey(function() {
  660. ////////////////////////////////// 请自行修改以下变量值 ////////////////////////////////////
  661. var appkey = newappkey //综合安防管理平台提供的appkey,必填
  662. var secret = that.setEncrypt(newsecret) //综合安防管理平台提供的secret,必填
  663. var ip = newloginIp //综合安防管理平台IP地址,必填
  664. var playMode = 0 //初始播放模式:0-预览,1-回放
  665. var port = Number(newloginPort) //综合安防管理平台端口,若启用HTTPS协议,默认443
  666. var snapDir = 'D:\\SnapDir' //抓图存储路径
  667. var videoDir = 'D:\\VideoDir' //紧急录像或录像剪辑存储路径
  668. var layout = '1x1' //playMode指定模式的布局
  669. var enableHTTPS = 1 //是否启用HTTPS协议与综合安防管理平台交互,这里总是填1
  670. var encryptedFields = 'secret' //加密字段,默认加密领域为secret
  671. var showToolbar = 1 //是否显示工具栏,0-不显示,非0-显示
  672. var showSmart = 1 //是否显示智能信息(如配置移动侦测后画面上的线框),0-不显示,非0-显示
  673. var buttonIDs = '0,16,256,257,258,259,260,512,513,514,515,516,517,768,769' //自定义工具条按钮
  674. ////////////////////////////////// 请自行修改以上变量值 ////////////////////////////////////
  675. that.oWebControl.JS_RequestInterface({
  676. funcName: 'init',
  677. argument: JSON.stringify({
  678. appkey: appkey, //API网关提供的appkey
  679. secret: secret, //API网关提供的secret
  680. ip: ip, //API网关IP地址
  681. playMode: playMode, //播放模式(决定显示预览还是回放界面)
  682. port: port, //端口
  683. snapDir: snapDir, //抓图存储路径
  684. videoDir: videoDir, //紧急录像或录像剪辑存储路径
  685. layout: layout, //布局
  686. enableHTTPS: enableHTTPS, //是否启用HTTPS协议
  687. encryptedFields: encryptedFields, //加密字段
  688. showToolbar: showToolbar, //是否显示工具栏
  689. showSmart: showSmart, //是否显示智能信息
  690. buttonIDs: buttonIDs //自定义工具条按钮
  691. })
  692. }).then(function(oData) {
  693. that.oWebControl.JS_Resize(1020, 600) // 初始化后resize一次,规避firefox下首次显示窗口后插件窗口未与DIV窗口重合问题
  694. })
  695. })
  696. },
  697. //获取公钥
  698. getPubKey(callback) {
  699. let that = this
  700. that.oWebControl.JS_RequestInterface({
  701. funcName: 'getRSAPubKey',
  702. argument: JSON.stringify({
  703. keyLength: 1024
  704. })
  705. }).then(function(oData) {
  706. console.log(oData)
  707. if (oData.responseMsg.data) {
  708. that.pubKey = oData.responseMsg.data
  709. callback()
  710. }
  711. })
  712. },
  713. //RSA加密
  714. setEncrypt(value) {
  715. var encrypt = new JSEncrypt()
  716. encrypt.setPublicKey(this.pubKey)
  717. return encrypt.encrypt(value)
  718. },
  719. /** ----------------------------------海康摄像头预览结束------------------------------------- */
  720. /** ----------------------------------事件弹窗开始------------------------------------- */
  721. editableLayers(processedState) {
  722. if (processedState == 'notProcessedSupermap') {
  723. let aa = this.$refs.notProcessedSupermap.isEditableLayers
  724. if (!this.$refs.notProcessedSupermap.isEditableLayers) {
  725. this.$refs.notProcessedSupermap.isEditableLayers = true
  726. } else {
  727. this.$refs.notProcessedSupermap.isEditableLayers = false
  728. }
  729. } else {
  730. let bb = this.$refs.processedSupermap.isEditableLayers
  731. if (!this.$refs.processedSupermap.isEditableLayers) {
  732. this.$refs.processedSupermap.isEditableLayers = true
  733. } else {
  734. this.$refs.processedSupermap.isEditableLayers = false
  735. }
  736. }
  737. },
  738. switchImage(url) {
  739. this.url = url
  740. },
  741. formLeaveTable() {
  742. let p = new Promise((resolve, reject) =>
  743. reject()
  744. )
  745. return p
  746. },
  747. async beforeLeave(newactiveName, oldActiveName) {
  748. let that = this
  749. if (newactiveName == 'frame') {
  750. return await that.formLeaveTable()
  751. }
  752. },
  753. setXsYc() {
  754. let that = this
  755. if (this.eventStatus == 'qr') {
  756. this.eventTypeShow = true
  757. } else {
  758. this.eventTypeShow = false
  759. }
  760. },
  761. setValue(event) {
  762. this.deptId = event.value
  763. this.deptName = event.label
  764. },
  765. cancelEventShow() {
  766. this.eventInfoVisibleActiveName = 'info'
  767. this.listEventPic = [] //事件图片
  768. this.listEventDept = [] //涉事单位List,
  769. this.listLog = [] //处理过程List,
  770. this.listoperateDept = []
  771. },
  772. /** 重置按钮操作 */
  773. resetQuery() {
  774. this.eventTypeShow = false
  775. this.eventType = ''
  776. this.deptName = ''
  777. this.eventStatus = ''
  778. },
  779. /** ----------------------------------事件弹窗结束------------------------------------- */
  780. /** ----------------------------------海康摄像头预览开始------------------------------------- */
  781. // 创建播放实例
  782. initPlugin(newappkey, newloginIp, newsecret, newloginPort) {
  783. let that = this
  784. that.oWebControl = new WebControl({
  785. szPluginContainer: 'playWnd', // 指定容器id
  786. iServicePortStart: 15900, // 指定起止端口号,建议使用该值
  787. iServicePortEnd: 15909,
  788. szClassId: '23BF3B0A-2C56-4D97-9C03-0CB103AA8F11', // 用于IE10使用ActiveX的clsid
  789. cbConnectSuccess: function() { // 创建WebControl实例成功
  790. that.oWebControl.JS_StartService('window', { // WebControl实例创建成功后需要启动服务
  791. dllPath: './VideoPluginConnect.dll' // 值"./VideoPluginConnect.dll"写死
  792. }).then(function() { // 启动插件服务成功
  793. that.oWebControl.JS_SetWindowControlCallback({ // 设置消息回调
  794. cbIntegrationCallBack: cbIntegrationCallBack
  795. })
  796. that.oWebControl.JS_CreateWnd('playWnd', 1020, 600).then(function() { //JS_CreateWnd创建视频播放窗口,宽高可设定
  797. that.init(newappkey, newloginIp, newsecret, newloginPort) // 创建播放实例成功后初始化
  798. })
  799. }, function() { // 启动插件服务失败
  800. })
  801. },
  802. cbConnectError: function() { // 创建WebControl实例失败
  803. that.oWebControl = null
  804. $('#playWnd').html('插件未启动,正在尝试启动,请稍候...<a href="./hk/VideoWebPlugin.exe">点击下载插件</a>')
  805. WebControl.JS_WakeUp('VideoWebPlugin://') // 程序未启动时执行error函数,采用wakeup来启动程序
  806. that.initCount++
  807. if (that.initCount < 3) {
  808. setTimeout(function() {
  809. that.initPlugin(newappkey, newloginIp, newsecret, newloginPort)
  810. }, 3000)
  811. } else {
  812. $('#playWnd').html('插件启动失败,请检查插件是否安装!<a href="./hk/VideoWebPlugin.exe">点击下载插件</a>')
  813. }
  814. },
  815. cbConnectClose: function(bNormalClose) {
  816. // 异常断开:bNormalClose = false
  817. // JS_Disconnect正常断开:bNormalClose = true
  818. that.oWebControl = null
  819. }
  820. })
  821. },
  822. //播放海康摄像头
  823. playhk(channelCode) {
  824. var cameraIndexCode = channelCode //获取输入的监控点编号值,必填
  825. var streamMode = 0 //主子码流标识:0-主码流,1-子码流
  826. var transMode = 1 //传输协议:0-UDP,1-TCP
  827. var gpuMode = 0 //是否启用GPU硬解,0-不启用,1-启用
  828. var wndId = -1 //播放窗口序号(在2x2以上布局下可指定播放窗口)
  829. cameraIndexCode = cameraIndexCode.replace(/(^\s*)/g, '')
  830. cameraIndexCode = cameraIndexCode.replace(/(\s*$)/g, '')
  831. this.oWebControl.JS_RequestInterface({
  832. funcName: 'startPreview',
  833. argument: JSON.stringify({
  834. cameraIndexCode: cameraIndexCode, //监控点编号
  835. streamMode: streamMode, //主子码流标识
  836. transMode: transMode, //传输协议
  837. gpuMode: gpuMode, //是否开启GPU硬解
  838. wndId: wndId //可指定播放窗口
  839. })
  840. })
  841. },
  842. //初始化
  843. init(newappkey, newloginIp, newsecret, newloginPort) {
  844. let that = this
  845. that.getPubKey(function() {
  846. ////////////////////////////////// 请自行修改以下变量值 ////////////////////////////////////
  847. var appkey = newappkey //综合安防管理平台提供的appkey,必填
  848. var secret = that.setEncrypt(newsecret) //综合安防管理平台提供的secret,必填
  849. var ip = newloginIp //综合安防管理平台IP地址,必填
  850. var playMode = 0 //初始播放模式:0-预览,1-回放
  851. var port = Number(newloginPort) //综合安防管理平台端口,若启用HTTPS协议,默认443
  852. var snapDir = 'D:\\SnapDir' //抓图存储路径
  853. var videoDir = 'D:\\VideoDir' //紧急录像或录像剪辑存储路径
  854. var layout = '1x1' //playMode指定模式的布局
  855. var enableHTTPS = 1 //是否启用HTTPS协议与综合安防管理平台交互,这里总是填1
  856. var encryptedFields = 'secret' //加密字段,默认加密领域为secret
  857. var showToolbar = 1 //是否显示工具栏,0-不显示,非0-显示
  858. var showSmart = 1 //是否显示智能信息(如配置移动侦测后画面上的线框),0-不显示,非0-显示
  859. var buttonIDs = '0,16,256,257,258,259,260,512,513,514,515,516,517,768,769' //自定义工具条按钮
  860. ////////////////////////////////// 请自行修改以上变量值 ////////////////////////////////////
  861. that.oWebControl.JS_RequestInterface({
  862. funcName: 'init',
  863. argument: JSON.stringify({
  864. appkey: appkey, //API网关提供的appkey
  865. secret: secret, //API网关提供的secret
  866. ip: ip, //API网关IP地址
  867. playMode: playMode, //播放模式(决定显示预览还是回放界面)
  868. port: port, //端口
  869. snapDir: snapDir, //抓图存储路径
  870. videoDir: videoDir, //紧急录像或录像剪辑存储路径
  871. layout: layout, //布局
  872. enableHTTPS: enableHTTPS, //是否启用HTTPS协议
  873. encryptedFields: encryptedFields, //加密字段
  874. showToolbar: showToolbar, //是否显示工具栏
  875. showSmart: showSmart, //是否显示智能信息
  876. buttonIDs: buttonIDs //自定义工具条按钮
  877. })
  878. }).then(function(oData) {
  879. that.oWebControl.JS_Resize(1020, 600) // 初始化后resize一次,规避firefox下首次显示窗口后插件窗口未与DIV窗口重合问题
  880. })
  881. })
  882. },
  883. //获取公钥
  884. getPubKey(callback) {
  885. let that = this
  886. that.oWebControl.JS_RequestInterface({
  887. funcName: 'getRSAPubKey',
  888. argument: JSON.stringify({
  889. keyLength: 1024
  890. })
  891. }).then(function(oData) {
  892. console.log(oData)
  893. if (oData.responseMsg.data) {
  894. that.pubKey = oData.responseMsg.data
  895. callback()
  896. }
  897. })
  898. },
  899. //RSA加密
  900. setEncrypt(value) {
  901. var encrypt = new JSEncrypt()
  902. encrypt.setPublicKey(this.pubKey)
  903. return encrypt.encrypt(value)
  904. }
  905. /** ----------------------------------海康摄像头预览结束------------------------------------- */
  906. }
  907. }
  908. // 推送消息
  909. function cbIntegrationCallBack(oData) {
  910. console.log(JSON.stringify(oData.responseMsg))
  911. }
  912. </script>
  913. <style rel="stylesheet/scss" lang="scss" scoped>
  914. @import '@/assets/styles/base.scss';
  915. .event-info-con {
  916. width: 100%;
  917. display: flex;
  918. .e-left {
  919. width: 32%;
  920. }
  921. .e-center {
  922. width: 30%;
  923. margin-left: 1%;
  924. .img-company {
  925. width: 100%;
  926. height: 18.3vh;
  927. img {
  928. }
  929. }
  930. }
  931. .e-right {
  932. margin-left: 1%;
  933. width: 45%;
  934. }
  935. .e-location-left {
  936. width: 28%;
  937. }
  938. .e-location-right {
  939. width: 71%;
  940. margin-left: 1rem;
  941. }
  942. }
  943. .el-dialog:not(.is-fullscreen) {
  944. margin-top: 5.5vh !important;
  945. }
  946. .bottom-menu-normal {
  947. max-width: 90%;
  948. padding: 0 3rem;
  949. position: absolute;
  950. left: 50%;
  951. transform: translateX(-50%);
  952. bottom: 0;
  953. z-index: 100000;
  954. border-radius: 5px;
  955. display: flex;
  956. justify-content: center;
  957. align-items: center;
  958. background: url(../assets/images/integrated/btm-menu.png) center no-repeat;
  959. background-size: cover;
  960. overflow: hidden;
  961. .btm-m-con {
  962. position: relative;
  963. color: $inBlue;
  964. font-size: .5rem;
  965. padding: 1rem 1.5rem;
  966. display: flex;
  967. align-items: center;
  968. justify-content: center;
  969. -webkit-transform: translateY(0);
  970. transform: translateY(0);
  971. transition: all 0.2s ease-in-out;
  972. cursor: pointer;
  973. white-space: nowrap;
  974. i {
  975. font-size: 1rem;
  976. color: $inBlue;
  977. text-shadow: 0 0 10px rgba($color: $inBlue, $alpha: .6);
  978. margin-right: 0.2rem;
  979. }
  980. }
  981. .btm-m-con:hover {
  982. text-shadow: 0 0 20px rgba($color: $inBlueHover, $alpha: 1.0);
  983. filter: brightness(2.3);
  984. -webkit-transform: translateX(0.2rem);
  985. transform: translateX(0.2rem);
  986. transition: all 0.2s ease-in-out;
  987. i {
  988. color: $inBlueHover;
  989. text-shadow: 0 0 20px rgba($color: $inBlueHover, $alpha: 1.0);
  990. }
  991. }
  992. .m-l-none {
  993. .el-input__inner {
  994. margin-left: 0 !important;
  995. }
  996. }
  997. }
  998. </style>