TVWall.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899
  1. <template>
  2. <div>
  3. <el-dialog :title="title" :visible.sync="TVWallVisible" v-if="TVWallVisible" customClass="TVWallCustomWidth"
  4. @close="cancelEventLocationShow()">
  5. <!--<div class="forthis" style="width: 22%; position: absolute;left: 0;z-index: 9999999999999;">-->
  6. <!--&lt;!&ndash; <div class="this-title">-->
  7. <!--<span>林场</span>-->
  8. <!--<span>45</span>-->
  9. <!--</div> &ndash;&gt;-->
  10. <!--<div class="i-list-con" style="height: 46vh; overflow-y: scroll;">-->
  11. <!--<span v-for="(item,index) in cameraList" :key="index">-->
  12. <!--<div class="d-l-con" @click="playhk(item.channelCode)">-->
  13. <!--<div class="d-l-l-text">-->
  14. <!--<i class="i-small"></i>-->
  15. <!--<h4>{{ item.cameraName }}</h4>-->
  16. <!--</div>-->
  17. <!--</div>-->
  18. <!--</span>-->
  19. <!--</div>-->
  20. <!--</div>-->
  21. <!--<div style="width:70%;height:400px;position:absolute;">-->
  22. <!--&lt;!&ndash;视频窗口展示-&#45;&#45;大华&ndash;&gt;-->
  23. <!--<div id="dom1" class="dom1"></div>-->
  24. <!--&lt;!&ndash;视频窗口展示-&#45;&#45;海康&ndash;&gt;-->
  25. <!--<div id="playWnd" class="playWnd" style="left: 0px; top: 0px;"></div>-->
  26. <!--</div>-->
  27. <div id="dom1" class="dom1"></div>
  28. </el-dialog>
  29. </div>
  30. </template>
  31. <script>
  32. /** ----------------------------------摄像头预览开始------------------------------------- */
  33. import { getDahuaVideoServer, getTVWallList } from '@/api/dahua/dahua'
  34. import { tvCameraList } from '@/api/haikang/haikang'
  35. import DHWs from '@/dahua/lib/DHWs'
  36. import { rotation } from '@/api/monitor'
  37. import Cookies from "js-cookie"
  38. import {selectConfigKey} from "@/api/system/config";
  39. /** ----------------------------------摄像头预览结束------------------------------------- */
  40. export default {
  41. dicts: ['event_source'],
  42. components: {},
  43. data() {
  44. return {
  45. title:['365','369','371','373','372','370'].includes(Cookies.get("deptId"))?"电视墙":"电视墙\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000您的所有操作痕迹已被后台记录,请谨慎操作。部分摄像头处于敏感区域,已屏蔽操控权限,无法操控。",
  46. tvListJson: [
  47. {
  48. 'switchTab': '1',
  49. 'treeLabels': [
  50. {
  51. 'labelCode': '123456',
  52. 'labelName': '视频场景',
  53. 'parentLabelCode': null
  54. },
  55. {
  56. 'labelCode': '5a81d1bd499b4940a21fc63ca51f4dfa',
  57. 'labelName': '标签2',
  58. 'parentLabelCode': 123456
  59. },
  60. {
  61. 'labelCode': 'd941adbbd3e64dac92cc448dec5293cd',
  62. 'labelName': '标签1',
  63. 'parentLabelCode': 123456
  64. }
  65. ],
  66. 'labelChannels': [{
  67. 'channelDates': [{
  68. 'channelCode': '6044981090191552',
  69. 'channelName': '复兴大桥中段-交通事故',
  70. 'channelSn': null,
  71. 'cameraType': 0,
  72. 'online': 1
  73. },
  74. {
  75. 'channelCode': 'ZgVzqsjwA1DTF561VGHK5E',
  76. 'channelName': '北京7青羊东二路77号2通道1',
  77. 'channelSn': null,
  78. 'cameraType': 1,
  79. 'online': 1
  80. }
  81. ],
  82. 'labelCode': 'd941adbbd3e64dac92cc448dec5293cd'
  83. },
  84. {
  85. 'channelDates': [{
  86. 'channelCode': 'ZgVzqsjwA1DTF561VGHKK7',
  87. 'channelName': '北京7青羊东二路77号2通道2',
  88. 'channelSn': null,
  89. 'cameraType': 2,
  90. 'online': 0
  91. }],
  92. 'labelCode': '5a81d1bd499b4940a21fc63ca51f4dfa'
  93. }
  94. ]
  95. },
  96. {
  97. 'switchTab': '2',
  98. 'labelChannels': [{
  99. 'channelDates': [{
  100. 'channelCode': 'ZgVzqsjwA1DTF561VGHK5E',
  101. 'channelName': '北京7青羊东二路77号2通道1',
  102. 'channelSn': null,
  103. 'cameraType': 1,
  104. 'online': 1
  105. },
  106. {
  107. 'channelCode': 'ZgVzqsjwA1DTF561VGHKK7',
  108. 'channelName': '北京7青羊东二路77号2通道2',
  109. 'channelSn': null,
  110. 'cameraType': 2,
  111. 'online': 0
  112. }
  113. ]
  114. }]
  115. }
  116. ],
  117. TVWallVisible: false,
  118. activeName: 'tv',
  119. channelId: ['ZgVzqsjwA1DTF561VHG69F'],
  120. /** ----------------------------------摄像头预览开始------------------------------------- */
  121. showModal: true,
  122. activePanel: 'key1',
  123. isLogin: false,
  124. loginType: '1',
  125. token: '',
  126. ctrlType: 'playerWin',
  127. https: 1,
  128. httpsList: [
  129. {
  130. value: 0,
  131. label: 0
  132. },
  133. {
  134. value: 1,
  135. label: 1
  136. }
  137. ],
  138. ctrlTypeList: [{
  139. value: 'playerWin',
  140. label: '播放控件'
  141. }, {
  142. value: 'realMonitorUI',
  143. label: '带设备树实时预览控件'
  144. }, {
  145. value: 'playbackUI',
  146. label: '带设备树视频回放控件'
  147. }, {
  148. value: 'TVWallUI',
  149. label: '视频上墙'
  150. }],
  151. ctrlList: [
  152. {
  153. value: 'ctrl1',
  154. label: '控件1'
  155. },
  156. {
  157. value: 'ctrl2',
  158. label: '控件2'
  159. },
  160. {
  161. value: 'ctrl3',
  162. label: '控件3'
  163. }
  164. ],
  165. splitList: [
  166. {
  167. value: 1,
  168. label: '1 * 1'
  169. },
  170. {
  171. value: 4,
  172. label: '2 * 2'
  173. },
  174. {
  175. value: 9,
  176. label: '3 * 3'
  177. }
  178. ],
  179. displayModeList: [
  180. {
  181. value: 1,
  182. label: '播放器预览模式'
  183. },
  184. {
  185. value: 2,
  186. label: '播放器回放模式'
  187. }
  188. ],
  189. mixedVideoDisplayModeList: [
  190. {
  191. value: 1,
  192. label: '播放实时视频'
  193. },
  194. {
  195. value: 2,
  196. label: '播放回放视频'
  197. }
  198. ],
  199. ctrl: 'ctrl1',
  200. splitNum: 1,
  201. displayMode: 1,
  202. displayTimeRange: [],
  203. modalDisplayTimeRange: [],
  204. mixedVideoTime: null,
  205. recordPath: 'C:\\DSS LightWeight\\DSS LightWeight Client\\Record\\',
  206. downloadName: '',
  207. downTimeRange: [],
  208. downloadFormat: 0,
  209. downloadFormatList: [{
  210. value: 0,
  211. label: 'dav'
  212. },
  213. {
  214. value: 1,
  215. label: 'avi'
  216. }, {
  217. value: 2,
  218. label: 'mp4'
  219. }],
  220. downloadSource: 3,
  221. downloadSourceList: [
  222. {
  223. value: 3,
  224. label: '中心录像'
  225. }, {
  226. value: 2,
  227. label: '设备录像'
  228. }],
  229. showDownloadStreamType: false,
  230. downloadStreamType: 1,
  231. downloadStreamTypeList: [{
  232. value: 1,
  233. label: '主码流'
  234. },
  235. {
  236. value: 2,
  237. label: '辅码流'
  238. },
  239. {
  240. value: 3,
  241. label: '三码流'
  242. }],
  243. downloadIsShow: true,
  244. downloadIsShowList: [{
  245. value: true,
  246. label: '是'
  247. },
  248. {
  249. value: false,
  250. label: '否'
  251. }],
  252. crtPosX: 0,
  253. crtPosY: 0,
  254. crtWidth: 1150,
  255. crtHeight: 700,
  256. domId: 'dom1',
  257. mixedVideoDisplayMode: 2,
  258. isShowTipe: true,
  259. /** ----------------------------------摄像头预览结束------------------------------------- */
  260. cameraList:[],
  261. initCount: 0,
  262. pubKey: '',
  263. oWebControl: null
  264. }
  265. },
  266. created() {
  267. const DHWsInstance = DHWs.getInstance()
  268. this.ws = DHWsInstance
  269. },
  270. methods: {
  271. cancelEventLocationShow() {
  272. // this.activeName = 'tv'
  273. this.TVWallVisible = false
  274. this.destroy()
  275. if (this.oWebControl != null) {
  276. this.oWebControl.JS_HideWnd() // 先让窗口隐藏,规避可能的插件窗口滞后于浏览器消失问题
  277. this.oWebControl.JS_Disconnect().then(function() { // 断开与插件服务连接成功
  278. },
  279. function() { // 断开与插件服务连接失败
  280. })
  281. }
  282. },
  283. //火点联动电视墙调用
  284. showTVWall1(longitude,latitude,tvListJson) {
  285. selectConfigKey("DssVersion").then(res => {
  286. if(this.ws.getLocalDssVersion()!=res.data){
  287. this.$modal.confirm('系统检测到新客户端版本,请更新后使用', '系统提示', {
  288. confirmButtonText: '确定',
  289. cancelButtonText: '取消',
  290. type: 'warning'
  291. }
  292. ).then(() => {
  293. selectConfigKey('video_plugin_url').then(response => {
  294. window.open(response.data);
  295. })
  296. }).catch(() => {
  297. return
  298. });
  299. return
  300. }else{
  301. // let that=this;
  302. /** ----------------------------------大华摄像头预览开始------------------------------------- */
  303. this.ws.addEventListener('connectStateChange', data => {
  304. if (data) {
  305. console.log('连接成功')
  306. } else {
  307. console.log('连接失败,下载客户端')
  308. this.alertReinstall()
  309. }
  310. })
  311. getDahuaVideoServer().then(newResponse => {
  312. this.ws.detectConnectQt().then(res => {
  313. if (res) { // 连接客户端成功
  314. this.alertLogin()
  315. this.ws.login({
  316. loginIp: newResponse.loginIp,
  317. loginPort: newResponse.loginPort,
  318. userName: newResponse.userName,
  319. userPwd: newResponse.userPwd,
  320. // loginIp: '192.168.100.100',
  321. // loginPort: 8314,
  322. // userName: 'system',
  323. // userPwd: 'Admin@123',
  324. token: '',
  325. https: 1
  326. })
  327. this.ws.on('loginState', (res) => {
  328. this.isLogin = res
  329. console.log('---res-----', res)
  330. if (res) {
  331. this.alertLoginSuccess()
  332. this.activePanel = 'key2'
  333. console.log(tvListJson)
  334. const array=[]
  335. const array1=[]
  336. if (tvListJson!=null)
  337. {
  338. tvListJson[0].treeLabels.forEach((item,index)=>
  339. {
  340. if (index!=0)
  341. {
  342. const param =Object.assign({})
  343. param.channelId=item.labelCode
  344. array.push(param)
  345. array1.push(item.labelCode)
  346. }
  347. })
  348. }
  349. this.create1(longitude,latitude,tvListJson,array,array1)
  350. // var obj=JSON.parse(tvListJson)
  351. } else {
  352. this.alertLoginFailed()
  353. }
  354. })
  355. } else { // 连接客户端失败
  356. this.alertReinstall()
  357. }
  358. })
  359. })
  360. /** ----------------------------------大华摄像头预览结束------------------------------------- */
  361. /** ----------------------------------海康摄像头预览开始------------------------------------- */
  362. // tvCameraList().then(response => {
  363. // this.cameraList=response.data
  364. // })
  365. // that.initPlugin()
  366. // setTimeout(function() {
  367. // that.playhk();
  368. // }, 5000)
  369. // /** ----------------------------------海康摄像头预览结束------------------------------------- */
  370. this.TVWallVisible = true
  371. }
  372. })
  373. },
  374. create1(longitude,latitude,tvListJson,array,array1) { // 调用创建控件接口
  375. let _this = this
  376. const params = [
  377. {
  378. 'ctrlType': 'realMonitorUI',
  379. 'ctrlCode': 'ctrl1',
  380. 'ctrlProperty': {
  381. 'displayMode': 1,
  382. 'splitNum': 4,
  383. 'channelList': [
  384. {
  385. 'channelId': ''
  386. }
  387. ]
  388. },
  389. 'visible': true,
  390. 'domId': 'dom1'
  391. }
  392. ]
  393. if(array1 != undefined && array1 != null ){
  394. params[0].ctrlProperty.splitNum = (array1.length == 1 ? 1 : 4)
  395. }
  396. this.setPos()
  397. this.customizeTree(tvListJson);
  398. _this.ws.createCtrl(params);
  399. _this.playRealMonitorVideo(array)
  400. setTimeout(() => {
  401. _this.rotation(longitude,latitude,array1)
  402. }, 5000)
  403. },
  404. playRealMonitorVideo(array) { // 自定义设备树自动播放指定通道编码视频
  405. const config = this.ws.config
  406. const { loginIp, userCode } = config
  407. this.ws.postMessage('playRealMonitorVideo', {
  408. loginIp,
  409. userCode,
  410. params: {
  411. ctrlCode: "ctrl1",
  412. array: array
  413. }
  414. })
  415. },
  416. rotation(lng,lat,list){
  417. console.log(list)
  418. rotation(lng,lat,list).then(res => {
  419. })
  420. },
  421. showTVWall(tvListJson,bfArray) {
  422. selectConfigKey("DssVersion").then(res => {
  423. if(this.ws.getLocalDssVersion()!=res.data){
  424. this.$modal.confirm('系统检测到新客户端版本,请更新后使用', '系统提示', {
  425. confirmButtonText: '确定',
  426. cancelButtonText: '取消',
  427. type: 'warning'
  428. }
  429. ).then(() => {
  430. selectConfigKey('video_plugin_url').then(response => {
  431. window.open(response.data);
  432. })
  433. }).catch(() => {
  434. return
  435. });
  436. return
  437. }else{
  438. if(tvListJson){
  439. this.preview(tvListJson,bfArray);
  440. this.TVWallVisible = true;
  441. return;
  442. }
  443. // let that=this;
  444. /** ----------------------------------大华摄像头预览开始------------------------------------- */
  445. this.ws.addEventListener('connectStateChange', data => {
  446. if (data) {
  447. console.log('连接成功')
  448. } else {
  449. console.log('连接失败,下载客户端')
  450. this.alertReinstall()
  451. }
  452. })
  453. this.preview()
  454. /** ----------------------------------大华摄像头预览结束------------------------------------- */
  455. /** ----------------------------------海康摄像头预览开始------------------------------------- */
  456. // tvCameraList().then(response => {
  457. // this.cameraList=response.data
  458. // })
  459. // that.initPlugin()
  460. // setTimeout(function() {
  461. // that.playhk();
  462. // }, 5000)
  463. // /** ----------------------------------海康摄像头预览结束------------------------------------- */
  464. this.TVWallVisible = true
  465. }
  466. })
  467. },
  468. /** ----------------------------------大华摄像头预览开始------------------------------------- */
  469. alertLogin: function() {
  470. this.$modal.msg('登录中....')
  471. },
  472. alertLoginSuccess: function() {
  473. this.$modal.msgSuccess('登录成功!')
  474. },
  475. alertLoginFailed: function() {
  476. this.$modal.msgError('登陆失败!')
  477. },
  478. alertReinstall: function() {
  479. this.$modal.msgWarning('请重新安装客户端')
  480. },
  481. /** 预览按钮操作 */
  482. preview(tvListJson,bfArray) {
  483. getTVWallList().then(newres => {
  484. getDahuaVideoServer().then(newResponse => {
  485. this.ws.detectConnectQt().then(res => {
  486. if (res) { // 连接客户端成功
  487. this.alertLogin()
  488. this.ws.login({
  489. loginIp: newResponse.loginIp,
  490. loginPort: newResponse.loginPort,
  491. userName: newResponse.userName,
  492. userPwd: newResponse.userPwd,
  493. // loginIp: '192.168.100.100',
  494. // loginPort: 8314,
  495. // userName: 'system',
  496. // userPwd: 'Admin@123',
  497. token: '',
  498. https: 1
  499. })
  500. this.ws.on('loginState', (res) => {
  501. this.isLogin = res
  502. console.log('---res-----', res)
  503. if (res) {
  504. this.alertLoginSuccess()
  505. this.activePanel = 'key2'
  506. this.create(tvListJson?tvListJson:newres.data,bfArray)
  507. } else {
  508. this.alertLoginFailed()
  509. }
  510. })
  511. } else { // 连接客户端失败
  512. this.alertReinstall()
  513. }
  514. })
  515. })
  516. })
  517. },
  518. create(tvListJson,bfArray) { // 调用创建控件接口
  519. // debugger
  520. let _this = this
  521. const params = [
  522. {
  523. 'ctrlType': 'realMonitorUI',
  524. 'ctrlCode': 'ctrl1',
  525. 'ctrlProperty': {
  526. 'displayMode': 1,
  527. 'splitNum': 4,
  528. 'channelList': [
  529. {
  530. 'channelId': ''
  531. }
  532. ]
  533. },
  534. 'visible': true,
  535. 'domId': 'dom1'
  536. }
  537. ]
  538. if (bfArray != undefined && bfArray != null) {
  539. params[0].ctrlProperty.splitNum = (bfArray.length == 1 ? 1 : 4)
  540. }
  541. this.setPos()
  542. this.customizeTree(tvListJson);
  543. let length = tvListJson[0].treeLabels.length > 4 ? 5 : tvListJson[0].treeLabels.length;
  544. bfArray = [];
  545. for (let i = 1; i < length; i++) {
  546. bfArray.push({"channelId": tvListJson[0].treeLabels[i].labelCode})
  547. }
  548. _this.ws.createCtrl(params);
  549. _this.playRealMonitorVideo(bfArray)
  550. },
  551. setPos() {
  552. let target = document.getElementById(this.domId)
  553. console.log(target, 'target')
  554. target.style.right = `${this.crtPosX}px`
  555. target.style.top = `${this.crtPosY}px`
  556. target.style.width = `${this.crtWidth}px`
  557. target.style.height = `${this.crtHeight}px`
  558. if (document.createEvent) {
  559. var event = document.createEvent('HTMLEvents')
  560. event.initEvent('resize', true, true)
  561. window.dispatchEvent(event)
  562. } else if (document.createEventObject) {
  563. window.fireEvent('onresize')
  564. }
  565. },
  566. destroy() { // 调用销毁控件接口
  567. if (!this.isLogin) {
  568. this.$modal.msgWarning('正在登陆客户端,请稍等......')
  569. return false
  570. }
  571. const ctrls = this.ws.ctrls.map(i => {
  572. if (i.ctrlCode === this.ctrl) {
  573. return i.ctrlCode
  574. }
  575. })
  576. this.ws.destroyCtrl(ctrls)
  577. },
  578. customizeTree(tvListJson) { // 调用控件接口树
  579. const config = this.ws.config
  580. const { loginIp, userCode } = config
  581. this.ws.postMessage('customizeTree', {
  582. loginIp,
  583. userCode,
  584. params: {
  585. array: tvListJson
  586. }
  587. })
  588. },
  589. /** ----------------------------------大华摄像头预览结束------------------------------------- */
  590. /** ----------------------------------海康摄像头预览开始------------------------------------- */
  591. // 创建播放实例
  592. initPlugin() {
  593. let that=this
  594. that.oWebControl = new WebControl({
  595. szPluginContainer: 'playWnd', // 指定容器id
  596. iServicePortStart: 15900, // 指定起止端口号,建议使用该值
  597. iServicePortEnd: 15909,
  598. szClassId: '23BF3B0A-2C56-4D97-9C03-0CB103AA8F11', // 用于IE10使用ActiveX的clsid
  599. cbConnectSuccess: function() { // 创建WebControl实例成功
  600. that.oWebControl.JS_StartService('window', { // WebControl实例创建成功后需要启动服务
  601. dllPath: './VideoPluginConnect.dll' // 值"./VideoPluginConnect.dll"写死
  602. }).then(function() { // 启动插件服务成功
  603. that.oWebControl.JS_SetWindowControlCallback({ // 设置消息回调
  604. cbIntegrationCallBack: cbIntegrationCallBack
  605. })
  606. that.oWebControl.JS_CreateWnd('playWnd', 850, 615).then(function() { //JS_CreateWnd创建视频播放窗口,宽高可设定
  607. that.init() // 创建播放实例成功后初始化
  608. })
  609. }, function() { // 启动插件服务失败
  610. })
  611. },
  612. cbConnectError: function() { // 创建WebControl实例失败
  613. that.oWebControl = null
  614. $('#playWnd').html('插件未启动,正在尝试启动,请稍候...<a href="./hk/VideoWebPlugin.exe">点击下载插件</a>')
  615. WebControl.JS_WakeUp('VideoWebPlugin://') // 程序未启动时执行error函数,采用wakeup来启动程序
  616. initCount++
  617. if (initCount < 3) {
  618. setTimeout(function() {
  619. that.initPlugin()
  620. }, 3000)
  621. } else {
  622. $('#playWnd').html('插件启动失败,请检查插件是否安装!<a href="./hk/VideoWebPlugin.exe">点击下载插件</a>')
  623. }
  624. },
  625. cbConnectClose: function(bNormalClose) {
  626. // 异常断开:bNormalClose = false
  627. // JS_Disconnect正常断开:bNormalClose = true
  628. console.log('cbConnectClose')
  629. that.oWebControl = null
  630. }
  631. })
  632. },
  633. //初始化
  634. init() {
  635. let that=this
  636. this.getPubKey(function() {
  637. ////////////////////////////////// 请自行修改以下变量值 ////////////////////////////////////
  638. var appkey = '24699060' //综合安防管理平台提供的appkey,必填
  639. var secret = that.setEncrypt('tt1pMbsrlwGZUWucdAPw') //综合安防管理平台提供的secret,必填
  640. var ip = '36.49.108.22' //综合安防管理平台IP地址,必填
  641. var playMode = 0 //初始播放模式:0-预览,1-回放
  642. var port = 1443 //综合安防管理平台端口,若启用HTTPS协议,默认443
  643. var snapDir = 'D:\\SnapDir' //抓图存储路径
  644. var videoDir = 'D:\\VideoDir' //紧急录像或录像剪辑存储路径
  645. var layout = '3x3' //playMode指定模式的布局
  646. var enableHTTPS = 1 //是否启用HTTPS协议与综合安防管理平台交互,这里总是填1
  647. var encryptedFields = 'secret' //加密字段,默认加密领域为secret
  648. var showToolbar = 1 //是否显示工具栏,0-不显示,非0-显示
  649. var showSmart = 1 //是否显示智能信息(如配置移动侦测后画面上的线框),0-不显示,非0-显示
  650. var buttonIDs = '0,16,256,257,258,259,260,512,513,514,515,516,517,768,769' //自定义工具条按钮
  651. ////////////////////////////////// 请自行修改以上变量值 ////////////////////////////////////
  652. that.oWebControl.JS_RequestInterface({
  653. funcName: 'init',
  654. argument: JSON.stringify({
  655. appkey: appkey, //API网关提供的appkey
  656. secret: secret, //API网关提供的secret
  657. ip: ip, //API网关IP地址
  658. playMode: playMode, //播放模式(决定显示预览还是回放界面)
  659. port: port, //端口
  660. snapDir: snapDir, //抓图存储路径
  661. videoDir: videoDir, //紧急录像或录像剪辑存储路径
  662. layout: layout, //布局
  663. enableHTTPS: enableHTTPS, //是否启用HTTPS协议
  664. encryptedFields: encryptedFields, //加密字段
  665. showToolbar: showToolbar, //是否显示工具栏
  666. showSmart: showSmart, //是否显示智能信息
  667. buttonIDs: buttonIDs //自定义工具条按钮
  668. })
  669. }).then(function(oData) {
  670. that.oWebControl.JS_Resize(850, 615) // 初始化后resize一次,规避firefox下首次显示窗口后插件窗口未与DIV窗口重合问题
  671. })
  672. })
  673. },
  674. //获取公钥
  675. getPubKey(callback) {
  676. let that=this
  677. that.oWebControl.JS_RequestInterface({
  678. funcName: 'getRSAPubKey',
  679. argument: JSON.stringify({
  680. keyLength: 1024
  681. })
  682. }).then(function(oData) {
  683. console.log(oData)
  684. if (oData.responseMsg.data) {
  685. that.pubKey = oData.responseMsg.data
  686. callback()
  687. }125
  688. })
  689. },
  690. //RSA加密
  691. setEncrypt(value) {
  692. var encrypt = new JSEncrypt()
  693. encrypt.setPublicKey(this.pubKey)
  694. return encrypt.encrypt(value)
  695. },
  696. //播放海康摄像头
  697. playhk(channelCode){
  698. var cameraIndexCode = channelCode //获取输入的监控点编号值,必填
  699. var streamMode = 0 //主子码流标识:0-主码流,1-子码流
  700. var transMode = 1 //传输协议:0-UDP,1-TCP
  701. var gpuMode = 0 //是否启用GPU硬解,0-不启用,1-启用
  702. var wndId = -1 //播放窗口序号(在2x2以上布局下可指定播放窗口)
  703. cameraIndexCode = cameraIndexCode.replace(/(^\s*)/g, '')
  704. cameraIndexCode = cameraIndexCode.replace(/(\s*$)/g, '')
  705. this.oWebControl.JS_RequestInterface({
  706. funcName: 'startPreview',
  707. argument: JSON.stringify({
  708. cameraIndexCode: cameraIndexCode, //监控点编号
  709. streamMode: streamMode, //主子码流标识
  710. transMode: transMode, //传输协议
  711. gpuMode: gpuMode, //是否开启GPU硬解
  712. wndId: wndId //可指定播放窗口
  713. })
  714. })
  715. }
  716. /** ----------------------------------海康摄像头预览结束------------------------------------- */
  717. }
  718. }
  719. // 推送消息
  720. function cbIntegrationCallBack(oData) {
  721. console.log(JSON.stringify(oData.responseMsg))
  722. }
  723. </script>
  724. <style rel="stylesheet/scss" lang="scss" scoped>
  725. @import '@/assets/styles/base.scss';
  726. .event-info-con {
  727. width: 100%;
  728. display: flex;
  729. .e-left {
  730. width: 32%;
  731. }
  732. .e-center {
  733. width: 30%;
  734. margin-left: 1%;
  735. .img-company {
  736. width: 100%;
  737. height: 18.3vh;
  738. img {
  739. }
  740. }
  741. }
  742. .e-right {
  743. margin-left: 1%;
  744. width: 45%;
  745. }
  746. .e-location-left {
  747. width: 28%;
  748. margin-top: 1rem;
  749. }
  750. .e-location-right {
  751. width: 71%;
  752. margin-top: 1.3rem;
  753. margin-left: 1rem;
  754. }
  755. }
  756. .el-dialog:not(.is-fullscreen) {
  757. margin-top: 5.5vh !important;
  758. }
  759. .bottom-menu-normal {
  760. max-width: 90%;
  761. padding: 0 3rem;
  762. position: absolute;
  763. left: 50%;
  764. transform: translateX(-50%);
  765. bottom: 0;
  766. z-index: 100000;
  767. border-radius: 5px;
  768. display: flex;
  769. justify-content: center;
  770. align-items: center;
  771. background: url(../assets/images/integrated/btm-menu.png) center no-repeat;
  772. background-size: cover;
  773. overflow: hidden;
  774. .btm-m-con {
  775. position: relative;
  776. color: $inBlue;
  777. font-size: .5rem;
  778. padding: 1rem 1.5rem;
  779. display: flex;
  780. align-items: center;
  781. justify-content: center;
  782. -webkit-transform: translateY(0);
  783. transform: translateY(0);
  784. transition: all 0.2s ease-in-out;
  785. cursor: pointer;
  786. white-space: nowrap;
  787. i {
  788. font-size: 1rem;
  789. color: $inBlue;
  790. text-shadow: 0 0 10px rgba($color: $inBlue, $alpha: .6);
  791. margin-right: 0.2rem;
  792. }
  793. }
  794. .btm-m-con:hover {
  795. text-shadow: 0 0 20px rgba($color: $inBlueHover, $alpha: 1.0);
  796. filter: brightness(2.3);
  797. -webkit-transform: translateX(0.2rem);
  798. transform: translateX(0.2rem);
  799. transition: all 0.2s ease-in-out;
  800. i {
  801. color: $inBlueHover;
  802. text-shadow: 0 0 20px rgba($color: $inBlueHover, $alpha: 1.0);
  803. }
  804. }
  805. .m-l-none {
  806. .el-input__inner {
  807. margin-left: 0 !important;
  808. }
  809. }
  810. }
  811. /*海康*/
  812. html, body {
  813. padding: 0;
  814. margin: 0;
  815. }
  816. .playWnd {
  817. margin: -13px 0 0 255px;
  818. width: 850px; /*播放容器的宽和高设定*/
  819. height: 615px;
  820. border: 1px solid red;
  821. }
  822. .operate {
  823. margin-top: 24px;
  824. }
  825. .operate::after {
  826. content: '';
  827. display: block;
  828. clear: both;
  829. }
  830. .module {
  831. float: left;
  832. width: 340px;
  833. /*min-height: 320px;*/
  834. margin-left: 16px;
  835. padding: 16px 8px;
  836. box-sizing: border-box;
  837. border: 1px solid #e5e5e5;
  838. }
  839. .module .item {
  840. margin-bottom: 4px;
  841. }
  842. .module input[type="text"] {
  843. box-sizing: border-box;
  844. display: inline-block;
  845. vertical-align: middle;
  846. margin-left: 0;
  847. width: 150px;
  848. min-height: 20px;
  849. }
  850. .module .btn {
  851. min-width: 80px;
  852. min-height: 24px;
  853. margin-top: 100px;
  854. margin-left: 80px;
  855. }
  856. </style>