eventLocation.vue 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041
  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. getNearEvent1,
  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. } else if (this.longitude >180 || this.longitude < -180 || this.latitude > 90 || this.latitude < -90) {
  307. this.$modal.msgError('请输入正确经纬度!')
  308. return
  309. }
  310. this.activeName = 'event'
  311. let marker = [{
  312. lng: this.longitude,
  313. lat: this.latitude,
  314. icon: 'marker',
  315. bindPopupHtml: '搜索点位',
  316. click: '',
  317. parameter: '',
  318. keepBindPopup: false,
  319. isAggregation: false
  320. }]
  321. let that = this
  322. getNearEvent1(that.longitude, that.latitude).then(res => {
  323. that.markersList = []
  324. that.eventList = res.data
  325. if (that.eventList != null && that.eventList.length > 0) {
  326. for (let i = 0; i < that.eventList.length; i++) {
  327. let markersMap = {
  328. lng: 124.59,
  329. lat: 43.02,
  330. icon: 'marker',
  331. bindPopupHtml: '',
  332. click: '',
  333. parameter: '',
  334. keepBindPopup: false,
  335. isAggregation: false
  336. }
  337. if (that.eventList.length > 200) {
  338. markersMap.isAggregation = true
  339. }
  340. if (that.eventList[i].eventStatusValue == 'forest_event_status_1') {
  341. markersMap.click = 'showEventDialog'
  342. markersMap.icon = 'sj-icon-map-xinshangbao'
  343. }
  344. if (that.eventList[i].eventStatusValue == 'forest_event_status_1' && that.eventList[i].urgeCount > 0) {
  345. markersMap.click = 'showEventDialog'
  346. markersMap.icon = 'sj-icon-map-cuiban'
  347. } else if (that.eventList[i].eventStatusValue == 'forest_event_status_2') {
  348. markersMap.click = 'showEventDialog'
  349. markersMap.icon = 'sj-icon-map-qianshou'
  350. markersMap.isAggregation = false
  351. } else if (that.eventList[i].eventStatusValue == 'forest_event_status_5') {
  352. markersMap.click = 'showEventDialog'
  353. markersMap.icon = 'sj-icon-map-banjie'
  354. markersMap.isAggregation = false
  355. } else if (that.eventList[i].eventStatusValue == 'forest_event_status_6') {
  356. markersMap.click = 'showEventDialog'
  357. markersMap.icon = 'sj-icon-map-guidang'
  358. } else if (that.eventList[i].eventStatusValue == 'forest_event_status_7') {
  359. markersMap.click = 'showEventDialog'
  360. markersMap.icon = 'sj-icon-map-queren'
  361. }
  362. markersMap.parameter = that.eventList[i].eventCode
  363. markersMap.lng = that.eventList[i].longitude
  364. markersMap.lat = that.eventList[i].latitude
  365. markersMap.bindPopupHtml = '<div class="map-tip">' +
  366. '<span>' +
  367. ' <div class="d-l-con">' +
  368. ' <div class="d-l-l-text">' +
  369. ' <h4>经纬度:' + that.eventList[i].longitude + ',' + that.eventList[i].latitude + '</h4>' +
  370. ' </div>' +
  371. ' </div>' +
  372. ' </span>' +
  373. '<span>' +
  374. ' <div class="d-l-con">' +
  375. ' <div class="d-l-l-text">' +
  376. ' <h4>事件名称:' + that.eventList[i].eventName + '</h4>' +
  377. ' </div>' +
  378. ' </div>' +
  379. ' </span>' +
  380. '<span>' +
  381. ' <div class="d-l-con">' +
  382. ' <div class="d-l-l-text">' +
  383. ' <h4>事件时间:' + that.eventList[i].createTime + '</h4>' +
  384. ' </div>' +
  385. ' </div>' +
  386. ' </span>'
  387. if(that.eventList[i].pictureType=='image'&&that.eventList[i].picturePath != null && that.eventList[i].picturePath != ''){
  388. markersMap.bindPopupHtml += '<span>' +
  389. ' <div class="d-l-con">' +
  390. ' <div class="d-l-l-text">' +
  391. '<img src="' + that.eventList[i].picturePath + '" style="width: 150px;height: 100px"/>' +
  392. ' </div>' +
  393. ' </div>' +
  394. ' </span>'
  395. }
  396. markersMap.bindPopupHtml += '</div>'
  397. that.markersList.push(markersMap)
  398. }
  399. setTimeout(() => {
  400. that.$refs.eventLocationSupermap.clearM(false)
  401. that.$refs.eventLocationSupermap.clearM(true)
  402. that.$refs.eventLocationSupermap.setMarkers(that.markersList)
  403. that.$refs.eventLocationSupermap.setMarkers(marker)
  404. }, 1000)
  405. } else {
  406. setTimeout(() => {
  407. that.$refs.eventLocationSupermap.clearM(false)
  408. that.$refs.eventLocationSupermap.clearM(true)
  409. that.$refs.eventLocationSupermap.setMarkers(marker)
  410. }, 1000)
  411. }
  412. })
  413. },
  414. handleClick(tab, event) {
  415. let that = this
  416. that.$refs.eventLocationSupermap.controlLevel(8)
  417. let marker = [{
  418. lng: that.longitude,
  419. lat: that.latitude,
  420. icon: 'marker',
  421. bindPopupHtml: '定位',
  422. click: '',
  423. parameter: '',
  424. keepBindPopup: false,
  425. isAggregation: false
  426. }]
  427. if (tab.name == 'monitor') {
  428. if (that.longitude == null || that.longitude == '' || that.latitude == null || that.latitude == '') {
  429. that.$modal.msgError('请输入经纬度!')
  430. return
  431. } else if (this.longitude >180 || this.longitude < -180 || this.latitude > 90 || this.latitude < -90) {
  432. this.$modal.msgError('请输入正确经纬度!')
  433. return
  434. }
  435. that.cameraMarkersList = []
  436. that.cameraList = []
  437. getNearCamera(that.longitude, that.latitude).then(res => {
  438. //根据设备类型查看列表
  439. that.cameraList = res.data
  440. if (res.data != null && res.data.length > 0) {
  441. for (let i = 0; i < res.data.length; i++) {
  442. let markersMap = {
  443. lng: 124.59,
  444. lat: 43.02,
  445. icon: 'camera',
  446. bindPopupHtml: '',
  447. click: 'preview',
  448. keepBindPopup: false,
  449. isAggregation: false
  450. }
  451. if (res.data[i].cameraCode != null) {
  452. markersMap.parameter = {
  453. code: res.data[i].cameraCode,
  454. type: res.data[i].cameraFactory
  455. }
  456. } else {
  457. markersMap.parameter = []
  458. }
  459. if (res.data.length > 50) {
  460. markersMap.isAggregation = true
  461. }
  462. markersMap.lng = res.data[i].longitude
  463. markersMap.lat = res.data[i].latitude
  464. markersMap.radius = res.data[i].cameraRadius
  465. markersMap.bindPopupHtml = '<div class="map-tip">' +
  466. '<span>' +
  467. ' <div class="d-l-con">' +
  468. ' <div class="d-l-l-text">' +
  469. ' <h4>经纬度:' + res.data[i].longitude +
  470. ',' + res.data[i].latitude + '</h4>' +
  471. ' </div>' +
  472. ' </div>' +
  473. ' </span>' +
  474. '<span>' +
  475. ' <div class="d-l-con">' +
  476. ' <div class="d-l-l-text">' +
  477. ' <h4>摄像头名称:' + res.data[i]
  478. .cameraName + '</h4>' +
  479. ' </div>' +
  480. ' </div>' +
  481. ' </span>' +
  482. '<span>' +
  483. ' <div class="d-l-con">' +
  484. ' <div class="d-l-l-text">' +
  485. ' <h4>网络运营商:' + (res.data[i].operatorType == "1" ? "联通" : (res.data[i].operatorType == "2" ? "移动":"电信")) + '</h4>' +
  486. ' </div>' +
  487. ' </div>' +
  488. ' </span>' +
  489. '<span>' +
  490. ' <div class="d-l-con">' +
  491. ' <div class="d-l-l-text">' +
  492. ' <h4>摄像头半径:' + res.data[i]
  493. .cameraRadius + '米</h4>' +
  494. ' </div>' +
  495. ' </div>' +
  496. ' </span>' +
  497. '</div>'
  498. that.cameraMarkersList.push(markersMap)
  499. }
  500. setTimeout(() => {
  501. that.$refs.eventLocationSupermap.clearM(true)
  502. that.$refs.eventLocationSupermap.clearM(false)
  503. that.$refs.eventLocationSupermap.setMarkersRadius(that.cameraMarkersList)
  504. that.$refs.eventLocationSupermap.setMarkers(marker)
  505. }, 1000)
  506. } else {
  507. setTimeout(() => {
  508. that.$refs.eventLocationSupermap.clearM(true)
  509. that.$refs.eventLocationSupermap.clearM(false)
  510. that.$refs.eventLocationSupermap.setMarkers(marker)
  511. }, 1000)
  512. }
  513. })
  514. } else {
  515. that.getNearEvent()
  516. }
  517. },
  518. dropLocation(lat, lng) {
  519. this.$refs.eventLocationSupermap.dropLocation(lat, lng)
  520. },
  521. showEventLocation() {
  522. this.eventLocationVisible = true
  523. },
  524. /** ----------------------------------摄像头预览开始------------------------------------- */
  525. alertLogin: function() {
  526. this.$modal.msg('登录中....')
  527. },
  528. alertLoginSuccess: function() {
  529. this.$modal.msgSuccess('登录成功!')
  530. },
  531. alertLoginFailed: function() {
  532. this.$modal.msgError('登陆失败!')
  533. },
  534. alertReinstall: function() {
  535. this.$modal.msgWarning('请重新安装客户端')
  536. },
  537. cancelEventLocationShow() {
  538. if (this.oWebControl != null) {
  539. this.oWebControl.JS_HideWnd() // 先让窗口隐藏,规避可能的插件窗口滞后于浏览器消失问题
  540. this.oWebControl.JS_Disconnect().then(function() { // 断开与插件服务连接成功
  541. },
  542. function() { // 断开与插件服务连接失败
  543. })
  544. }
  545. },
  546. /** 预览按钮操作 */
  547. preview(cameraParam) {
  548. if (cameraParam.type == '1') {
  549. getDahuaVideoServer().then(newResponse => {
  550. console.log(newResponse)
  551. this.ws.detectConnectQt().then(res => {
  552. if (res) { // 连接客户端成功
  553. this.alertLogin()
  554. this.ws.login({
  555. loginIp: newResponse.loginIp,
  556. loginPort: newResponse.loginPort,
  557. userName: newResponse.userName,
  558. userPwd: newResponse.userPwd,
  559. token: '',
  560. https: 0
  561. })
  562. this.ws.on('loginState', (res) => {
  563. this.isLogin = res
  564. console.log('---res-----', res)
  565. if (res) {
  566. this.alertLoginSuccess()
  567. this.activePanel = 'key2'
  568. this.realTimeVideoDialog(cameraParam.code)
  569. } else {
  570. this.alertLoginFailed()
  571. }
  572. })
  573. } else { // 连接客户端失败
  574. this.alertReinstall()
  575. }
  576. })
  577. })
  578. } else if (cameraParam.type == '0') {
  579. let that = this
  580. that.cameraVisible = true
  581. getHaiKangVideoServer({ cameraCode: cameraParam.code }).then(newResponse => {
  582. that.cameraTitle = '摄像头-' + newResponse.data.cameraName
  583. that.initPlugin(newResponse.data.appkey, newResponse.data.loginIp, newResponse.data.secret, newResponse.data.loginPort)
  584. setTimeout(function() {
  585. that.playhk(newResponse.data.channelCode)
  586. }, 5000)
  587. })
  588. }
  589. },
  590. realTimeVideoDialog(cameraParams) { // 调用弹窗实时播放接口
  591. if (!this.isLogin) {
  592. this.$Message.info('正在登陆客户端,请稍等......')
  593. return false
  594. }
  595. const params = [cameraParams]
  596. this.ws.openVideo(params)
  597. },
  598. /** ----------------------------------摄像头预览结束------------------------------------- */
  599. /** ----------------------------------海康摄像头预览开始------------------------------------- */
  600. // 创建播放实例
  601. initPlugin(newappkey, newloginIp, newsecret, newloginPort) {
  602. let that = this
  603. that.oWebControl = new WebControl({
  604. szPluginContainer: 'playWnd', // 指定容器id
  605. iServicePortStart: 15900, // 指定起止端口号,建议使用该值
  606. iServicePortEnd: 15909,
  607. szClassId: '23BF3B0A-2C56-4D97-9C03-0CB103AA8F11', // 用于IE10使用ActiveX的clsid
  608. cbConnectSuccess: function() { // 创建WebControl实例成功
  609. that.oWebControl.JS_StartService('window', { // WebControl实例创建成功后需要启动服务
  610. dllPath: './VideoPluginConnect.dll' // 值"./VideoPluginConnect.dll"写死
  611. }).then(function() { // 启动插件服务成功
  612. that.oWebControl.JS_SetWindowControlCallback({ // 设置消息回调
  613. cbIntegrationCallBack: cbIntegrationCallBack
  614. })
  615. that.oWebControl.JS_CreateWnd('playWnd', 1020, 600).then(function() { //JS_CreateWnd创建视频播放窗口,宽高可设定
  616. that.init(newappkey, newloginIp, newsecret, newloginPort) // 创建播放实例成功后初始化
  617. })
  618. }, function() { // 启动插件服务失败
  619. })
  620. },
  621. cbConnectError: function() { // 创建WebControl实例失败
  622. that.oWebControl = null
  623. $('#playWnd').html('插件未启动,正在尝试启动,请稍候...<a href="./hk/VideoWebPlugin.exe">点击下载插件</a>')
  624. WebControl.JS_WakeUp('VideoWebPlugin://') // 程序未启动时执行error函数,采用wakeup来启动程序
  625. initCount++
  626. if (initCount < 3) {
  627. setTimeout(function() {
  628. that.initPlugin(newappkey, newloginIp, newsecret, newloginPort)
  629. }, 3000)
  630. } else {
  631. $('#playWnd').html('插件启动失败,请检查插件是否安装!<a href="./hk/VideoWebPlugin.exe">点击下载插件</a>')
  632. }
  633. },
  634. cbConnectClose: function(bNormalClose) {
  635. // 异常断开:bNormalClose = false
  636. // JS_Disconnect正常断开:bNormalClose = true
  637. console.log('cbConnectClose')
  638. that.oWebControl = null
  639. }
  640. })
  641. },
  642. //播放海康摄像头
  643. playhk(channelCode) {
  644. var cameraIndexCode = channelCode //获取输入的监控点编号值,必填
  645. var streamMode = 0 //主子码流标识:0-主码流,1-子码流
  646. var transMode = 1 //传输协议:0-UDP,1-TCP
  647. var gpuMode = 0 //是否启用GPU硬解,0-不启用,1-启用
  648. var wndId = -1 //播放窗口序号(在2x2以上布局下可指定播放窗口)
  649. cameraIndexCode = cameraIndexCode.replace(/(^\s*)/g, '')
  650. cameraIndexCode = cameraIndexCode.replace(/(\s*$)/g, '')
  651. this.oWebControl.JS_RequestInterface({
  652. funcName: 'startPreview',
  653. argument: JSON.stringify({
  654. cameraIndexCode: cameraIndexCode, //监控点编号
  655. streamMode: streamMode, //主子码流标识
  656. transMode: transMode, //传输协议
  657. gpuMode: gpuMode, //是否开启GPU硬解
  658. wndId: wndId //可指定播放窗口
  659. })
  660. })
  661. },
  662. //初始化
  663. init(newappkey, newloginIp, newsecret, newloginPort) {
  664. let that = this
  665. that.getPubKey(function() {
  666. ////////////////////////////////// 请自行修改以下变量值 ////////////////////////////////////
  667. var appkey = newappkey //综合安防管理平台提供的appkey,必填
  668. var secret = that.setEncrypt(newsecret) //综合安防管理平台提供的secret,必填
  669. var ip = newloginIp //综合安防管理平台IP地址,必填
  670. var playMode = 0 //初始播放模式:0-预览,1-回放
  671. var port = Number(newloginPort) //综合安防管理平台端口,若启用HTTPS协议,默认443
  672. var snapDir = 'D:\\SnapDir' //抓图存储路径
  673. var videoDir = 'D:\\VideoDir' //紧急录像或录像剪辑存储路径
  674. var layout = '1x1' //playMode指定模式的布局
  675. var enableHTTPS = 1 //是否启用HTTPS协议与综合安防管理平台交互,这里总是填1
  676. var encryptedFields = 'secret' //加密字段,默认加密领域为secret
  677. var showToolbar = 1 //是否显示工具栏,0-不显示,非0-显示
  678. var showSmart = 1 //是否显示智能信息(如配置移动侦测后画面上的线框),0-不显示,非0-显示
  679. var buttonIDs = '0,16,256,257,258,259,260,512,513,514,515,516,517,768,769' //自定义工具条按钮
  680. ////////////////////////////////// 请自行修改以上变量值 ////////////////////////////////////
  681. that.oWebControl.JS_RequestInterface({
  682. funcName: 'init',
  683. argument: JSON.stringify({
  684. appkey: appkey, //API网关提供的appkey
  685. secret: secret, //API网关提供的secret
  686. ip: ip, //API网关IP地址
  687. playMode: playMode, //播放模式(决定显示预览还是回放界面)
  688. port: port, //端口
  689. snapDir: snapDir, //抓图存储路径
  690. videoDir: videoDir, //紧急录像或录像剪辑存储路径
  691. layout: layout, //布局
  692. enableHTTPS: enableHTTPS, //是否启用HTTPS协议
  693. encryptedFields: encryptedFields, //加密字段
  694. showToolbar: showToolbar, //是否显示工具栏
  695. showSmart: showSmart, //是否显示智能信息
  696. buttonIDs: buttonIDs //自定义工具条按钮
  697. })
  698. }).then(function(oData) {
  699. that.oWebControl.JS_Resize(1020, 600) // 初始化后resize一次,规避firefox下首次显示窗口后插件窗口未与DIV窗口重合问题
  700. })
  701. })
  702. },
  703. //获取公钥
  704. getPubKey(callback) {
  705. let that = this
  706. that.oWebControl.JS_RequestInterface({
  707. funcName: 'getRSAPubKey',
  708. argument: JSON.stringify({
  709. keyLength: 1024
  710. })
  711. }).then(function(oData) {
  712. console.log(oData)
  713. if (oData.responseMsg.data) {
  714. that.pubKey = oData.responseMsg.data
  715. callback()
  716. }
  717. })
  718. },
  719. //RSA加密
  720. setEncrypt(value) {
  721. var encrypt = new JSEncrypt()
  722. encrypt.setPublicKey(this.pubKey)
  723. return encrypt.encrypt(value)
  724. },
  725. /** ----------------------------------海康摄像头预览结束------------------------------------- */
  726. /** ----------------------------------事件弹窗开始------------------------------------- */
  727. editableLayers(processedState) {
  728. if (processedState == 'notProcessedSupermap') {
  729. let aa = this.$refs.notProcessedSupermap.isEditableLayers
  730. if (!this.$refs.notProcessedSupermap.isEditableLayers) {
  731. this.$refs.notProcessedSupermap.isEditableLayers = true
  732. } else {
  733. this.$refs.notProcessedSupermap.isEditableLayers = false
  734. }
  735. } else {
  736. let bb = this.$refs.processedSupermap.isEditableLayers
  737. if (!this.$refs.processedSupermap.isEditableLayers) {
  738. this.$refs.processedSupermap.isEditableLayers = true
  739. } else {
  740. this.$refs.processedSupermap.isEditableLayers = false
  741. }
  742. }
  743. },
  744. switchImage(url) {
  745. this.url = url
  746. },
  747. formLeaveTable() {
  748. let p = new Promise((resolve, reject) =>
  749. reject()
  750. )
  751. return p
  752. },
  753. async beforeLeave(newactiveName, oldActiveName) {
  754. let that = this
  755. if (newactiveName == 'frame') {
  756. return await that.formLeaveTable()
  757. }
  758. },
  759. setXsYc() {
  760. let that = this
  761. if (this.eventStatus == 'qr') {
  762. this.eventTypeShow = true
  763. } else {
  764. this.eventTypeShow = false
  765. }
  766. },
  767. setValue(event) {
  768. this.deptId = event.value
  769. this.deptName = event.label
  770. },
  771. cancelEventShow() {
  772. this.eventInfoVisibleActiveName = 'info'
  773. this.listEventPic = [] //事件图片
  774. this.listEventDept = [] //涉事单位List,
  775. this.listLog = [] //处理过程List,
  776. this.listoperateDept = []
  777. },
  778. /** 重置按钮操作 */
  779. resetQuery() {
  780. this.eventTypeShow = false
  781. this.eventType = ''
  782. this.deptName = ''
  783. this.eventStatus = ''
  784. },
  785. /** ----------------------------------事件弹窗结束------------------------------------- */
  786. /** ----------------------------------海康摄像头预览开始------------------------------------- */
  787. // 创建播放实例
  788. initPlugin(newappkey, newloginIp, newsecret, newloginPort) {
  789. let that = this
  790. that.oWebControl = new WebControl({
  791. szPluginContainer: 'playWnd', // 指定容器id
  792. iServicePortStart: 15900, // 指定起止端口号,建议使用该值
  793. iServicePortEnd: 15909,
  794. szClassId: '23BF3B0A-2C56-4D97-9C03-0CB103AA8F11', // 用于IE10使用ActiveX的clsid
  795. cbConnectSuccess: function() { // 创建WebControl实例成功
  796. that.oWebControl.JS_StartService('window', { // WebControl实例创建成功后需要启动服务
  797. dllPath: './VideoPluginConnect.dll' // 值"./VideoPluginConnect.dll"写死
  798. }).then(function() { // 启动插件服务成功
  799. that.oWebControl.JS_SetWindowControlCallback({ // 设置消息回调
  800. cbIntegrationCallBack: cbIntegrationCallBack
  801. })
  802. that.oWebControl.JS_CreateWnd('playWnd', 1020, 600).then(function() { //JS_CreateWnd创建视频播放窗口,宽高可设定
  803. that.init(newappkey, newloginIp, newsecret, newloginPort) // 创建播放实例成功后初始化
  804. })
  805. }, function() { // 启动插件服务失败
  806. })
  807. },
  808. cbConnectError: function() { // 创建WebControl实例失败
  809. that.oWebControl = null
  810. $('#playWnd').html('插件未启动,正在尝试启动,请稍候...<a href="./hk/VideoWebPlugin.exe">点击下载插件</a>')
  811. WebControl.JS_WakeUp('VideoWebPlugin://') // 程序未启动时执行error函数,采用wakeup来启动程序
  812. that.initCount++
  813. if (that.initCount < 3) {
  814. setTimeout(function() {
  815. that.initPlugin(newappkey, newloginIp, newsecret, newloginPort)
  816. }, 3000)
  817. } else {
  818. $('#playWnd').html('插件启动失败,请检查插件是否安装!<a href="./hk/VideoWebPlugin.exe">点击下载插件</a>')
  819. }
  820. },
  821. cbConnectClose: function(bNormalClose) {
  822. // 异常断开:bNormalClose = false
  823. // JS_Disconnect正常断开:bNormalClose = true
  824. that.oWebControl = null
  825. }
  826. })
  827. },
  828. //播放海康摄像头
  829. playhk(channelCode) {
  830. var cameraIndexCode = channelCode //获取输入的监控点编号值,必填
  831. var streamMode = 0 //主子码流标识:0-主码流,1-子码流
  832. var transMode = 1 //传输协议:0-UDP,1-TCP
  833. var gpuMode = 0 //是否启用GPU硬解,0-不启用,1-启用
  834. var wndId = -1 //播放窗口序号(在2x2以上布局下可指定播放窗口)
  835. cameraIndexCode = cameraIndexCode.replace(/(^\s*)/g, '')
  836. cameraIndexCode = cameraIndexCode.replace(/(\s*$)/g, '')
  837. this.oWebControl.JS_RequestInterface({
  838. funcName: 'startPreview',
  839. argument: JSON.stringify({
  840. cameraIndexCode: cameraIndexCode, //监控点编号
  841. streamMode: streamMode, //主子码流标识
  842. transMode: transMode, //传输协议
  843. gpuMode: gpuMode, //是否开启GPU硬解
  844. wndId: wndId //可指定播放窗口
  845. })
  846. })
  847. },
  848. //初始化
  849. init(newappkey, newloginIp, newsecret, newloginPort) {
  850. let that = this
  851. that.getPubKey(function() {
  852. ////////////////////////////////// 请自行修改以下变量值 ////////////////////////////////////
  853. var appkey = newappkey //综合安防管理平台提供的appkey,必填
  854. var secret = that.setEncrypt(newsecret) //综合安防管理平台提供的secret,必填
  855. var ip = newloginIp //综合安防管理平台IP地址,必填
  856. var playMode = 0 //初始播放模式:0-预览,1-回放
  857. var port = Number(newloginPort) //综合安防管理平台端口,若启用HTTPS协议,默认443
  858. var snapDir = 'D:\\SnapDir' //抓图存储路径
  859. var videoDir = 'D:\\VideoDir' //紧急录像或录像剪辑存储路径
  860. var layout = '1x1' //playMode指定模式的布局
  861. var enableHTTPS = 1 //是否启用HTTPS协议与综合安防管理平台交互,这里总是填1
  862. var encryptedFields = 'secret' //加密字段,默认加密领域为secret
  863. var showToolbar = 1 //是否显示工具栏,0-不显示,非0-显示
  864. var showSmart = 1 //是否显示智能信息(如配置移动侦测后画面上的线框),0-不显示,非0-显示
  865. var buttonIDs = '0,16,256,257,258,259,260,512,513,514,515,516,517,768,769' //自定义工具条按钮
  866. ////////////////////////////////// 请自行修改以上变量值 ////////////////////////////////////
  867. that.oWebControl.JS_RequestInterface({
  868. funcName: 'init',
  869. argument: JSON.stringify({
  870. appkey: appkey, //API网关提供的appkey
  871. secret: secret, //API网关提供的secret
  872. ip: ip, //API网关IP地址
  873. playMode: playMode, //播放模式(决定显示预览还是回放界面)
  874. port: port, //端口
  875. snapDir: snapDir, //抓图存储路径
  876. videoDir: videoDir, //紧急录像或录像剪辑存储路径
  877. layout: layout, //布局
  878. enableHTTPS: enableHTTPS, //是否启用HTTPS协议
  879. encryptedFields: encryptedFields, //加密字段
  880. showToolbar: showToolbar, //是否显示工具栏
  881. showSmart: showSmart, //是否显示智能信息
  882. buttonIDs: buttonIDs //自定义工具条按钮
  883. })
  884. }).then(function(oData) {
  885. that.oWebControl.JS_Resize(1020, 600) // 初始化后resize一次,规避firefox下首次显示窗口后插件窗口未与DIV窗口重合问题
  886. })
  887. })
  888. },
  889. //获取公钥
  890. getPubKey(callback) {
  891. let that = this
  892. that.oWebControl.JS_RequestInterface({
  893. funcName: 'getRSAPubKey',
  894. argument: JSON.stringify({
  895. keyLength: 1024
  896. })
  897. }).then(function(oData) {
  898. console.log(oData)
  899. if (oData.responseMsg.data) {
  900. that.pubKey = oData.responseMsg.data
  901. callback()
  902. }
  903. })
  904. },
  905. //RSA加密
  906. setEncrypt(value) {
  907. var encrypt = new JSEncrypt()
  908. encrypt.setPublicKey(this.pubKey)
  909. return encrypt.encrypt(value)
  910. }
  911. /** ----------------------------------海康摄像头预览结束------------------------------------- */
  912. }
  913. }
  914. // 推送消息
  915. function cbIntegrationCallBack(oData) {
  916. console.log(JSON.stringify(oData.responseMsg))
  917. }
  918. </script>
  919. <style rel="stylesheet/scss" lang="scss" scoped>
  920. @import '@/assets/styles/base.scss';
  921. .event-info-con {
  922. width: 100%;
  923. display: flex;
  924. .e-left {
  925. width: 32%;
  926. }
  927. .e-center {
  928. width: 30%;
  929. margin-left: 1%;
  930. .img-company {
  931. width: 100%;
  932. height: 18.3vh;
  933. img {
  934. }
  935. }
  936. }
  937. .e-right {
  938. margin-left: 1%;
  939. width: 45%;
  940. }
  941. .e-location-left {
  942. width: 28%;
  943. }
  944. .e-location-right {
  945. width: 71%;
  946. margin-left: 1rem;
  947. }
  948. }
  949. .el-dialog:not(.is-fullscreen) {
  950. margin-top: 5.5vh !important;
  951. }
  952. .bottom-menu-normal {
  953. max-width: 90%;
  954. padding: 0 3rem;
  955. position: absolute;
  956. left: 50%;
  957. transform: translateX(-50%);
  958. bottom: 0;
  959. z-index: 100000;
  960. border-radius: 5px;
  961. display: flex;
  962. justify-content: center;
  963. align-items: center;
  964. background: url(../assets/images/integrated/btm-menu.png) center no-repeat;
  965. background-size: cover;
  966. overflow: hidden;
  967. .btm-m-con {
  968. position: relative;
  969. color: $inBlue;
  970. font-size: .5rem;
  971. padding: 1rem 1.5rem;
  972. display: flex;
  973. align-items: center;
  974. justify-content: center;
  975. -webkit-transform: translateY(0);
  976. transform: translateY(0);
  977. transition: all 0.2s ease-in-out;
  978. cursor: pointer;
  979. white-space: nowrap;
  980. i {
  981. font-size: 1rem;
  982. color: $inBlue;
  983. text-shadow: 0 0 10px rgba($color: $inBlue, $alpha: .6);
  984. margin-right: 0.2rem;
  985. }
  986. }
  987. .btm-m-con:hover {
  988. text-shadow: 0 0 20px rgba($color: $inBlueHover, $alpha: 1.0);
  989. filter: brightness(2.3);
  990. -webkit-transform: translateX(0.2rem);
  991. transform: translateX(0.2rem);
  992. transition: all 0.2s ease-in-out;
  993. i {
  994. color: $inBlueHover;
  995. text-shadow: 0 0 20px rgba($color: $inBlueHover, $alpha: 1.0);
  996. }
  997. }
  998. .m-l-none {
  999. .el-input__inner {
  1000. margin-left: 0 !important;
  1001. }
  1002. }
  1003. }
  1004. </style>