TVWalls.vue 30 KB

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