eventLocation.vue 31 KB

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