TVWall.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672
  1. <template>
  2. <div>
  3. <el-dialog title="电视墙" :visible.sync="TVWallVisible" v-if="TVWallVisible" width="770px" style="height: 700px;"
  4. @close="cancelEventLocationShow()">
  5. <div style="width:100%;height:400px;position:relative;">
  6. <div id="dom1" class="dom1"></div>
  7. </div>
  8. </el-dialog>
  9. </div>
  10. </template>
  11. <script>
  12. /** ----------------------------------摄像头预览开始------------------------------------- */
  13. import { getDahuaVideoServer, getTVWallList } from '@/api/dahua/dahua'
  14. import DHWs from '@/dahua/lib/DHWs'
  15. /** ----------------------------------摄像头预览结束------------------------------------- */
  16. export default {
  17. dicts: ['event_source'],
  18. components: {},
  19. data() {
  20. return {
  21. tvListJson: [{
  22. 'switchTab': '1',
  23. 'treeLabels': [
  24. {
  25. 'labelCode': '123456',
  26. 'labelName': '视频场景',
  27. 'parentLabelCode': null
  28. },
  29. {
  30. 'labelCode': '5a81d1bd499b4940a21fc63ca51f4dfa',
  31. 'labelName': '标签2',
  32. 'parentLabelCode': 123456
  33. },
  34. {
  35. 'labelCode': 'd941adbbd3e64dac92cc448dec5293cd',
  36. 'labelName': '标签1',
  37. 'parentLabelCode': 123456
  38. }
  39. ],
  40. 'labelChannels': [{
  41. 'channelDates': [{
  42. 'channelCode': '6044981090191552',
  43. 'channelName': '复兴大桥中段-交通事故',
  44. 'channelSn': null,
  45. 'cameraType': 0,
  46. 'online': 1
  47. },
  48. {
  49. 'channelCode': 'ZgVzqsjwA1DTF561VGHK5E',
  50. 'channelName': '北京7青羊东二路77号2通道1',
  51. 'channelSn': null,
  52. 'cameraType': 1,
  53. 'online': 1
  54. }
  55. ],
  56. 'labelCode': 'd941adbbd3e64dac92cc448dec5293cd'
  57. },
  58. {
  59. 'channelDates': [{
  60. 'channelCode': 'ZgVzqsjwA1DTF561VGHKK7',
  61. 'channelName': '北京7青羊东二路77号2通道2',
  62. 'channelSn': null,
  63. 'cameraType': 2,
  64. 'online': 0
  65. }],
  66. 'labelCode': '5a81d1bd499b4940a21fc63ca51f4dfa'
  67. }
  68. ]
  69. },
  70. {
  71. 'switchTab': '2',
  72. 'labelChannels': [{
  73. 'channelDates': [{
  74. 'channelCode': 'ZgVzqsjwA1DTF561VGHK5E',
  75. 'channelName': '北京7青羊东二路77号2通道1',
  76. 'channelSn': null,
  77. 'cameraType': 1,
  78. 'online': 1
  79. },
  80. {
  81. 'channelCode': 'ZgVzqsjwA1DTF561VGHKK7',
  82. 'channelName': '北京7青羊东二路77号2通道2',
  83. 'channelSn': null,
  84. 'cameraType': 2,
  85. 'online': 0
  86. }
  87. ]
  88. }]
  89. }
  90. ],
  91. TVWallVisible: false,
  92. activeName: 'tv',
  93. channelId: ['ZgVzqsjwA1DTF561VHG69F'],
  94. /** ----------------------------------摄像头预览开始------------------------------------- */
  95. showModal: true,
  96. activePanel: 'key1',
  97. isLogin: false,
  98. loginType: '1',
  99. token: '',
  100. ctrlType: 'playerWin',
  101. https: 1,
  102. httpsList: [
  103. {
  104. value: 0,
  105. label: 0
  106. },
  107. {
  108. value: 1,
  109. label: 1
  110. }
  111. ],
  112. ctrlTypeList: [{
  113. value: 'playerWin',
  114. label: '播放控件'
  115. }, {
  116. value: 'realMonitorUI',
  117. label: '带设备树实时预览控件'
  118. }, {
  119. value: 'playbackUI',
  120. label: '带设备树视频回放控件'
  121. }, {
  122. value: 'TVWallUI',
  123. label: '视频上墙'
  124. }],
  125. ctrlList: [
  126. {
  127. value: 'ctrl1',
  128. label: '控件1'
  129. },
  130. {
  131. value: 'ctrl2',
  132. label: '控件2'
  133. },
  134. {
  135. value: 'ctrl3',
  136. label: '控件3'
  137. }
  138. ],
  139. splitList: [
  140. {
  141. value: 1,
  142. label: '1 * 1'
  143. },
  144. {
  145. value: 4,
  146. label: '2 * 2'
  147. },
  148. {
  149. value: 9,
  150. label: '3 * 3'
  151. }
  152. ],
  153. displayModeList: [
  154. {
  155. value: 1,
  156. label: '播放器预览模式'
  157. },
  158. {
  159. value: 2,
  160. label: '播放器回放模式'
  161. }
  162. ],
  163. mixedVideoDisplayModeList: [
  164. {
  165. value: 1,
  166. label: '播放实时视频'
  167. },
  168. {
  169. value: 2,
  170. label: '播放回放视频'
  171. }
  172. ],
  173. ctrl: 'ctrl1',
  174. splitNum: 1,
  175. displayMode: 1,
  176. displayTimeRange: [],
  177. modalDisplayTimeRange: [],
  178. mixedVideoTime: null,
  179. recordPath: 'C:\\DSS LightWeight\\DSS LightWeight Client\\Record\\',
  180. downloadName: '',
  181. downTimeRange: [],
  182. downloadFormat: 0,
  183. downloadFormatList: [{
  184. value: 0,
  185. label: 'dav'
  186. },
  187. {
  188. value: 1,
  189. label: 'avi'
  190. }, {
  191. value: 2,
  192. label: 'mp4'
  193. }],
  194. downloadSource: 3,
  195. downloadSourceList: [
  196. {
  197. value: 3,
  198. label: '中心录像'
  199. }, {
  200. value: 2,
  201. label: '设备录像'
  202. }],
  203. showDownloadStreamType: false,
  204. downloadStreamType: 1,
  205. downloadStreamTypeList: [{
  206. value: 1,
  207. label: '主码流'
  208. },
  209. {
  210. value: 2,
  211. label: '辅码流'
  212. },
  213. {
  214. value: 3,
  215. label: '三码流'
  216. }],
  217. downloadIsShow: true,
  218. downloadIsShowList: [{
  219. value: true,
  220. label: '是'
  221. },
  222. {
  223. value: false,
  224. label: '否'
  225. }],
  226. crtPosX: 0,
  227. crtPosY: 0,
  228. crtWidth: 740,
  229. crtHeight: 400,
  230. domId: 'dom1',
  231. mixedVideoDisplayMode: 2,
  232. isShowTipe: true
  233. /** ----------------------------------摄像头预览结束------------------------------------- */
  234. }
  235. },
  236. created() {
  237. /** ----------------------------------摄像头预览开始------------------------------------- */
  238. const DHWsInstance = DHWs.getInstance()
  239. this.ws = DHWsInstance
  240. console.log(this.ws)
  241. this.ws.addEventListener('connectStateChange', data => {
  242. if (data) {
  243. console.log('连接成功')
  244. } else {
  245. console.log('连接失败,下载客户端')
  246. this.alertReinstall()
  247. // this.isShowTipe && this.$modal.confirm({
  248. // title: '下载客户端',
  249. // content: '检测到您未安装部分插件,将影响部分功能使用,请下载后使用?',
  250. // onOk: () => {
  251. // //这里写下载方法
  252. // this.isShowTipe = false
  253. // },
  254. // onCancel: () => {
  255. // this.isShowTipe = false
  256. // }
  257. // });
  258. }
  259. })
  260. /** ----------------------------------摄像头预览结束------------------------------------- */
  261. },
  262. methods: {
  263. cancelEventLocationShow() {
  264. this.activeName = 'tv'
  265. this.TVWallVisible = false
  266. this.destroy()
  267. },
  268. showTVWall() {
  269. this.preview()
  270. this.TVWallVisible = true
  271. },
  272. /** ----------------------------------摄像头预览开始------------------------------------- */
  273. alertLogin: function() {
  274. this.$modal.msg('登录中....')
  275. },
  276. alertLoginSuccess: function() {
  277. this.$modal.msgSuccess('登录成功!')
  278. },
  279. alertLoginFailed: function() {
  280. this.$modal.msgError('登陆失败!')
  281. },
  282. alertReinstall: function() {
  283. this.$modal.msgWarning('请重新安装客户端')
  284. },
  285. /** 预览按钮操作 */
  286. preview() {
  287. getTVWallList().then(newres => {
  288. getDahuaVideoServer().then(newResponse => {
  289. this.ws.detectConnectQt().then(res => {
  290. if (res) { // 连接客户端成功
  291. this.alertLogin()
  292. this.ws.login({
  293. loginIp: newResponse.loginIp,
  294. loginPort: newResponse.loginPort,
  295. userName: newResponse.userName,
  296. userPwd: newResponse.userPwd,
  297. token: '',
  298. https: 1
  299. })
  300. this.ws.on('loginState', (res) => {
  301. this.isLogin = res
  302. console.log('---res-----', res)
  303. if (res) {
  304. this.alertLoginSuccess()
  305. this.activePanel = 'key2'
  306. this.create(newres.data)
  307. } else {
  308. this.alertLoginFailed()
  309. }
  310. })
  311. } else { // 连接客户端失败
  312. this.alertReinstall()
  313. }
  314. })
  315. })
  316. })
  317. },
  318. create(tvListJson) { // 调用创建控件接口
  319. let _this = this
  320. const params = [
  321. {
  322. 'ctrlType': 'realMonitorUI',
  323. 'ctrlCode': 'ctrl1',
  324. 'ctrlProperty': {
  325. 'displayMode': 1,
  326. 'splitNum': 1,
  327. 'channelList': [
  328. {
  329. 'channelId': '8ORBqXFlA1D77U45SM1ROC'
  330. }
  331. ]
  332. },
  333. 'visible': true,
  334. 'domId': 'dom1'
  335. }
  336. ]
  337. this.setPos()
  338. _this.ws.createCtrl(params).then(res => {
  339. console.log(res)
  340. this.customizeTree(tvListJson)
  341. }).catch(e => {
  342. console.log(e)
  343. })
  344. _this.ws.on('createCtrlResult', (res) => {
  345. console.log(res)
  346. this.customizeTree(tvListJson)
  347. _this.ws.on('createCtrlResult', (res) => {
  348. console.log(res)
  349. this.customizeTree(tvListJson)
  350. })
  351. })
  352. },
  353. setPos() {
  354. let target = document.getElementById(this.domId)
  355. console.log(target, 'target')
  356. target.style.right = `${this.crtPosX}px`
  357. target.style.top = `${this.crtPosY}px`
  358. target.style.width = `${this.crtWidth}px`
  359. target.style.height = `${this.crtHeight}px`
  360. if (document.createEvent) {
  361. var event = document.createEvent('HTMLEvents')
  362. event.initEvent('resize', true, true)
  363. window.dispatchEvent(event)
  364. } else if (document.createEventObject) {
  365. window.fireEvent('onresize')
  366. }
  367. },
  368. destroy() { // 调用销毁控件接口
  369. if (!this.isLogin) {
  370. this.$Message.info('正在登陆客户端,请稍等......')
  371. return false
  372. }
  373. const ctrls = this.ws.ctrls.map(i => {
  374. if (i.ctrlCode === this.ctrl) {
  375. return i.ctrlCode
  376. }
  377. })
  378. this.ws.destroyCtrl(ctrls)
  379. },
  380. customizeTree(tvListJson) { // 调用控件接口树
  381. const config = this.ws.config
  382. const { loginIp, userCode } = config
  383. this.ws.postMessage('customizeTree', {
  384. loginIp,
  385. userCode,
  386. params: {
  387. array: tvListJson
  388. // [
  389. // {
  390. // "switchTab":"1",
  391. // "treeLabels":[
  392. // {
  393. // "labelCode": "1",
  394. // "labelName": "视频场景",
  395. // "parentLabelCode": null
  396. // },
  397. // {
  398. // "labelCode":"1000010",
  399. // "labelName":"迎水11",
  400. // "parentLabelCode":1
  401. // },
  402. // {
  403. // "labelCode":"1000011",
  404. // "labelName":"西村",
  405. // "parentLabelCode": 1
  406. // },
  407. // {
  408. // "labelCode":"1000012",
  409. // "labelName":"矿山屯 ",
  410. // "parentLabelCode": 1
  411. // },
  412. // {
  413. // "labelCode":"1000013",
  414. // "labelName":"头道",
  415. // "parentLabelCode": 1
  416. // },
  417. // {
  418. // "labelCode":"1000014",
  419. // "labelName":"五女峰",
  420. // "parentLabelCode": 1
  421. // }
  422. // ],
  423. // "labelChannels":[
  424. // {
  425. // "labelCode":"1000010",
  426. // "channelDates":[
  427. // {
  428. // "channelCode":"ZgVzqsjwA1DTF561VGHK5E",
  429. // "channelName":"1a",
  430. // "channelSn":null,
  431. // "cameraType":0,
  432. // "online":1
  433. // },
  434. // {
  435. // "channelCode":"ZgVzqsjwA1DTF561VGHK8V",
  436. // "channelName":"2a",
  437. // "channelSn":null,
  438. // "cameraType":0,
  439. // "online":1
  440. // },
  441. // {
  442. // "channelCode":"ZgVzqsjwA1DTF561VGHKK7",
  443. // "channelName":"2a",
  444. // "channelSn":null,
  445. // "cameraType":0,
  446. // "online":1
  447. // }
  448. // ]
  449. // },
  450. // {
  451. // "labelCode":"1000011",
  452. // "channelDates":[
  453. // {
  454. // "channelCode":"ZgVzqsjwA1DTF561VGHK5E",
  455. // "channelName":"1a",
  456. // "channelSn":null,
  457. // "cameraType":0,
  458. // "online":1
  459. // },
  460. // {
  461. // "channelCode":"ZgVzqsjwA1DTF561VGHK8V",
  462. // "channelName":"2a",
  463. // "channelSn":null,
  464. // "cameraType":0,
  465. // "online":1
  466. // },
  467. // {
  468. // "channelCode":"ZgVzqsjwA1DTF561VGHKK7",
  469. // "channelName":"2a",
  470. // "channelSn":null,
  471. // "cameraType":0,
  472. // "online":1
  473. // }
  474. // ]
  475. // },
  476. // {
  477. // "labelCode":"1000012",
  478. // "channelDates":[
  479. // {
  480. // "channelCode":"ZgVzqsjwA1DTF561VGHK5E",
  481. // "channelName":"1a",
  482. // "channelSn":null,
  483. // "cameraType":0,
  484. // "online":1
  485. // },
  486. // {
  487. // "channelCode":"ZgVzqsjwA1DTF561VGHK8V",
  488. // "channelName":"2a",
  489. // "channelSn":null,
  490. // "cameraType":0,
  491. // "online":1
  492. // },
  493. // {
  494. // "channelCode":"ZgVzqsjwA1DTF561VGHKK7",
  495. // "channelName":"2a",
  496. // "channelSn":null,
  497. // "cameraType":0,
  498. // "online":1
  499. // }
  500. // ]
  501. // },
  502. // {
  503. // "labelCode":"1000013",
  504. // "channelDates":[
  505. // {
  506. // "channelCode":"ZgVzqsjwA1DTF561VGHK5E",
  507. // "channelName":"1a",
  508. // "channelSn":null,
  509. // "cameraType":0,
  510. // "online":1
  511. // },
  512. // {
  513. // "channelCode":"ZgVzqsjwA1DTF561VGHK8V",
  514. // "channelName":"2a",
  515. // "channelSn":null,
  516. // "cameraType":0,
  517. // "online":1
  518. // },
  519. // {
  520. // "channelCode":"ZgVzqsjwA1DTF561VGHKK7",
  521. // "channelName":"2a",
  522. // "channelSn":null,
  523. // "cameraType":0,
  524. // "online":1
  525. // }
  526. // ]
  527. // },
  528. // {
  529. // "labelCode":"1000014",
  530. // "channelDates":[
  531. // {
  532. // "channelCode":"ZgVzqsjwA1DTF561VGHK5E",
  533. // "channelName":"1a",
  534. // "channelSn":null,
  535. // "cameraType":0,
  536. // "online":1
  537. // },
  538. // {
  539. // "channelCode":"ZgVzqsjwA1DTF561VGHK8V",
  540. // "channelName":"2a",
  541. // "channelSn":null,
  542. // "cameraType":0,
  543. // "online":1
  544. // },
  545. // {
  546. // "channelCode":"ZgVzqsjwA1DTF561VGHKK7",
  547. // "channelName":"2a",
  548. // "channelSn":null,
  549. // "cameraType":0,
  550. // "online":1
  551. // }
  552. // ]
  553. // }
  554. // ]
  555. // }
  556. // ]
  557. }
  558. })
  559. }
  560. /** ----------------------------------摄像头预览结束------------------------------------- */
  561. }
  562. }
  563. </script>
  564. <style rel="stylesheet/scss" lang="scss" scoped>
  565. @import '@/assets/styles/base.scss';
  566. .event-info-con {
  567. width: 100%;
  568. display: flex;
  569. .e-left {
  570. width: 32%;
  571. }
  572. .e-center {
  573. width: 30%;
  574. margin-left: 1%;
  575. .img-company {
  576. width: 100%;
  577. height: 18.3vh;
  578. img {
  579. }
  580. }
  581. }
  582. .e-right {
  583. margin-left: 1%;
  584. width: 45%;
  585. }
  586. .e-location-left {
  587. width: 28%;
  588. margin-top: 1rem;
  589. }
  590. .e-location-right {
  591. width: 71%;
  592. margin-top: 1.3rem;
  593. margin-left: 1rem;
  594. }
  595. }
  596. .el-dialog:not(.is-fullscreen) {
  597. margin-top: 5.5vh !important;
  598. }
  599. .bottom-menu-normal {
  600. max-width: 90%;
  601. padding: 0 3rem;
  602. position: absolute;
  603. left: 50%;
  604. transform: translateX(-50%);
  605. bottom: 0;
  606. z-index: 100000;
  607. border-radius: 5px;
  608. display: flex;
  609. justify-content: center;
  610. align-items: center;
  611. background: url(../assets/images/integrated/btm-menu.png) center no-repeat;
  612. background-size: cover;
  613. overflow: hidden;
  614. .btm-m-con {
  615. position: relative;
  616. color: $inBlue;
  617. font-size: .5rem;
  618. padding: 1rem 1.5rem;
  619. display: flex;
  620. align-items: center;
  621. justify-content: center;
  622. -webkit-transform: translateY(0);
  623. transform: translateY(0);
  624. transition: all 0.2s ease-in-out;
  625. cursor: pointer;
  626. white-space: nowrap;
  627. i {
  628. font-size: 1rem;
  629. color: $inBlue;
  630. text-shadow: 0 0 10px rgba($color: $inBlue, $alpha: .6);
  631. margin-right: 0.2rem;
  632. }
  633. }
  634. .btm-m-con:hover {
  635. text-shadow: 0 0 20px rgba($color: $inBlueHover, $alpha: 1.0);
  636. filter: brightness(2.3);
  637. -webkit-transform: translateX(0.2rem);
  638. transform: translateX(0.2rem);
  639. transition: all 0.2s ease-in-out;
  640. i {
  641. color: $inBlueHover;
  642. text-shadow: 0 0 20px rgba($color: $inBlueHover, $alpha: 1.0);
  643. }
  644. }
  645. .m-l-none {
  646. .el-input__inner {
  647. margin-left: 0 !important;
  648. }
  649. }
  650. }
  651. </style>